+2023-01-30 Bruno Haible <bruno@clisp.org>
+
+ at-internal: Add support for z/OS.
+ Reported and draft patch by Igor Todorovski <itodorov@ca.ibm.com>.
+ * lib/openat-proc.c [z/OS]: Include <termios.h>.
+ (openat_proc_name): For z/OS, use an approach similar to kLIBC, with
+ 3 lines of z/OS specific code by Igor Todorovski <itodorov@ca.ibm.com>.
+
2023-01-29 Bruno Haible <bruno@clisp.org>
Fix compilation errors with CC="clang -D_FORTIFY_SOURCE=2" on Android.
/* Create /proc/self/fd-related names for subfiles of open directories.
- Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2023 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <string.h>
#include <unistd.h>
-#ifdef __KLIBC__
+#ifdef __KLIBC__ /* OS/2 */
# include <InnoTekLIBC/backend.h>
#endif
+#ifdef __MVS__ /* z/OS */
+# include <termios.h>
+#endif
#include "intprops.h"
return buf;
}
-#ifndef __KLIBC__
+#if !(defined __KLIBC__ || defined __MVS__)
+ /* Generic code for Linux, Solaris, and similar platforms. */
# define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/"
{
enum {
dirlen = sprintf (result, PROC_SELF_FD_FORMAT, fd);
}
}
-#else
+#else /* (defined __KLIBC__ || defined __MVS__), i.e. OS/2 or z/OS */
/* OS/2 kLIBC provides a function to retrieve a path from a fd. */
{
- char dir[_MAX_PATH];
size_t bufsize;
+# ifdef __KLIBC__
+ char dir[_MAX_PATH];
if (__libc_Back_ioFHToPath (fd, dir, sizeof dir))
return NULL;
+# endif
+# ifdef __MVS__
+ char dir[_XOPEN_PATH_MAX];
+ if (w_ioctl (fd, _IOCC_GPN, sizeof dir, dir) == 0)
+ __e2a_l (dir, sizeof dir);
+# endif
dirlen = strlen (dir);
bufsize = dirlen + 1 + strlen (file) + 1; /* 1 for '/', 1 for null */