diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-05-05 20:03:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-05-05 20:03:03 +0000 |
commit | 3c38e028f36115cb4b5621380dc95b0d247ca011 (patch) | |
tree | 4750c46e2a3262f71aafa1c98dbba335331d22fc /sysdeps | |
parent | f1d86a931b2c51a24540e7ea3cda60dc154e064a (diff) | |
download | glibc-3c38e028f36115cb4b5621380dc95b0d247ca011.tar.gz glibc-3c38e028f36115cb4b5621380dc95b0d247ca011.tar.xz glibc-3c38e028f36115cb4b5621380dc95b0d247ca011.zip |
Update.
2000-05-05 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/aix/linux/errnoconv.c: Moved to... * sysdeps/unix/sysv/linux/powerpc/aix/errnoconv.c: ...here. * sysdeps/unix/sysv/aix/linux/statconv.c: Moved to... * sysdeps/unix/sysv/linux/powerpc/aix/statconv.c: ...here. * sysdeps/unix/sysv/aix/linux/direntconv.c: Moved to... * sysdeps/unix/sysv/linux/powerpc/aix/direntconv.c: ...here. * sysdeps/unix/sysv/aix/linux/linux-errno.h: Removed. * sysdeps/unix/sysv/aix/linux/linux-stat.h: Removed * sysdeps/unix/sysv/aix/linux/linux-dirent.h: Removed. * sysdeps/unix/sysv/linux/powerpc/aix/aix-dirent.h: New file. * sysdeps/unix/sysv/linux/powerpc/aix/aix-errno.h: New file. * sysdeps/unix/sysv/linux/powerpc/aix/aix-stat.h: New file. * sysdeps/unix/sysv/linux/powerpc/aix/aix-termios.h: New file. * sysdeps/unix/sysv/linux/powerpc/aix/tcsetattr.c: New file.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/unix/sysv/aix/linux/direntconv.c | 31 | ||||
-rw-r--r-- | sysdeps/unix/sysv/aix/linux/errnoconv.c | 125 | ||||
-rw-r--r-- | sysdeps/unix/sysv/aix/linux/linux-errno.h | 135 | ||||
-rw-r--r-- | sysdeps/unix/sysv/aix/linux/linux-stat.h | 131 | ||||
-rw-r--r-- | sysdeps/unix/sysv/aix/linux/statconv.c | 35 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/aix-dirent.h (renamed from sysdeps/unix/sysv/aix/linux/linux-dirent.h) | 18 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/aix-errno.h | 125 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/aix-stat.h | 76 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/aix-termios.h | 84 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/direntconv.c | 49 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/errnoconv.c | 143 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/statconv.c | 53 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/aix/tcsetattr.c | 171 |
13 files changed, 710 insertions, 466 deletions
diff --git a/sysdeps/unix/sysv/aix/linux/direntconv.c b/sysdeps/unix/sysv/aix/linux/direntconv.c deleted file mode 100644 index 620a0a0719..0000000000 --- a/sysdeps/unix/sysv/aix/linux/direntconv.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <dirent.h> -#include <string.h> -#include "linux-dirent.h" - -#ifndef DT_UNKNOWN -# define DT_UNKNOWN 0 -#endif - - -void -__dirent_aix_to_linux (const struct dirent *aixdir, - struct linuxdirent *linuxdir) -{ - linuxdir->d_ino = aixdir->d_ino; - linuxdir->d_off = aixdir->d_off; - linuxdir->d_reclen = aixdir->d_reclen; - linuxdir->d_type = DT_UNKNOWN; - strncpy (linuxdir->d_name, aixdir->d_name, 256); -} - - -void -__dirent64_aix_to_linux (const struct dirent64 *aixdir, - struct linuxdirent64 *linuxdir) -{ - linuxdir->d_ino = aixdir->d_ino; - linuxdir->d_off = aixdir->d_off; - linuxdir->d_reclen = aixdir->d_reclen; - linuxdir->d_type = DT_UNKNOWN; - strncpy (linuxdir->d_name, aixdir->d_name, 256); -} diff --git a/sysdeps/unix/sysv/aix/linux/errnoconv.c b/sysdeps/unix/sysv/aix/linux/errnoconv.c deleted file mode 100644 index 95bd5a32b2..0000000000 --- a/sysdeps/unix/sysv/aix/linux/errnoconv.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Convert the error number the AIX kernel returns to what the Linux - application expects. */ -#include <errno.h> -#include "linux-errno.h" - - -static int mapping[] = -{ - [EPERM] = LINUX_EPERM, - [ENOENT] = LINUX_ENOENT, - [ESRCH] = LINUX_ESRCH, - [EINTR] = LINUX_EINTR, - [EIO] = LINUX_EIO, - [ENXIO] = LINUX_ENXIO, - [E2BIG] = LINUX_E2BIG, - [ENOEXEC] = LINUX_ENOEXEC, - [EBADF] = LINUX_EBADF, - [ECHILD] = LINUX_ECHILD, - [EAGAIN] = LINUX_EAGAIN, - [ENOMEM] = LINUX_ENOMEM, - [EACCES] = LINUX_EACCES, - [EFAULT] = LINUX_EFAULT, - [ENOTBLK] = LINUX_ENOTBLK, - [EBUSY] = LINUX_EBUSY, - [EEXIST] = LINUX_EEXIST, - [EXDEV] = LINUX_EXDEV, - [ENODEV] = LINUX_ENODEV, - [ENOTDIR] = LINUX_ENOTDIR, - [EISDIR] = LINUX_EISDIR, - [EINVAL] = LINUX_EINVAL, - [ENFILE] = LINUX_ENFILE, - [EMFILE] = LINUX_EMFILE, - [ENOTTY] = LINUX_ENOTTY, - [ETXTBSY] = LINUX_ETXTBSY, - [EFBIG] = LINUX_EFBIG, - [ENOSPC] = LINUX_ENOSPC, - [EIDRM] = LINUX_EIDRM, - [ECHRNG] = LINUX_ECHRNG, - [EL2NSYNC] = LINUX_EL2NSYNC, - [EL3HLT] = LINUX_EL3HLT, - [EL3RST] = LINUX_EL3RST, - [ELNRNG] = LINUX_ELNRNG, - [EUNATCH] = LINUX_EUNATCH, - [ENOCSI] = LINUX_ENOCSI, - [EL2HLT] = LINUX_EL2HLT, - [EDEADLK] = LINUX_EDEADLK, - [ENOTREADY] = LINUX_ENOTREADY, - // EWPROTECT: no Linux equivalent - // EFORMAT: no Linux equivalent - [ENOLCK] = LINUX_ENOLCK, - // ENOCONNECT: No Linux equivalent - [ESTALE] = LINUX_ESTALE, - // EDIST: no Linux equivalent - [54] = LINUX_EAGAIN, // EWOULDBLOCK - [EINPROGRESS] = LINUX_EINPROGRESS, - [EALREADY] = LINUX_EALREADY, - [ENOTSOCK] = LINUX_ENOTSOCK, - [EDESTADDRREQ] = LINUX_EDESTADDRREQ, - [EMSGSIZE] = LINUX_EMSGSIZE, - [EPROTOTYPE] = LINUX_EPROTOTYPE, - [ENOPROTOOPT] = LINUX_ENOPROTOOPT, - [EPROTONOSUPPORT] = LINUX_EPROTONOSUPPORT, - [ESOCKTNOSUPPORT] = LINUX_ESOCKTNOSUPPORT, - [EOPNOTSUPP] = LINUX_EOPNOTSUPP, - [EPFNOSUPPORT] = LINUX_EPFNOSUPPORT, - [EAFNOSUPPORT] = LINUX_EAFNOSUPPORT, - [EADDRINUSE] = LINUX_EADDRINUSE, - [EADDRNOTAVAIL] = LINUX_EADDRNOTAVAIL, - [ENETDOWN] = LINUX_ENETDOWN, - [ENETUNREACH] = LINUX_ENETUNREACH, - [ENETRESET] = LINUX_ENETRESET, - [ECONNABORTED] = LINUX_ECONNABORTED, - [ECONNRESET] = LINUX_ECONNRESET, - [ENOBUFS] = LINUX_ENOBUFS, - [EISCONN] = LINUX_EISCONN, - [ENOTCONN] = LINUX_ENOTCONN, - [ESHUTDOWN] = LINUX_ESHUTDOWN, - [ETIMEDOUT] = LINUX_ETIMEDOUT, - [ECONNREFUSED] = LINUX_ECONNREFUSED, - [EHOSTDOWN] = LINUX_EHOSTDOWN, - [EHOSTUNREACH] = LINUX_EHOSTUNREACH, - [ERESTART] = LINUX_ERESTART, - [EPROCLIM] = LINUX_EPROCLIM, - [EUSERS] = LINUX_EUSERS, - [ELOOP] = LINUX_ELOOP, - [ENAMETOOLONG] = LINUX_ENAMETOOLONG, - [87] = LINUX_ENOTEMPTY, // ENOTEMPTY - [EDQUOT] = LINUX_EDQUOT, - [ECORRUPT] = LINUX_ECORRUPT, - [EREMOTE] = LINUX_EREMOTE, - [ENOSYS] = LINUX_ENOSYS, - [EMEDIA] = LINUX_EMEDIA, - [ESOFT] = LINUX_ESOFT, - [ENOATTR] = LINUX_ENOATTR, - [ESAD] = LINUX_ESAD, - // ENOTRUST: no Linux equivalent - [ETOOMANYREFS] = LINUX_ETOOMANYREFS, - [EILSEQ] = LINUX_EILSEQ, - [ECANCELED] = LINUX_ECANCELED, - [ENOSR] = LINUX_ENOSR, - [ETIME] = LINUX_ETIME, - [EBADMSG] = LINUX_EBADMSG, - [EPROTO] = LINUX_EPROTO, - [ENODATA] = LINUX_ENODATA, - [ENOSTR] = LINUX_ENOSTR, - [ENOTSUP] = LINUX_ENOTSUP, - [EMULTIHOP] = LINUX_EMULTIHOP, - [ENOLINK] = LINUX_ENOLINK, - [EOVERFLOW] = LINUX_EOVERFLOW -}; - - -int -__errno_aix_to_linux (int err) -{ - int conv; - - if (err >= 0 && err < (sizeof (mapping) / sizeof (mapping[0])) - && ((conv = mapping[err]) != 0 || err == 0)) - return conv; - - /* The error value is not known. Create a special value which can - be easily recognized as an invalid result. */ - return 512 + err; -} diff --git a/sysdeps/unix/sysv/aix/linux/linux-errno.h b/sysdeps/unix/sysv/aix/linux/linux-errno.h deleted file mode 100644 index b7cf0a5c5f..0000000000 --- a/sysdeps/unix/sysv/aix/linux/linux-errno.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef _LINUX_ERRNO_H -#define _LINUX_ERRNO_H - -#define LINUX_EPERM 1 -#define LINUX_ENOENT 2 -#define LINUX_ESRCH 3 -#define LINUX_EINTR 4 -#define LINUX_EIO 5 -#define LINUX_ENXIO 6 -#define LINUX_E2BIG 7 -#define LINUX_ENOEXEC 8 -#define LINUX_EBADF 9 -#define LINUX_ECHILD 10 -#define LINUX_EAGAIN 11 -#define LINUX_ENOMEM 12 -#define LINUX_EACCES 13 -#define LINUX_EFAULT 14 -#define LINUX_ENOTBLK 15 -#define LINUX_EBUSY 16 -#define LINUX_EEXIST 17 -#define LINUX_EXDEV 18 -#define LINUX_ENODEV 19 -#define LINUX_ENOTDIR 20 -#define LINUX_EISDIR 21 -#define LINUX_EINVAL 22 -#define LINUX_ENFILE 23 -#define LINUX_EMFILE 24 -#define LINUX_ENOTTY 25 -#define LINUX_ETXTBSY 26 -#define LINUX_EFBIG 27 -#define LINUX_ENOSPC 28 -#define LINUX_ESPIPE 29 -#define LINUX_EROFS 30 -#define LINUX_EMLINK 31 -#define LINUX_EPIPE 32 -#define LINUX_EDOM 33 -#define LINUX_ERANGE 34 -#define LINUX_EDEADLK 35 -#define LINUX_ENAMETOOLONG 36 -#define LINUX_ENOLCK 37 -#define LINUX_ENOSYS 38 -#define LINUX_ENOTEMPTY 39 -#define LINUX_ELOOP 40 -#define LINUX_ENOMSG 42 -#define LINUX_EIDRM 43 -#define LINUX_ECHRNG 44 -#define LINUX_EL2NSYNC 45 -#define LINUX_EL3HLT 46 -#define LINUX_EL3RST 47 -#define LINUX_ELNRNG 48 -#define LINUX_EUNATCH 49 -#define LINUX_ENOCSI 50 -#define LINUX_EL2HLT 51 -#define LINUX_EBADE 52 -#define LINUX_EBADR 53 -#define LINUX_EXFULL 54 -#define LINUX_ENOANO 55 -#define LINUX_EBADRQC 56 -#define LINUX_EBADSLT 57 -#define LINUX_EDEADLOCK 58 -#define LINUX_EBFONT 59 -#define LINUX_ENOSTR 60 -#define LINUX_ENODATA 61 -#define LINUX_ETIME 62 -#define LINUX_ENOSR 63 -#define LINUX_ENONET 64 -#define LINUX_ENOPKG 65 -#define LINUX_EREMOTE 66 -#define LINUX_ENOLINK 67 -#define LINUX_EADV 68 -#define LINUX_ESRMNT 69 -#define LINUX_ECOMM 70 -#define LINUX_EPROTO 71 -#define LINUX_EMULTIHOP 72 -#define LINUX_EDOTDOT 73 -#define LINUX_EBADMSG 74 -#define LINUX_EOVERFLOW 75 -#define LINUX_ENOTUNIQ 76 -#define LINUX_EBADFD 77 -#define LINUX_EREMCHG 78 -#define LINUX_ELIBACC 79 -#define LINUX_ELIBBAD 80 -#define LINUX_ELIBSCN 81 -#define LINUX_ELIBMAX 82 -#define LINUX_ELIBEXEC 83 -#define LINUX_EILSEQ 84 -#define LINUX_ERESTART 85 -#define LINUX_ESTRPIPE 86 -#define LINUX_EUSERS 87 -#define LINUX_ENOTSOCK 88 -#define LINUX_EDESTADDRREQ 89 -#define LINUX_EMSGSIZE 90 -#define LINUX_EPROTOTYPE 91 -#define LINUX_ENOPROTOOPT 92 -#define LINUX_EPROTONOSUPPORT 93 -#define LINUX_ESOCKTNOSUPPORT 94 -#define LINUX_EOPNOTSUPP 95 -#define LINUX_EPFNOSUPPORT 96 -#define LINUX_EAFNOSUPPORT 97 -#define LINUX_EADDRINUSE 98 -#define LINUX_EADDRNOTAVAIL 99 -#define LINUX_ENETDOWN 100 -#define LINUX_ENETUNREACH 101 -#define LINUX_ENETRESET 102 -#define LINUX_ECONNABORTED 103 -#define LINUX_ECONNRESET 104 -#define LINUX_ENOBUFS 105 -#define LINUX_EISCONN 106 -#define LINUX_ENOTCONN 107 -#define LINUX_ESHUTDOWN 108 -#define LINUX_ETOOMANYREFS 109 -#define LINUX_ETIMEDOUT 110 -#define LINUX_ECONNREFUSED 111 -#define LINUX_EHOSTDOWN 112 -#define LINUX_EHOSTUNREACH 113 -#define LINUX_EALREADY 114 -#define LINUX_EINPROGRESS 115 -#define LINUX_ESTALE 116 -#define LINUX_EUCLEAN 117 -#define LINUX_ENOTNAM 118 -#define LINUX_ENAVAIL 119 -#define LINUX_EISNAM 120 -#define LINUX_EREMOTEIO 121 -#define LINUX_EDQUOT 122 - -#define LINUX_ENOMEDIUM 123 -#define LINUX_EMEDIUMTYPE 124 - -/* Should never be seen by user programs */ -#define LINUX_ERESTARTSYS 512 -#define LINUX_ERESTARTNOINTR 513 -#define LINUX_ERESTARTNOHAND 514 -#define LINUX_ENOIOCTLCMD 515 - -#endif diff --git a/sysdeps/unix/sysv/aix/linux/linux-stat.h b/sysdeps/unix/sysv/aix/linux/linux-stat.h deleted file mode 100644 index 01a2d4d253..0000000000 --- a/sysdeps/unix/sysv/aix/linux/linux-stat.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright (C) 1992, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SYS_STAT_H -# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." -#endif - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino64_t st_ino; /* File serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - unsigned long int __unused4; - unsigned long int __unused5; - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; - - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - unsigned long int __unused4; - unsigned long int __unused5; - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ - -/* These don't actually exist on System V, but having them doesn't hurt. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - - -/* Thi macro (with a different name) is normally in <sys/sysmacros.h>. */ -#define linux_makedev(major, minor) (((major) << 8 | (minor))) diff --git a/sysdeps/unix/sysv/aix/linux/statconv.c b/sysdeps/unix/sysv/aix/linux/statconv.c deleted file mode 100644 index 5333e23d7b..0000000000 --- a/sysdeps/unix/sysv/aix/linux/statconv.c +++ /dev/null @@ -1,35 +0,0 @@ -void -__stat_aix_to_linux (const struct stat *aixstat, struct stat *linuxstat) -{ - linuxstat->st_dev = linux_makedev (major (aixstat->st_dev), - minor (aixstat->st_dev)); - linuxstat->st_ino = aixstat->st_ino; - /* The following assumes that the mode values are the same on AIX - and Linux which is true in the moment. */ - linuxstat->st_mode = aixstat->st_mode; - linuxstat->st_nlink = aixstat->st_nlink; - /* There is no st_flag field in Linux. */ - linuxstat->st_uid = aixstat->st_uid; - linuxstat->st_gid = aixstat->st_gid; - linuxstat->st_rdev = linux_makedev (major (aixstat->st_rdev), - minor (aixstat->st_rdev)); - linuxstat->st_size = aixstat->st_size; - linuxstat->st_atime = aixstat->st_atime; - linuxstat->st_mtime = aixstat->st_mtime; - linuxstat->st_ctime = aixstat->st_ctime; - linuxstat->st_blksize = aixstat->st_blksize; - linuxstat->st_blocks = aixstat->st_blocks; - /* There is no st_vfstype in Linux. */ - /* There is no st_vfs in Linux. */ - /* There is no st_type in Linux. */ - /* There is no st_gen in Linux. */ - - /* File in the padding values with repeatable values. */ - linuxstat->__pad1 = 0; - linuxstat->__pad2 = 0; - linuxstat->__unused1 = 0; - linuxstat->__unused2 = 0; - linuxstat->__unused3 = 0; - linuxstat->__unused4 = 0; - linuxstat->__unused5 = 0; -} diff --git a/sysdeps/unix/sysv/aix/linux/linux-dirent.h b/sysdeps/unix/sysv/linux/powerpc/aix/aix-dirent.h index 935ffda7a0..c18e9fa4bf 100644 --- a/sysdeps/unix/sysv/aix/linux/linux-dirent.h +++ b/sysdeps/unix/sysv/linux/powerpc/aix/aix-dirent.h @@ -1,19 +1,19 @@ -#include "linuxtypes.h" +#include "aix-types.h" -struct linuxdirent +struct aixdirent { - __linux_ino_t d_ino; - __linux_off_t d_off; + aixino_t d_ino; + aixoff_t d_off; unsigned short int d_reclen; - unsigned char d_type; + unsigned short int d_namlen; char d_name[256]; /* We must not include limits.h! */ }; -struct linuxdirent64 +struct aixdirent64 { - __linux_ino64_t d_ino; - __linux_off64_t d_off; + aixino64_t d_ino; + aixoff64_t d_off; unsigned short int d_reclen; - unsigned char d_type; + unsigned short int d_namlen; char d_name[256]; /* We must not include limits.h! */ }; diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/aix-errno.h b/sysdeps/unix/sysv/linux/powerpc/aix/aix-errno.h new file mode 100644 index 0000000000..c81d609d86 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/aix/aix-errno.h @@ -0,0 +1,125 @@ +/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define AIX_EPERM 1 +#define AIX_ENOENT 2 +#define AIX_ESRCH 3 +#define AIX_EINTR 4 +#define AIX_EIO 5 +#define AIX_ENXIO 6 +#define AIX_E2BIG 7 +#define AIX_ENOEXEC 8 +#define AIX_EBADF 9 +#define AIX_ECHILD 10 +#define AIX_EAGAIN 11 +#define AIX_ENOMEM 12 +#define AIX_EACCES 13 +#define AIX_EFAULT 14 +#define AIX_ENOTBLK 15 +#define AIX_EBUSY 16 +#define AIX_EEXIST 17 +#define AIX_EXDEV 18 +#define AIX_ENODEV 19 +#define AIX_ENOTDIR 20 +#define AIX_EISDIR 21 +#define AIX_EINVAL 22 +#define AIX_ENFILE 23 +#define AIX_EMFILE 24 +#define AIX_ENOTTY 25 +#define AIX_ETXTBSY 26 +#define AIX_EFBIG 27 +#define AIX_ENOSPC 28 +#define AIX_ESPIPE 29 +#define AIX_EROFS 30 +#define AIX_EMLINK 31 +#define AIX_EPIPE 32 +#define AIX_EDOM 33 +#define AIX_ERANGE 34 +#define AIX_ENOMSG 35 +#define AIX_EIDRM 36 +#define AIX_ECHRNG 37 +#define AIX_EL2NSYNC 38 +#define AIX_EL3HLT 39 +#define AIX_EL3RST 40 +#define AIX_ELNRNG 41 +#define AIX_EUNATCH 42 +#define AIX_ENOCSI 43 +#define AIX_EL2HLT 44 +#define AIX_EDEADLK 45 +#define AIX_ENOTREADY 46 +#define AIX_EWRPROTECT 47 +#define AIX_EFORMAT 48 +#define AIX_ENOLCK 49 +#define AIX_ENOCONNECT 50 +#define AIX_ESTALE 52 +#define AIX_EDIST 53 +#define AIX_EWOULDBLOCK 54 +#define AIX_EINPROGRESS 55 +#define AIX_EALREADY 56 +#define AIX_ENOTSOCK 57 +#define AIX_EDESTADDRREQ 58 +#define AIX_EMSGSIZE 59 +#define AIX_EPROTOTYPE 60 +#define AIX_ENOPROTOOPT 61 +#define AIX_EPROTONOSUPPORT 62 +#define AIX_ESOCKTNOSUPPORT 63 +#define AIX_EOPNOTSUPP 64 +#define AIX_EPFNOSUPPORT 65 +#define AIX_EAFNOSUPPORT 66 +#define AIX_EADDRINUSE 67 +#define AIX_EADDRNOTAVAIL 68 +#define AIX_ENETDOWN 69 +#define AIX_ENETUNREACH 70 +#define AIX_ENETRESET 71 +#define AIX_ECONNABORTED 72 +#define AIX_ECONNRESET 73 +#define AIX_ENOBUFS 74 +#define AIX_EISCONN 75 +#define AIX_ENOTCONN 76 +#define AIX_ESHUTDOWN 77 +#define AIX_ETIMEDOUT 78 +#define AIX_ECONNREFUSED 79 +#define AIX_EHOSTDOWN 80 +#define AIX_EHOSTUNREACH 81 +#define AIX_ERESTART 82 +#define AIX_EPROCLIM 83 +#define AIX_EUSERS 84 +#define AIX_ELOOP 85 +#define AIX_ENAMETOOLONG 86 +#define AIX_EDQUOT 88 +#define AIX_ECORRUPT 89 +#define AIX_EREMOTE 93 +#define AIX_ENOSYS 109 +#define AIX_EMEDIA 110 +#define AIX_ESOFT 111 +#define AIX_ENOATTR 112 +#define AIX_ESAD 113 +#define AIX_ENOTRUST 114 +#define AIX_ETOOMANYREFS 115 +#define AIX_EILSEQ 116 +#define AIX_ECANCELED 117 +#define AIX_ENOSR 118 +#define AIX_ETIME 119 +#define AIX_EBADMSG 120 +#define AIX_EPROTO 121 +#define AIX_ENODATA 122 +#define AIX_ENOSTR 123 +#define AIX_ENOTSUP 124 +#define AIX_EMULTIHOP 125 +#define AIX_ENOLINK 126 +#define AIX_EOVERFLOW 127 diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/aix-stat.h b/sysdeps/unix/sysv/linux/powerpc/aix/aix-stat.h new file mode 100644 index 0000000000..3bead8fad9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/aix/aix-stat.h @@ -0,0 +1,76 @@ +/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +struct aixstat + { + aixdev_t st_dev; + aixino_t st_ino; + aixmode_t st_mode; + aixnlink_t st_nlink; + unsigned short int st_flag; + aixuid_t st_uid; + aixgid_t st_gid; + aixdev_t st_rdev; + aixoff_t st_size; + aixtime_t st_atime; + unsigned long int __unused1; + aixtime_t st_mtime; + unsigned long int __unused2; + aixtime_t st_ctime; + unsigned long int __unused3; + aixblksize_t st_blksize; + aixblkcnt_t st_blocks; + int st_vfstype; + unsigned int st_vfs; + unsigned int st_type; + unsigned int st_gen; + +#define _STATBUF_RESERVED_SPACE 9 + unsigned int st_reserved[_STATBUF_RESERVED_SPACE]; + }; + +struct aixstat64 + { + aixdev_t st_dev; + aixino64_t st_ino; + aixmode_t st_mode; + aixnlink_t st_nlink; + unsigned short int st_flag; + aixuid_t st_uid; + aixgid_t st_gid; + aixdev_t st_rdev; + int st_ssize; + aixtime_t st_atime; + unsigned long int __unused1; + aixtime_t st_mtime; + unsigned long int __unused2; + aixtime_t st_ctime; + unsigned long int __unused3; + aixblksize_t st_blksize; + aixblkcnt64_t st_blocks; + int st_vfstype; + unsigned int st_vfs; + unsigned int st_type; + unsigned int st_gen; + unsigned int st_reserved[_STATBUF_RESERVED_SPACE]; + unsigned int st_padto_ll; + aixoff64_t st_size; + }; + +#define aix_major(x) (int) ((unsigned int) (x) >> 16) +#define aix_minor(x) (int) ((x) & 0xFFFF) diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/aix-termios.h b/sysdeps/unix/sysv/linux/powerpc/aix/aix-termios.h new file mode 100644 index 0000000000..9bb301c486 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/aix/aix-termios.h @@ -0,0 +1,84 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "aix-types.h" + +#define AIX_NCCS 16 +struct aixtermios +{ + aixtcflag_t c_iflag; + aixtcflag_t c_oflag; + aixtcflag_t c_cflag; + aixtcflag_t c_lflag; + aixcc_t c_line; + aixcc_t c_cc[AIX_NCCS]; + aixspeed_t c_ispeed; + aixspeed_t c_ospeed; +}; + +#define AIX_VINTR 0 +#define AIX_VQUIT 1 +#define AIX_VERASE 2 +#define AIX_VKILL 3 +#define AIX_VEOF 4 +#define AIX_VEOL 5 +#define AIX_VEOL2 6 +#define AIX_VSTART 7 +#define AIX_VSTOP 8 +#define AIX_VSUSP 9 +#define AIX_VDSUSP 10 +#define AIX_VREPRINT 11 +#define AIX_VDISCRD 12 +#define AIX_VWERSE 13 +#define AIX_VLNEXT 14 + +#define AIX_IUCLC 0x00000800 +#define AIX_IXANY 0x00001000 +#define AIX_IMAXBE 0x00010000 + +#define AIX_OLCUC 0x00000002 +#define AIX_ONLCR 0x00000004 +#define AIX_TABDLY 0x00000c00 +#define AIX_TAB0 0x00000000 +#define AIX_TAB1 0x00000400 +#define AIX_TAB2 0x00000800 +#define AIX_TAB3 0x00000c00 +#define AIX_BSDLY 0x00001000 +#define AIX_BS0 0x00000000 +#define AIX_BS1 0x00001000 +#define AIX_FFDLY 0x00002000 +#define AIX_FF0 0x00000000 +#define AIX_FF1 0x00002000 +#define AIX_NLDLY 0x00004000 +#define AIX_NL0 0x00000000 +#define AIX_NL1 0x00004000 +#define AIX_VTDLY 0x00008000 +#define AIX_VT0 0x00000000 +#define AIX_VT1 0x00008000 + +#define AIX_CSIZE 0x00000030 +#define AIX_CS5 0x00000000 +#define AIX_CS6 0x00000010 +#define AIX_CS7 0x00000020 +#define AIX_CS8 0x00000030 +#define AIX_CSTOPB 0x00000040 +#define AIX_CREAD 0x00000080 +#define AIX_PARENB 0x00000100 +#define AIX_PARODD 0x00000200 +#define AIX_HUPCL 0x00000400 +#define AIX_CLOCAL 0x00000800 diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/direntconv.c b/sysdeps/unix/sysv/linux/powerpc/aix/direntconv.c new file mode 100644 index 0000000000..2cd50f6bac --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/aix/direntconv.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <dirent.h> +#include <string.h> +#include "linux-dirent.h" + +#ifndef DT_UNKNOWN +# define DT_UNKNOWN 0 +#endif + + +void +__dirent_aix_to_linux (const struct aixdirent *aixdir, + struct dirent *linuxdir) +{ + linuxdir->d_ino = aixdir->d_ino; + linuxdir->d_off = aixdir->d_off; + linuxdir->d_reclen = aixdir->d_reclen; + linuxdir->d_type = DT_UNKNOWN; + memcpy (linuxdir->d_name, aixdir->d_name, aixdir->d_namlen + 1); +} + + +void +__dirent64_aix_to_linux (const struct aixdirent64 *aixdir, + struct dirent64 *linuxdir) +{ + linuxdir->d_ino = aixdir->d_ino; + linuxdir->d_off = aixdir->d_off; + linuxdir->d_reclen = aixdir->d_reclen; + linuxdir->d_type = DT_UNKNOWN; + memcpy (linuxdir->d_name, aixdir->d_name, aixdir->d_namlen + 1); +} diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/errnoconv.c b/sysdeps/unix/sysv/linux/powerpc/aix/errnoconv.c new file mode 100644 index 0000000000..83f0562dc9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/aix/errnoconv.c @@ -0,0 +1,143 @@ +/* Convert the error number the AIX kernel returns to what the Linux + application expects. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include "linux-errno.h" + + +static int mapping[] = +{ + [AIX_EPERM] = EPERM, + [AIX_ENOENT] = ENOENT, + [AIX_ESRCH] = ESRCH, + [AIX_EINTR] = EINTR, + [AIX_EIO] = EIO, + [AIX_ENXIO] = ENXIO, + [AIX_E2BIG] = E2BIG, + [AIX_ENOEXEC] = ENOEXEC, + [AIX_EBADF] = EBADF, + [AIX_ECHILD] = ECHILD, + [AIX_EAGAIN] = EAGAIN, + [AIX_ENOMEM] = ENOMEM, + [AIX_EACCES] = EACCES, + [AIX_EFAULT] = EFAULT, + [AIX_ENOTBLK] = ENOTBLK, + [AIX_EBUSY] = EBUSY, + [AIX_EEXIST] = EEXIST, + [AIX_EXDEV] = EXDEV, + [AIX_ENODEV] = ENODEV, + [AIX_ENOTDIR] = ENOTDIR, + [AIX_EISDIR] = EISDIR, + [AIX_EINVAL] = EINVAL, + [AIX_ENFILE] = ENFILE, + [AIX_EMFILE] = EMFILE, + [AIX_ENOTTY] = ENOTTY, + [AIX_ETXTBSY] = ETXTBSY, + [AIX_EFBIG] = EFBIG, + [AIX_ENOSPC] = ENOSPC, + [AIX_EIDRM] = EIDRM, + [AIX_ECHRNG] = ECHRNG, + [AIX_EL2NSYNC] = EL2NSYNC, + [AIX_EL3HLT] = EL3HLT, + [AIX_EL3RST] = EL3RST, + [AIX_ELNRNG] = ELNRNG, + [AIX_EUNATCH] = EUNATCH, + [AIX_ENOCSI] = ENOCSI, + [AIX_EL2HLT] = EL2HLT, + [AIX_EDEADLK] = EDEADLK, + [AIX_ENOTREADY] = ENOTREADY, + // EWPROTECT: no Linux equivalent + // EFORMAT: no Linux equivalent + [AIX_ENOLCK] = ENOLCK, + // ENOCONNECT: No Linux equivalent + [AIX_ESTALE] = ESTALE, + // EDIST: no Linux equivalent + [54] = EAGAIN, // EWOULDBLOCK + [AIX_EINPROGRESS] = EINPROGRESS, + [AIX_EALREADY] = EALREADY, + [AIX_ENOTSOCK] = ENOTSOCK, + [AIX_EDESTADDRREQ] = EDESTADDRREQ, + [AIX_EMSGSIZE] = EMSGSIZE, + [AIX_EPROTOTYPE] = EPROTOTYPE, + [AIX_ENOPROTOOPT] = ENOPROTOOPT, + [AIX_EPROTONOSUPPORT] = EPROTONOSUPPORT, + [AIX_ESOCKTNOSUPPORT] = ESOCKTNOSUPPORT, + [AIX_EOPNOTSUPP] = EOPNOTSUPP, + [AIX_EPFNOSUPPORT] = EPFNOSUPPORT, + [AIX_EAFNOSUPPORT] = EAFNOSUPPORT, + [AIX_EADDRINUSE] = EADDRINUSE, + [AIX_EADDRNOTAVAIL] = EADDRNOTAVAIL, + [AIX_ENETDOWN] = ENETDOWN, + [AIX_ENETUNREACH] = ENETUNREACH, + [AIX_ENETRESET] = ENETRESET, + [AIX_ECONNABORTED] = ECONNABORTED, + [AIX_ECONNRESET] = ECONNRESET, + [AIX_ENOBUFS] = ENOBUFS, + [AIX_EISCONN] = EISCONN, + [AIX_ENOTCONN] = ENOTCONN, + [AIX_ESHUTDOWN] = ESHUTDOWN, + [AIX_ETIMEDOUT] = ETIMEDOUT, + [AIX_ECONNREFUSED] = ECONNREFUSED, + [AIX_EHOSTDOWN] = EHOSTDOWN, + [AIX_EHOSTUNREACH] = EHOSTUNREACH, + [AIX_ERESTART] = ERESTART, + [AIX_EPROCLIM] = EPROCLIM, + [AIX_EUSERS] = EUSERS, + [AIX_ELOOP] = ELOOP, + [AIX_ENAMETOOLONG] = ENAMETOOLONG, + [87] = ENOTEMPTY, // ENOTEMPTY + [AIX_EDQUOT] = EDQUOT, + [AIX_ECORRUPT] = ECORRUPT, + [AIX_EREMOTE] = EREMOTE, + [AIX_ENOSYS] = ENOSYS, + [AIX_EMEDIA] = EMEDIA, + [AIX_ESOFT] = ESOFT, + [AIX_ENOATTR] = ENOATTR, + [AIX_ESAD] = ESAD, + // ENOTRUST: no Linux equivalent + [AIX_ETOOMANYREFS] = ETOOMANYREFS, + [AIX_EILSEQ] = EILSEQ, + [AIX_ECANCELED] = ECANCELED, + [AIX_ENOSR] = ENOSR, + [AIX_ETIME] = ETIME, + [AIX_EBADMSG] = EBADMSG, + [AIX_EPROTO] = EPROTO, + [AIX_ENODATA] = ENODATA, + [AIX_ENOSTR] = ENOSTR, + [AIX_ENOTSUP] = ENOTSUP, + [AIX_EMULTIHOP] = EMULTIHOP, + [AIX_ENOLINK] = ENOLINK, + [AIX_EOVERFLOW] = EOVERFLOW +}; + + +int +__errno_aix_to_linux (int err) +{ + int conv; + + if (err >= 0 && err < (sizeof (mapping) / sizeof (mapping[0])) + && ((conv = mapping[err]) != 0 || err == 0)) + return conv; + + /* The error value is not known. Create a special value which can + be easily recognized as an invalid result. */ + return 512 + err; +} diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/statconv.c b/sysdeps/unix/sysv/linux/powerpc/aix/statconv.c new file mode 100644 index 0000000000..3810eb6543 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/aix/statconv.c @@ -0,0 +1,53 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +void +__stat_aix_to_linux (const struct aixstat *aixstat, struct stat *linuxstat) +{ + linuxstat->st_dev = makedev (aix_major (aixstat->st_dev), + aix_minor (aixstat->st_dev)); + linuxstat->st_ino = aixstat->st_ino; + /* The following assumes that the mode values are the same on AIX + and Linux which is true in the moment. */ + linuxstat->st_mode = aixstat->st_mode; + linuxstat->st_nlink = aixstat->st_nlink; + /* There is no st_flag field in Linux. */ + linuxstat->st_uid = aixstat->st_uid; + linuxstat->st_gid = aixstat->st_gid; + linuxstat->st_rdev = makedev (aix_major (aixstat->st_rdev), + aix_minor (aixstat->st_rdev)); + linuxstat->st_size = aixstat->st_size; + linuxstat->st_atime = aixstat->st_atime; + linuxstat->st_mtime = aixstat->st_mtime; + linuxstat->st_ctime = aixstat->st_ctime; + linuxstat->st_blksize = aixstat->st_blksize; + linuxstat->st_blocks = aixstat->st_blocks; + /* There is no st_vfstype in Linux. */ + /* There is no st_vfs in Linux. */ + /* There is no st_type in Linux. */ + /* There is no st_gen in Linux. */ + + /* File in the padding values with repeatable values. */ + linuxstat->__pad1 = 0; + linuxstat->__pad2 = 0; + linuxstat->__unused1 = 0; + linuxstat->__unused2 = 0; + linuxstat->__unused3 = 0; + linuxstat->__unused4 = 0; + linuxstat->__unused5 = 0; +} diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/tcsetattr.c b/sysdeps/unix/sysv/linux/powerpc/aix/tcsetattr.c new file mode 100644 index 0000000000..bf3b2d638c --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/aix/tcsetattr.c @@ -0,0 +1,171 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <termios.h> +#include "aix-termios.h" + +int +tcsetattr (fd, optional_actions, linuxtermios_p) + int fd; + int optional_actions; + const struct termios *linuxtermios_p; +{ + struct aixtermios aixtermios; + int result; + + /* `optional_actions' does not have to be changed, AIX uses the + same values as Linux. */ + + aixtermios.c_cc[AIX_VINTR] = linuxtermios_p->c_cc[VINTR]; + aixtermios.c_cc[AIX_VQUIT] = linuxtermios_p->c_cc[VQUIT]; + aixtermios.c_cc[AIX_VERASE] = linuxtermios_p->c_cc[VERASE]; + aixtermios.c_cc[AIX_VKILL] = linuxtermios_p->c_cc[VKILL]; + aixtermios.c_cc[AIX_VEOF] = linuxtermios_p->c_cc[VEOF]; + // XXX VMIN has the same value as VEOF !? + aixtermios.c_cc[AIX_VEOL] = linuxtermios_p->c_cc[VEOL]; + // XXX VTIME has the same value as VEOL !? + aixtermios.c_cc[AIX_VEOL2] = linuxtermios_p->c_cc[VEOL2]; + aixtermios.c_cc[AIX_VSTART] = linuxtermios_p->c_cc[VSTART]; + aixtermios.c_cc[AIX_VSTOP] = linuxtermios_p->c_cc[VSTOP]; + aixtermios.c_cc[AIX_VSUSP] = linuxtermios_p->c_cc[VSUSP]; + aixtermios.c_cc[AIX_VDSUSP] = 0; // XXX No Linux equivalent !? + aixtermios.c_cc[AIX_VREPRINT] = linuxtermios_p->c_cc[VREPRINT]; + aixtermios.c_cc[AIX_VDISCARD] = linuxtermios_p->c_cc[VDISCARD]; + aixtermios.c_cc[AIX_VWERASE] = linuxtermios_p->c_cc[VWERASE]; + aixtermios.c_cc[AIX_VLNEXT] = linuxtermios_p->c_cc[VLNEXT]; + + /* AIX has not all the speeds (the high one) Linux supports. The + symbol names and values used for the speeds are fortunately the + same. */ + if ((linuxtermios_p->c_cflag & CBAUD) > B38400) + { + __set_errno (EINVAL); + return -1; + } + + aixtermios.c_c_flag = linuxtermios_p->c_cflag & CBAUD; + + /* Only the IUCLC, IXANY, and IMAXBEL values are different in the + c_iflag member. */ + aixtermios.c_iflag = linuxtermios_p->c_iflag & 0x7ff; + if (linuxtermios_p->c_iflag & IXANY) + aixtermios.c_iflag |= AIX_IXANY; + if (linuxtermios_p->c_iflag & IUCLC) + aixtermios.c_iflag |= AIX_IUCLC; + if (linuxtermios_p->c_iflag & IMAXBEL) + aixtermios.c_iflag |= AIX_IMAXBEL; + + /* Many of the c_oflag files differ. Bummer. */ + aixtermios.c_oflag = (linuxtermios_p->c_oflag + & (OPOST | OCRNL | ONOCR | ONLRET | OFILL + | OFDEL | TABDLY)); + if (linuxtermios_p->c_oflag & OLCUC) + aixtermios.c_oflag |= AIX_OLCUC; + if (linuxtermios_p->c_oflag & ONLCR) + aixtermios.c_oflag |= AIX_ONLCR; + if (linuxtermios_p->c_oflag & NLDLY) + { + if ((linuxtermios_p->c_oflag & NLDLY) >= NL2) + { + __set_errno (EINVAL); + return -1; + } + + if (linuxtermios_p->c_oflag & NLDLY) + aixtermios.c_oflag |= AIX_NL1; + } + if (linuxtermios_p->c_oflag & TABDLY) + { +#define offset 2 +#if TAB0 >> offset != AIX_TAB1 || TAB1 >> offset != AIX_TAB3 +# error "Check the offset" +#endif + aixtermios.c_oflag |= (linuxtermios_p->c_oflag >> offset) & AIX_TABDLY; +#undef offset + } + if (linuxtermios_p->c_oflag & FFDLY) + aixtermios.c_oflag |= AIX_FF1; + if (linuxtermios_p->c_oflag & BSDLY) + aixtermios.c_oflag |= AIX_BS1; + if (linuxtermios_p->c_oflag & VTDLY) + aixtermios.c_oflag |= AIX_VT1; + + /* A lot of the c_cflag member is also different. */ + if (linuxtermios_p->c_cflag & CSIZE) + { +#define offset 4 +#if LINUX_CSIZE >> offset != AIX_CSIZE +# error "Check the offset" +#endif + aixtermios.c_cflag |= (linuxtermios_p->c_cflag >> offset) & AIX_CSIZE; +#undef offset + } + + if (linuxtermios_p->c_cflag & STOPB) + aixtermios.c_cflag |= AIX_STOPB; + if (linuxtermios_p->c_cflag & CREAD) + aixtermios.c_cflag |= AIX_CREAD; + if (linuxtermios_p->c_cflag & PARENB) + aixtermios.c_cflag |= AIX_PARENB; + if (linuxtermios_p->c_cflag & PARODD) + aixtermios.c_cflag |= AIX_PARODD; + if (linuxtermios_p->c_cflag & HUPCL) + aixtermios.c_cflag |= AIX_HUPCL; + if (linuxtermios_p->c_cflag & CLOCAL) + aixtermios.c_cflag |= AIX_CLOCAL; + + /* The c_lflag is information is also different. */ + aixtermios.c_lflag = 0; + if (linuxtermios_p->c_lflag & ISIG) + aixtermios.c_lflag |= AIX_ISIG; + if (linuxtermios_p->c_lflag & ICANON) + aixtermios.c_lflag |= AIX_ICANON; + if (linuxtermios_p->c_lflag & XCASE) + aixtermios.c_lflag |= AIX_XCASE; + if (linuxtermios_p->c_lflag & ECHO) + aixtermios.c_lflag |= AIX_ECHO; + if (linuxtermios_p->c_lflag & ECHOE) + aixtermios.c_lflag |= AIX_ECHOE; + if (linuxtermios_p->c_lflag & ECHOK) + aixtermios.c_lflag |= AIX_ECHOK; + if (linuxtermios_p->c_lflag & ECHONL) + aixtermios.c_lflag |= AIX_ECHONL; + if (linuxtermios_p->c_lflag & NOFLSH) + aixtermios.c_lflag |= AIX_NOFLSH; + if (linuxtermios_p->c_lflag & TOSTOP) + aixtermios.c_lflag |= AIX_TOSTOP; + if (linuxtermios_p->c_lflag & ECHOCTL) + aixtermios.c_lflag |= AIX_ECHOCTL; + if (linuxtermios_p->c_lflag & ECHOPRT) + aixtermios.c_lflag |= AIX_ECHOPRT; + if (linuxtermios_p->c_lflag & ECHOKE) + aixtermios.c_lflag |= AIX_ECHOKE; + if (linuxtermios_p->c_lflag & FLUSHO) + aixtermios.c_lflag |= AIX_FLUSHO; + if (linuxtermios_p->c_lflag & PENDIN) + aixtermios.c_lflag |= AIX_PENDIN; + if (linuxtermios_p->c_lflag & IEXTEN) + aixtermios.c_lflag |= AIX_IEXTEN; + + result = /* XXX syscall */; + + // Convert error here or in syscall. + + return result; +} |