diff options
Diffstat (limited to 'ports/sysdeps/unix/sysv')
408 files changed, 16149 insertions, 0 deletions
diff --git a/ports/sysdeps/unix/sysv/aix/Dist b/ports/sysdeps/unix/sysv/aix/Dist new file mode 100644 index 000000000..609fd778e --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/Dist @@ -0,0 +1,15 @@ +dl-support.c +dl-error.c +dl-addr.c +dl-sym.c +dl-open.c +dl-close.c +dl-libc.c +dlldr.h +kernel_proto.h +start-libc.c +sysv_termio.h +bits/utmpx.h +gnu/lib-names.h +uitrunc.c +utmpx.h diff --git a/ports/sysdeps/unix/sysv/aix/Implies b/ports/sysdeps/unix/sysv/aix/Implies new file mode 100644 index 000000000..279438d43 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/Implies @@ -0,0 +1,8 @@ +# AIX shares most of the syscalls which are also common to BSD and SVR4. +unix/common + +# AIX has all functions of the mmap family which are described in POSIX.4. +unix/mman + +# AIX has network support in the kernel. +unix/inet diff --git a/ports/sysdeps/unix/sysv/aix/Makefile b/ports/sysdeps/unix/sysv/aix/Makefile new file mode 100644 index 000000000..2da531109 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/Makefile @@ -0,0 +1,41 @@ +# XXX For now always link against the syscalls export file. +# This is a hack until the import/export stuff is worked out. ++postctor += /lib/syscalls.exp + +ifeq ($(subdir),csu) + +sysdep_routines += aix-syscalls + +# +# The foo.c is a workaround for the linker complaining about no input files. +$(objpfx)aix-syscalls.o : /lib/syscalls.exp + echo "static int a;" > foo.c + $(CC) -c foo.c + ld -bM:SRE -bpT:0x00000000 -bpD:0x00000000 -bnoentry -bI:/lib/syscalls.exp -bE:/lib/syscalls.exp foo.o -o $@ + rm foo.c foo.o + + +endif + +ifeq ($(subdir),misc) +sysdep_routines += dl-error dl-support dl-libc dl-open dl-sym \ + dl-close dl-addr uitrunc + +static-only-routines = gprsave0 gprrest0 gprsave1 gprrest1 fprsave fprrest +endif + +ifeq ($(subdir),login) +sysdep_routines += setutxent getutxent endutxent getutxid getutxline \ + pututxline utmpxname + +#sysdep_headers += utmpx.h bits/utmpx.h +#sysdep_headers += bits/utmp.h bits/utmpx.h +endif + +# Don't compile the ctype glue code, since there is no old non-GNU C library. +inhibit-glue = yes + +# XXX Don't know yet why this is needed in the moment. +ifeq ($(subdir),timezone) +CPPFLAGS-zic.c = -Dunix +endif diff --git a/ports/sysdeps/unix/sysv/aix/Versions b/ports/sysdeps/unix/sysv/aix/Versions new file mode 100644 index 000000000..4c32bbbe7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/Versions @@ -0,0 +1,6 @@ +libc { + GLIBC_2.2 { + # u* + umount; + } +} diff --git a/ports/sysdeps/unix/sysv/aix/_exit.c b/ports/sysdeps/unix/sysv/aix/_exit.c new file mode 100644 index 000000000..510f3ae88 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/_exit.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdlib.h> + + +/* We define only thr alias introduced in ISO C99 because _exit itself + is a system call. */ +void +_Exit (status) + int status; +{ + _exit (status); +} diff --git a/ports/sysdeps/unix/sysv/aix/accept.c b/ports/sysdeps/unix/sysv/aix/accept.c new file mode 100644 index 000000000..73f11499f --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/accept.c @@ -0,0 +1,30 @@ +/* Copyright (C) 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/socket.h> + +extern int naccept (int s, void *uap_name, int *uap_anamelen); + +int +accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len) +{ + assert (sizeof (socklen_t) == sizeof (int)); + return naccept (fd, addr.__sockaddr__, addr_len); +} +libc_hidden_def (accept) diff --git a/ports/sysdeps/unix/sysv/aix/access.c b/ports/sysdeps/unix/sysv/aix/access.c new file mode 100644 index 000000000..97f8e6879 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/access.c @@ -0,0 +1,30 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ACC_INVOKER 0x01 + +extern int accessx (const char *name, int type, int who); + +int +__access (const char *name, int type) +{ + return accessx (name, type, ACC_INVOKER); +} +strong_alias (__access, access) diff --git a/ports/sysdeps/unix/sysv/aix/bind.c b/ports/sysdeps/unix/sysv/aix/bind.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bind.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/dirent.h b/ports/sysdeps/unix/sysv/aix/bits/dirent.h new file mode 100644 index 000000000..48eeb3288 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/dirent.h @@ -0,0 +1,55 @@ +/* Directory entry structure `struct dirent'. Old System V version. + Copyright (C) 1996, 1997, 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DIRENT_H +# error "Never use <bits/dirent.h> directly; include <dirent.h> instead." +#endif + +struct dirent + { +#ifndef __USE_FILE_OFFSET64 + __off_t d_off; + __ino_t d_ino; +#else + __off64_t d_off; + __ino64_t d_ino; +#endif + unsigned short int d_reclen; + unsigned short int d_namlen; + char d_name[256]; + }; + +#ifdef __USE_LARGEFILE64 +struct dirent64 + { + __off64_t d_off; + __ino64_t d_ino; + unsigned short int d_reclen; + unsigned short int d_namlen; + char d_name[256]; + }; +#endif + +#define d_fileno d_ino /* Backwards compatibility. */ +#define d_offset d_off + +#define _DIRENT_HAVE_D_NAMLEN +#define _DIRENT_HAVE_D_RECLEN +#define _DIRENT_HAVE_D_OFF +#undef _DIRENT_HAVE_D_TYPE diff --git a/ports/sysdeps/unix/sysv/aix/bits/dlfcn.h b/ports/sysdeps/unix/sysv/aix/bits/dlfcn.h new file mode 100644 index 000000000..e18417527 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/dlfcn.h @@ -0,0 +1,47 @@ +/* AIX dependent definitions for run-time dynamic loading. + Copyright (C) 1996, 1997, 1998, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DLFCN_H +# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead." +#endif + +/* The MODE argument to `dlopen' contains one of the following: */ +#define RTLD_LAZY 0x004 /* Lazy function call binding. */ +#define RTLD_NOW 0x002 /* Immediate function call binding. */ +#define RTLD_BINDING_MASK 0x6 /* Mask of binding time value. */ + +/* If the following bit is set in the MODE argument to `dlopen', + the symbols of the loaded object and its dependencies are made + visible as if the object were linked directly into the program. */ +#define RTLD_GLOBAL 0x10000 + +/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. + The implementation does this by default and so we can define the + value to zero. */ +#define RTLD_LOCAL 0x800000 + +#ifdef __USE_GNU +/* These are extensions of the AIX kernel. */ +# define RTLD_NOAUTODEFER 0x020000 +# define RTLD_MEMBER 0x040000 +# define RTLD_UNIX_LATEST 0x100000 +#endif + +/* No support to profile shared libraries available. */ +# define DL_CALL_FCT(fctp, args) fctp args diff --git a/ports/sysdeps/unix/sysv/aix/bits/endian.h b/ports/sysdeps/unix/sysv/aix/bits/endian.h new file mode 100644 index 000000000..8e9b98ef7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/endian.h @@ -0,0 +1,23 @@ +/* Copyright (C) 1997, 1998, 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ENDIAN_H +# error "Never use <bits/endian.h> directly; include <endian.h> instead." +#endif + +#define __BYTE_ORDER __BIG_ENDIAN diff --git a/ports/sysdeps/unix/sysv/aix/bits/errno.h b/ports/sysdeps/unix/sysv/aix/bits/errno.h new file mode 100644 index 000000000..9f22a965e --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/errno.h @@ -0,0 +1,153 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file defines the `errno' constants. */ + +#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath) +#undef __need_Emath +#define __Emath_defined 1 + +#endif + +#ifdef _ERRNO_H +# undef EDOM +# undef EILSEQ +# undef ERANGE + +# define EPERM 1 /* Operation not permitted. */ +# define ENOENT 2 /* No such file or directory. */ +# define ESRCH 3 /* No such process. */ +# define EINTR 4 /* interrupted system call. */ +# define EIO 5 /* I/O error. */ +# define ENXIO 6 /* No such device or address. */ +# define E2BIG 7 /* Arg list too long. */ +# define ENOEXEC 8 /* Exec format error. */ +# define EBADF 9 /* Bad file descriptor. */ +# define ECHILD 10 /* No child processes. */ +# define EAGAIN 11 /* Resource temporarily unavailable. */ +# define ENOMEM 12 /* Not enough space. */ +# define EACCES 13 /* Permission denied. */ +# define EFAULT 14 /* Bad address. */ +# define ENOTBLK 15 /* Block device required. */ +# define EBUSY 16 /* Resource busy. */ +# define EEXIST 17 /* File exists. */ +# define EXDEV 18 /* Improper link. */ +# define ENODEV 19 /* No such device. */ +# define ENOTDIR 20 /* Not a directory. */ +# define EISDIR 21 /* Is a directory. */ +# define EINVAL 22 /* Invalid argument. */ +# define ENFILE 23 /* Too many open files in system. */ +# define EMFILE 24 /* Too many open files. */ +# define ENOTTY 25 /* Inappropriate I/O control operation. */ +# define ETXTBSY 26 /* Text file busy. */ +# define EFBIG 27 /* File too large. */ +# define ENOSPC 28 /* No space left on device. */ +# define ESPIPE 29 /* Invalid seek. */ +# define EROFS 30 /* Read only file system. */ +# define EMLINK 31 /* Too many links. */ +# define EPIPE 32 /* Broken pipe. */ +# define EDOM 33 /* Domain error within math function. */ +# define ERANGE 34 /* Result too large. */ +# define ENOMSG 35 /* No message of desired type. */ +# define EIDRM 36 /* Identifier removed. */ +# define ECHRNG 37 /* Channel number out of range. */ +# define EL2NSYNC 38 /* Level 2 not synchronized. */ +# define EL3HLT 39 /* Level 3 halted. */ +# define EL3RST 40 /* Level 3 reset. */ +# define ELNRNG 41 /* Link number out of range. */ +# define EUNATCH 42 /* Protocol driver not attached. */ +# define ENOCSI 43 /* No CSI structure available. */ +# define EL2HLT 44 /* Level 2 halted. */ +# define EDEADLK 45 /* Resource deadlock avoided. */ +# define ENOTREADY 46 /* Device not ready. */ +# define EWRPROTECT 47 /* Write-protected media. */ +# define EFORMAT 48 /* Unformatted media. */ +# define ENOLCK 49 /* No locks available. */ +# define ENOCONNECT 50 /* No connection. */ +# define ESTALE 52 /* No filesystem. */ +# define EDIST 53 /* Old, currently unused AIX errno. */ +# if __USE_XOPEN_EXTENDED +# define EWOULDBLOCK EAGAIN /* Operation would block. */ +# else /* __USE_XOPEN_EXTENDED */ +# define EWOULDBLOCK 54 +# endif /* __USE_XOPEN_EXTENDED */ +# define EINPROGRESS 55 /* Operation now in progress. */ +# define EALREADY 56 /* Operation already in progress. */ +# define ENOTSOCK 57 /* Socket operation on non-socket. */ +# define EDESTADDRREQ 58 /* Destination address required. */ +# define EDESTADDREQ EDESTADDRREQ /* Destination address required. */ +# define EMSGSIZE 59 /* Message too long. */ +# define EPROTOTYPE 60 /* Protocol wrong type for socket. */ +# define ENOPROTOOPT 61 /* Protocol not available. */ +# define EPROTONOSUPPORT 62 /* Protocol not supported. */ +# define ESOCKTNOSUPPORT 63 /* Socket type not supported. */ +# define EOPNOTSUPP 64 /* Operation not supported on socket. */ +# define EPFNOSUPPORT 65 /* Protocol family not supported. */ +# define EAFNOSUPPORT 66 /* Address family not supported by protocol + family. */ +# define EADDRINUSE 67 /* Address already in use. */ +# define EADDRNOTAVAIL 68 /* Can't assign requested address. */ +# define ENETDOWN 69 /* Network is down. */ +# define ENETUNREACH 70 /* Network is unreachable. */ +# define ENETRESET 71 /* Network dropped connection on reset. */ +# define ECONNABORTED 72 /* Software caused connection abort. */ +# define ECONNRESET 73 /* Connection reset by peer. */ +# define ENOBUFS 74 /* No buffer space available. */ +# define EISCONN 75 /* Socket is already connected. */ +# define ENOTCONN 76 /* Socket is not connected. */ +# define ESHUTDOWN 77 /* Can't send after socket shutdown. */ +# define ETIMEDOUT 78 /* Connection timed out. */ +# define ECONNREFUSED 79 /* Connection refused. */ +# define EHOSTDOWN 80 /* Host is down. */ +# define EHOSTUNREACH 81 /* No route to host. */ +# define ERESTART 82 /* Restart the system call. */ +# define EPROCLIM 83 /* Too many processes. */ +# define EUSERS 84 /* Too many users. */ +# define ELOOP 85 /* Too many levels of symbolic links. */ +# define ENAMETOOLONG 86 /* File name too long. */ +# define ENOTEMPTY EEXIST /* Directory not empty. */ +# define EDQUOT 88 /* Disc quota exceeded. */ +# define ECORRUPT 89 /* Invalid file system control data. */ +# define EREMOTE 93 /* Item is not local to host. */ +# define ENOSYS 109 /* Function not implemented POSIX. */ +# define EMEDIA 110 /* Media surface error. */ +# define ESOFT 111 /* I/O completed, but needs relocation. */ +# define ENOATTR 112 /* No attribute found. */ +# define ESAD 113 /* Security authentication denied. */ +# define ENOTRUST 114 /* Not a trusted program. */ +# define ETOOMANYREFS 115 /* Too many references: can't splice. */ +# define EILSEQ 116 /* Invalid wide character. */ +# define ECANCELED 117 /* Asynchronous i/o cancelled. */ +# define ENOSR 118 /* Temp out of streams resources. */ +# define ETIME 119 /* I_STR ioctl timed out. */ +# define EBADMSG 120 /* Wrong message type at stream head. */ +# define EPROTO 121 /* STREAMS protocol error. */ +# define ENODATA 122 /* No message ready at stream head. */ +# define ENOSTR 123 /* Fd is not a stream. */ +# define ECLONEME ERESTART /* This is the way we clone a stream. */ +# define ENOTSUP 124 /* POSIX threads unsupported value. */ +# define EMULTIHOP 125 /* Multihop is not allowed. */ +# define ENOLINK 126 /* The link has been severed. */ +# define EOVERFLOW 127 /* Value too large to be stored in data type.*/ +#endif + +#if !defined _ERRNO_H && defined __need_Emath +# define EDOM 33 /* Math argument out of domain of function. */ +# define EILSEQ 116 /* Illegal byte sequence. */ +# define ERANGE 34 /* Math result not representable. */ +#endif /* !_ERRNO_H && __need_Emath */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/fcntl.h b/ports/sysdeps/unix/sysv/aix/bits/fcntl.h new file mode 100644 index 000000000..c65b8beeb --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/fcntl.h @@ -0,0 +1,137 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 1995-1999, 2000, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FCNTL_H +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." +#endif + + +#include <sys/types.h> + +/* open/fcntl. */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_NONBLOCK 04 +#define O_NDELAY O_NONBLOCK +#define O_APPEND 010 +#define O_SYNC 020 +#define O_FSYNC O_SYNC +#define O_CREAT 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_EXCL 02000 /* not fcntl */ +#define O_NOCTTY 04000 /* not fcntl */ +#define O_ASYNC 0400000 + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0400000000 +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC 020000000 /* Synchronize data. */ +# define O_RSYNC 010000000 /* Synchronize read operations. */ +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 5 /* Get record locking info. */ +# define F_SETLK 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK 11 /* Get record locking info. */ +# define F_SETLK 12 /* Set record locking info (non-blocking). */ +# define F_SETLKW 13 /* Set record locking info (blocking). */ +#endif + +#ifdef __USE_LARGEFILE64 +# define F_GETLK64 11 /* Get record locking info. */ +# define F_SETLK64 12 /* Set record locking info (non-blocking). */ +# define F_SETLKW64 13 /* Set record locking info (blocking). */ +#endif + +#if defined __USE_BSD || defined __USE_UNIX98 +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 1 /* Read lock. */ +#define F_WRLCK 2 /* Write lock. */ +#define F_UNLCK 3 /* Remove lock. */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + unsigned int l_sysid; + __pid_t l_pid; /* Process holding the lock. */ + int l_vfs; +#ifdef __USE_FILE_OFFSET64 + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + unsigned int l_sysid; + __pid_t l_pid; /* Process holding the lock. */ + int l_vfs; + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/ioctl-types.h b/ports/sysdeps/unix/sysv/aix/bits/ioctl-types.h new file mode 100644 index 000000000..d8fe8c8d5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/ioctl-types.h @@ -0,0 +1,91 @@ +/* Structure types for pre-termios terminal ioctls. AIX version. + Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IOCTL_H +# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead." +#endif + +/* Constants for use with `ioctl'. */ +#define TIOC ('T' << 8) +#define TCGETS (TIOC | 1) +#define TCSETS (TIOC | 2) +#define TCSETSW (TIOC | 3) +#define TCSETSF (TIOC | 4) +#define TCGETA (TIOC | 5) +#define TCSETA (TIOC | 6) +#define TCSETAW (TIOC | 7) +#define TCSETAF (TIOC | 8) +#define TCSBRK (TIOC | 9) +#define TCSBREAK (TIOC | 10) +#define TCXONC (TIOC | 11) +#define TCFLSH (TIOC | 12) +#define TCGLEN (TIOC | 13) +#define TCSLEN (TIOC | 14) +#define TCSAK (TIOC | 15) +#define TCQSAK (TIOC | 16) +#define TCTRUST (TIOC | 17) +#define TCQTRUST (TIOC | 18) +#define TCSMAP (TIOC | 19) +#define TCGMAP (TIOC | 20) +#define TCKEP (TIOC | 21) +#define TCGSAK (TIOC | 22) +#define TCLOOP (TIOC | 23) +#define TCVPD (TIOC | 24) +#define TCREG (TIOC | 25) +#define TCGSTATUS (TIOC | 26) +#define TCSCONTROL (TIOC | 27) +#define TCSCSMAP (TIOC | 28) +#define TCGCSMAP (TIOC | 29) +#define TCMGR TCSAK +#define TCQMGR TCQSAK +#define TIONREAD FIONREAD + + + +struct winsize +{ + unsigned short int ws_row; + unsigned short int ws_col; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; +}; + +#define NCC 8 +struct termio +{ + unsigned short int c_iflag; /* input mode flags */ + unsigned short int c_oflag; /* output mode flags */ + unsigned short int c_cflag; /* control mode flags */ + unsigned short int c_lflag; /* local mode flags */ + char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG diff --git a/ports/sysdeps/unix/sysv/aix/bits/ioctls.h b/ports/sysdeps/unix/sysv/aix/bits/ioctls.h new file mode 100644 index 000000000..8023c144d --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/ioctls.h @@ -0,0 +1,248 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IOCTL_H +# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead." +#endif + + +#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN (0x40000000<<1) /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +#define _IO(x,y) (IOC_VOID|(x<<8)|y) +#define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +#define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +#define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) + +#define TIOCGETD _IOR('t', 0, int) /* get line discipline */ +#define TIOCSETD _IOW('t', 1, int) /* set line discipline */ +#define TIOCHPCL _IO('t', 2) /* hang up on last close */ +#define TIOCMODG _IOR('t', 3, int) /* get modem control state */ +#define TIOCMODS _IOW('t', 4, int) /* set modem control state */ +#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ +#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ +#define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty */ +#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ +#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ +#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ +#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */ +#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */ +#define TANDEM 0x00000001 /* send stopc on out q full */ +#define CBREAK 0x00000002 /* half-cooked mode */ +#define LCASE 0x00000004 /* simulate lower case */ +#define CRMOD 0x00000010 /* map \r to \r\n on output */ +#define RAW 0x00000020 /* no i/o processing */ +#define ODDP 0x00000040 /* get/send odd parity */ +#define EVENP 0x00000080 /* get/send even parity */ +#define ANYP 0x000000c0 /* get any parity/send none */ +#define CRDELAY 0x00000300 /* \r delay */ +#define TBDELAY 0x00000c00 /* horizontal tab delay */ +#define XTABS 0x00000c00 /* expand tabs on output */ +#define BSDELAY 0x00001000 /* \b delay */ +#define VTDELAY 0x00002000 /* vertical tab delay */ +#define NLDELAY 0x0000c000 /* \n delay */ +#define NL2 0x00008000 /* vt05 */ +#define NL3 0x0000c000 +#define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY) +#define PRTERA 0x00020000 /* \ ... / erase */ +#define CRTERA 0x00040000 /* " \b " to wipe out char */ +#define TILDE 0x00080000 /* hazeltine tilde kludge */ +#define LITOUT 0x00200000 /* literal output */ +#define CRTBS 0x00400000 /* do backspacing for crt */ +#define MDMBUF 0x00800000 /* dtr pacing */ +#define NOHANG 0x01000000 /* no SIGHUP on carrier drop */ +#define L001000 0x02000000 +#define CRTKIL 0x04000000 /* kill line with " \b " */ +#define PASS8 0x08000000 +#define CTLECH 0x10000000 /* echo control chars as ^X */ +#define DECCTQ 0x40000000 /* only ^Q starts after ^S */ +#define NOFLUSH 0x80000000 /* no output flush on signal */ + + +/* SYS V REL. 4 PTY IOCTLs */ +#define UNLKPT _IO('t',70) /* unlock slave pty */ +#define ISPTM _IO('t',71) /* ret. maj+min of pty master */ +#define ISPTS _IO('t',73) /* return maj+min of slave */ +#define GRTPT _IO('t',74) /* grantpt slave pty*/ +#define RLOGIND _IO('t',75) /* for rlogind protocol in ptydd */ +#define TELNETDP _IO('t',76) /* for telnetd protocol in ptydd */ + +#define TIOCCONS _IOW('t', 98, int) /* become virtual console */ +#define TIOCGSID _IOR('t', 72, int) /* get the tty session id */ + + /* locals, from 127 down */ +#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ +#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ +#define TIOCLSET _IOW('t', 125, int) /* set entire mode word */ +#define TIOCLGET _IOR('t', 124, int) /* get local modes */ +#define LCRTBS (CRTBS>>16) +#define LPRTERA (PRTERA>>16) +#define LCRTERA (CRTERA>>16) +#define LTILDE (TILDE>>16) +#define LMDMBUF (MDMBUF>>16) +#define LLITOUT (LITOUT>>16) +#define LTOSTOP (TOSTOP>>16) +#define LFLUSHO (FLUSHO>>16) +#define LNOHANG (NOHANG>>16) +#define LCRTKIL (CRTKIL>>16) +#define LPASS8 (PASS8>>16) +#define LCTLECH (CTLECH>>16) +#define LPENDIN (PENDIN>>16) +#define LDECCTQ (DECCTQ>>16) +#define LNOFLSH (NOFLUSH>>16) +#define TIOCSBRK _IO('t', 123) /* set break bit */ +#define TIOCCBRK _IO('t', 122) /* clear break bit */ +#define TIOCSDTR _IO('t', 121) /* set data terminal ready */ +#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ +#define TIOCGPGRP _IOR('t', 119, int) /* get process group */ +#define TIOCSPGRP _IOW('t', 118, int) /* set process gorup */ +#define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars */ +#define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars */ +#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ +#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ +#define TIOCNOTTY _IO('t', 113) /* void tty association */ +#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ +#define TIOCPKT_DATA 0x00 /* data packet */ +#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ +#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ +#define TIOCPKT_STOP 0x04 /* stop output */ +#define TIOCPKT_START 0x08 /* start output */ +#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ +#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ +#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ +#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ +#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ +#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ +#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ +#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ +#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ +#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ +#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ +#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ +/* SLIP (Serial Line IP) ioctl's */ +#define SLIOCGUNIT _IOR('t', 101, int) /* get slip unit number */ +#define SLIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ +#define SLIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ +#define SLIOCSATTACH _IOWR('t', 91, int) /* Attach slip i.f. to tty */ +#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ + +#define OTTYDISC 0 /* old, v7 std tty driver */ +#define NETLDISC 1 /* line discip for berk net */ +#define NTTYDISC 2 /* new tty discipline */ +#define TABLDISC 3 /* tablet discipline */ +#define SLIPDISC 4 /* serial IP discipline */ + +#define FIOCLEX _IO('f', 1) /* set close on exec */ +#define FIONCLEX _IO('f', 2) /* clear close on exec */ +/* another local */ + +#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ +#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ + +#define FIOSETOWN _IOW('f', 124, int) /* set owner */ +#define FIOGETOWN _IOR('f', 123, int) /* get owner */ +#define FIOASYNCQX _IOW('f', 122, int) /* set/clear async queueing */ + +/* socket i/o controls */ +#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ +#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ +#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ +#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ + +#define SIOCADDRT (int)_IOW('r', 10, struct ortentry) /* add route */ +#define SIOCDELRT (int)_IOW('r', 11, struct ortentry) /* delete route */ + +#define SIOCSIFADDR (int)_IOW('i', 12, struct oifreq) /* set ifnet address */ +#define OSIOCGIFADDR (int)_IOWR('i',13, struct oifreq) /* get ifnet address */ +#define SIOCGIFADDR (int)_IOWR('i',33, struct oifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR (int)_IOW('i', 14, struct oifreq) /* set p-p address */ +#define OSIOCGIFDSTADDR (int)_IOWR('i',15, struct oifreq) /* get p-p address */ +#define SIOCGIFDSTADDR (int)_IOWR('i',34, struct oifreq) /* get p-p address */ +#define SIOCSIFFLAGS (int)_IOW('i', 16, struct oifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS (int)_IOWR('i',17, struct oifreq) /* get ifnet flags */ +#define OSIOCGIFBRDADDR (int)_IOWR('i',18, struct oifreq) /* get broadcast addr */ +#define SIOCGIFBRDADDR (int)_IOWR('i',35, struct oifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR (int)_IOW('i',19, struct oifreq) /* set broadcast addr */ +#define OSIOCGIFCONF (int)_IOWR('i',20, struct ifconf) /* get ifnet list */ +#define CSIOCGIFCONF (int)_IOWR('i',36, struct ifconf) /* get ifnet list */ +#define SIOCGIFCONF (int)_IOWR('i',69, struct ifconf) /* get ifnet list */ +#define OSIOCGIFNETMASK (int)_IOWR('i',21, struct oifreq) /* get net addr mask */ +#define SIOCGIFNETMASK (int)_IOWR('i',37, struct oifreq) /* get net addr mask */ +#define SIOCSIFNETMASK (int)_IOW('i',22, struct oifreq) /* set net addr mask */ +#define SIOCGIFMETRIC (int)_IOWR('i',23, struct oifreq) /* get IF metric */ +#define SIOCSIFMETRIC (int)_IOW('i',24, struct oifreq) /* set IF metric */ +#define SIOCDIFADDR (int)_IOW('i',25, struct oifreq) /* delete IF addr */ +#define SIOCAIFADDR (int)_IOW('i',26, struct ifaliasreq) /* add/chg IF alias */ +#define SIOCSIFSUBCHAN (int)_IOW('i',27, struct oifreq) /* set subchannel adr.*/ +#define SIOCSIFNETDUMP (int)_IOW('i',28, struct oifreq) /* set netdump fastwrt*/ + +#define SIOCSARP (int)_IOW('i', 30, struct arpreq) /* set arp entry */ +#define OSIOCGARP (int)_IOWR('i',31, struct arpreq) /* get arp entry */ +#define SIOCGARP (int)_IOWR('i',38, struct arpreq) /* get arp entry */ +#define SIOCDARP (int)_IOW('i', 32, struct arpreq) /* delete arp entry */ + +#define SIOCSIFOPTIONS (int)_IOW('i', 41, struct oifreq) /* set ifnet options */ +#define SIOCGIFOPTIONS (int)_IOWR('i',42, struct oifreq) /* get ifnet options */ +#define SIOCADDMULTI (int)_IOW('i', 49, struct ifreq) /* add multicast addr */ +#define SIOCDELMULTI (int)_IOW('i', 50, struct ifreq) /* del multicast addr */ +#define SIOCGETVIFCNT (int)_IOWR('u', 51, struct sioc_vif_req)/* vif pkt cnt */ +#define SIOCGETSGCNT (int)_IOWR('u', 52, struct sioc_sg_req) /* s,g pkt cnt */ + +#define SIOCADDNETID (int)_IOW('i',87, struct oifreq) /* set netids */ +#define SIOCSIFMTU (int)_IOW('i',88, struct oifreq) /* set mtu */ +#define SIOCGIFMTU (int)_IOWR('i',86, struct oifreq) /* get mtu */ + +#define SIOCSNETOPT (int)_IOW('i', 90, struct optreq) /* set network option */ +#define SIOCGNETOPT (int)_IOWR('i', 91, struct optreq) /* get network option */ +#define SIOCDNETOPT (int)_IOWR('i', 92, struct optreq) /* set default */ + +#define SIOCSX25XLATE (int)_IOW('i', 99, struct oifreq) /* set xlate tab */ +#define SIOCGX25XLATE (int)_IOWR('i',100, struct oifreq) /* get xlate tab */ +#define SIOCDX25XLATE (int)_IOW('i', 101, struct oifreq) /* delete xlate tab */ + +#define SIOCIFDETACH (int)_IOW('i', 102, struct ifreq) /* detach an ifnet */ +#define SIOCIFATTACH (int)_IOW('i', 103, struct ifreq) /* attach an ifnet */ + +#define SIOCGNMTUS (int)_IO('i',110) /* get NMTUs */ +#define SIOCGETMTUS (int)_IO('i',111) /* get common_mtus */ +#define SIOCADDMTU (int)_IOW('i',112, int) /* add mtu */ +#define SIOCDELMTU (int)_IOW('i',113, int) /* delete mtu */ + +#define SIOCGIFGIDLIST (int)_IO('i', 104) /* get gidlist */ +#define SIOCSIFGIDLIST (int)_IO('i', 105) /* set gidlist */ + +#define SIOCGSIZIFCONF (int)_IOR('i', 106, int) /* get size for SIOCGIFCONF */ + +#define SIOCIF_ATM_UBR (int)_IOW('i',120,struct ifreq) /* set ubr rate */ +#define SIOCIF_ATM_SNMPARP (int)_IOW('i',121,struct ifreq) /* atm snmp arp */ +#define SIOCIF_ATM_IDLE (int)_IOW('i',122,struct ifreq) /* set idle time */ +#define SIOCIF_ATM_DUMPARP (int)_IOW('i',123,struct ifreq) /* atm dump arp */ +#define SIOCIF_ATM_SVC (int)_IOW('i',124,struct ifreq) /* atmif init */ +#define SIOCIF_ATM_DARP (int)_IOW('i',125,struct ifreq) /* del atmarp */ +#define SIOCIF_ATM_GARP (int)_IOW('i',126,struct ifreq) /* get atmarp */ +#define SIOCIF_ATM_SARP (int)_IOW('i',127,struct ifreq) /* set atmarp */ + +#define SIOCGISNO (int)_IOWR('i',107, struct oifreq) /* get IF network options */ +#define SIOCSISNO (int)_IOW('i', 108, struct oifreq) /* set IF network options */ +#define SIOCGIFBAUDRATE (int)_IOWR('i', 109, struct oifreq) /* get ifnet's if_baudrate */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/poll.h b/ports/sysdeps/unix/sysv/aix/bits/poll.h new file mode 100644 index 000000000..b9f2f7155 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/poll.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_POLL_H +# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." +#endif + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x0001 /* There is data to read. */ +#define POLLPRI 0x0002 /* There is urgent data to read. */ +#define POLLOUT 0x0004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x0010 /* Normal data may be read. */ +# define POLLRDBAND 0x0020 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x0040 /* Priority data may be written. */ +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x4000 /* Error condition. */ +#define POLLHUP 0x2000 /* Hung up. */ +#define POLLNVAL 0x8000 /* Invalid polling request. */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/resource.h b/ports/sysdeps/unix/sysv/aix/bits/resource.h new file mode 100644 index 000000000..cc851e8a0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/resource.h @@ -0,0 +1,191 @@ +/* Bit values & structures for resource limits. AIX version. + Copyright (C) 1994, 1996-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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_RESOURCE_H +# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." +#endif + +#include <bits/types.h> + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + RLIMIT_RSS = 5, +#define RLIMIT_RSS RLIMIT_RSS + + /* Address space limit (?) */ + RLIMIT_AS = 6, +#define RLIMIT_AS RLIMIT_AS + + /* Number of open files. */ + RLIMIT_NOFILE = 7, + RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE RLIMIT_OFILE + + RLIM_NLIMITS = 10 +#define RLIMIT_NLIMITS RLIMIT_NLIMITS +#define RLIM_NLIMITS RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((long int)(~0UL >> 1)) +#else +# define RLIM_INFINITY 0x7fffffffffffffffLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0x7fffffffffffffffLL +#endif + +#define RLIM_SAVED_MAX (RLIM_INFINITY - 1) +#define RLIM_SAVED_CUR (RLIM_INFINITY - 2) + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1 +#define RUSAGE_CHILDREN RUSAGE_CHILDREN +}; + +#define __need_timeval +#include <bits/time.h> /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long int ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long int ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long int ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long int ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long int ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long int ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long int ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long int ru_inblock; + /* Number of output operations via the file system. */ + long int ru_oublock; + /* Number of IPC messages sent. */ + long int ru_msgsnd; + /* Number of IPC messages received. */ + long int ru_msgrcv; + /* Number of signals delivered. */ + long int ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long int ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long int ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; diff --git a/ports/sysdeps/unix/sysv/aix/bits/setjmp.h b/ports/sysdeps/unix/sysv/aix/bits/setjmp.h new file mode 100644 index 000000000..82a58ae06 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/setjmp.h @@ -0,0 +1,46 @@ +/* Copyright (C) 1997, 1998, 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Define the machine-dependent type `jmp_buf'. PowerPC version. */ + +#ifndef _SETJMP_H +# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." +#endif + +/* The previous bits/setjmp.h had __jmp_buf defined as a structure. + We use an array of 'long int' instead, to make writing the + assembler easier. Naturally, user code should not depend on + either representation. */ + +#if defined __USE_MISC || defined _ASM +# define JB_GPR1 0 /* Also known as the stack pointer */ +# define JB_GPR2 1 +# define JB_LR 2 /* The address we will return to */ +# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */ +# define JB_CR 21 /* Condition code registers. */ +# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */ +#endif + +#ifndef _ASM +typedef long int __jmp_buf[64]; +#endif + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)[JB_GPR1]) diff --git a/ports/sysdeps/unix/sysv/aix/bits/sigaction.h b/ports/sysdeps/unix/sysv/aix/bits/sigaction.h new file mode 100644 index 000000000..55414b8f1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/sigaction.h @@ -0,0 +1,72 @@ +/* The proper definitions for AIX's sigaction. + Copyright (C) 1993-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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Signal handler. */ +#ifdef __USE_POSIX199309 + union + { + /* Used if SA_SIGINFO is not set. */ + __sighandler_t sa_handler; + /* Used if SA_SIGINFO is set. */ + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction +#else + __sighandler_t sa_handler; +#endif + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* Special flags. */ + int sa_flags; + }; + +/* Bits in `sa_flags'. */ +#define SA_NOCLDSTOP 4 /* Don't send SIGCHLD when children stop. */ +#define SA_NOCLDWAIT 0x400 /* Don't create on death of child. */ +#define SA_SIGINFO 0x100 /* Invoke signal-catching function with + three arguments instead of one. */ +#if defined __USE_UNIX98 || defined __USE_MISC +# define SA_ONSTACK 0x00000001 /* Use signal stack by using `sa_restorer'. */ +# define SA_RESTART 0x00000008 /* Restart syscall on signal return. */ +# define SA_NODEFER 0x00000200 /* Don't automatically block the signal when + its handler is being executed. */ +# define SA_RESETHAND 0x00000002 /* Reset to SIG_DFL on entry to handler. */ +#endif +#ifdef __USE_MISC +/* Some aliases for the SA_ constants. */ +# define SA_NOMASK SA_NODEFER +# define SA_ONESHOT SA_RESETHAND +# define SA_STACK SA_ONSTACK +#endif + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_BLOCK 0 /* Block signals. */ +#define SIG_UNBLOCK 1 /* Unblock signals. */ +#define SIG_SETMASK 2 /* Set the set of blocked signals. */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/sigcontext.h b/ports/sysdeps/unix/sysv/aix/bits/sigcontext.h new file mode 100644 index 000000000..40bec1b71 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/sigcontext.h @@ -0,0 +1,32 @@ +/* Copyright (C) 1996, 1997, 1998, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." +#endif + +#include <sys/ucontext.h> + + +struct sigcontext +{ + int sc_onstack; /* Sigstack state to restore. */ + sigset_t sc_mask; /* Signal mask to restore. */ + int sc_uerror; /* u_error to restore. */ + struct mcontext_t sc_jmpbuf; /* Process context to restore. */ +}; diff --git a/ports/sysdeps/unix/sysv/aix/bits/signum.h b/ports/sysdeps/unix/sysv/aix/bits/signum.h new file mode 100644 index 000000000..67eb94960 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/signum.h @@ -0,0 +1,96 @@ +/* Signal number definitions. AIX version. + Copyright (C) 1995-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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +# define SIG_CATCHE ((__sighandler_t) 3) +#endif + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGABRT 6 /* Abort (ANSI). */ +#define SIGIOT SIGABRT /* Abort (terminal) process. */ +#define SIGEMT 7 /* EMT instruction. */ +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* BUS error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 /* Bad system call. */ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGURG 16 /* Urgent condition on socket (4.2 BSD). */ +#define SIGIOINT SIGURG /* Printer to backend error signal. */ +#define SIGSTOP 17 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 18 /* Keyboard stop (POSIX). */ +#define SIGCONT 19 /* Continue (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGCHLD 20 /* Child status has changed (POSIX). */ +#define SIGTTIN 21 /* Background read from tty (POSIX). */ +#define SIGTTOU 22 /* Background write to tty (POSIX). */ +#define SIGIO 23 /* I/O now possible (4.2 BSD). */ +#define SIGAIO SIGIO /* Base LAN I/O. */ +#define SIGPTY SIGIO /* PTY I/O. */ +#define SIGPOLL SIGIO /* ANother I/O event. */ +#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ +#define SIGMSG 27 /* Input data is in the ring buffer. */ +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ +#define SIGPWR 29 /* Power failure restart (System V). */ +#define SIGUSR1 30 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 31 /* User-defined signal 2 (POSIX). */ +#define SIGPROF 32 /* Profiling alarm clock (4.2 BSD). */ +#define SIGDANGER 33 /* System crash imminent. */ +#define SIGVTALRM 34 /* Virtual alarm clock (4.2 BSD). */ +#define SIGMIGRATE 35 /* Migrate process. */ +#define SIGPRE 36 /* Programming exception. */ +#define SIGVIRT 37 /* AIX virtual time alarm. */ +#define SIGARLM1 38 /* Reserved, don't use. */ +#define SIGWAITING 39 /* Reserved, don't use. */ +#define SIGCPUFAIL 59 /* Predictive de-configuration of processors.*/ +#define SIGKAP 60 /* Keep alive poll from native keyboard. */ +#define SIGGRANT SIGKAP /* Monitor mode granted. */ +#define SIGRETRACT 61 /* Monitor mode should be relinguished. */ +#define SIGSOUND 62 /* Sound control has completed. */ +#define SIGSAK 63 /* Secure attentation key. */ + +#define _NSIG 64 /* Biggest signal number + 1 + (including real-time signals). */ + +#define SIGRTMIN (__libc_current_sigrtmin ()) +#define SIGRTMAX (__libc_current_sigrtmax ()) + +/* These are the hard limits of the kernel. These values should not be + used directly at user level. */ +#define __SIGRTMIN 888 +#define __SIGRTMAX 999 + +#endif /* <signal.h> included. */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/sigset.h b/ports/sysdeps/unix/sysv/aix/bits/sigset.h new file mode 100644 index 000000000..0dc6b40a7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/sigset.h @@ -0,0 +1,125 @@ +/* __sig_atomic_t, __sigset_t, and related definitions. AIX version. + Copyright (C) 1991,1992,1994,1996,1997,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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGSET_H_types +# define _SIGSET_H_types 1 + +typedef int __sig_atomic_t; + +/* A `sigset_t' has a bit for each signal. */ + +typedef struct + { + unsigned int __losigs; + unsigned int __hisigs; + } __sigset_t; + +#endif + + +/* We only want to define these functions if <signal.h> was actually + included; otherwise we were included just to define the types. Since we + are namespace-clean, it wouldn't hurt to define extra macros. But + trouble can be caused by functions being defined (e.g., any global + register vars declared later will cause compilation errors). */ + +#if !defined _SIGSET_H_fns && defined _SIGNAL_H +# define _SIGSET_H_fns 1 + +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +# endif + +/* Return a mask that includes the bit for SIG only. */ +# define __sigmask(sig) \ + (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned int)))) + +# if defined __GNUC__ && __GNUC__ >= 2 +# define __sigemptyset(set) \ + (__extension__ ({ sigset_t *__set = (set); \ + __set->__losigs = __set->__hisigs = 0; \ + 0; })) +# define __sigfillset(set) \ + (__extension__ ({ sigset_t *__set = (set); \ + __set->__losigs = __set->__hisigs = ~0u; \ + 0; })) + +# ifdef __USE_GNU +/* The POSIX does not specify for handling the whole signal set in one + command. This is often wanted and so we define three more functions + here. */ +# define __sigisemptyset(set) \ + (__extension__ ({ const sigset_t *__set = (set); \ + (__set->__losigs | __set->__hisigs) == 0; })) +# define __sigandset(dest, left, right) \ + (__extension__ ({ sigset_t *__dest = (dest); \ + const sigset_t *__left = (left); \ + const sigset_t *__right = (right); \ + __dest->__losigs = __left->__losigs & __right->__losigs; \ + __dest->__hisigs = __left->__hisigs & __right->__hisigs; \ + 0; })) +# define __sigorset(dest, left, right) \ + (__extension__ ({ sigset_t *__dest = (dest); \ + const sigset_t *__left = (left); \ + const sigset_t *__right = (right); \ + __dest->__losigs = __left->__losigs | __right->__losigs; \ + __dest->__hisigs = __left->__hisigs | __right->__hisigs; \ + 0; })) +# endif +# endif + +/* These functions needn't check for a bogus signal number -- error + checking is done in the non __ versions. */ + +extern int __sigismember (__const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); + +# ifdef __USE_EXTERN_INLINES +_EXTERN_INLINE int +__sigismember (__const __sigset_t *__set, int __sig) +{ + unsigned int __mask = __sigmask (__sig); + + return ((__sig < 33 ? __set->__losigs : __set->__hisigs) & __mask ) ? 1 : 0; +} + +_EXTERN_INLINE int +__sigaddset (__sigset_t *__set, int __sig) +{ + unsigned int __mask = __sigmask (__sig); + + (__sig < 33 ? __set->__losigs : __set->__hisigs) |= __mask; + + return 0; +} + +_EXTERN_INLINE int +__sigdelset (__sigset_t *__set, int __sig) +{ + unsigned int __mask = __sigmask (__sig); + + (__sig < 33 ? __set->__losigs : __set->__hisigs) &= ~__mask; + + return 0; +} +# endif + + +#endif /* ! _SIGSET_H_fns. */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/sigstack.h b/ports/sysdeps/unix/sysv/aix/bits/sigstack.h new file mode 100644 index 000000000..cefd33c23 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/sigstack.h @@ -0,0 +1,46 @@ +/* sigstack, sigaltstack definitions. + Copyright (C) 1998, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include this file directly. Use <signal.h> instead" +#endif + + +/* Structure describing a signal stack (obsolete). */ +struct sigstack + { + void *ss_sp; /* Signal stack pointer. */ + int ss_onstack; /* Nonzero if executing on this stack. */ + }; + + +/* Possible values for `ss_flags.'. */ +enum +{ + SS_ONSTACK = 1, +#define SS_ONSTACK SS_ONSTACK + SS_DISABLE +#define SS_DISABLE SS_DISABLE +}; + +/* Minimum stack size for a signal handler. */ +#define MINSIGSTKSZ 1024 + +/* System default stack size. */ +#define SIGSTKSZ 4096 diff --git a/ports/sysdeps/unix/sysv/aix/bits/socket.h b/ports/sysdeps/unix/sysv/aix/bits/socket.h new file mode 100644 index 000000000..1fdadfe08 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/socket.h @@ -0,0 +1,293 @@ +/* System-specific socket constants and types. AIX version. + Copyright (C) 1991,92,1994-1999,2000,2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __BITS_SOCKET_H +#define __BITS_SOCKET_H + +#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H +# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." +#endif + +#define __need_size_t +#define __need_NULL +#include <stddef.h> + +#include <limits.h> +#include <sys/types.h> + +/* Type for length arguments in socket calls. */ +#ifndef __socklen_t_defined +typedef __socklen_t socklen_t; +# define __socklen_t_defined +#endif + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_STREAM = 1, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_CONN_DGRAM = 6 /* Conneciton datagram. */ +#define SOCK_CONN_DGRAM SOCK_CONN_DGRAM +}; + +/* Protocol families. */ +#define PF_UNSPEC 0 /* Unspecified. */ +#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ +#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ +#define PF_INET 2 /* IP protocol family. */ +#define PF_IMPLINK 3 /* ARPAnet IMP addresses. */ +#define PF_PUP 4 /* PUP protocols (e.g., BSP). */ +#define PF_CHAOS 5 /* MIT CHAOS protocols. */ +#define PF_NS 6 /* XEROX NS protocols. */ +#define PF_ISO 7 /* ISO protocols. */ +#define PF_OSI PF_ISO +#define PF_ECMA 8 /* European Computer Manufacturers. */ +#define PF_DATAKIT 9 /* Datakit protocols. */ +#define PF_CCITT 10 /* CCITT protocols, X.25 etc. */ +#define PF_SNA 11 /* IBM SNA. */ +#define PF_DECnet 12 /* DECnet. */ +#define PF_DLI 13 /* DEC Direct data link interface. */ +#define PF_LAT 14 /* LAT. */ +#define PF_HYLINK 15 /* NSC Hyperchannel. */ +#define PF_APPLETALK 16 /* Apple Talk. */ +#define PF_NETLINK 17 /* Internet Routing Protocol. */ +#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ +#define PF_LINK 18 /* Link layer interface. */ +#define PF_XTP 19 /* eXpress Transfer Protocol (no AF). */ +#define PF_INTF 20 /* Debugging use only. */ +#define PF_RIF 21 /* Raw interface. */ +#define PF_NETWARE 22 +#define PF_NDD 23 +#define PF_INET6 24 /* IPv6. */ +#define PF_MAX 30 /* For now.. */ + +/* Address families. */ +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE +#define AF_INET PF_INET +#define AF_IMPLINK PF_IMPLINK +#define AF_PUP PF_PUP +#define AF_CHAOS PF_CHAOS +#define AF_NS PF_NS +#define AF_ISO PF_ISO +#define AF_OSI PF_OSI +#define AF_ECMA PF_ECMA +#define AF_DATAKIT PF_DATAKIT +#define AF_CCITT PF_CCITT +#define AF_SNA PF_SNA +#define AF_DECnet PF_DECnet +#define AF_DLI PF_DLI +#define AF_LAT PF_LAT +#define AF_HYLINK PF_HYLINK +#define AF_APPLETALK PF_APPLETALK +#define AF_NETLINK PF_NETLINK +#define AF_ROUTE PF_ROUTE +#define AF_LINK PF_LINK +#define AF_INTF PF_INTF +#define AF_RIF PF_RIF +#define AF_NETWARE PF_NETWARE +#define AF_NDD PF_NDD +#define AF_INET6 PF_INET6 +#define AF_MAX PF_MAX + +/* Socket level values. Others are defined in the appropriate headers. + + XXX These definitions also should go into the appropriate headers as + far as they are available. */ +#define SOL_SOCKET 0xffff + +/* Maximum queue length specifiable by listen. */ +#define SOMAXCONN 1024 + +/* Get the definition of the macro to define the common sockaddr members. */ +#include <bits/sockaddr.h> + +/* Structure describing a generic socket address. */ +struct sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ + char sa_data[14]; /* Address data. */ + }; + + +/* Structure large enough to hold any socket address (with the historical + exception of AF_UNIX). We reserve 128 bytes. */ +#if ULONG_MAX > 0xffffffff +# define __ss_aligntype __uint64_t +#else +# define __ss_aligntype __uint32_t +#endif +#define _SS_SIZE 128 +#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype))) + +struct sockaddr_storage + { + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + __ss_aligntype __ss_align; /* Force desired alignment. */ + char __ss_padding[_SS_PADSIZE]; + }; + + +/* Bits in the FLAGS argument to `send', `recv', et al. */ +enum + { + MSG_OOB = 0x01, /* Process out-of-band data. */ +#define MSG_OOB MSG_OOB + MSG_PEEK = 0x02, /* Peek at incoming messages. */ +#define MSG_PEEK MSG_PEEK + MSG_DONTROUTE = 0x04, /* Don't use local routing. */ +#define MSG_DONTROUTE MSG_DONTROUTE + MSG_EOR = 0x08, /* End of record. */ +#define MSG_EOR MSG_EOR + MSG_TRUNC = 0x10, +#define MSG_TRUNC MSG_TRUNC + MSG_CTRUNC = 0x20, /* Control data lost before delivery. */ +#define MSG_CTRUNC MSG_CTRUNC + MSG_WAITALL = 0x40, /* Wait for a full request. */ +#define MSG_WAITALL MSG_WAITALL + MSG_MPEG2 = 0x80, /* Message contain MPEG2 data. */ +#define MSG_MPEG2 MSG_MPEG2 + }; + + +/* Structure describing messages sent by + `sendmsg' and received by `recvmsg'. */ +struct msghdr + { + void *msg_name; /* Address to send to/receive from. */ + socklen_t msg_namelen; /* Length of address data. */ + + struct iovec *msg_iov; /* Vector of data to send/receive into. */ + int msg_iovlen; /* Number of elements in the vector. */ + + void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ + socklen_t msg_controllen; /* Ancillary data buffer length. */ + + int msg_flags; /* Flags on received message. */ + }; + +/* Structure used for storage of ancillary data object information. */ +struct cmsghdr + { + socklen_t cmsg_len; /* Length of data in cmsg_data plus length + of cmsghdr structure. */ + int cmsg_level; /* Originating protocol. */ + int cmsg_type; /* Protocol specific type. */ +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L + __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ +#endif + }; + +/* Ancillary data object manipulation macros. */ +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L +# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) +#else +# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) +#endif +#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) +#define CMSG_FIRSTHDR(mhdr) \ + ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ + ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) +#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ + & ~(sizeof (size_t) - 1)) +#define CMSG_SPACE(len) (CMSG_ALIGN (len) \ + + CMSG_ALIGN (sizeof (struct cmsghdr))) +#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) + +extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, + struct cmsghdr *__cmsg) __THROW; +#ifdef __USE_EXTERN_INLINES +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +# endif +_EXTERN_INLINE struct cmsghdr * +__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW +{ + if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) + /* The kernel header does this so there may be a reason. */ + return 0; + + __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + + CMSG_ALIGN (__cmsg->cmsg_len)); + if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control + + __mhdr->msg_controllen) + || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) + > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) + /* No more entries. */ + return 0; + return __cmsg; +} +#endif /* Use `extern inline'. */ + +/* Socket level message types. This must match the definitions in + <linux/socket.h>. */ +enum + { + SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ +#define SCM_RIGHTS SCM_RIGHTS + }; + +/* Options flags per socket. */ +#define SO_DEBUG 0x0001 /* Turn on debugging info recording. */ +#define SO_ACCEPTCONN 0x0002 /* Socket has had listen(). */ +#define SO_REUSEADDR 0x0004 /* Allow local address reuse. */ +#define SO_KEEPALIVE 0x0008 /* Keep connections alive. */ +#define SO_DONTROUTE 0x0010 /* Just use interface addresses. */ +#define SO_BROADCAST 0x0020 /* Permit sending of broadcast msgs. */ +#define SO_USELOOPBACK 0x0040 /* Bypass hardware when possible. */ +#define SO_LINGER 0x0080 /* Linger on close if data present. */ +#define SO_OOBINLINE 0x0100 /* Leave received OOB data in line. */ +#define SO_REUSEPORT 0x0200 /* Allow local address & port reuse. */ +#define SO_USE_IFBUFS 0x0400 /* Interface will supply buffers. */ +#define SO_CKSUMRECV 0x0800 /* Defer checksum until receive. */ +#define SO_NOREUSEADDR 0x1000 /* Prevent local address reuse. */ +#define SO_SNDBUF 0x1001 /* Send buffer size. */ +#define SO_RCVBUF 0x1002 /* Receive buffer size. */ +#define SO_SNDLOWAT 0x1003 /* Send low-water mark. */ +#define SO_RCVLOWAT 0x1004 /* Receive low-water mark. */ +#define SO_SNDTIMEO 0x1005 /* Send timeout. */ +#define SO_RCVTIMEO 0x1006 /* Receive timeout. */ +#define SO_ERROR 0x1007 /* Get error status and clear. */ +#define SO_TYPE 0x1008 /* Get socket type. */ +#define SO_KERNACCEPT 0x2000 /* Derive a in-kernel only socket. */ +#define SO_AUDIT 0x8000 /* Turn on socket auditing. */ + + +/* Structure used to manipulate the SO_LINGER option. */ +struct linger + { + int l_onoff; /* Nonzero to linger on close. */ + int l_linger; /* Time to linger. */ + }; + +#endif /* bits/socket.h */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/stat.h b/ports/sysdeps/unix/sysv/aix/bits/stat.h new file mode 100644 index 000000000..adcb1d101 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/stat.h @@ -0,0 +1,119 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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 + +struct stat + { + __dev_t st_dev; /* Device. */ + __ino_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + unsigned short int st_flag; /* Flag word. */ + __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. */ +#ifndef __USE_FILE_OFFSET64 + __off_t st_size; /* Size of file, in bytes. */ +#else + int st_ssize; /* Size of file, in bytes. */ +#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; + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ + int st_vfstype; /* Type of the filesystem. */ + unsigned int st_vfs; /* Vfs number. */ + unsigned int st_type; /* Vnode type. */ + unsigned int st_gen; /* Inode generation number. */ + +#define _STATBUF_RESERVED_SPACE 9 + unsigned int st_reserved[_STATBUF_RESERVED_SPACE]; + +#ifdef __USE_FILE_OFFSET64 + unsigned int st_padto_ll; + __off64_t st_size; /* 64 bit file size in bytes. */ +#endif + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + unsigned short int st_flag; /* Flag word. */ + __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. */ + int st_ssize; /* Size of file, in bytes. */ + __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; + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ + int st_vfstype; /* Type of the filesystem. */ + unsigned int st_vfs; /* Vfs number. */ + unsigned int st_type; /* Vnode type. */ + unsigned int st_gen; /* Inode generation number. */ + unsigned int st_reserved[_STATBUF_RESERVED_SPACE]; + unsigned int st_padto_ll; + __off64_t st_size; /* 64 bit file size in bytes. */ + }; +#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. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. */ +#define __S_TYPEISMQ(buf) (0) +#define __S_TYPEISSEM(buf) (0) +#define __S_TYPEISSHM(buf) (0) + +/* 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. */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/statfs.h b/ports/sysdeps/unix/sysv/aix/bits/statfs.h new file mode 100644 index 000000000..0a1c0a5e6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/statfs.h @@ -0,0 +1,77 @@ +/* Copyright (C) 1997, 1998, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STATFS_H +# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." +#endif + +#include <bits/types.h> /* for __fsid_t and __fsblkcnt_t*/ + +struct statfs + { + int f_version; + int f_type; + int f_bsize; + /* The following five elements have type `int' since AIX's fsfilcnt_t + and fsblkcnt_t types do not fit. */ + int f_blocks; + int f_bfree; + int f_bavail; + int f_files; + int f_ffree; + __fsid_t f_fsid; + int f_vfstype; + int f_fsize; + int f_vfsnumber; + int f_vfsoff; + int f_vfslen; + int f_vfsvers; + char f_fname[32]; + char f_fpack[32]; + int f_name_max; + }; + +#ifdef __USE_LARGEFILE64 +/* XXX There seems to be no 64-bit versio of this structure. */ +struct statfs64 + { + int f_version; + int f_type; + int f_bsize; + /* The following five elements have type `int' since AIX's fsfilcnt_t + and fsblkcnt_t types do not fit. */ + int f_blocks; + int f_bfree; + int f_bavail; + int f_files; + int f_ffree; + __fsid_t f_fsid; + int f_vfstype; + int f_fsize; + int f_vfsnumber; + int f_vfsoff; + int f_vfslen; + int f_vfsvers; + char f_fname[32]; + char f_fpack[32]; + int f_name_max; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAME_MAX diff --git a/ports/sysdeps/unix/sysv/aix/bits/termios.h b/ports/sysdeps/unix/sysv/aix/bits/termios.h new file mode 100644 index 000000000..b178d9c1b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/termios.h @@ -0,0 +1,189 @@ +/* termios type and macro definitions. AIX version. + 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _TERMIOS_H +# error "Never include <bits/termios.h> directly; use <termios.h> instead." +#endif + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 16 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[NCCS]; /* control characters */ + }; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VEOL 5 +#define VSTART 7 +#define VSTOP 8 +#define VSUSP 9 +#define VMIN 4 +#define VTIME 5 +#define VEOL2 6 +#define VDSUSP 10 +#define VREPRINT 11 +#define VDISCARD 12 +#define VWERSE 13 +#define VWERASE VWERSE +#define VLNEXT 14 +#define VSTRT VSTART + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IXON 0001000 +#define IXOFF 0002000 +#define IUCLC 0004000 +#define IXANY 0010000 +#define IMAXBEL 0200000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#if defined __USE_MISC || defined __USE_XOPEN +# define CRDLY 0001400 +# define CR0 0000000 +# define CR1 0000400 +# define CR2 0001000 +# define CR3 0001400 +# define TABDLY 0006000 +# define TAB0 0000000 +# define TAB1 0002000 +# define TAB2 0004000 +# define TAB3 0006000 +# define BSDLY 0010000 +# define BS0 0000000 +# define BS1 0010000 +# define FFDLY 0020000 +# define FF0 0000000 +# define FF1 0020000 +# define NLDLY 0040000 +# define NL0 0000000 +# define NL1 0040000 +#endif + +#define VTDLY 0100000 +#define VT0 0000000 +#define VT1 0100000 + +/* c_cflag bit meaning */ +#ifdef __USE_MISC +# define CBAUD 0000017 +#endif +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +#endif +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#ifdef __USE_MISC +# define CIBAUD 000003600000 /* input baud rate (not used) */ +# define CRTSCTS 020000000000 /* flow control */ +#endif + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#if defined __USE_MISC || defined __USE_XOPEN +# define XCASE 0000004 +#endif +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0200000 +#ifdef __USE_MISC +# define ECHOCTL 0400000 +# define ECHOPRT 01000000 +# define ECHOKE 02000000 +# define FLUSHO 004000000 +# define PENDIN 04000000000 +#endif +#define IEXTEN 010000000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + + +#define _IOT_termios /* Hurd ioctl type field. */ \ + _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) diff --git a/ports/sysdeps/unix/sysv/aix/bits/types.h b/ports/sysdeps/unix/sysv/aix/bits/types.h new file mode 100644 index 000000000..12c3be730 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/types.h @@ -0,0 +1,136 @@ +/* Copyright (C) 1991,92,1994-1999,2000,2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use <sys/types.h> instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include <features.h> + +#define __need_NULL +#define __need_size_t +#include <stddef.h> + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; +#ifdef __GNUC__ +__extension__ typedef unsigned long long int __u_quad_t; +__extension__ typedef long long int __quad_t; +#else +typedef struct + { + long int __val[2]; + } __quad_t; +typedef struct + { + __u_long __val[2]; + } __u_quad_t; +#endif +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#ifdef __GNUC__ +__extension__ typedef signed long long int __int64_t; +__extension__ typedef unsigned long long int __uint64_t; +#endif +typedef __quad_t *__qaddr_t; + +typedef __u_long __dev_t; /* Type of device numbers. */ +typedef __u_int __uid_t; /* Type of user identifications. */ +typedef __u_int __gid_t; /* Type of group identifications. */ +typedef __u_long __ino_t; /* Type of file serial numbers. */ +typedef __u_int __mode_t; /* Type of file attribute bitmasks. */ +typedef short int __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef int __pid_t; /* Type of process identifications. */ +typedef long int __ssize_t; /* Type of a byte count, or error. */ +typedef __u_long __rlim_t; /* Type of resource counts. */ +typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ +typedef unsigned int __id_t; /* General type for ID. */ + +typedef struct + { + unsigned long int __val[2]; + } __fsid_t; /* Type of file system IDs. */ + +/* Everythin' else. */ +typedef long int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef int __suseconds_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ + +typedef int __clock_t; + +/* Clock ID used in clock and timer functions. */ +typedef int __clockid_t; + +/* Timer ID returned by `timer_create'. */ +typedef int __timer_t; + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +typedef long int __key_t; + +/* Type to represent block size. */ +typedef int __blksize_t; + +/* Types from the Large File Support interface. */ + +/* Type to count number os disk blocks. */ +typedef int __blkcnt_t; +typedef __quad_t __blkcnt64_t; + +/* Type to count file system blocks. */ +typedef __u_long __fsblkcnt_t; +typedef __u_quad_t __fsblkcnt64_t; + +/* Type to count file system inodes. */ +typedef __u_long __fsfilcnt_t; +typedef __u_quad_t __fsfilcnt64_t; + +/* Type of file serial numbers. */ +typedef __u_quad_t __ino64_t; + +/* Type of file sizes and offsets. */ +typedef __loff_t __off64_t; + +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + +/* Duplicates info from stdint.h but this is used in unistd.h. */ +typedef signed long __intptr_t; + +/* Duplicate info from sys/socket.h. */ +typedef unsigned int __socklen_t; + +#endif /* bits/types.h */ diff --git a/ports/sysdeps/unix/sysv/aix/bits/uio.h b/ports/sysdeps/unix/sysv/aix/bits/uio.h new file mode 100644 index 000000000..60781532a --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/uio.h @@ -0,0 +1,42 @@ +/* Copyright (C) 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UIO_H +# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead." +#endif + + +#include <sys/types.h> + + +/* Size of object which can be written atomically. + + This macro has different values in different kernel versions. The + latest versions of ther kernel use 1024 and this is good choice. Since + the C library implementation of readv/writev is able to emulate the + functionality even if the currently running kernel does not support + this large value the readv/writev call will not fail because of this. */ +#define UIO_MAXIOV 16 + + +/* Structure for scatter/gather I/O. */ +struct iovec + { + void *iov_base; /* Pointer to data. */ + size_t iov_len; /* Length of data. */ + }; diff --git a/ports/sysdeps/unix/sysv/aix/bits/utmp.h b/ports/sysdeps/unix/sysv/aix/bits/utmp.h new file mode 100644 index 000000000..b78a2afda --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/utmp.h @@ -0,0 +1,73 @@ +/* The `struct utmp' type, describing entries in the utmp file. AIX. + Copyright (C) 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UTMP_H +# error "Never include <bits/utmp.h> directly; use <utmp.h> instead." +#endif + +#include <paths.h> +#include <sys/time.h> +#include <sys/types.h> + + +#define UT_LINESIZE 12 +#define UT_NAMESIZE 8 +#define UT_HOSTSIZE 16 + + +struct utmp + { +#define ut_name ut_user + char ut_user[UT_NAMESIZE]; + char ut_id[14]; + char ut_line[UT_LINESIZE]; + short int ut_type; + short int ut_pid; + struct exit_status + { + short int e_termination; + short int e_exit; + } ut_exit; + __time_t ut_time; + char ut_host[UT_HOSTSIZE]; + }; + + +/* Values for the `ut_type' field of a `struct utmp'. */ +#define EMPTY 0 /* No valid user accounting information. */ + +#define RUN_LVL 1 /* The system's runlevel. */ +#define BOOT_TIME 2 /* Time of system boot. */ +#define OLD_TIME 3 /* Time when system clock changed. */ +#define NEW_TIME 4 /* Time after system clock changed. */ + +#define INIT_PROCESS 5 /* Process spawned by the init process. */ +#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ +#define USER_PROCESS 7 /* Normal process. */ +#define DEAD_PROCESS 8 /* Terminated process. */ + +#define ACCOUNTING 9 + + +/* Tell the user that we have a modern system with UT_HOST, UT_TYPE, and + UT_ID fields. */ +#define _HAVE_UT_TYPE 1 +#define _HAVE_UT_PID 1 +#define _HAVE_UT_ID 1 +#define _HAVE_UT_HOST 1 diff --git a/ports/sysdeps/unix/sysv/aix/bits/utmpx.h b/ports/sysdeps/unix/sysv/aix/bits/utmpx.h new file mode 100644 index 000000000..438b5f3a5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/utmpx.h @@ -0,0 +1,75 @@ +/* Structures and defenitions for the user accounting database. AIX. + Copyright (C) 1997, 1998, 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UTMPX_H +# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead." +#endif + +#include <bits/types.h> +#include <sys/time.h> + + +#ifdef __USE_GNU +# include <paths.h> +# define _PATH_UTMPX _PATH_UTMP +# define _PATH_WTMPX _PATH_WTMP +#endif + + +#define __UT_LINESIZE 12 +#define __UT_NAMESIZE 8 +#define __UT_HOSTSIZE 16 + + +/* The structure describing an entry in the user accounting database. */ +struct utmpx +{ + char ut_user[__UT_NAMESIZE]; /* Username. */ + char ut_id[14]; /* Inittab ID. */ + char ut_line[__UT_LINESIZE]; /* Devicename. */ + short int ut_type; /* Type of login. */ + __pid_t ut_pid; /* Process ID of login process. */ + struct timeval ut_tv; /* Time entry was made. */ + char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */ +}; + + +/* Values for the `ut_type' field of a `struct utmpx'. */ +#define EMPTY 0 /* No valid user accounting information. */ + +#define RUN_LVL 1 /* The system's runlevel. */ +#define BOOT_TIME 2 /* Time of system boot. */ +#define NEW_TIME 3 /* Time after system clock changed. */ +#define OLD_TIME 4 /* Time when system clock changed. */ + +#define INIT_PROCESS 5 /* Process spawned by the init process. */ +#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ +#define USER_PROCESS 7 /* Normal process. */ +#define DEAD_PROCESS 8 /* Terminated process. */ + +#ifdef __USE_GNU +# define ACCOUNTING 9 /* System accounting. */ +#endif + +#define _HAVE_UT_TYPE 1 +#define _HAVE_UT_PID 1 +#define _HAVE_UT_ID 1 +#define _HAVE_UT_TV 1 +#define _HAVE_UT_HOST 1 + diff --git a/ports/sysdeps/unix/sysv/aix/bits/utsname.h b/ports/sysdeps/unix/sysv/aix/bits/utsname.h new file mode 100644 index 000000000..d238f5efd --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/bits/utsname.h @@ -0,0 +1,23 @@ +/* Copyright (C) 1997, 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UTSNAME_H +# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead." +#endif + +#define _UTSNAME_LENGTH 32 diff --git a/ports/sysdeps/unix/sysv/aix/brk.c b/ports/sysdeps/unix/sysv/aix/brk.c new file mode 100644 index 000000000..66707fe60 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/brk.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__brk (void *addr) +{ + return brk (addr); +} diff --git a/ports/sysdeps/unix/sysv/aix/chdir.c b/ports/sysdeps/unix/sysv/aix/chdir.c new file mode 100644 index 000000000..153084eb6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/chdir.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__chdir (const char *path) +{ + return chdir (path); +} diff --git a/ports/sysdeps/unix/sysv/aix/chmod.c b/ports/sysdeps/unix/sysv/aix/chmod.c new file mode 100644 index 000000000..628d09cce --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/chmod.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/stat.h> + +int +__chmod (const char *path, mode_t mode) +{ + return chmod (path, mode); +} diff --git a/ports/sysdeps/unix/sysv/aix/chown.c b/ports/sysdeps/unix/sysv/aix/chown.c new file mode 100644 index 000000000..2b6e82e73 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/chown.c @@ -0,0 +1,26 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__chown (const char *file, uid_t owner, gid_t group) +{ + return chown (file, owner, group); +} +libc_hidden_def (__chown) diff --git a/ports/sysdeps/unix/sysv/aix/chroot.c b/ports/sysdeps/unix/sysv/aix/chroot.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/chroot.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/close.c b/ports/sysdeps/unix/sysv/aix/close.c new file mode 100644 index 000000000..7be595643 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/close.c @@ -0,0 +1,26 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__close (int fd) +{ + return close (fd); +} +libc_hidden_def (__close) diff --git a/ports/sysdeps/unix/sysv/aix/configure b/ports/sysdeps/unix/sysv/aix/configure new file mode 100644 index 000000000..2c07b415f --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/configure @@ -0,0 +1,6 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/unix/sysv/aix. + +# Don't bother trying to generate any glue code to be compatible with the +# existing system library, because we are the only system library. +inhibit_glue=yes diff --git a/ports/sysdeps/unix/sysv/aix/configure.in b/ports/sysdeps/unix/sysv/aix/configure.in new file mode 100644 index 000000000..bb783fc0c --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/configure.in @@ -0,0 +1,6 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/unix/sysv/aix. + +# Don't bother trying to generate any glue code to be compatible with the +# existing system library, because we are the only system library. +inhibit_glue=yes diff --git a/ports/sysdeps/unix/sysv/aix/connect.c b/ports/sysdeps/unix/sysv/aix/connect.c new file mode 100644 index 000000000..2f58be1ed --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/connect.c @@ -0,0 +1,11 @@ +/* This is a system call. We only have to provide the wrapper. */ +#include <sys/socket.h> + +#undef __connect + +int +__connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) +{ + return connect (fd, addr, len); +} +INTDEF(__connect) diff --git a/ports/sysdeps/unix/sysv/aix/creat.c b/ports/sysdeps/unix/sysv/aix/creat.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/creat.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/dl-addr.c b/ports/sysdeps/unix/sysv/aix/dl-addr.c new file mode 100644 index 000000000..b8dbddfe4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dl-addr.c @@ -0,0 +1,30 @@ +/* + Copyright (C) 1996, 1997, 1998, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <dlfcn.h> +#include <stdlib.h> +#include <ldsodefs.h> + +int +internal_function +_dl_addr (const void *address, Dl_info *info) +{ + return 0; +} + diff --git a/ports/sysdeps/unix/sysv/aix/dl-close.c b/ports/sysdeps/unix/sysv/aix/dl-close.c new file mode 100644 index 000000000..edd45851f --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dl-close.c @@ -0,0 +1,46 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdarg.h> +#include <stdlib.h> +#include <sys/types.h> +#include <errno.h> +#include <dlfcn.h> +#include <dlldr.h> + +extern int _dl_numso; +extern DL_SODATA *_dl_sotable; + +void +_dl_close (void *handle) +{ + if ((int) handle < 0 || (int) handle >= _dl_numso || _dl_sotable == NULL) + { + errno = EINVAL; + return; + } + + if (_dl_sotable[(int) handle].handle != 0) + __unload (_dl_sotable[(int) handle].handle); + + _dl_sotable[(int) handle].index = 0; + _dl_sotable[(int) handle].dataorg = 0; + _dl_sotable[(int) handle].handle = 0; + _dl_sotable[(int) handle].type = 0; +} + diff --git a/ports/sysdeps/unix/sysv/aix/dl-error.c b/ports/sysdeps/unix/sysv/aix/dl-error.c new file mode 100644 index 000000000..9c6335b59 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dl-error.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +#include <elf/dl-error.c> diff --git a/ports/sysdeps/unix/sysv/aix/dl-libc.c b/ports/sysdeps/unix/sysv/aix/dl-libc.c new file mode 100644 index 000000000..69c627c19 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dl-libc.c @@ -0,0 +1,41 @@ +/* Handle loading and unloading shared objects for internal libc purposes. + Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <dlfcn.h> +#include <stdlib.h> +#include <ldsodefs.h> + +void * +__libc_dlopen (const char *name) +{ + return _dl_open (name, RTLD_LAZY, NULL); +} + +void * +__libc_dlsym (void *map, const char *name) +{ + return _dl_sym (map, name, NULL); +} + +int +__libc_dlclose (void *map) +{ + _dl_close (map); + return 0; +} diff --git a/ports/sysdeps/unix/sysv/aix/dl-open.c b/ports/sysdeps/unix/sysv/aix/dl-open.c new file mode 100644 index 000000000..070471d51 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dl-open.c @@ -0,0 +1,133 @@ +/* Copyright (C) 1999, 2000, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <malloc.h> +#include <stdarg.h> +#include <stdlib.h> +#include <sys/types.h> +#include <errno.h> +#include <dlfcn.h> +#include <dlldr.h> + +#define NUM_SHARED_OBJECTS 32 + +int _dl_numso = NUM_SHARED_OBJECTS; +DL_SODATA *_dl_sotable = NULL; + +void * +_dl_open (const char *file, int mode, const void *caller) +{ + DL_SODATA *new_so; + void *handle; + int entry; + int bsize = _dl_numso * sizeof (DL_INFO); + DL_INFO *dl_info = malloc (bsize); + + if (dl_info == NULL) + return NULL; + + /* 1st time thru initial shared object data table. */ + if (_dl_sotable == NULL) + { + _dl_sotable = (DL_SODATA *) calloc (_dl_numso, sizeof (DL_SODATA)); + if (_dl_sotable == NULL) + return NULL; + + __loadx (DL_POSTLOADQ, dl_info, bsize, NULL); + while (!(dl_info[0].dlinfo_xflags & DL_INFO_OK) + || dl_info[0].dlinfo_arraylen == 0) + { + bsize *= 2; + dl_info = realloc (dl_info, bsize); + if (dl_info == NULL) + return NULL; + + __loadx (DL_POSTLOADQ, dl_info, bsize, NULL); + } + } + + /* Validate mode bits. */ + if (!(mode & RTLD_NOW) && !(mode & RTLD_LAZY)) + { + free (dl_info); + errno = EINVAL; + return NULL; + } + + /* Load the module. */ + handle = (void *) __loadx (DL_LOAD | DL_LOAD_RTL | DL_LOAD_LDX1, + dl_info, bsize, file, NULL); + if (handle == NULL) + { + free (dl_info); + errno = EINVAL; + return NULL; + } + + /* Was dl_info buffer to small to get info. */ + while (!(dl_info[0].dlinfo_xflags & DL_INFO_OK) + || dl_info[0].dlinfo_arraylen == 0) + { + bsize *= 2; + dl_info = realloc (dl_info, bsize); + if (dl_info == NULL) + { + (void) __unload ((void *) handle); + errno = ENOMEM; + return NULL; + } + __loadx (DL_POSTLOADQ | DL_LOAD_RTL, dl_info, bsize, handle); + } + + /* Get an empty entry in the shared object table. */ + for (entry = 0; entry < _dl_numso; ++entry) + if (_dl_sotable[entry].type == 0) + break; + + /* See if the table needs to be increased. */ + if (entry == _dl_numso) + { + new_so = (DL_SODATA *) realloc (_dl_sotable, + _dl_numso * 2 * sizeof (DL_SODATA)); + if (new_so == NULL) + return NULL; + + memset (new_so + _dl_numso, '\0', _dl_numso * sizeof (DL_SODATA)); + _dl_numso *= 2; + _dl_sotable = new_so; + } + + /* See if this is syscall (look for /unix in file). */ + if (strcmp ("/unix", file) == 0) + { + _dl_sotable[entry].index = dl_info[1].dlinfo_index; + _dl_sotable[entry].dataorg = dl_info[1].dlinfo_dataorg; + _dl_sotable[entry].handle = handle; + _dl_sotable[entry].type = DL_UNIX_SYSCALL; + } + else + { + _dl_sotable[entry].index = dl_info[1].dlinfo_index; + _dl_sotable[entry].dataorg = dl_info[1].dlinfo_dataorg; + _dl_sotable[entry].handle = handle; + _dl_sotable[entry].type = DL_GETSYM; + } + + free (dl_info); + return (void *) entry; +} diff --git a/ports/sysdeps/unix/sysv/aix/dl-support.c b/ports/sysdeps/unix/sysv/aix/dl-support.c new file mode 100644 index 000000000..6172c853d --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dl-support.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +#include <elf/dl-support.c> diff --git a/ports/sysdeps/unix/sysv/aix/dl-sym.c b/ports/sysdeps/unix/sysv/aix/dl-sym.c new file mode 100644 index 000000000..3f48b12cd --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dl-sym.c @@ -0,0 +1,58 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdarg.h> +#include <stdlib.h> +#include <sys/types.h> +#include <errno.h> +#include <dlfcn.h> +#include <dlldr.h> + +extern int _dl_numso; +extern DL_SODATA *_dl_sotable; + +void * +_dl_sym (void *handle, const char *symbol, void *who) +{ + void *rt_function; + + if ((int) handle < 0 || (int) handle >= _dl_numso || _dl_sotable == NULL) + { + errno = EINVAL; + return NULL; + } + + switch (_dl_sotable[(int) handle].type) + { + case DL_UNIX_SYSCALL: + rt_function = (void *) __loadx (DL_UNIX_SYSCALL, (void *) symbol); + break; + + case DL_GETSYM: + rt_function = (void *) __loadx (DL_GETSYM, (void *) symbol, + _dl_sotable[(int) handle].index, + _dl_sotable[(int) handle].dataorg); + break; + + default: + errno = EINVAL; + return NULL; + } + + return rt_function; +} diff --git a/ports/sysdeps/unix/sysv/aix/dlldr.h b/ports/sysdeps/unix/sysv/aix/dlldr.h new file mode 100644 index 000000000..e0f3740d2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/dlldr.h @@ -0,0 +1,111 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +/* + + int __loadx(flag, module, arg1, arg2, arg3) + + The __loadx() is a call to ld_loadutil() kernel function, which + does the real work. Note ld_loadutil() is not exported an cannot be + called directly from user space. + + void *ld_loadutil() call is a utility function used for loader extensions + supporting run-time linking and dl*() functions. + + void * - will return the modules entry point if it succeds of NULL + on failure. + + int flag - the flag field performas a dual role: the top 8 bits specify + the work for __loadx() to perform, the bottom 8 bits are + used to pass flags to the work routines, all other bits are + reserved. + +*/ + +#define DL_LOAD 0x1000000 /* __loadx(flag,buf, buf_len, filename, libr_path) */ +#define DL_POSTLOADQ 0x2000000 /* __loadx(flag,buf, buf_len, module_handle) */ +#define DL_EXECQ 0x3000000 /* __loadx(flag,buf, buf_len) */ +#define DL_EXITQ 0x4000000 /* __loadx(flag,buf, buf_len) */ +#define DL_PREUNLOADQ 0x5000000 /* __loadx(flag,buf, buf_len, module_handle) */ +#define DL_INIT 0x6000000 /* __loadx(flag,NULL) */ +#define DL_GETSYM 0x7000000 /* __loadx(flag,symbol, index, modules_data_origin) */ +#define DL_SETDEPEND 0x8000000 /* __loadx(flag,import_data_org, import_index, */ + /* export_data_org, export_index) */ +#define DL_DELDEPEND 0x9000000 /* __loadx(flag,import_data_org, import_index, */ + /* export_data_org, export_index) */ +#define DL_GLOBALSYM 0xA000000 /* __loadx(flag,symbol_name, ptr_to_rec_index, */ + /* ptr_to_rec_data_org) */ +#define DL_UNIX_SYSCALL 0xB000000 /* __loadx(flag,syscall_symbol_name) */ + +#define DL_FUNCTION_MASK 0xFF000000 +#define DL_SRCHDEPENDS 0x00100000 +#define DL_SRCHMODULE 0x00080000 +#define DL_SRCHLOADLIST 0x00040000 +#define DL_LOAD_LDX1 0x00040000 +#define DL_LOAD_RTL 0x00020000 +#define DL_HASHSTRING 0x00020000 +#define DL_INFO_OK 0x00010000 +#define DL_LOAD_DLINFO 0x00010000 +#define DL_UNLOADED 0x00020000 + +typedef union _dl_info +{ + struct { + uint _xflags; /* flag bits in the array */ + uint _size; /* size of this structure */ + uint _arraylen; /* number of following elements */ + } _dl_stat; + struct { + caddr_t _textorg; /* start of loaded program image */ + caddr_t _dataorg; /* start of data instance */ + uint _datasize; /* size of data instance */ + ushort _index; /* index of this le in la_dynlist */ + ushort _mflags; /* info about module from load() */ + } _dl_array; +} DL_INFO; + +#define dlinfo_xflags _dl_stat._xflags +#define dlinfo_arraylen _dl_stat._arraylen +#define dlinfo_size _dl_stat._size + +#define dlinfo_textorg _dl_array._textorg +#define dlinfo_datasize _dl_array._datasize +#define dlinfo_dataorg _dl_array._dataorg +#define dlinfo_index _dl_array._index +#define dlinfo_flags _dl_array._mflags + +#define DL_HAS_RTINIT 0x1 /* indicates the module __rtinit symbols */ +#define DL_IS_NEW 0x2 /* indicates that the module is newly loaded */ + +struct _xArgs +{ + char *libpath; + DL_INFO *info; + uint infosize; +}; + +/* Shared Object DATA used for dl-open,dl-sym & dl-close support */ +typedef struct +{ + void *handle; /* handle for __loadx */ + uint type; /* type of __loadx flag */ + ushort index; /* dlinfo_index */ + caddr_t dataorg; /* dlinfo_dataorg */ +} DL_SODATA; + diff --git a/ports/sysdeps/unix/sysv/aix/environ.c b/ports/sysdeps/unix/sysv/aix/environ.c new file mode 100644 index 000000000..01e7ba828 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/environ.c @@ -0,0 +1 @@ +/* We don't need to define environ, the kernel does it. */ diff --git a/ports/sysdeps/unix/sysv/aix/euidaccess.c b/ports/sysdeps/unix/sysv/aix/euidaccess.c new file mode 100644 index 000000000..c666af5fd --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/euidaccess.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define ACC_SELF 0 + +int +euidaccess (const char *name, int type) +{ + return accessx (name, type, ACC_SELF); +} diff --git a/ports/sysdeps/unix/sysv/aix/execve.c b/ports/sysdeps/unix/sysv/aix/execve.c new file mode 100644 index 000000000..f8cc07d55 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/execve.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__execve (const char *path, char *const argv[], char *const envp[]) +{ + return execve (path, argv, envp); +} diff --git a/ports/sysdeps/unix/sysv/aix/fchdir.c b/ports/sysdeps/unix/sysv/aix/fchdir.c new file mode 100644 index 000000000..9fe7e8bec --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fchdir.c @@ -0,0 +1,26 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__fchdir (fd) + int fd; +{ + return fchdir (fd); +} diff --git a/ports/sysdeps/unix/sysv/aix/fchmod.c b/ports/sysdeps/unix/sysv/aix/fchmod.c new file mode 100644 index 000000000..d4f0ac958 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fchmod.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/stat.h> + +int +__fchmod (int fd, mode_t mode) +{ + return fchmod (fd, mode); +} diff --git a/ports/sysdeps/unix/sysv/aix/fchown.c b/ports/sysdeps/unix/sysv/aix/fchown.c new file mode 100644 index 000000000..64252c038 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fchown.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__fchown (int fds, uid_t owner, gid_t group) +{ + return fchown (fds, owner, group); +} diff --git a/ports/sysdeps/unix/sysv/aix/fcntl.c b/ports/sysdeps/unix/sysv/aix/fcntl.c new file mode 100644 index 000000000..7f16cbe01 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fcntl.c @@ -0,0 +1,43 @@ +/* Copyright (C) 1999, 2000, 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fcntl.h> +#include <stdarg.h> + +extern int kfcntl (int fdes, int cmd, unsigned long int arg); + +int +__fcntl (int fdes, int cmd, ...) +{ + va_list va; + int res; + unsigned long int arg; + + va_start (va, cmd); + arg = va_arg (va, unsigned long int); + + res = kfcntl (fdes, cmd, arg); + + va_end (va); + + return res; +} +libc_hidden_def (__fcntl) +strong_alias (__fcntl, fcntl) +strong_alias (__fcntl, __libc_fcntl) +libc_hidden_def (__libc_fcntl) diff --git a/ports/sysdeps/unix/sysv/aix/fdatasync.c b/ports/sysdeps/unix/sysv/aix/fdatasync.c new file mode 100644 index 000000000..851f2e570 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fdatasync.c @@ -0,0 +1,31 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define _FDATASYNC 0x00400000 +#define FDATASYNC _FDATASYNC + +extern int kfsync_range (int fd, int how, long long int off, + long long int len); + +int +fdatasync (int fd) +{ + return kfsync_range (fd, FDATASYNC, 0, 0); +} diff --git a/ports/sysdeps/unix/sysv/aix/fork.c b/ports/sysdeps/unix/sysv/aix/fork.c new file mode 100644 index 000000000..478d4afad --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fork.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#undef __fork + +pid_t +__fork (void) +{ + return kfork (); +} +libc_hidden_def (__fork) +strong_alias (__fork, fork) diff --git a/ports/sysdeps/unix/sysv/aix/fstatfs.c b/ports/sysdeps/unix/sysv/aix/fstatfs.c new file mode 100644 index 000000000..3f531f2a8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fstatfs.c @@ -0,0 +1,27 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/statfs.h> + +extern int fstatfs (int fd, struct statfs *buf); + +int +__fstatfs (int fd, struct statfs *buf) +{ + return fstatfs (fd, buf); +} diff --git a/ports/sysdeps/unix/sysv/aix/fsync.c b/ports/sysdeps/unix/sysv/aix/fsync.c new file mode 100644 index 000000000..58734b6e8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fsync.c @@ -0,0 +1,31 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define _FSYNC 0x00000010 +#define FFILESYNC _FSYNC + +extern int kfsync_range (int fd, int how, long long int off, + long long int len); + +int +fsync (int fd) +{ + return kfsync_range (fd, FFILESYNC, 0, 0); +} diff --git a/ports/sysdeps/unix/sysv/aix/ftruncate.c b/ports/sysdeps/unix/sysv/aix/ftruncate.c new file mode 100644 index 000000000..758f2a423 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/ftruncate.c @@ -0,0 +1,28 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int kftruncate (int fd, long long int length); + +int +__ftruncate (int fd, off_t length) +{ + return kftruncate (fd, length); +} +strong_alias (__ftruncate, ftruncate) diff --git a/ports/sysdeps/unix/sysv/aix/ftruncate64.c b/ports/sysdeps/unix/sysv/aix/ftruncate64.c new file mode 100644 index 000000000..5e7e4be4c --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/ftruncate64.c @@ -0,0 +1,28 @@ +/* Copyright (C) 1999, 2000, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int kftruncate (int fd, long long int length); + +int +__ftruncate64 (int fd, off64_t length) +{ + return kftruncate (fd, length); +} +weak_alias (__ftruncate64, ftruncate64) diff --git a/ports/sysdeps/unix/sysv/aix/fxstat.c b/ports/sysdeps/unix/sysv/aix/fxstat.c new file mode 100644 index 000000000..1ba56f690 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fxstat.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/stat.h> + +#define STX_NORMAL 0x00 + +extern int fstatx (int fd, struct stat *st, int len, int cmd); + +int +__fxstat (int ver, int fd, struct stat *st) +{ + assert (ver == 0); + return fstatx (fd, st, sizeof (*st), STX_NORMAL); +} +hidden_def (__fxstat) diff --git a/ports/sysdeps/unix/sysv/aix/fxstat64.c b/ports/sysdeps/unix/sysv/aix/fxstat64.c new file mode 100644 index 000000000..5f75e070c --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/fxstat64.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/stat.h> + +#define STX_NORMAL 0x00 +#define STX_64 0x08 + +extern int fstatx (int fd, struct stat64 *st, int len, int cmd); + +int +__fxstat64 (int ver, int fd, struct stat64 *st) +{ + assert (ver == 0); + return fstatx (fd, st, sizeof (*st), STX_NORMAL | STX_64); +} +hidden_def (__fxstat64) diff --git a/ports/sysdeps/unix/sysv/aix/getdents.c b/ports/sysdeps/unix/sysv/aix/getdents.c new file mode 100644 index 000000000..ca896c332 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getdents.c @@ -0,0 +1,28 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <dirent.h> +#include <sys/types.h> + +extern int getdirent (int fd, char *buf, size_t count); + +ssize_t +__getdents (int fd, char *buf, size_t count) +{ + return getdirent (fd, buf, count); +} diff --git a/ports/sysdeps/unix/sysv/aix/getegid.c b/ports/sysdeps/unix/sysv/aix/getegid.c new file mode 100644 index 000000000..c24692502 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getegid.c @@ -0,0 +1,29 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_EFFECTIVE 0x01 + + +gid_t +__getegid (void) +{ + return getgidx (ID_EFFECTIVE); +} +strong_alias (__getegid, getegid) diff --git a/ports/sysdeps/unix/sysv/aix/geteuid.c b/ports/sysdeps/unix/sysv/aix/geteuid.c new file mode 100644 index 000000000..b0722134b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/geteuid.c @@ -0,0 +1,29 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_EFFECTIVE 0x01 + + +uid_t +__geteuid (void) +{ + return getuidx (ID_EFFECTIVE); +} +strong_alias (__geteuid, geteuid) diff --git a/ports/sysdeps/unix/sysv/aix/getgid.c b/ports/sysdeps/unix/sysv/aix/getgid.c new file mode 100644 index 000000000..8b102b137 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getgid.c @@ -0,0 +1,30 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_REAL 2 + +extern gid_t getgidx (int which); + +gid_t +__getgid (void) +{ + return getgidx (ID_REAL); +} +strong_alias (__getgid, getgid) diff --git a/ports/sysdeps/unix/sysv/aix/getgroups.c b/ports/sysdeps/unix/sysv/aix/getgroups.c new file mode 100644 index 000000000..f7c813b19 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getgroups.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__getgroups (int size, gid_t list[]) +{ + return getgroups (size, list); +} diff --git a/ports/sysdeps/unix/sysv/aix/gethostname.c b/ports/sysdeps/unix/sysv/aix/gethostname.c new file mode 100644 index 000000000..a42384059 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/gethostname.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1999, 2000, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__gethostname (name, len) + char *name; + size_t len; +{ + return gethostname (name, len); +} diff --git a/ports/sysdeps/unix/sysv/aix/getpeername.c b/ports/sysdeps/unix/sysv/aix/getpeername.c new file mode 100644 index 000000000..bec9bac2a --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getpeername.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2000, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +extern int ngetpeername (int s, void *uap_asa, int *uap_alen); + +int +getpeername (int fd, __SOCKADDR_ARG addr, socklen_t *len) +{ + return ngetpeername (fd, addr.__sockaddr__, len); +} +weak_alias (getpeername,__getpeername) diff --git a/ports/sysdeps/unix/sysv/aix/getpgid.c b/ports/sysdeps/unix/sysv/aix/getpgid.c new file mode 100644 index 000000000..a6e75f3f9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getpgid.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int kgetpgidx (pid_t pid); + +int +__getgpid (pid_t pid) +{ + return kgetpgidx (pid); +} +libc_hidden_def (__getgpid) +strong_alias (__getpgid, getpgid) diff --git a/ports/sysdeps/unix/sysv/aix/getpgrp.c b/ports/sysdeps/unix/sysv/aix/getpgrp.c new file mode 100644 index 000000000..ce37738be --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getpgrp.c @@ -0,0 +1 @@ +/* This function is available as a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/getpid.c b/ports/sysdeps/unix/sysv/aix/getpid.c new file mode 100644 index 000000000..8a74e22da --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getpid.c @@ -0,0 +1,9 @@ +/* This is a system call. We only have to provide the wrapper. */ +#include <unistd.h> + +int +__getpid (void) +{ + return getpid (); +} +libc_hidden_def (__getpid) diff --git a/ports/sysdeps/unix/sysv/aix/getppid.c b/ports/sysdeps/unix/sysv/aix/getppid.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getppid.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/getpriority.c b/ports/sysdeps/unix/sysv/aix/getpriority.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getpriority.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/getrlimit.c b/ports/sysdeps/unix/sysv/aix/getrlimit.c new file mode 100644 index 000000000..0699cec64 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getrlimit.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/resource.h> + +int +__getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits) +{ + return getrlimit (resource, rlimits); +} diff --git a/ports/sysdeps/unix/sysv/aix/getrlimit64.c b/ports/sysdeps/unix/sysv/aix/getrlimit64.c new file mode 100644 index 000000000..dd33ca9c7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getrlimit64.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/resource.h> + +int +__getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits) +{ + return getrlimit64 (resource, rlimits); +} diff --git a/ports/sysdeps/unix/sysv/aix/getrusage.c b/ports/sysdeps/unix/sysv/aix/getrusage.c new file mode 100644 index 000000000..b578b75aa --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getrusage.c @@ -0,0 +1,27 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/resource.h> + +int +__getrusage (who, usage) + enum __rusage_who who; + struct rusage *usage; +{ + return getrusage (who, usage); +} diff --git a/ports/sysdeps/unix/sysv/aix/getsid.c b/ports/sysdeps/unix/sysv/aix/getsid.c new file mode 100644 index 000000000..6994eb8dd --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getsid.c @@ -0,0 +1,27 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int kgetsid (pid_t pid); + +int +getsid (pid_t pid) +{ + return kgetsid (pid); +} diff --git a/ports/sysdeps/unix/sysv/aix/getsockname.c b/ports/sysdeps/unix/sysv/aix/getsockname.c new file mode 100644 index 000000000..ac1bf34fc --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getsockname.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +extern int ngetsockname (int s, void *uap_asa, int *uap_alen); + +int +__getsockname (int fd, __SOCKADDR_ARG addr, socklen_t *len) +{ + return ngetsockname (fd, addr.__sockaddr__, len); +} + +weak_alias (__getsockname, getsockname) diff --git a/ports/sysdeps/unix/sysv/aix/gettimeofday.c b/ports/sysdeps/unix/sysv/aix/gettimeofday.c new file mode 100644 index 000000000..34a92eb39 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/gettimeofday.c @@ -0,0 +1,98 @@ +/* Copyright (C) 1991,92,94,95,96,97,2001,2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <time.h> +#include <sys/time.h> + +#ifndef HAVE_GNU_LD +# define __daylight daylight +# define __timezone timezone +# define __tzname tzname +#endif + +#undef __gettimeofday + +extern int rtc_upper (void); +extern int rtc_lower (void); + +/* Assembler Routines to access the timer registers */ +asm("\n\ +.rtc_upper: mfspr 3,4 # copy RTCU to return register\n\ + blr\n\ +\n\ +.rtc_lower: mfspr 3,5 # copy RTCL to return register\n\ + blr\n\ +"); + +/* Get the current time of day and timezone information, + putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. + Returns 0 on success, -1 on errors. */ +int +__gettimeofday (tv, tz) + struct timeval *tv; + struct timezone *tz; +{ + int ts, tl, tu; + + if (tv == NULL) + { + __set_errno (EINVAL); + return -1; + } + + ts = rtc_upper (); /* Seconds. */ + tl = rtc_lower (); /* Nanoseconds. */ + tu = rtc_upper (); /* Check for a carry from. */ + if (ts != tu) /* The lower reg to the upper. */ + tl = rtc_lower (); /* Recover from the race condition. */ + + tv->tv_sec = (long int) (tu + (double) tl / 1000000000); + tv->tv_usec = (long int) ((double) tl / 1000); + + if (tz != NULL) + { + const time_t timer = tv->tv_sec; + struct tm tm; + const struct tm *tmp; + + const long int save_timezone = __timezone; + const long int save_daylight = __daylight; + char *save_tzname[2]; + save_tzname[0] = __tzname[0]; + save_tzname[1] = __tzname[1]; + + tmp = localtime_r (&timer, &tm); + + tz->tz_minuteswest = __timezone / 60; + tz->tz_dsttime = __daylight; + + __timezone = save_timezone; + __daylight = save_daylight; + __tzname[0] = save_tzname[0]; + __tzname[1] = save_tzname[1]; + + if (tmp == NULL) + return -1; + } + + return 0; +} + +INTDEF(__gettimeofday) +weak_alias (__gettimeofday, gettimeofday) diff --git a/ports/sysdeps/unix/sysv/aix/getuid.c b/ports/sysdeps/unix/sysv/aix/getuid.c new file mode 100644 index 000000000..e042666fe --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/getuid.c @@ -0,0 +1,30 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_REAL 2 + +extern uid_t getuidx (int which); + +uid_t +__getuid (void) +{ + return getuidx (ID_REAL); +} +strong_alias (__getuid, getuid) diff --git a/ports/sysdeps/unix/sysv/aix/gnu/lib-names.h b/ports/sysdeps/unix/sysv/aix/gnu/lib-names.h new file mode 100644 index 000000000..d41f822f1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/gnu/lib-names.h @@ -0,0 +1,31 @@ +#ifndef __GNU_LIB_NAMES_H +#define __GNU_LIB_NAMES_H 1 + +#define LIBBROKENLOCALE_SO "libBrokenLocale.a" +#define LIBCRYPT_SO "libcrypt.a" +#define LIBC_SO "libc.a" +#define LIBDB1_SO "libdb1.a" +#define LIBDB_SO "libdb.a" +#define LIBDL_SO "libdl.a" +#define LIBM_SO "libm.a" +#define LIBNOVERSION_SO "libNoVersion.a" +#define LIBNSL_SO "libnsl.a" +#define LIBNSS1_COMPAT_SO "libnss1_compat.a" +#define LIBNSS1_DB_SO "libnss1_db.a" +#define LIBNSS1_DNS_SO "libnss1_dns.a" +#define LIBNSS1_FILES_SO "libnss1_files.a" +#define LIBNSS1_NIS_SO "libnss1_nis.a" +#define LIBNSS_COMPAT_SO "libnss_compat.a" +#define LIBNSS_DB_SO "libnss_db.a" +#define LIBNSS_DNS_SO "libnss_dns.a" +#define LIBNSS_FILES_SO "libnss_files.a" +#define LIBNSS_HESIOD_SO "libnss_hesiod.a" +#define LIBNSS_LDAP_SO "libnss_ldap.a" +#define LIBNSS_NISPLUS_SO "libnss_nisplus.a" +#define LIBNSS_NIS_SO "libnss_nis.a" +#define LIBPTHREAD_SO "libpthread.a" +#define LIBRESOLV_SO "libresolv.a" +#define LIBRT_SO "librt.a" +#define LIBUTIL_SO "libutil.a" + +#endif /* gnu/lib-names.h */ diff --git a/ports/sysdeps/unix/sysv/aix/init-first.c b/ports/sysdeps/unix/sysv/aix/init-first.c new file mode 100644 index 000000000..24ef109dd --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/init-first.c @@ -0,0 +1,103 @@ +/* Initialization code run first thing by the XCOFF startup code. AIX version. + Copyright (C) 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include <sysdep.h> +#include <fpu_control.h> +#include <sys/param.h> +#include <sys/types.h> +#include <libc-internal.h> + +#ifndef SHARED +# include <ldsodefs.h> +# include "dl-osinfo.h" +#endif + +extern void __libc_init (int, char **, char **); + +/* The function is called from assembly stubs the compiler can't see. */ +static void init (int, char **, char **) __attribute__ ((unused)); + +/* Set nonzero if we have to be prepared for more then one libc being + used in the process. Safe assumption if initializer never runs. */ +int __libc_multiple_libcs attribute_hidden = 1; + +/* Remember the command line argument and enviroment contents for + later calls of initializers for dynamic libraries. */ +int __libc_argc attribute_hidden; +char **__libc_argv attribute_hidden; + + +static void +init (int argc, char **argv, char **envp) +{ +#ifdef USE_NONOPTION_FLAGS + extern void __getopt_clean_environment (char **); +#endif + /* The next variable is only here to work around a bug in gcc <= 2.7.2.2. + If the address would be taken inside the expression the optimizer + would try to be too smart and throws it away. Grrr. */ + + /* XXX disable dl for now + __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up; */ + + /* Save the command-line arguments. */ + __libc_argc = argc; + __libc_argv = argv; + __environ = envp; + +#ifndef SHARED + __libc_init_secure (); +#endif + + __libc_init (argc, argv, envp); + +#ifdef USE_NONOPTION_FLAGS + /* This is a hack to make the special getopt in GNU libc working. */ + __getopt_clean_environment (envp); +#endif + +#ifdef SHARED + __libc_global_ctors (); +#endif +} + +#ifdef SHARED + +strong_alias (init, _init); + +extern void __libc_init_first (void); + +void +__libc_init_first (void) +{ +} + +#else +extern void __libc_init_first (int argc, char **argv, char **envp); + +void +__libc_init_first (int argc, char **argv, char **envp) +{ + init (argc, argv, envp); +} +#endif diff --git a/ports/sysdeps/unix/sysv/aix/ioctl.c b/ports/sysdeps/unix/sysv/aix/ioctl.c new file mode 100644 index 000000000..f47b699be --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/ioctl.c @@ -0,0 +1,43 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdarg.h> +#include <sys/ioctl.h> + +extern int kioctl (int fdes, int cmd, unsigned long int arg, + unsigned long int ext); + +int +__ioctl (int fdes, unsigned long int cmd, ...) +{ + va_list va; + int res; + unsigned long int arg; + unsigned long int ext; + + va_start (va, cmd); + arg = va_arg (va, unsigned long int); + ext = va_arg (va, unsigned long int); + + res = kioctl (fdes, cmd, arg, ext); + + va_end (va); + + return res; +} +strong_alias (__ioctl, ioctl) diff --git a/ports/sysdeps/unix/sysv/aix/kernel_proto.h b/ports/sysdeps/unix/sysv/aix/kernel_proto.h new file mode 100644 index 000000000..e9ad06dc3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/kernel_proto.h @@ -0,0 +1,25 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file contains prototypes for the "functions" exported by /unix + on AIX. */ +#include <sys/types.h> + + +extern ssize_t kwrite (int, const void *, size_t); diff --git a/ports/sysdeps/unix/sysv/aix/kill.c b/ports/sysdeps/unix/sysv/aix/kill.c new file mode 100644 index 000000000..8538e29f8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/kill.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__kill (pid_t pid, int sig) +{ + return kill (pid, sig); +} diff --git a/ports/sysdeps/unix/sysv/aix/lchown.c b/ports/sysdeps/unix/sysv/aix/lchown.c new file mode 100644 index 000000000..44e3b749e --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/lchown.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__lchown (const char *file, uid_t owner, gid_t group) +{ + return lchown (file, owner, group); +} diff --git a/ports/sysdeps/unix/sysv/aix/libc-start.c b/ports/sysdeps/unix/sysv/aix/libc-start.c new file mode 100644 index 000000000..813e28d09 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/libc-start.c @@ -0,0 +1,290 @@ +/* Initialization code run first thing by the XCOFF startup code. AIX version. + Copyright (C) 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> + +/* hack to use uchar's */ +typedef unsigned char uchar; +#include <xcoff.h> +#include <rtinit.h> +#include <dlldr.h> +#include <bits/libc-lock.h> + +extern void __libc_init_first (int argc, char **argv, char **envp); + +/* XXX disable for now +extern int __libc_multiple_libcs; */ + +/* XXX normally defined in generic/dl-sydep.c, hack it into existance +extern void *__libc_stack_end; */ +void *__libc_stack_end; + + struct __libc_start_data_rec { + void *stack; + void *toc; + int argc; + char **argv; + char **envp; + char *data; + char *text; + unsigned mcount; + unsigned special; + int (*main)(int, char **, char **); + void (*init)(void); + void (*fini)(void); + void (*rtld_fini)(void); + }; + +extern struct __libc_start_data_rec __libc_start_data; +extern int errno; + +/* The first piece of initialized data. */ +int __data_start = 0; + +#ifndef HAVE_ELF +/* Since gcc/crtstuff.c won't define it unless the ELF format is used + we will need to define it here. */ +void *__dso_handle = NULL; +#endif + +/* AIX kernel function */ +extern int __loadx (int flag, void *module, void *arg1, void *arg2, + void *arg3); +/* Needed by setenv */ +char **__environ; + +/* + * Find __rtinit symbol + * + * __RTINIT *find_rtinit() + * + * __RTINIT *rti - pointer to __rtinit data structure + */ + +static __RTINIT * +find_rtinit (void) +{ + struct xcoffhdr *xcoff_hdr; + SCNHDR *sec_hdr; + SCNHDR *ldr_sec_hdr; + SCNHDR *data_sec_hdr; + LDSYM *ldsym_hdr; + __RTINIT *rtl; + + xcoff_hdr = (struct xcoffhdr *) __libc_start_data.text; + sec_hdr = (SCNHDR *) ((caddr_t) &xcoff_hdr->aouthdr + + xcoff_hdr->filehdr.f_opthdr); + ldr_sec_hdr = (SCNHDR *) (sec_hdr + (xcoff_hdr->aouthdr.o_snloader - 1)); + ldsym_hdr = (LDSYM *) ((caddr_t) xcoff_hdr + ldr_sec_hdr->s_scnptr + + LDHDRSZ); + + if (__libc_start_data.mcount <= 0) + { + if (!ldr_sec_hdr->s_scnptr) + return NULL; + + if (memcmp (ldsym_hdr, RTINIT_NAME, sizeof(RTINIT_NAME) - 1) != 0) + return NULL; + } + + data_sec_hdr = (SCNHDR *) (sec_hdr + (xcoff_hdr->aouthdr.o_sndata - 1)); + rtl = (__RTINIT *) (ldsym_hdr->l_value + + (__libc_start_data.data - data_sec_hdr->s_vaddr)); + return rtl; +} + +/* The mod_init1 calls every initialization function + for a given module. + + void mod_init1(handler, rti) + + void *handler - if NULL init funtions for modules loaded at exec time + are being executed. Otherwise, the handler points to the + module loaded. + + __RTINIT *rti - pointer to __rtinit data structure (with rti->init_offset + not equal to zero) + */ + +static void +mod_init1 (void *handler,__RTINIT *rtl) +{ + __RTINIT_DESCRIPTOR *descriptor; + + descriptor = (__RTINIT_DESCRIPTOR *) ((caddr_t) &rtl->rtl + + rtl->init_offset); + while (descriptor->f != NULL) + { + if (!(descriptor->flags & _RT_CALLED)) + { + descriptor->flags |= _RT_CALLED; + /* Execute init/fini. */ + descriptor->f (handler, rtl, descriptor); + } + descriptor = (__RTINIT_DESCRIPTOR *) ((caddr_t) descriptor + + rtl->__rtinit_descriptor_size); + } +} + +/* The modinit() function performs run-time linking, if enabled, and calling + the init() function for all loaded modules. + + int modinit() + */ + +#define DL_BUFFER_SIZE 1000 + +static int +modinit (void) +{ + int *handler = NULL; + __RTINIT *rtinit_info = NULL; + int flag; + DL_INFO dl_buffer[DL_BUFFER_SIZE]; + DL_INFO *dl_info = dl_buffer; + int i; + + /* Find __rtinit symbols */ + rtinit_info = find_rtinit (); + + flag = DL_EXECQ; + if (rtinit_info && rtinit_info->rtl) + flag |= DL_LOAD_RTL; + + /* Get a list of modules that have __rtinit. */ + if (__loadx (flag, dl_info, (void *) sizeof (dl_buffer), NULL, NULL)) + exit (0x90); + + if (( dl_info[0].dlinfo_xflags & DL_INFO_OK)) + { + rtinit_info = find_rtinit (); + if ((rtinit_info != NULL) & (rtinit_info->rtl != NULL)) + { + if ((*rtinit_info->rtl) (dl_info, 0)) + exit (0x90); + } + } + + /* Initialization each module loaded that has __rtinit. */ + if (dl_info[0].dlinfo_xflags & DL_INFO_OK) + { + for (i = 1; i < dl_info[0].dlinfo_arraylen + 1; ++i) + if (dl_info[i].dlinfo_flags & DL_HAS_RTINIT) + { + rtinit_info = find_rtinit (); + if (rtinit_info) + mod_init1 (handler, rtinit_info); + } + } + + return 0; +} + + +void +__libc_start_init (void) +{ + /* Do run-time linking, if enabled and call the init() + for all loaded modules. */ + if (__libc_start_data.mcount != __libc_start_data.special) + modinit (); +} + +/* For now these are just stubs. */ +void +__libc_start_fini (void) +{ +} + +void +__libc_start_rtld_fini (void) +{ +} + +void +__libc_start_main (void) +{ +#ifndef SHARED + + /* The next variable is only here to work around a bug in gcc <= 2.7.2.2. + If the address would be taken inside the expression the optimizer + would try to be too smart and throws it away. Grrr. */ + + /* XXX disable for now + int *dummy_addr = &_dl_starting_up; + + __libc_multiple_libcs = dummy_addr && !_dl_starting_up; */ +#endif + + /* Store the lowest stack address. */ + __libc_stack_end = __libc_start_data.stack; + + /* Used by setenv */ + __environ = __libc_start_data.envp; + +#ifndef SHARED + /* Clear errno. */ + errno = 0; + + /* Some security at this point. Prevent starting a SUID binary where + the standard file descriptors are not opened. We have to do this + only for statically linked applications since otherwise the dynamic + loader did the work already. */ + if (__builtin_expect (__libc_enable_secure, 0)) + __libc_check_standard_fds (); + +#endif + + /* Register the destructor of the dynamic linker if there is any. */ + if (__builtin_expect (__libc_start_data.rtld_fini != NULL, 1)) + __cxa_atexit ((void (*) (void *)) __libc_start_data.rtld_fini, NULL, NULL); + + /* Call the initializer of the libc. This is only needed here if we + are compiling for the static library in which case we haven't + run the constructors in `_dl_start_user'. */ +#ifndef SHARED + __libc_init_first (__libc_start_data.argc, __libc_start_data.argv, + __libc_start_data.envp); +#endif + + /* Register the destructor of the program, if any. */ + if (__libc_start_data.fini) + __cxa_atexit ((void (*) (void *)) __libc_start_data.fini, NULL, NULL); + + /* Call the initializer of the program, if any. */ +#ifdef SHARED + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) + _dl_debug_printf ("\ninitialize program: %s\n\n", + __libc_start_data.argv[0]); +#endif + if (__libc_start_data.init) + (*__libc_start_data.init) (); + +#ifdef SHARED + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) + _dl_debug_printf ("\ntransferring control: %s\n\n", + __libc_start_data.argv[0]); +#endif + + exit ((*__libc_start_data.main) (__libc_start_data.argc, + __libc_start_data.argv, + __libc_start_data.envp)); +} diff --git a/ports/sysdeps/unix/sysv/aix/link.c b/ports/sysdeps/unix/sysv/aix/link.c new file mode 100644 index 000000000..2cacbebc3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/link.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__link (from, to) + const char *from; + const char *to; +{ + return link (from, to); +} diff --git a/ports/sysdeps/unix/sysv/aix/lockf.c b/ports/sysdeps/unix/sysv/aix/lockf.c new file mode 100644 index 000000000..4a8c14fd6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/lockf.c @@ -0,0 +1,27 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int klockf (int fd, int function, long long int size); + +int +lockf (int fd, int cmd, off_t len) +{ + return klockf (fd, cmd, len); +} diff --git a/ports/sysdeps/unix/sysv/aix/lockf64.c b/ports/sysdeps/unix/sysv/aix/lockf64.c new file mode 100644 index 000000000..529c2b447 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/lockf64.c @@ -0,0 +1,27 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int klockf (int fd, int function, long long int size); + +int +lockf64 (int fd, int cmd, off64_t len) +{ + return klockf (fd, cmd, len); +} diff --git a/ports/sysdeps/unix/sysv/aix/lseek.c b/ports/sysdeps/unix/sysv/aix/lseek.c new file mode 100644 index 000000000..d4cbdbe70 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/lseek.c @@ -0,0 +1,10 @@ +/* This is a system call. We only have to provide the wrapper. */ +#include <unistd.h> + +off_t +__lseek (int fd, off_t offset, int whence) +{ + return lseek (fd, offset, whence); +} +strong_alias (__lseek, __libc_lseek) +libc_hidden_def (__lseek) diff --git a/ports/sysdeps/unix/sysv/aix/lseek64.c b/ports/sysdeps/unix/sysv/aix/lseek64.c new file mode 100644 index 000000000..5892663d8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/lseek64.c @@ -0,0 +1,35 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int klseek (int fd, long long int offset, int sbase, + long long int *new_offp); + +off64_t +__libc_lseek64 (int fd, off64_t offset, int whence) +{ + long long int res; + + if (klseek (fd, offset, whence, &res) < 0) + res = -1ll; + + return res; +} +strong_alias (__libc_lseek64, __lseek64) +strong_alias (__libc_lseek64, lseek64) diff --git a/ports/sysdeps/unix/sysv/aix/lxstat.c b/ports/sysdeps/unix/sysv/aix/lxstat.c new file mode 100644 index 000000000..879e80cbe --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/lxstat.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/stat.h> + +#define STX_LINK 0x01 + +extern int statx (const char *pathname, struct stat *st, int len, int cmd); + +int +__lxstat (int ver, const char *pathname, struct stat *st) +{ + assert (ver == 0); + return statx (pathname, st, sizeof (*st), STX_LINK); +} +hidden_def (__lxstat) diff --git a/ports/sysdeps/unix/sysv/aix/lxstat64.c b/ports/sysdeps/unix/sysv/aix/lxstat64.c new file mode 100644 index 000000000..73324fe55 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/lxstat64.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/stat.h> + +#define STX_LINK 0x01 +#define STX_64 0x08 + +extern int statx (const char *pathname, struct stat64 *st, int len, int cmd); + +int +__lxstat64 (int ver, const char *pathname, struct stat64 *st) +{ + assert (ver == 0); + return statx (pathname, st, sizeof (*st), STX_LINK | STX_64); +} +hidden_def (__lxstat64) diff --git a/ports/sysdeps/unix/sysv/aix/madvise.c b/ports/sysdeps/unix/sysv/aix/madvise.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/madvise.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/mkdir.c b/ports/sysdeps/unix/sysv/aix/mkdir.c new file mode 100644 index 000000000..4a4e5ceef --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/mkdir.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/stat.h> + +int +__mkdir (const char *name, mode_t mode) +{ + return mkdir (name, mode); +} diff --git a/ports/sysdeps/unix/sysv/aix/mknod.c b/ports/sysdeps/unix/sysv/aix/mknod.c new file mode 100644 index 000000000..8ed3d6b53 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/mknod.c @@ -0,0 +1,28 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/stat.h> + +int +__mknod (path, mode, device) + const char *path; + mode_t mode; + dev_t device; +{ + return mknod (path, mode, device); +} diff --git a/ports/sysdeps/unix/sysv/aix/mmap.c b/ports/sysdeps/unix/sysv/aix/mmap.c new file mode 100644 index 000000000..cd967d36b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/mmap.c @@ -0,0 +1,9 @@ +/* This is a system call. We only have to provide the wrapper. */ +#include <sys/mman.h> +#include <sys/types.h> + +void * +__mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) +{ + return mmap (addr, len, prot, flags, fd, offset); +} diff --git a/ports/sysdeps/unix/sysv/aix/mmap64.c b/ports/sysdeps/unix/sysv/aix/mmap64.c new file mode 100644 index 000000000..ae70ef4ac --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/mmap64.c @@ -0,0 +1,30 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/mman.h> +#include <sys/types.h> + +extern int kmmap (void *addr, size_t len, int prot, int flags, int fd, + long long int offset); + +void * +__mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) +{ + return kmmap (addr, len, prot, flags, fd, offset); +} +strong_alias (__mmap64, mmap64) diff --git a/ports/sysdeps/unix/sysv/aix/mprotect.c b/ports/sysdeps/unix/sysv/aix/mprotect.c new file mode 100644 index 000000000..8bf95abb0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/mprotect.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/mman.h> + +int +__mprotect (void *addr, size_t len, int prot) +{ + return mprotect (addr, len, prot); +} diff --git a/ports/sysdeps/unix/sysv/aix/msgctl.c b/ports/sysdeps/unix/sysv/aix/msgctl.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/msgctl.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/msgget.c b/ports/sysdeps/unix/sysv/aix/msgget.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/msgget.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/msgrcv.c b/ports/sysdeps/unix/sysv/aix/msgrcv.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/msgrcv.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/msgsnd.c b/ports/sysdeps/unix/sysv/aix/msgsnd.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/msgsnd.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/msync.c b/ports/sysdeps/unix/sysv/aix/msync.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/msync.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/munmap.c b/ports/sysdeps/unix/sysv/aix/munmap.c new file mode 100644 index 000000000..7f583be35 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/munmap.c @@ -0,0 +1,8 @@ +/* This is a system call. We only have to provide the wrapper. */ +#include <sys/mman.h> + +int +__munmap (void *addr, size_t len) +{ + return munmap (addr, len); +} diff --git a/ports/sysdeps/unix/sysv/aix/nanosleep.c b/ports/sysdeps/unix/sysv/aix/nanosleep.c new file mode 100644 index 000000000..842275f77 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/nanosleep.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/time.h> +#include <sys/types.h> + +struct timestruc_t +{ + time_t tv_sec; /* seconds. */ + suseconds_t tv_nsec; /* and nanoseconds. */ +}; + + +extern int _nsleep (struct timestruc_t *rqtp, struct timestruc_t *rmtp); + +int +__libc_nanosleep (const struct timespec *req, struct timespec *rem) +{ + assert (sizeof (struct timestruc_t) == sizeof (*req)); + return _nsleep ((struct timestruc_t *) req, (struct timestruc_t *) rem); +} +strong_alias (__libc_nanosleep, __nanosleep) +libc_hidden_def (__nanosleep) +strong_alias (__libc_nanosleep, nanosleep) diff --git a/ports/sysdeps/unix/sysv/aix/net/if.h b/ports/sysdeps/unix/sysv/aix/net/if.h new file mode 100644 index 000000000..20256d3ad --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/net/if.h @@ -0,0 +1,196 @@ +/* Copyright (C) 1997, 1998, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NET_IF_H + +#define _NET_IF_H 1 +#include <features.h> + +#include <sys/types.h> +#include <sys/socket.h> + +/* Standard interface flags. */ +enum + { + IFF_UP = 0x1, /* Interface is up. */ +#define IFF_UP IFF_UP + IFF_BROADCAST = 0x2, /* Broadcast address valid. */ +#define IFF_BROADCAST IFF_BROADCAST + IFF_DEBUG = 0x4, /* Turn on debugging. */ +#define IFF_DEBUG IFF_DEBUG + IFF_LOOPBACK = 0x8, /* Is a loopback net. */ +#define IFF_LOOPBACK IFF_LOOPBACK + IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */ +#define IFF_POINTOPOINT IFF_POINTOPOINT + IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */ +#define IFF_NOTRAILERS IFF_NOTRAILERS + IFF_RUNNING = 0x40, /* Resources allocated. */ +#define IFF_RUNNING IFF_RUNNING + IFF_NOARP = 0x80, /* No address resolution protocol. */ +#define IFF_NOARP IFF_NOARP + IFF_PROMISC = 0x100, /* Receive all packets. */ +#define IFF_PROMISC IFF_PROMISC + + /* Not supported */ + IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */ +#define IFF_ALLMULTI IFF_ALLMULTI + + IFF_OACTIVE = 0x400, /* Transmission in progress. */ +#define IFF_OACTIVE IFF_OACTIVE + IFF_SIMPLEX = 0x800, /* Cannot hear own transmissions. */ +#define IFF_SIMPLEX IFF_SIMPLEX + IFF_DO_HW_LOOPBACK = 0x10000, /* Force loopback through hardware. */ +#define IFF_DO_HW_LOOPBACK IFF_DO_HW_LOOPBACK + IFF_ALLCAST = 0x20000, /* Global broadcast. */ +#define IFF_ALLCAST IFF_ALLCAST + IFF_BRIDGE = 0x40000, /* Receive all bridge packets. */ +#define IFF_BRIDGE IFF_BRIDGE + IFF_NOECHO = IFF_SIMPLEX, /* Reeives echo packets. */ +#define IFF_NOECHO IFF_NOECHO + }; + +/* The ifaddr structure contains information about one address of an + interface. They are maintained by the different address families, + are allocated and attached when an address is set, and are linked + together so all addresses for an interface can be located. */ + +struct ifaddr + { + struct sockaddr ifa_addr; /* Address of interface. */ + union + { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; + struct sockaddr *ifa_netmask; /* Used to determine subnet. */ + struct iface *ifa_ifp; /* Back-pointer to interface. */ + struct ifaddr *ifa_next; /* Next address for interface. */ + void (*ifa_rtrequest) (void); + struct rtentry *ifa_rt; + unsigned short int ifa_flags; + short int ifa_refcnt; + }; + +#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ +#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */ + +/* Interface request structure used for socket ioctl's. All interface + ioctl's must have parameter definitions which begin with ifr_name. + The remainder may be interface specific. */ + +struct ifreq + { +#define IFHWADDRLEN 6 +#define IFNAMSIZ 16 + union + { + char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ + } ifr_ifrn; + + union + { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + unsigned int ifru_mtu; + char ifru_slave[IFNAMSIZ]; /* Just fits the size */ + __caddr_t ifru_data; + unsigned short int ifru_site6; + } ifr_ifru; + }; + +/* Old AIX 3.1 version. */ +struct oifreq +{ + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union + { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + int ifru_flags; + int ifru_metric; + caddr_t ifru_data; + unsigned int ifru_mtu; + } ifr_ifru; + unsigned char reserved[8]; +}; + + +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_slave ifr_ifru.ifru_slave /* slave device */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ +#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ +#define ifr_baudrate ifr_ifru.ifru_ivalue /* link bandwidth */ +#define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */ +#define ifr_site6 ifr_ifru.ifru_site6 /* IPv6 site index */ + + +/* Structure used in SIOCGIFCONF request. Used to retrieve interface + configuration for machine (useful for programs which must know all + networks accessible). */ + +struct ifconf + { + int ifc_len; /* Size of buffer. */ + union + { + __caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; + }; +#define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */ +#define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */ + +__BEGIN_DECLS + +/* Convert an interface name to an index, and vice versa. */ + +extern unsigned int if_nametoindex (__const char *__ifname) __THROW; +extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW; + +/* Return a list of all interfaces and their indices. */ + +struct if_nameindex + { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "eth0", ... */ + }; + +extern struct if_nameindex *if_nameindex (void) __THROW; + +/* Free the data returned from if_nameindex. */ + +extern void if_freenameindex (struct if_nameindex *__ptr) __THROW; + +__END_DECLS + +#endif /* net/if.h */ diff --git a/ports/sysdeps/unix/sysv/aix/open.c b/ports/sysdeps/unix/sysv/aix/open.c new file mode 100644 index 000000000..2b42f8e81 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/open.c @@ -0,0 +1,40 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fcntl.h> +#include <stdarg.h> +#include <unistd.h> + +int +__open (const char *file, int oflag, ...) +{ + int mode = 0; + + if (oflag & O_CREAT) + { + va_list arg; + va_start (arg, oflag); + mode = va_arg (arg, int); + va_end (arg); + } + + return open (file, oflag, mode); +} +libc_hidden_def (__open) +strong_alias (__open, __libc_open) +libc_hidden_def (__libc_open) diff --git a/ports/sysdeps/unix/sysv/aix/pipe.c b/ports/sysdeps/unix/sysv/aix/pipe.c new file mode 100644 index 000000000..4a3ba1c04 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/pipe.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__pipe (pipedes) + int pipedes[2]; +{ + return pipe (pipedes); +} +libc_hidden_def (__pipe) diff --git a/ports/sysdeps/unix/sysv/aix/poll.c b/ports/sysdeps/unix/sysv/aix/poll.c new file mode 100644 index 000000000..5ce540991 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/poll.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1999, 2000, 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/poll.h> + +int +__poll (fds, nfds, timeout) + struct pollfd *fds; + nfds_t nfds; + int timeout; +{ + return poll (fds, nfds, timeout); +} +libc_hidden_def (__poll) diff --git a/ports/sysdeps/unix/sysv/aix/posix_madvise.c b/ports/sysdeps/unix/sysv/aix/posix_madvise.c new file mode 100644 index 000000000..7ab4bed8e --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/posix_madvise.c @@ -0,0 +1,8 @@ +#include <errno.h> +#include <sys/mman.h> + +int +posix_madvise (void *addr, size_t len, int advise) +{ + return madvise (addr, len, advise) ? errno : 0; +} diff --git a/ports/sysdeps/unix/sysv/aix/powerpc/memset.c b/ports/sysdeps/unix/sysv/aix/powerpc/memset.c new file mode 100644 index 000000000..6955ef5e9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/powerpc/memset.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +/* Until the cache line issues are resolved use the generic implementation. */ +#include <sysdeps/generic/memset.c> diff --git a/ports/sysdeps/unix/sysv/aix/powerpc/register-dump.h b/ports/sysdeps/unix/sysv/aix/powerpc/register-dump.h new file mode 100644 index 000000000..f0d8b9983 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/powerpc/register-dump.h @@ -0,0 +1,281 @@ +/* Dump registers. + Copyright (C) 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/uio.h> +#include <stdio-common/_itoa.h> +#include <sys/ucontext.h> + +/* We will print the register dump in this format: + +Register dump: +fp0-3: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 +fp4-7: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 +fp8-11: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 +fp12-15: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 +fp16-19: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 +fp20-23: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 +fp24-27: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 +fp28-31: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 + +r00-07 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +r08-15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +r16-23 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +r24-31 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 + + trap 00000000 iar 00000000 msr 00000000 cr 00000000 + lr 00000000 ctr 00000000 xer 00000000 mq 00000000 + tid 00000000 fpscr 00000000 + +*/ + + +static void +hexvalue (unsigned long int value, char *buf, size_t len) +{ + char *cp = _itoa_word (value, buf + len, 16, 0); + while (cp > buf) + *--cp = '0'; +} + + +static void +register_dump (int fd, struct sigcontext *ctx) +{ + char regs[108][8]; + struct iovec iov[38]; + struct __mstsafe *reg_state; + int i; + int ii; + size_t nr = 0; + +#define ADD_STRING(str) \ + iov[nr].iov_base = (char *) str; \ + iov[nr].iov_len = strlen (str); \ + ++nr +#define ADD_MEM(str, len) \ + iov[nr].iov_base = str; \ + iov[nr].iov_len = len; \ + ++nr + + reg_state = (struct __mstsafe *)&ctx->sc_jmpbuf.__jmp_context; + + hexvalue (reg_state->__excp_type, regs[0], 8); + hexvalue (reg_state->__iar, regs[1], 8); + hexvalue (reg_state->__msr, regs[2], 8); + hexvalue (reg_state->__cr, regs[3], 8); + hexvalue (reg_state->__lr, regs[4], 8); + hexvalue (reg_state->__ctr, regs[5], 8); + hexvalue (reg_state->__xer, regs[6], 8); + hexvalue (reg_state->__mq, regs[7], 8); + hexvalue (reg_state->__tid, regs[8], 8); + hexvalue (reg_state->__fpscr, regs[9], 8); + + ii=10; + for (i = 0; i <= 96; i++,ii++) + hexvalue (reg_state->__gpr[i], regs[ii], 8); + + /* Generate the output. */ + ADD_STRING ("Register dump:\n\nfp0-3: "); + ADD_MEM (regs[42], 8); + ADD_MEM (regs[43], 8); + ADD_STRING (" "); + ADD_MEM (regs[44], 8); + ADD_MEM (regs[45], 8); + ADD_STRING (" "); + ADD_MEM (regs[46], 8); + ADD_MEM (regs[47], 8); + ADD_STRING (" "); + ADD_MEM (regs[48], 8); + ADD_MEM (regs[49], 8); + ADD_STRING ("\nfp4-7: "); + ADD_MEM (regs[50], 8); + ADD_MEM (regs[51], 8); + ADD_STRING (" "); + ADD_MEM (regs[52], 8); + ADD_MEM (regs[53], 8); + ADD_STRING (" "); + ADD_MEM (regs[54], 8); + ADD_MEM (regs[55], 8); + ADD_STRING (" "); + ADD_MEM (regs[56], 8); + ADD_MEM (regs[57], 8); + ADD_STRING ("\nfp8-11: "); + ADD_MEM (regs[58], 8); + ADD_MEM (regs[59], 8); + ADD_STRING (" "); + ADD_MEM (regs[60], 8); + ADD_MEM (regs[61], 8); + ADD_STRING (" "); + ADD_MEM (regs[62], 8); + ADD_MEM (regs[63], 8); + ADD_STRING (" "); + ADD_MEM (regs[64], 8); + ADD_MEM (regs[65], 8); + ADD_STRING ("\nfp12-15: "); + ADD_MEM (regs[66], 8); + ADD_MEM (regs[67], 8); + ADD_STRING (" "); + ADD_MEM (regs[68], 8); + ADD_MEM (regs[69], 8); + ADD_STRING (" "); + ADD_MEM (regs[70], 8); + ADD_MEM (regs[71], 8); + ADD_STRING (" "); + ADD_MEM (regs[72], 8); + ADD_MEM (regs[73], 8); + ADD_STRING ("\nfp16-19: "); + ADD_MEM (regs[74], 8); + ADD_MEM (regs[75], 8); + ADD_STRING (" "); + ADD_MEM (regs[76], 8); + ADD_MEM (regs[78], 8); + ADD_STRING (" "); + ADD_MEM (regs[79], 8); + ADD_MEM (regs[80], 8); + ADD_STRING (" "); + ADD_MEM (regs[81], 8); + ADD_MEM (regs[82], 8); + ADD_STRING ("\nfp20-23: "); + ADD_MEM (regs[83], 8); + ADD_MEM (regs[84], 8); + ADD_STRING (" "); + ADD_MEM (regs[85], 8); + ADD_MEM (regs[86], 8); + ADD_STRING (" "); + ADD_MEM (regs[87], 8); + ADD_MEM (regs[88], 8); + ADD_STRING (" "); + ADD_MEM (regs[89], 8); + ADD_MEM (regs[90], 8); + ADD_STRING ("\nfp24-27: "); + ADD_MEM (regs[91], 8); + ADD_MEM (regs[92], 8); + ADD_STRING (" "); + ADD_MEM (regs[93], 8); + ADD_MEM (regs[94], 8); + ADD_STRING (" "); + ADD_MEM (regs[95], 8); + ADD_MEM (regs[96], 8); + ADD_STRING (" "); + ADD_MEM (regs[97], 8); + ADD_MEM (regs[98], 8); + ADD_STRING ("\nfp28-31: "); + ADD_MEM (regs[99], 8); + ADD_MEM (regs[100], 8); + ADD_STRING (" "); + ADD_MEM (regs[101], 8); + ADD_MEM (regs[102], 8); + ADD_STRING (" "); + ADD_MEM (regs[103], 8); + ADD_MEM (regs[104], 8); + ADD_STRING (" "); + ADD_MEM (regs[105], 8); + ADD_MEM (regs[106], 8); + ADD_STRING ("\n\nr00-07 "); + ADD_MEM (regs[10], 8); + ADD_STRING (" "); + ADD_MEM (regs[11], 8); + ADD_STRING (" "); + ADD_MEM (regs[12], 8); + ADD_STRING (" "); + ADD_MEM (regs[13], 8); + ADD_STRING (" "); + ADD_MEM (regs[14], 8); + ADD_STRING (" "); + ADD_MEM (regs[15], 8); + ADD_STRING (" "); + ADD_MEM (regs[16], 8); + ADD_STRING (" "); + ADD_MEM (regs[17], 8); + ADD_STRING ("\nr08-15 "); + ADD_MEM (regs[18], 8); + ADD_STRING (" "); + ADD_MEM (regs[19], 8); + ADD_STRING (" "); + ADD_MEM (regs[20], 8); + ADD_STRING (" "); + ADD_MEM (regs[21], 8); + ADD_STRING (" "); + ADD_MEM (regs[22], 8); + ADD_STRING (" "); + ADD_MEM (regs[23], 8); + ADD_STRING (" "); + ADD_MEM (regs[24], 8); + ADD_STRING (" "); + ADD_MEM (regs[25], 8); + ADD_STRING ("\nr16-23 "); + ADD_MEM (regs[26], 8); + ADD_STRING (" "); + ADD_MEM (regs[27], 8); + ADD_STRING (" "); + ADD_MEM (regs[28], 8); + ADD_STRING (" "); + ADD_MEM (regs[29], 8); + ADD_STRING (" "); + ADD_MEM (regs[30], 8); + ADD_STRING (" "); + ADD_MEM (regs[31], 8); + ADD_STRING (" "); + ADD_MEM (regs[32], 8); + ADD_STRING (" "); + ADD_MEM (regs[33], 8); + ADD_STRING ("\nr24-31 "); + ADD_MEM (regs[34], 8); + ADD_STRING (" "); + ADD_MEM (regs[35], 8); + ADD_STRING (" "); + ADD_MEM (regs[36], 8); + ADD_STRING (" "); + ADD_MEM (regs[37], 8); + ADD_STRING (" "); + ADD_MEM (regs[38], 8); + ADD_STRING (" "); + ADD_MEM (regs[39], 8); + ADD_STRING (" "); + ADD_MEM (regs[40], 8); + ADD_STRING (" "); + ADD_MEM (regs[41], 8); + ADD_STRING ("\n\n trap "); + ADD_MEM (regs[0], 8); + ADD_STRING (" iar "); + ADD_MEM (regs[1], 8); + ADD_STRING (" msr "); + ADD_MEM (regs[2], 8); + ADD_STRING (" cr "); + ADD_MEM (regs[3], 8); + ADD_STRING ("\n lr "); + ADD_MEM (regs[4], 8); + ADD_STRING (" ctr "); + ADD_MEM (regs[5], 8); + ADD_STRING (" xer "); + ADD_MEM (regs[6], 8); + ADD_STRING (" mq "); + ADD_MEM (regs[7], 8); + ADD_STRING ("\n tid "); + ADD_MEM (regs[8], 8); + ADD_STRING (" fpscr "); + ADD_MEM (regs[9], 8); + ADD_STRING ("\n"); + + /* Write the stuff out. */ + writev (fd, iov, nr); +} + +#define REGISTER_DUMP register_dump (fd, ctx) + diff --git a/ports/sysdeps/unix/sysv/aix/powerpc/s_lrint.c b/ports/sysdeps/unix/sysv/aix/powerpc/s_lrint.c new file mode 100644 index 000000000..1a8b590d2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/powerpc/s_lrint.c @@ -0,0 +1,29 @@ +/* Round floating-point to integer. AIX/PowerPC version. + Copyright (C) 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdeps/powerpc/fpu/s_lrint.c> + +/* This code will also work for a 'float' argument. */ +asm ("\ + .globl .__lrintf + .globl .lrintf + .weak .lrintf + .set .__lrintf,.__lrint + .set .lrintf,.__lrint +"); diff --git a/ports/sysdeps/unix/sysv/aix/pread.c b/ports/sysdeps/unix/sysv/aix/pread.c new file mode 100644 index 000000000..8d8bfd741 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/pread.c @@ -0,0 +1,28 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int kpread (int fd, void *buf, size_t len, long long int off); + +ssize_t +__pread (int fd, void *buf, size_t len, off_t off) +{ + return kpread (fd, buf, len, off); +} +weak_alias (__pread, pread) diff --git a/ports/sysdeps/unix/sysv/aix/pread64.c b/ports/sysdeps/unix/sysv/aix/pread64.c new file mode 100644 index 000000000..0d4df2263 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/pread64.c @@ -0,0 +1,28 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int kpread (int fd, void *buf, size_t len, long long int off); + +ssize_t +__pread64 (int fd, void *buf, size_t len, off64_t off) +{ + return kpread (fd, buf, len, off); +} +weak_alias (__pread64, pread64) diff --git a/ports/sysdeps/unix/sysv/aix/profil-counter.h b/ports/sysdeps/unix/sysv/aix/profil-counter.h new file mode 100644 index 000000000..2492a63ba --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/profil-counter.h @@ -0,0 +1,27 @@ +/* Machine-dependent SIGPROF signal handler. AIX version. + Copyright (C) 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* In many Unix systems signal handlers are called like this + and the interrupted PC is easily findable in the `struct sigcontext'. */ + +static void +profil_counter (int signr, int code, struct sigcontext *scp) +{ + profil_count ((void *) scp->sc_jmpbuf.__jmp_context.__gpr[0]); +} diff --git a/ports/sysdeps/unix/sysv/aix/read.c b/ports/sysdeps/unix/sysv/aix/read.c new file mode 100644 index 000000000..ca0edb30d --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/read.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int kread (int fd, void *buf, size_t len); + +ssize_t +__libc_read (int fd, void *buf, size_t len) +{ + return kread (fd, buf, len); +} +libc_hidden_def (__libc_read) +strong_alias (__libc_read, __read) +libc_hidden_def (__read) +strong_alias (__libc_read, read) diff --git a/ports/sysdeps/unix/sysv/aix/readlink.c b/ports/sysdeps/unix/sysv/aix/readlink.c new file mode 100644 index 000000000..2770358b9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/readlink.c @@ -0,0 +1,8 @@ +/* This is a system call. We only have to provide the wrapper. */ +#include <unistd.h> + +int +__readlink (const char *path, char *buf, size_t len) +{ + return readlink (path, buf, len); +} diff --git a/ports/sysdeps/unix/sysv/aix/readv.c b/ports/sysdeps/unix/sysv/aix/readv.c new file mode 100644 index 000000000..eddca0fc8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/readv.c @@ -0,0 +1,38 @@ +/* Copyright (C) 1991, 1995-1998, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/uio.h> + +extern ssize_t kreadv (int fd, const struct iovec *iovp, size_t iovcnt, + long int ext); + +/* Read data from file descriptor FD, and put the result in the + buffers described by VECTOR, which is a vector of COUNT `struct iovec's. + The buffers are filled in the order specified. + Operates just like `read' (see <unistd.h>) except that data are + put in VECTOR instead of a contiguous buffer. */ +ssize_t +__libc_readv (fd, vector, count) + int fd; + const struct iovec *vector; + int count; +{ + return kreadv (fd, vector, count, 0); +} +strong_alias (__libc_readv, __readv) +weak_alias (__libc_readv, readv) diff --git a/ports/sysdeps/unix/sysv/aix/recv.c b/ports/sysdeps/unix/sysv/aix/recv.c new file mode 100644 index 000000000..b8ae73e20 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/recv.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2000, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +extern ssize_t recv (int fd, void *buf, size_t n, int flags); + + +ssize_t +__recv (int fd, void *buf, size_t n, int flags) +{ + return recv (fd, buf, n, flags); +} diff --git a/ports/sysdeps/unix/sysv/aix/recvfrom.c b/ports/sysdeps/unix/sysv/aix/recvfrom.c new file mode 100644 index 000000000..08ff1113f --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/recvfrom.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1999, 2000, 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +extern ssize_t nrecvfrom (int s, void *uap_buf, size_t len, int flags, + void *uap_from, socklen_t *uap_fromlenaddr); + +ssize_t +__recvfrom (int fd, void *buf, size_t n, int flags, __SOCKADDR_ARG addr, + socklen_t *addr_len) +{ + return nrecvfrom (fd, buf, n, flags, addr.__sockaddr__, addr_len); +} + +weak_alias (__recvfrom, recvfrom) diff --git a/ports/sysdeps/unix/sysv/aix/recvmsg.c b/ports/sysdeps/unix/sysv/aix/recvmsg.c new file mode 100644 index 000000000..201c26741 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/recvmsg.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1999, 2000, 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +extern ssize_t nrecvmsg (int s, struct msghdr *uap_msg, int flags); + +ssize_t +__recvmsg (int fd, struct msghdr *message, int flags) +{ + return nrecvmsg (fd, message, flags); +} + +weak_alias (__recvmsg, recvmsg) diff --git a/ports/sysdeps/unix/sysv/aix/rename.c b/ports/sysdeps/unix/sysv/aix/rename.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/rename.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/revoke.c b/ports/sysdeps/unix/sysv/aix/revoke.c new file mode 100644 index 000000000..8f6a4848d --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/revoke.c @@ -0,0 +1,41 @@ +/* Revoke the access of all descriptors currently open on a file. AIX version. + Copyright (C) 1995, 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> + +extern int frevoke (int fdes); + +int +revoke (file) + const char *file; +{ + int fd; + int res; + + fd = open (file, O_RDONLY); + if (fd < 0) + return -1; + + res = frevoke (fd); + (void) close (fd); + + return res; +} diff --git a/ports/sysdeps/unix/sysv/aix/rmdir.c b/ports/sysdeps/unix/sysv/aix/rmdir.c new file mode 100644 index 000000000..91c600694 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/rmdir.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__rmdir (const char *name) +{ + return rmdir (name); +} diff --git a/ports/sysdeps/unix/sysv/aix/sbrk.c b/ports/sysdeps/unix/sysv/aix/sbrk.c new file mode 100644 index 000000000..0a590ee8c --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sbrk.c @@ -0,0 +1,26 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +void * +__sbrk (intptr_t delta) +{ + return sbrk (delta); +} +libc_hidden_def (__sbrk) diff --git a/ports/sysdeps/unix/sysv/aix/sched_yield.c b/ports/sysdeps/unix/sysv/aix/sched_yield.c new file mode 100644 index 000000000..b5fbc0753 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sched_yield.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sched.h> + +extern void yield (void); + + +/* Yield the processor. */ +int +__sched_yield (void) +{ + yield (); + return 0; +} +strong_alias (__sched_yield, sched_yield) diff --git a/ports/sysdeps/unix/sysv/aix/select.c b/ports/sysdeps/unix/sysv/aix/select.c new file mode 100644 index 000000000..9bf5bae47 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/select.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/time.h> + +int +__select (nfds, readfds, writefds, exceptfds, timeout) + int nfds; + fd_set *readfds; + fd_set *writefds; + fd_set *exceptfds; + struct timeval *timeout; +{ + return select (nfds, readfds, writefds, exceptfds, timeout); +} +libc_hidden_def (__select) diff --git a/ports/sysdeps/unix/sysv/aix/semctl.c b/ports/sysdeps/unix/sysv/aix/semctl.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/semctl.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/semget.c b/ports/sysdeps/unix/sysv/aix/semget.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/semget.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/semop.c b/ports/sysdeps/unix/sysv/aix/semop.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/semop.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/sendmsg.c b/ports/sysdeps/unix/sysv/aix/sendmsg.c new file mode 100644 index 000000000..5b1baf63a --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sendmsg.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1999, 2000, 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +extern int nsendmsg (int s, const void *uap_msg, int flags); + +ssize_t +__sendmsg (int fd, const struct msghdr *message, int flags) +{ + return nsendmsg (fd, message, flags); +} + +weak_alias (__sendmsg, sendmsg) + diff --git a/ports/sysdeps/unix/sysv/aix/sendto.c b/ports/sysdeps/unix/sysv/aix/sendto.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sendto.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/setegid.c b/ports/sysdeps/unix/sysv/aix/setegid.c new file mode 100644 index 000000000..75123cedf --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setegid.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_EFFECTIVE 0x01 + + +extern int setgidx (int mask, gid_t gid); + +int +__setegid (gid_t gid) +{ + return setgidx (ID_EFFECTIVE, gid); +} +strong_alias (__setegid, setegid) +libc_hidden_def (setegid) diff --git a/ports/sysdeps/unix/sysv/aix/seteuid.c b/ports/sysdeps/unix/sysv/aix/seteuid.c new file mode 100644 index 000000000..6ea7e7ba0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/seteuid.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_EFFECTIVE 0x01 + + +extern int setuidx (int mask, uid_t uid); + +int +__seteuid (uid_t uid) +{ + return setuidx (ID_EFFECTIVE, uid); +} +strong_alias (__seteuid, seteuid) +libc_hidden_def (seteuid) diff --git a/ports/sysdeps/unix/sysv/aix/setgid.c b/ports/sysdeps/unix/sysv/aix/setgid.c new file mode 100644 index 000000000..5b8038110 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setgid.c @@ -0,0 +1,31 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_REAL 0x02 + + +extern int setgidx (int mask, gid_t gid); + +int +__setgid (gid_t gid) +{ + return setgidx (ID_REAL, gid); +} +strong_alias (__setgid, setgid) diff --git a/ports/sysdeps/unix/sysv/aix/setgroups.c b/ports/sysdeps/unix/sysv/aix/setgroups.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setgroups.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/setitimer.c b/ports/sysdeps/unix/sysv/aix/setitimer.c new file mode 100644 index 000000000..d7e741abe --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setitimer.c @@ -0,0 +1,68 @@ +/* Copyright (C) 1991, 1994, 1995, 1996, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stddef.h> +#include <errno.h> +#include <sys/time.h> +#include <unistd.h> +#include <signal.h> + +extern int __libc_nanosleep (const struct timespec *requested_time, + struct timespec *remaining); +int +__setitimer (which, new, old) + enum __itimer_which which; + const struct itimerval *new; + struct itimerval *old; +{ + if (new == NULL) + { + __set_errno (EINVAL); + return -1; + } + + switch (which) + { + default: + __set_errno (EINVAL); + return -1; + + case ITIMER_VIRTUAL: + case ITIMER_PROF: + __set_errno (ENOSYS); + return -1; + + case ITIMER_REAL: + break; + } + + switch (__fork()) + { + case -1: exit(-1); + case 0: + { + struct timespec ts ={.tv_sec = (long int)new->it_value.tv_sec, .tv_nsec = 0}; + __libc_nanosleep(&ts,&ts); + __kill(getppid(), SIGALRM); + exit(0); + } + default: + } + return 0; +} +weak_alias (__setitimer, setitimer) diff --git a/ports/sysdeps/unix/sysv/aix/setpgid.c b/ports/sysdeps/unix/sysv/aix/setpgid.c new file mode 100644 index 000000000..b076f28ed --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setpgid.c @@ -0,0 +1,28 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__setpgid (pid, pgid) + int pid; + int pgid; +{ + return setpgid (pid, pgid); +} +libc_hidden_def (__setpgid) diff --git a/ports/sysdeps/unix/sysv/aix/setpgrp.c b/ports/sysdeps/unix/sysv/aix/setpgrp.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setpgrp.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/setpriority.c b/ports/sysdeps/unix/sysv/aix/setpriority.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setpriority.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/setregid.c b/ports/sysdeps/unix/sysv/aix/setregid.c new file mode 100644 index 000000000..35812300b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setregid.c @@ -0,0 +1,41 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_EFFECTIVE 0x01 +#define ID_REAL 0x02 + + +extern int setgidx (int mask, gid_t gid); + +int +__setregid (gid_t rgid, gid_t egid) +{ + int res; + + if (rgid == egid) + return setgidx (ID_EFFECTIVE | ID_REAL, egid); + + res = setgidx (ID_REAL, rgid); + if (res == 0) + res = setgidx (ID_EFFECTIVE, egid); + + return res; +} +strong_alias (__setregid, setregid) diff --git a/ports/sysdeps/unix/sysv/aix/setreuid.c b/ports/sysdeps/unix/sysv/aix/setreuid.c new file mode 100644 index 000000000..430d2fedc --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setreuid.c @@ -0,0 +1,41 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_EFFECTIVE 0x01 +#define ID_REAL 0x02 + + +extern int setuidx (int mask, uid_t uid); + +int +__setreuid (uid_t ruid, uid_t euid) +{ + int res; + + if (ruid == euid) + return setuidx (ID_EFFECTIVE | ID_REAL, euid); + + res = setuidx (ID_REAL, ruid); + if (res == 0) + res = setuidx (ID_EFFECTIVE, euid); + + return res; +} +strong_alias (__setreuid, setreuid) diff --git a/ports/sysdeps/unix/sysv/aix/setrlimit.c b/ports/sysdeps/unix/sysv/aix/setrlimit.c new file mode 100644 index 000000000..818819d8e --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setrlimit.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/resource.h> + +int +__setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits) +{ + return setrlimit (resource, rlimits); +} diff --git a/ports/sysdeps/unix/sysv/aix/setrlimit64.c b/ports/sysdeps/unix/sysv/aix/setrlimit64.c new file mode 100644 index 000000000..f305c6f82 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setrlimit64.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/resource.h> + +int +__setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits) +{ + return setrlimit64 (resource, rlimits); +} diff --git a/ports/sysdeps/unix/sysv/aix/setsid.c b/ports/sysdeps/unix/sysv/aix/setsid.c new file mode 100644 index 000000000..c017c122b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setsid.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__setsid () +{ + return setsid (); +} diff --git a/ports/sysdeps/unix/sysv/aix/setsockopt.c b/ports/sysdeps/unix/sysv/aix/setsockopt.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setsockopt.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/setuid.c b/ports/sysdeps/unix/sysv/aix/setuid.c new file mode 100644 index 000000000..1772fc797 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/setuid.c @@ -0,0 +1,31 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#define ID_REAL 0x02 + + +extern int setuidx (int mask, uid_t uid); + +int +__setuid (uid_t uid) +{ + return setuidx (ID_REAL, uid); +} +strong_alias (__setuid, setuid) diff --git a/ports/sysdeps/unix/sysv/aix/shmat.c b/ports/sysdeps/unix/sysv/aix/shmat.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/shmat.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/shmctl.c b/ports/sysdeps/unix/sysv/aix/shmctl.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/shmctl.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/shmdt.c b/ports/sysdeps/unix/sysv/aix/shmdt.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/shmdt.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/shmget.c b/ports/sysdeps/unix/sysv/aix/shmget.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/shmget.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/sigaction.c b/ports/sysdeps/unix/sysv/aix/sigaction.c new file mode 100644 index 000000000..6b48a505c --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sigaction.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1991,1995,1996,1997,2000,2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <signal.h> + +extern int _sigaction (int sig, const struct sigaction *act, + struct sigaction *oact); + +/* If ACT is not NULL, change the action for SIG to *ACT. + If OACT is not NULL, put the old action for SIG in *OACT. */ +int +__sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; +{ + return _sigaction (sig, act, oact); +} +libc_hidden_def (__sigaction) +strong_alias (__sigaction, sigaction) diff --git a/ports/sysdeps/unix/sysv/aix/sigaltstack.c b/ports/sysdeps/unix/sysv/aix/sigaltstack.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sigaltstack.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/sigpending.c b/ports/sysdeps/unix/sysv/aix/sigpending.c new file mode 100644 index 000000000..729b75a3b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sigpending.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1991, 1995, 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <signal.h> + +extern int _sigpending (sigset_t *set); + + +/* Store in SET all signals that are blocked and pending. */ +int +sigpending (set) + sigset_t *set; +{ + return _sigpending (set); +} diff --git a/ports/sysdeps/unix/sysv/aix/sigprocmask.c b/ports/sysdeps/unix/sysv/aix/sigprocmask.c new file mode 100644 index 000000000..1046903b9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sigprocmask.c @@ -0,0 +1,8 @@ +/* This is a system call. We only have to provide the wrapper. */ +#include <signal.h> + +int +__sigprocmask (int how, const sigset_t *set, sigset_t *oset) +{ + return sigprocmask (how, set, oset); +} diff --git a/ports/sysdeps/unix/sysv/aix/sigset-cvt-mask.h b/ports/sysdeps/unix/sysv/aix/sigset-cvt-mask.h new file mode 100644 index 000000000..cc05fb70f --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sigset-cvt-mask.h @@ -0,0 +1,33 @@ +/* Convert between lowlevel sigmask and libc representation of sigset_t. + AIX version. + Copyright (C) 1998,2000,02 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +static inline int __attribute__ ((unused)) +sigset_set_old_mask (sigset_t *set, int mask) +{ + set->__losigs = (unsigned int) mask; + set->__hisigs = 0; + return 0; +} + +static inline int __attribute__ ((unused)) +sigset_get_old_mask (const sigset_t *set) +{ + return (unsigned int) set->__losigs; +} diff --git a/ports/sysdeps/unix/sysv/aix/sigstack.c b/ports/sysdeps/unix/sysv/aix/sigstack.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sigstack.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/sigsuspend.c b/ports/sysdeps/unix/sysv/aix/sigsuspend.c new file mode 100644 index 000000000..c9120d6e9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sigsuspend.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1991, 1995-1998, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <signal.h> + +extern int _sigsuspend (const sigset_t *sigmask); + + +/* Change the set of blocked signals to SET, + wait until a signal arrives, and restore the set of blocked signals. */ +int +__sigsuspend (set) + const sigset_t *set; +{ + return _sigsuspend (set); +} +libc_hidden_def (__sigsuspend) +weak_alias (__sigsuspend, sigsuspend) diff --git a/ports/sysdeps/unix/sysv/aix/sleep.c b/ports/sysdeps/unix/sysv/aix/sleep.c new file mode 100644 index 000000000..aa8d76d3d --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sleep.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <time.h> +#include <unistd.h> +#include <errno.h> + +extern int __libc_nanosleep (const struct timespec *requested_time, + struct timespec *remaining); + +unsigned int +__sleep (seconds) + unsigned int seconds; +{ + struct timespec ts ={.tv_sec = (long int)seconds, .tv_nsec = 0}; + __libc_nanosleep(&ts,&ts); + return 0; +} +weak_alias (__sleep, sleep) diff --git a/ports/sysdeps/unix/sysv/aix/socket.c b/ports/sysdeps/unix/sysv/aix/socket.c new file mode 100644 index 000000000..236b1b168 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/socket.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +int +__socket (int domain, int type, int protocol) +{ + return socket (domain, type, protocol); +} diff --git a/ports/sysdeps/unix/sysv/aix/socketpair.c b/ports/sysdeps/unix/sysv/aix/socketpair.c new file mode 100644 index 000000000..8adeac97f --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/socketpair.c @@ -0,0 +1,25 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/socket.h> + +int +__socketpair (int domain, int type, int protocol, int fds[2]) +{ + return socketpair (domain, type, protocol, fds); +} diff --git a/ports/sysdeps/unix/sysv/aix/speed.c b/ports/sysdeps/unix/sysv/aix/speed.c new file mode 100644 index 000000000..3a453a7be --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/speed.c @@ -0,0 +1,75 @@ +/* `struct termios' speed frobnication functions. AIX version. + Copyright (C) 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stddef.h> +#include <errno.h> +#include <termios.h> + +/* Return the output baud rate stored in *TERMIOS_P. */ +speed_t +cfgetospeed (termios_p) + const struct termios *termios_p; +{ + return termios_p->c_cflag & 0x0000000f; +} + +/* Return the input baud rate stored in *TERMIOS_P. */ +speed_t +cfgetispeed (termios_p) + const struct termios *termios_p; +{ + return (termios_p->c_cflag & 0x000f0000) >> 16; +} + +/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ +int +cfsetospeed (termios_p, speed) + struct termios *termios_p; + speed_t speed; +{ + if (termios_p == NULL) + { + __set_errno (EINVAL); + return -1; + } + + termios_p->c_cflag &= ~0x0000000f; + termios_p->c_cflag |= speed & 0x0000000f; + return 0; +} +libc_hidden_def (cfsetospeed) + + +/* Set the input baud rate stored in *TERMIOS_P to SPEED. */ +int +cfsetispeed (termios_p, speed) + struct termios *termios_p; + speed_t speed; +{ + if (termios_p == NULL) + { + __set_errno (EINVAL); + return -1; + } + + termios_p->c_cflag &= ~0x000f0000; + termios_p->c_cflag |= (speed << 16) & ~0x000f0000; + return 0; +} +libc_hidden_def (cfsetispeed) diff --git a/ports/sysdeps/unix/sysv/aix/start-libc.c b/ports/sysdeps/unix/sysv/aix/start-libc.c new file mode 100644 index 000000000..0cbe79d0b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/start-libc.c @@ -0,0 +1,265 @@ +/* Initialization code run first thing by the XCOFF startup code. AIX version. + Copyright (C) 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> + +/* hack to use uchar's */ +typedef unsigned char uchar; +#include <xcoff.h> +#include <rtinit.h> +#include <dlldr.h> +#include <bits/libc-lock.h> + +extern void __libc_init_first (int argc, char **argv, char **envp); + +/* XXX disable for now +extern int __libc_multiple_libcs; */ + +/* XXX normally defined in generic/dl-sydep.c, hack it into existance +extern void *__libc_stack_end; */ +void *__libc_stack_end; + +struct __libc_start_data_rec +{ + void *stack; + void *toc; + int argc; + char **argv; + char **envp; + char *data; + char *text; + unsigned int mcount; + unsigned int special; + int (*main) (int, char **, char **); + void (*init) (void); + void (*fini) (void); + void (*rtld_fini) (void); +}; + +extern struct __libc_start_data_rec __libc_start_data; +extern int errno; + +/* The first piece of initialized data. */ +int __data_start = 0; + +#ifndef HAVE_ELF +/* Since gcc/crtstuff.c won't define it unless the ELF format is used + we will need to define it here. */ +void *__dso_handle = NULL; +#endif + +/* AIX kernel function */ +extern int __loadx (int flag, void *module, void *arg1, void *arg2, + void *arg3); +/* Needed by setenv */ +char **__environ; + +/* + Find __rtinit symbol + + __RTINIT *find_rtinit() + + __RTINIT *rti - pointer to __rtinit data structure + */ + +static __RTINIT * +find_rtinit (void) +{ + struct xcoffhdr *xcoff_hdr; + SCNHDR *sec_hdr; + SCNHDR *ldr_sec_hdr; + SCNHDR *data_sec_hdr; + LDSYM *ldsym_hdr; + __RTINIT *rtl; + + xcoff_hdr = (struct xcoffhdr *) __libc_start_data.text; + sec_hdr = (SCNHDR *) ((caddr_t) &xcoff_hdr->aouthdr + + xcoff_hdr->filehdr.f_opthdr); + ldr_sec_hdr = (SCNHDR *) (sec_hdr + (xcoff_hdr->aouthdr.o_snloader - 1)); + ldsym_hdr = (LDSYM *) ((caddr_t)xcoff_hdr + ldr_sec_hdr->s_scnptr + + LDHDRSZ); + + if ( __libc_start_data.mcount <= 0) + { + if (!ldr_sec_hdr->s_scnptr) + return (__RTINIT *) 0; + + if (memcmp (ldsym_hdr, RTINIT_NAME, sizeof (RTINIT_NAME) - 1)) + return (__RTINIT *) 0; + } + + data_sec_hdr = (SCNHDR *) (sec_hdr + (xcoff_hdr->aouthdr.o_sndata - 1)); + rtl = (__RTINIT *) (ldsym_hdr->l_value + + (__libc_start_data.data - data_sec_hdr->s_vaddr)); + return rtl; +} + +/* + The mod_init1 calls every initialization function for a given module. + + void mod_init1(handler, rti) + + void *handler - if NULL init funtions for modules loaded at exec time + are being executed. Otherwise, the handler points to the + module loaded. + + __RTINIT *rti - pointer to __rtinit data structure (with rti->init_offset + not equal to zero) + */ + +static void +mod_init1 (void *handler,__RTINIT *rtl) +{ + __RTINIT_DESCRIPTOR *descriptor; + + descriptor = (__RTINIT_DESCRIPTOR *) ((caddr_t) &rtl->rtl + + rtl->init_offset); + while (descriptor->f != NULL) + { + if (!(descriptor->flags & _RT_CALLED)) + { + descriptor->flags |= _RT_CALLED; + (descriptor->f) (handler, rtl, descriptor); /* execute init/fini */ + } + descriptor = (__RTINIT_DESCRIPTOR *) ((caddr_t) descriptor + + rtl->__rtinit_descriptor_size); + } +} + +/* The modinit() function performs run-time linking, if enabled, and calling + the init() function for all loaded modules. */ + +#define DL_BUFFER_SIZE 1000 + +static int +modinit (void) +{ + int *handler = 0; + __RTINIT *rtinit_info = 0; + int flag; + DL_INFO dl_buffer[DL_BUFFER_SIZE]; + DL_INFO *dl_info = dl_buffer; + int i; + + /* Find __rtinit symbols */ + rtinit_info = find_rtinit (); + + flag = DL_EXECQ; + if (rtinit_info && rtinit_info->rtl) + flag |= DL_LOAD_RTL; + + /* Get a list of modules that have __rtinit */ + if (__loadx (flag, dl_info, (void *) sizeof (dl_buffer), NULL, NULL)) + exit (0x90); + + if (dl_info[0].dlinfo_xflags & DL_INFO_OK) + { + rtinit_info = find_rtinit (); + if ((rtinit_info != NULL) & (rtinit_info->rtl != NULL)) + { + if ((*rtinit_info->rtl) (dl_info, 0)) + exit (0x90); + } + } + + /* Initialization each module loaded that has __rtinit. */ + if (dl_info[0].dlinfo_xflags & DL_INFO_OK) + { + for (i = 1; i < dl_info[0].dlinfo_arraylen + 1; ++i) + if (dl_info[i].dlinfo_flags & DL_HAS_RTINIT) + { + rtinit_info = find_rtini t(); + if (rtinit_info) + mod_init1 (handler, rtinit_info); + } + } + + return 0; +} + + +void +__libc_start_init (void) +{ + /* Do run-time linking, if enabled and call the init() + for all loaded modules. */ + if (__libc_start_data.mcount != __libc_start_data.special) + modinit (); +} + +/* For now these are just stubs. */ +void +__libc_start_fini (void) +{ +} + +void +__libc_start_rtld_fini (void) +{ +} + + +int +__libc_start_main (void) +{ + /* Store the lowest stack address. */ + __libc_stack_end = __libc_start_data.stack; + + /* Used by setenv */ + __environ = __libc_start_data.envp; + +#ifndef SHARED + /* Clear errno. */ + errno = 0; + + /* Some security at this point. Prevent starting a SUID binary where + the standard file descriptors are not opened. We have to do this + only for statically linked applications since otherwise the dynamic + loader did the work already. */ + if (__builtin_expect (__libc_enable_secure, 0)) + __libc_check_standard_fds (); + +#endif + + /* Register the destructor of the dynamic linker if there is any. */ + if (__builtin_expect (__libc_start_data.rtld_fini != NULL, 1)) + __cxa_atexit ((void (*) (void *)) __libc_start_data.rtld_fini, NULL, NULL); + + /* Call the initializer of the libc. This is only needed here if we + are compiling for the static library in which case we haven't + run the constructors in `_dl_start_user'. */ +#ifndef SHARED + __libc_init_first (__libc_start_data.argc, __libc_start_data.argv, + __libc_start_data.envp); +#endif + + /* Register the destructor of the program, if any. */ + if (__libc_start_data.fini) + __cxa_atexit ((void (*) (void *)) __libc_start_data.fini, NULL, NULL); + + /* Call the initializer of the program, if any. */ + if (__libc_start_data.init) + (*__libc_start_data.init) (); + + exit ((*__libc_start_data.main) (__libc_start_data.argc, + __libc_start_data.argv, + __libc_start_data.envp)); +} diff --git a/ports/sysdeps/unix/sysv/aix/start.s b/ports/sysdeps/unix/sysv/aix/start.s new file mode 100644 index 000000000..79d8ef489 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/start.s @@ -0,0 +1,126 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + .file "start.s" + .toc +T.lsd: .tc __libc_start_data[tc], __libc_start_data[rw] +T.main: .tc main[tc], main[rw] +T.init: .tc __libc_start_init[tc], __libc_start_init[rw] +T.fini: .tc __libc_start_fini[tc], __libc_start_init[rw] +T.rtld_fini : .tc __libc_start_rtld_fini[tc], __libc_start_rtld_fini[rw] + + .globl __start + .globl .__start + .globl __libc_start_data + + .extern .__libc_start_main + .extern .main + .extern main + .extern __libc_start_init + .extern __libc_start_fini + .extern __libc_start_rtld_fini + +/* Text */ + + .csect __start[ds] +__start: + .long .__start, TOC[tc0], 0 + + .csect .text[pr] +.__start: + +/* No prologue needed, __start does not have to follow the ABI. + + Input from kernel/loader + r1 : stack + r2 : TOC + r3 : argc + r4 : argv + r5 : envp + r28 : data origin + r29 : text origin + r30 : module count + r31 : default processing flag + + If r31 == r30, no special processing is needed, ie r28, r29 & r30 + are not used + + Save input in __libc_start_data */ + l 16, T.lsd(2) + st 1, 0(16) /* stack */ + st 2, 4(16) /* toc */ + st 3, 8(16) /* argc */ + st 4, 12(16) /* argv */ + st 5, 16(16) /* envp */ + st 28, 20(16) /* data origin */ + st 29, 24(16) /* text origin */ + st 30, 28(16) /* module count */ + st 31, 32(16) /* special */ + +/* Call __libc_start_main() */ + + bl .__libc_start_main + nop + +/* No epilog needed, __start does not have to follow the ABI */ + +/* Trace back */ +TB.__start: + .long 0x0 + .long 0xc2040 + .long 0x0 + .long TB.__start - .__start + .short 7 + .byte "__start" + .byte 0,0,0 + +/* Data + __libc_start_data + Space to keep libc initialization information */ + + .csect __libc_start_data[rw] +__libc_start_data: +/* For kernel/loader input args */ + .space 36 + +/* Externs */ + .long main +init: + .long __libc_start_init +fini: + .long __libc_start_fini +rtld_fini: + .long __libc_start_rtld_fini + .space 0x1000 + (4 + rtld_fini - __libc_start_data) diff --git a/ports/sysdeps/unix/sysv/aix/statfs.c b/ports/sysdeps/unix/sysv/aix/statfs.c new file mode 100644 index 000000000..1ead597da --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/statfs.c @@ -0,0 +1,28 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/statfs.h> + +extern int statfs (const char *file, struct statfs *buf); + +int +__statfs (const char *file, struct statfs *buf) +{ + return statfs (file, buf); +} +libc_hidden_def (__statfs) diff --git a/ports/sysdeps/unix/sysv/aix/symlink.c b/ports/sysdeps/unix/sysv/aix/symlink.c new file mode 100644 index 000000000..cb2496595 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/symlink.c @@ -0,0 +1,27 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__symlink (from, to) + const char *from; + const char *to; +{ + return symlink (from, to); +} diff --git a/ports/sysdeps/unix/sysv/aix/sync.c b/ports/sysdeps/unix/sysv/aix/sync.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sync.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/sys/param.h b/ports/sysdeps/unix/sysv/aix/sys/param.h new file mode 100644 index 000000000..7448f1a6e --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sys/param.h @@ -0,0 +1,48 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H 1 + +/* This file should contain various parameter macros appropriate for the + machine and operating system. There is no standard set of macros; this + file is just for compatibility with programs written for Unix that + expect it to define things. On Unix systems that do not have their own + sysdep version of this file, it is generated at build time by examining + the installed headers on the system. */ + +#include <limits.h> + +#define MAXSYMLINKS 1 +#define MAXPATHLEN 256 + +/* The pagesize is 4096. */ +#define EXEC_PAGESIZE 4096 + +/* maximum number of supplemental groups. */ +#define NGROUPS 32 + +/* Macros for min/max. */ +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) + + +/* Maximum length of hostname. */ +#define MAXHOSTNAMELEN 256 + +#endif /* sys/param.h */ diff --git a/ports/sysdeps/unix/sysv/aix/sys/ucontext.h b/ports/sysdeps/unix/sysv/aix/sys/ucontext.h new file mode 100644 index 000000000..ddb3f010c --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sys/ucontext.h @@ -0,0 +1,113 @@ +/* Copyright (C) 1997, 1998, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include <features.h> +#include <bits/types.h> +#include <bits/sigset.h> + + +/* Alternate, preferred interface. */ +typedef struct sigaltstack + { + void *ss_sp; + size_t ss_size; + int ss_flags; + int __pad[4]; + } stack_t; + + +/* Forward declaration of AIX type. */ +typedef struct label_t label_t; + + + +typedef unsigned int kvmhandle_t; +typedef struct + { + unsigned long int __alloc; + kvmhandle_t __srval[16]; + } adspace_t; + + + +#define _NGPRS 32 +#define _NFPRS 32 + +struct __mstsafe +{ + struct __mstsave *__prev; /* Previous save area. */ + label_t *__kjmpbuf; /* Pointer to saved context. */ + char *__stackfix; /* Stack fix pointer. */ + char __intpri; /* Interrupt priority. */ + char __backt; /* Back-track flag. */ + char __rsvd[2]; /* Reserved. */ + __pid_t __curid; /* Copy of curid. */ + + int __excp_type; /* Exception type for debugger. */ + unsigned long int __iar; /* Instruction address register. */ + unsigned long int __msr; /* Machine state register. */ + unsigned long int __cr; /* Condition register. */ + unsigned long int __lr; /* Link register. */ + unsigned long int __ctr; /* Count register. */ + unsigned long int __xer; /* Fixed point exception. */ + unsigned long int __mq; /* Multiply/quotient register. */ + unsigned long int __tid; /* TID register. */ + unsigned long int __fpscr; /* Floating point status reg. */ + char __fpeu; /* Floating point ever used. */ + char __fpinfo; /* Floating point status flags. */ + char __pad[2]; /* Pad to dword boundary. */ + /* 1 implies state is in mstext */ + unsigned long int __except[5]; /* exception structure. */ + char __pad1[4]; /* Old bus field. */ + unsigned long int __o_iar; /* Old iar (for longjmp excpt). */ + unsigned long int __o_toc; /* Old toc (for longjmp excpt). */ + unsigned long int __o_arg1; /* Old arg1 (for longjmp excpt). */ + unsigned long int __excbranch; /* If not NULL, address to branch + to on exception. Used by + assembler routines for low + cost exception handling. */ + unsigned long int __fpscrx; /* Software extension to fpscr. */ + unsigned long int __o_vaddr; /* Saved vaddr for vmexception. */ + unsigned long int __cachealign[7]; /* Reserved. */ + adspace_t __as; /* Segment registers. */ + unsigned long int __gpr[_NGPRS]; /* General purpose registers. */ + double __fpr[_NFPRS]; /* Floating point registers. */ + }; + +typedef struct mcontext_t + { + struct __mstsafe __jmp_context; + } mcontext_t; + + +typedef struct ucontext_t + { + int __sc_onstack; /* Sigstack state to restore. */ + __sigset_t uc_sigmask; /* The set of signals that are blocked when + this context is active. */ + int __sc_uerror; /* u_error to restore. */ + mcontext_t uc_mcontext; /* Machine-specific image of saved context. */ + struct ucontext_t *uc_link; /* context resumed after this one returns */ + stack_t uc_stack; /* stack used by context */ + int __pad[4]; + } ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/ports/sysdeps/unix/sysv/aix/syscall.c b/ports/sysdeps/unix/sysv/aix/syscall.c new file mode 100644 index 000000000..6f204ff80 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/syscall.c @@ -0,0 +1,2 @@ +/* XXX We will have to see whether it is possible to implement this + function at all. */ diff --git a/ports/sysdeps/unix/sysv/aix/sysdep.h b/ports/sysdeps/unix/sysv/aix/sysdep.h new file mode 100644 index 000000000..dcf37f253 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sysdep.h @@ -0,0 +1,88 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdeps/unix/powerpc/sysdep.h> + + +/* This seems to always be the case on PPC. */ +#define ALIGNARG(log2) log2 + +/* How to define local lables. */ +#define L(name) L..##name + +/* Label in text section. */ +#define C_TEXT(name) .##name + +/* Function descriptor. */ +#define FUNCDESC(real, code) \ + .toc; \ + .csect real##[DS], 3; \ + .globl real; \ +real: \ + .long code, TOC[tc0], 0; + +/* Code to generate function entry code. */ +#define ENTRY(name) \ + FUNCDESC (name, C_TEXT (name)) \ + .csect .text[PR], 2; \ + .globl C_TEXT (name); \ +C_TEXT (name): + +/* XXX For now we don't define any code. */ +#define CALL_MCOUNT + +#define EALIGN_W_0 /* No words to insert. */ +#define EALIGN_W_1 nop +#define EALIGN_W_2 nop;nop +#define EALIGN_W_3 nop;nop;nop +#define EALIGN_W_4 EALIGN_W_3;nop +#define EALIGN_W_5 EALIGN_W_4;nop +#define EALIGN_W_6 EALIGN_W_5;nop +#define EALIGN_W_7 EALIGN_W_6;nop + +/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes + past a 2^align boundary. */ +#ifdef PROF +#define EALIGN(name, alignt, words) \ + FUNCDESC (name, C_TEXT (name)) \ + .csect .text[PR], 2; \ + .align ALIGNARG(2); \ + .globl C_TEXT (name); \ +C_TEXT (name): \ + CALL_MCOUNT \ + b L(align_0); \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ +L(align_0): +#else /* PROF */ +#define EALIGN(name, alignt, words) \ + FUNCDESC (name, C_TEXT (name)) \ + .csect .text[PR], 2; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + .globl C_TEXT (name); \ +C_TEXT (name): +#endif + +/* No special end code for now. We will eventually add to usual prolog + with function length etc. */ +#define END(name) + + +/* Jumping to another function. We are jumping to the TOC entry. */ +#define JUMPTARGET(name) C_TEXT (name) diff --git a/ports/sysdeps/unix/sysv/aix/sysv_termio.h b/ports/sysdeps/unix/sysv/aix/sysv_termio.h new file mode 100644 index 000000000..f314c0e16 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/sysv_termio.h @@ -0,0 +1,155 @@ +/* Copyright (C) 1992, 1997, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* In various parts of this file we define the System V values for + things as _SYSV_<whatever>. Those are the values that System V + uses for termio, and also (SVR4) termios. Not necessarily the + same as the GNU termios that the library user sees. */ + +/* Number of elements of c_cc. termio only. */ +#define _SYSV_NCC 8 + +#define _SYSV_VINTR 0 +#define _SYSV_VQUIT 1 +#define _SYSV_VERASE 2 +#define _SYSV_VKILL 3 +#define _SYSV_VEOF 4 +/* This field means VEOF if ICANON, VMIN if not. */ +#define _SYSV_VMIN 4 +#define _SYSV_VEOL 5 +/* This field means VEOL if ICANON, VTIME if not. */ +#define _SYSV_VTIME 5 +#define _SYSV_VEOL2 6 + +/* Flags in c_iflag. */ +#define _SYSV_IGNBRK 1 +#define _SYSV_BRKINT 2 +#define _SYSV_IGNPAR 4 +#define _SYSV_PARMRK 8 +#define _SYSV_INPCK 0x10 +#define _SYSV_ISTRIP 0x20 +#define _SYSV_INLCR 0x40 +#define _SYSV_IGNCR 0x80 +#define _SYSV_ICRNL 0x100 +#define _SYSV_IUCLC 0x200 +#define _SYSV_IXON 0x400 +#define _SYSV_IXANY 0x800 +#define _SYSV_IXOFF 0x1000 +#define _SYSV_IMAXBEL 0x2000 + +/* Flags in c_cflag. */ +#define _SYSV_CBAUD 0xf +#define _SYSV_CIBAUD 0xf0000 /* termios only. */ +#define _SYSV_IBSHIFT 16 +/* Values for CBAUD and CIBAUD. */ +#define _SYSV_B0 0 +#define _SYSV_B50 1 +#define _SYSV_B75 2 +#define _SYSV_B110 3 +#define _SYSV_B134 4 +#define _SYSV_B150 5 +#define _SYSV_B200 6 +#define _SYSV_B300 7 +#define _SYSV_B600 8 +#define _SYSV_B1200 9 +#define _SYSV_B1800 10 +#define _SYSV_B2400 11 +#define _SYSV_B4800 12 +#define _SYSV_B9600 13 +#define _SYSV_B19200 14 +#define _SYSV_B38400 15 + +#define _SYSV_CS5 0 +#define _SYSV_CS6 0x10 +#define _SYSV_CS7 0x20 +#define _SYSV_CS8 0x30 +#define _SYSV_CSIZE 0x30 +#define _SYSV_CSTOPB 0x40 +#define _SYSV_CREAD 0x80 +#define _SYSV_PARENB 0x100 +#define _SYSV_PARODD 0x200 +#define _SYSV_HUPCL 0x400 +#define _SYSV_CLOCAL 0x800 + +/* Flags in c_lflag. */ +#define _SYSV_ISIG 1 +#define _SYSV_ICANON 2 +#define _SYSV_ECHO 8 +#define _SYSV_ECHOE 0x10 +#define _SYSV_ECHOK 0x20 +#define _SYSV_ECHONL 0x40 +#define _SYSV_NOFLSH 0x80 +#define _SYSV_TOSTOP 0x100 +#define _SYSV_ECHOCTL 0x200 +#define _SYSV_ECHOPRT 0x400 +#define _SYSV_ECHOKE 0x800 +#define _SYSV_FLUSHO 0x2000 +#define _SYSV_PENDIN 0x4000 +#define _SYSV_IEXTEN 0x8000 + +/* Flags in c_oflag. */ +#define _SYSV_OPOST 1 +#define _SYSV_OLCUC 2 +#define _SYSV_ONLCR 4 +#define _SYSV_NLDLY 0x100 +#define _SYSV_NL0 0 +#define _SYSV_NL1 0x100 +#define _SYSV_CRDLY 0x600 +#define _SYSV_CR0 0 +#define _SYSV_CR1 0x200 +#define _SYSV_CR2 0x400 +#define _SYSV_CR3 0x600 +#define _SYSV_TABDLY 0x1800 +#define _SYSV_TAB0 0 +#define _SYSV_TAB1 0x0800 +#define _SYSV_TAB2 0x1000 +/* TAB3 is an obsolete name for XTABS. But we provide it since some + programs expect it to exist. */ +#define _SYSV_TAB3 0x1800 +#define _SYSV_XTABS 0x1800 +#define _SYSV_BSDLY 0x2000 +#define _SYSV_BS0 0 +#define _SYSV_BS1 0x2000 +#define _SYSV_VTDLY 0x4000 +#define _SYSV_VT0 0 +#define _SYSV_VT1 0x4000 +#define _SYSV_FFDLY 0x8000 +#define _SYSV_FF0 0 +#define _SYSV_FF1 0x8000 + +/* ioctl's. */ + +#define _TCGETA 0x5405 +#define _TCSETA 0x5406 +#define _TCSETAW 0x5407 +#define _TCSETAF 0x5408 +#define _TCSBRK 0x5409 +#define _TCXONC 0x540B +#define _TCFLSH 0x540C +#define _TIOCGPGRP 0x7414 +#define _TIOCSPGRP 0x7415 + +struct __sysv_termio + { + unsigned short c_iflag; + unsigned short c_oflag; + unsigned short c_cflag; + unsigned short c_lflag; + char c_line; + unsigned char c_cc[_SYSV_NCC]; + }; diff --git a/ports/sysdeps/unix/sysv/aix/tcgetattr.c b/ports/sysdeps/unix/sysv/aix/tcgetattr.c new file mode 100644 index 000000000..01ffd55ef --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/tcgetattr.c @@ -0,0 +1,152 @@ +/* Copyright (C) 1992, 1995, 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stddef.h> +#include <sysv_termio.h> +#include <termios.h> +#include <sys/ioctl.h> + +/* Put the state of FD into *TERMIOS_P. */ +int +__tcgetattr (fd, termios_p) + int fd; + struct termios *termios_p; +{ + struct __sysv_termio buf; + + if (termios_p == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (__ioctl (fd, _TCGETA, &buf) < 0) + return -1; + + termios_p->c_cflag &= ~0x000f0000; + termios_p->c_cflag |= (termios_p->c_cflag & 0xf) << 16; + + termios_p->c_iflag = 0; + if (buf.c_iflag & _SYSV_IGNBRK) + termios_p->c_iflag |= IGNBRK; + if (buf.c_iflag & _SYSV_BRKINT) + termios_p->c_iflag |= BRKINT; + if (buf.c_iflag & _SYSV_IGNPAR) + termios_p->c_iflag |= IGNPAR; + if (buf.c_iflag & _SYSV_PARMRK) + termios_p->c_iflag |= PARMRK; + if (buf.c_iflag & _SYSV_INPCK) + termios_p->c_iflag |= INPCK; + if (buf.c_iflag & _SYSV_ISTRIP) + termios_p->c_iflag |= ISTRIP; + if (buf.c_iflag & _SYSV_INLCR) + termios_p->c_iflag |= INLCR; + if (buf.c_iflag & _SYSV_IGNCR) + termios_p->c_iflag |= IGNCR; + if (buf.c_iflag & _SYSV_ICRNL) + termios_p->c_iflag |= ICRNL; + if (buf.c_iflag & _SYSV_IXON) + termios_p->c_iflag |= IXON; + if (buf.c_iflag & _SYSV_IXOFF) + termios_p->c_iflag |= IXOFF; + if (buf.c_iflag & _SYSV_IXANY) + termios_p->c_iflag |= IXANY; + if (buf.c_iflag & _SYSV_IMAXBEL) + termios_p->c_iflag |= IMAXBEL; + + termios_p->c_oflag = 0; + if (buf.c_oflag & OPOST) + termios_p->c_oflag |= OPOST; + if (buf.c_oflag & ONLCR) + termios_p->c_oflag |= ONLCR; + termios_p->c_cflag = 0; + switch (buf.c_cflag & _SYSV_CSIZE) + { + case _SYSV_CS5: + termios_p->c_cflag |= CS5; + break; + case _SYSV_CS6: + termios_p->c_cflag |= CS6; + break; + case _SYSV_CS7: + termios_p->c_cflag |= CS7; + break; + case _SYSV_CS8: + termios_p->c_cflag |= CS8; + break; + } + if (buf.c_cflag & _SYSV_CSTOPB) + termios_p->c_cflag |= CSTOPB; + if (buf.c_cflag & _SYSV_CREAD) + termios_p->c_cflag |= CREAD; + if (buf.c_cflag & _SYSV_PARENB) + termios_p->c_cflag |= PARENB; + if (buf.c_cflag & _SYSV_PARODD) + termios_p->c_cflag |= PARODD; + if (buf.c_cflag & _SYSV_HUPCL) + termios_p->c_cflag |= HUPCL; + if (buf.c_cflag & _SYSV_CLOCAL) + termios_p->c_cflag |= CLOCAL; + termios_p->c_lflag = 0; + if (buf.c_lflag & _SYSV_ISIG) + termios_p->c_lflag |= ISIG; + if (buf.c_lflag & _SYSV_ICANON) + termios_p->c_lflag |= ICANON; + if (buf.c_lflag & _SYSV_ECHO) + termios_p->c_lflag |= ECHO; + if (buf.c_lflag & _SYSV_ECHOE) + termios_p->c_lflag |= ECHOE; + if (buf.c_lflag & _SYSV_ECHOK) + termios_p->c_lflag |= ECHOK; + if (buf.c_lflag & _SYSV_ECHONL) + termios_p->c_lflag |= ECHONL; + if (buf.c_lflag & _SYSV_NOFLSH) + termios_p->c_lflag |= NOFLSH; + if (buf.c_lflag & _SYSV_TOSTOP) + termios_p->c_lflag |= TOSTOP; + if (buf.c_lflag & _SYSV_ECHOKE) + termios_p->c_lflag |= ECHOKE; + if (buf.c_lflag & _SYSV_ECHOPRT) + termios_p->c_lflag |= ECHOPRT; + if (buf.c_lflag & _SYSV_ECHOCTL) + termios_p->c_lflag |= ECHOCTL; + if (buf.c_lflag & _SYSV_FLUSHO) + termios_p->c_lflag |= FLUSHO; + if (buf.c_lflag & _SYSV_PENDIN) + termios_p->c_lflag |= PENDIN; + if (buf.c_lflag & _SYSV_IEXTEN) + termios_p->c_lflag |= IEXTEN; + + termios_p->c_cc[VEOF] = buf.c_cc[_SYSV_VEOF]; + termios_p->c_cc[VEOL] = buf.c_cc[_SYSV_VEOL]; + termios_p->c_cc[VEOL2] = buf.c_cc[_SYSV_VEOL2]; + termios_p->c_cc[VERASE] = buf.c_cc[_SYSV_VERASE]; + termios_p->c_cc[VKILL] = buf.c_cc[_SYSV_VKILL]; + termios_p->c_cc[VINTR] = buf.c_cc[_SYSV_VINTR]; + termios_p->c_cc[VQUIT] = buf.c_cc[_SYSV_VQUIT]; + termios_p->c_cc[VSTART] = '\021'; /* XON (^Q). */ + termios_p->c_cc[VSTOP] = '\023'; /* XOFF (^S). */ + termios_p->c_cc[VSUSP] = '\0'; /* System V release 3 lacks job control. */ + termios_p->c_cc[VMIN] = buf.c_cc[_SYSV_VMIN]; + termios_p->c_cc[VTIME] = buf.c_cc[_SYSV_VTIME]; + + return 0; +} + +weak_alias (__tcgetattr, tcgetattr) diff --git a/ports/sysdeps/unix/sysv/aix/tcsetattr.c b/ports/sysdeps/unix/sysv/aix/tcsetattr.c new file mode 100644 index 000000000..8e78da1c2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/tcsetattr.c @@ -0,0 +1,198 @@ +/* Copyright (C) 1992,1995,1996,1997,2000,2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stddef.h> +#include <termios.h> +#include <sys/ioctl.h> + +#include <sysv_termio.h> + + +const speed_t __unix_speeds[] = + { + 0, + 50, + 75, + 110, + 134, + 150, + 200, + 300, + 600, + 1200, + 1800, + 2400, + 4800, + 9600, + 19200, + 38400, + }; + + +/* Set the state of FD to *TERMIOS_P. */ +int +tcsetattr (fd, optional_actions, termios_p) + int fd; + int optional_actions; + const struct termios *termios_p; +{ + struct __sysv_termio buf; + int ioctl_function; + + if (termios_p == NULL) + { + __set_errno (EINVAL); + return -1; + } + switch (optional_actions) + { + case TCSANOW: + ioctl_function = _TCSETA; + break; + case TCSADRAIN: + ioctl_function = _TCSETAW; + break; + case TCSAFLUSH: + ioctl_function = _TCSETAF; + break; + default: + __set_errno (EINVAL); + return -1; + } + + if ((termios_p->c_cflag & 0x000f0000) >> 16 != (termios_p->c_cflag & 0xf)) + { + __set_errno (EINVAL); + return -1; + } + + buf.c_iflag = 0; + if (termios_p->c_iflag & IGNBRK) + buf.c_iflag |= _SYSV_IGNBRK; + if (termios_p->c_iflag & BRKINT) + buf.c_iflag |= _SYSV_BRKINT; + if (termios_p->c_iflag & IGNPAR) + buf.c_iflag |= _SYSV_IGNPAR; + if (termios_p->c_iflag & PARMRK) + buf.c_iflag |= _SYSV_PARMRK; + if (termios_p->c_iflag & INPCK) + buf.c_iflag |= _SYSV_INPCK; + if (termios_p->c_iflag & ISTRIP) + buf.c_iflag |= _SYSV_ISTRIP; + if (termios_p->c_iflag & INLCR) + buf.c_iflag |= _SYSV_INLCR; + if (termios_p->c_iflag & IGNCR) + buf.c_iflag |= _SYSV_IGNCR; + if (termios_p->c_iflag & ICRNL) + buf.c_iflag |= _SYSV_ICRNL; + if (termios_p->c_iflag & IXON) + buf.c_iflag |= _SYSV_IXON; + if (termios_p->c_iflag & IXOFF) + buf.c_iflag |= _SYSV_IXOFF; + if (termios_p->c_iflag & IXANY) + buf.c_iflag |= _SYSV_IXANY; + if (termios_p->c_iflag & IMAXBEL) + buf.c_iflag |= _SYSV_IMAXBEL; + + buf.c_oflag = 0; + if (termios_p->c_oflag & OPOST) + buf.c_oflag |= _SYSV_OPOST; + if (termios_p->c_oflag & ONLCR) + buf.c_oflag |= _SYSV_ONLCR; + + /* So far, buf.c_cflag contains the speed in CBAUD. */ + if (termios_p->c_cflag & CSTOPB) + buf.c_cflag |= _SYSV_CSTOPB; + if (termios_p->c_cflag & CREAD) + buf.c_cflag |= _SYSV_CREAD; + if (termios_p->c_cflag & PARENB) + buf.c_cflag |= _SYSV_PARENB; + if (termios_p->c_cflag & PARODD) + buf.c_cflag |= _SYSV_PARODD; + if (termios_p->c_cflag & HUPCL) + buf.c_cflag |= _SYSV_HUPCL; + if (termios_p->c_cflag & CLOCAL) + buf.c_cflag |= _SYSV_CLOCAL; + switch (termios_p->c_cflag & CSIZE) + { + case CS5: + buf.c_cflag |= _SYSV_CS5; + break; + case CS6: + buf.c_cflag |= _SYSV_CS6; + break; + case CS7: + buf.c_cflag |= _SYSV_CS7; + break; + case CS8: + buf.c_cflag |= _SYSV_CS8; + break; + } + + buf.c_lflag = 0; + if (termios_p->c_lflag & ISIG) + buf.c_lflag |= _SYSV_ISIG; + if (termios_p->c_lflag & ICANON) + buf.c_lflag |= _SYSV_ICANON; + if (termios_p->c_lflag & ECHO) + buf.c_lflag |= _SYSV_ECHO; + if (termios_p->c_lflag & ECHOE) + buf.c_lflag |= _SYSV_ECHOE; + if (termios_p->c_lflag & ECHOK) + buf.c_lflag |= _SYSV_ECHOK; + if (termios_p->c_lflag & ECHONL) + buf.c_lflag |= _SYSV_ECHONL; + if (termios_p->c_lflag & NOFLSH) + buf.c_lflag |= _SYSV_NOFLSH; + if (termios_p->c_lflag & TOSTOP) + buf.c_lflag |= _SYSV_TOSTOP; + if (termios_p->c_lflag & ECHOCTL) + buf.c_lflag |= _SYSV_ECHOCTL; + if (termios_p->c_lflag & ECHOPRT) + buf.c_lflag |= _SYSV_ECHOPRT; + if (termios_p->c_lflag & ECHOKE) + buf.c_lflag |= _SYSV_ECHOKE; + if (termios_p->c_lflag & FLUSHO) + buf.c_lflag |= _SYSV_FLUSHO; + if (termios_p->c_lflag & PENDIN) + buf.c_lflag |= _SYSV_PENDIN; + if (termios_p->c_lflag & IEXTEN) + buf.c_lflag |= _SYSV_IEXTEN; + + buf.c_cc[_SYSV_VINTR] = termios_p->c_cc[VINTR]; + buf.c_cc[_SYSV_VQUIT] = termios_p->c_cc[VQUIT]; + buf.c_cc[_SYSV_VERASE] = termios_p->c_cc[VERASE]; + buf.c_cc[_SYSV_VKILL] = termios_p->c_cc[VKILL]; + if (buf.c_lflag & _SYSV_ICANON) + { + buf.c_cc[_SYSV_VEOF] = termios_p->c_cc[VEOF]; + buf.c_cc[_SYSV_VEOL] = termios_p->c_cc[VEOL]; + } + else + { + buf.c_cc[_SYSV_VMIN] = termios_p->c_cc[VMIN]; + buf.c_cc[_SYSV_VTIME] = termios_p->c_cc[VTIME]; + } + buf.c_cc[_SYSV_VEOL2] = termios_p->c_cc[VEOL2]; + + if (__ioctl (fd, ioctl_function, &buf) < 0) + return -1; + return 0; +} +libc_hidden_def (tcsetattr) diff --git a/ports/sysdeps/unix/sysv/aix/times.c b/ports/sysdeps/unix/sysv/aix/times.c new file mode 100644 index 000000000..8ebc40b02 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/times.c @@ -0,0 +1,30 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/times.h> + +/* Store the CPU time used by this process and all its + dead children (and their dead children) in BUFFER. + Return the elapsed real time, or (clock_t) -1 for errors. + All times are in CLK_TCKths of a second. */ +clock_t +__times (buffer) + struct tms *buffer; +{ + return times (buffer); +} diff --git a/ports/sysdeps/unix/sysv/aix/truncate.c b/ports/sysdeps/unix/sysv/aix/truncate.c new file mode 100644 index 000000000..247aebb33 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/truncate.c @@ -0,0 +1,28 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int ktruncate (const char *name, long long int length); + +int +__truncate (const char *name, off_t length) +{ + return ktruncate (name, length); +} +strong_alias (__truncate, truncate) diff --git a/ports/sysdeps/unix/sysv/aix/truncate64.c b/ports/sysdeps/unix/sysv/aix/truncate64.c new file mode 100644 index 000000000..3a219c018 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/truncate64.c @@ -0,0 +1,28 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +extern int ktruncate (const char *name, long long int length); + +int +__truncate64 (const char *name, off64_t length) +{ + return ktruncate (name, length); +} +strong_alias (__truncate64, truncate64) diff --git a/ports/sysdeps/unix/sysv/aix/uitrunc.c b/ports/sysdeps/unix/sysv/aix/uitrunc.c new file mode 100644 index 000000000..54cdc3af7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/uitrunc.c @@ -0,0 +1,42 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <math.h> + +/* The uitrunc function returns the nearest unsigned integer + to the x parameter in the direction of 0. This actions is + equivalent to truncation off the fraction bits of the x + parameter and then converting x to an unsigned integer. */ +unsigned int +__uitrunc (double x) +{ + double xrf; + unsigned int xr; + xr = (unsigned int) x; + xrf = (double) xr; + if (x >= 0.0) + if (x - xrf >= 0.5 && x - xrf < 1.0 && x + 1 > 0) + return x + 1; + else + return x; + else + if (xrf - x >= 0.5 && xrf - x < 1.0 && x - 1 < 0) + return x - 1; + else + return x; +} diff --git a/ports/sysdeps/unix/sysv/aix/ulimit.c b/ports/sysdeps/unix/sysv/aix/ulimit.c new file mode 100644 index 000000000..44fef6449 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/ulimit.c @@ -0,0 +1,37 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdarg.h> +#include <sys/resource.h> + +long int +__ulimit (int cmd, ...) +{ + va_list va; + long int arg; + long int res; + + va_start (va, cmd); + arg = va_arg (va, long int); + + res = ulimit (cmd, arg); + + va_end (va); + + return res; +} diff --git a/ports/sysdeps/unix/sysv/aix/umask.c b/ports/sysdeps/unix/sysv/aix/umask.c new file mode 100644 index 000000000..e8c45e40b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/umask.c @@ -0,0 +1,26 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/stat.h> + +mode_t +__umask (mask) + mode_t mask; +{ + return umask (mask); +} diff --git a/ports/sysdeps/unix/sysv/aix/uname.c b/ports/sysdeps/unix/sysv/aix/uname.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/uname.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/unlink.c b/ports/sysdeps/unix/sysv/aix/unlink.c new file mode 100644 index 000000000..6fe9b59c6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/unlink.c @@ -0,0 +1,26 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +int +__unlink (name) + const char *name; +{ + return unlink (name); +} diff --git a/ports/sysdeps/unix/sysv/aix/usleep.c b/ports/sysdeps/unix/sysv/aix/usleep.c new file mode 100644 index 000000000..a1d55eb2b --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/usleep.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <time.h> +#include <unistd.h> +#include <errno.h> + +extern int __libc_nanosleep (const struct timespec *requested_time, + struct timespec *remaining); + +/* Sleep USECONDS microseconds, or until a previously set timer goes off. */ +int +usleep (useconds) + useconds_t useconds; +{ + struct timespec ts ={.tv_sec = 0, .tv_nsec = (long int)useconds * 1000}; + __libc_nanosleep(&ts,&ts); + return 0; +} diff --git a/ports/sysdeps/unix/sysv/aix/ustat.c b/ports/sysdeps/unix/sysv/aix/ustat.c new file mode 100644 index 000000000..6036fbbff --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/ustat.c @@ -0,0 +1 @@ +/* This is a system call. */ diff --git a/ports/sysdeps/unix/sysv/aix/utimes.c b/ports/sysdeps/unix/sysv/aix/utimes.c new file mode 100644 index 000000000..9bef02ae0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/utimes.c @@ -0,0 +1,27 @@ +/* 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/time.h> + +int +__utimes (file, tvp) + const char *file; + const struct timeval tvp[2]; +{ + return utimes (file, tvp); +} diff --git a/ports/sysdeps/unix/sysv/aix/utmpx.h b/ports/sysdeps/unix/sysv/aix/utmpx.h new file mode 100644 index 000000000..1647bfe68 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/utmpx.h @@ -0,0 +1,89 @@ +/* Copyright (C) 1997, 1998, 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UTMPX_H +#define _UTMPX_H 1 + +#include <features.h> +#include <sys/time.h> + +/* Required according to Unix98. */ +#ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif + +/* Get system dependent values and data structures. */ +#include <bits/utmpx.h> + +#ifdef __USE_GNU +/* Compatibility names for the strings of the canonical file names. */ +# define UTMPX_FILE _PATH_UTMPX +# define UTMPX_FILENAME _PATH_UTMPX +# define WTMPX_FILE _PATH_WTMPX +# define WTMPX_FILENAME _PATH_WTMPX +#endif + +/* For the getutmp{,x} functions we need the `struct utmp'. */ +#ifdef __USE_GNU +struct utmp; +#endif + + +__BEGIN_DECLS + +/* Open user accounting database. */ +extern void setutxent (void) __THROW; + +/* Close user accounting database. */ +extern void endutxent (void) __THROW; + +/* Get the next entry from the user accounting database. */ +extern struct utmpx *getutxent (void) __THROW; + +/* Get the user accounting database entry corresponding to ID. */ +extern struct utmpx *getutxid (__const struct utmpx *__id) __THROW; + +/* Get the user accounting database entry corresponding to LINE. */ +extern struct utmpx *getutxline (__const struct utmpx *__line) __THROW; + +/* Write the entry UTMPX into the user accounting database. */ +extern struct utmpx *pututxline (__const struct utmpx *__utmpx) __THROW; + + +#ifdef __USE_GNU +/* Change name of the utmpx file to be examined. */ +extern int utmpxname (__const char *__file) __THROW; + +/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. */ +extern void updwtmpx (__const char *__wtmpx_file, + __const struct utmpx *__utmpx) __THROW; + + +/* Copy the information in UTMPX to UTMP. */ +extern void getutmp (__const struct utmpx *__utmpx, + struct utmp *__utmp) __THROW; + +/* Copy the information in UTMP to UTMPX. */ +extern void getutmpx (__const struct utmp *__utmp, + struct utmpx *__utmpx) __THROW; +#endif + +__END_DECLS + +#endif /* utmpx.h */ diff --git a/ports/sysdeps/unix/sysv/aix/wait3.c b/ports/sysdeps/unix/sysv/aix/wait3.c new file mode 100644 index 000000000..b0f7faa15 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/wait3.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1992, 93, 1995-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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <sys/wait.h> +#include <sys/types.h> +#include <stddef.h> + +extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options, + struct rusage *ru_loc, siginfo_t *infop); + +/* Wait for a child to exit. When one does, put its status in *STAT_LOC and + return its process ID. For errors return (pid_t) -1. If USAGE is not nil, + store information about the child's resource usage (as a `struct rusage') + there. If the WUNTRACED bit is set in OPTIONS, return status for stopped + children; otherwise don't. */ +pid_t +__wait3 (__WAIT_STATUS stat_loc, int options, struct rusage *usage) +{ + if (usage != NULL) + { + __set_errno (ENOSYS); + return (pid_t) -1; + } + return kwaitpid (stat_loc.__iptr, WAIT_ANY, options, usage, NULL); +} +strong_alias (__wait3, wait3) diff --git a/ports/sysdeps/unix/sysv/aix/wait4.c b/ports/sysdeps/unix/sysv/aix/wait4.c new file mode 100644 index 000000000..dd08f4278 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/wait4.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1991, 1992, 1995-1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stddef.h> +#include <sys/types.h> +#include <sys/wait.h> + +extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options, + struct rusage *ru_loc, siginfo_t *infop); + +pid_t +__wait4 (__pid_t pid, __WAIT_STATUS stat_loc, int options, + struct rusage *usage) +{ + return kwaitpid (stat_loc.__iptr, pid, options, usage, NULL); +} +strong_alias (__wait4, wait4) diff --git a/ports/sysdeps/unix/sysv/aix/waitid.c b/ports/sysdeps/unix/sysv/aix/waitid.c new file mode 100644 index 000000000..1d637df76 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/waitid.c @@ -0,0 +1,83 @@ +/* Pseudo implementation of waitid. + Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <signal.h> +#define __need_NULL +#include <stddef.h> +#include <sys/wait.h> +#include <sys/types.h> + +#include <assert.h> + +extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options, + struct rusage *ru_loc, siginfo_t *infop); + +int +__waitid (idtype, id, infop, options) + idtype_t idtype; + id_t id; + siginfo_t *infop; + int options; +{ + pid_t pid, child; + int status; + + switch (idtype) + { + case P_PID: + if(id <= 0) + goto invalid; + pid = (pid_t) id; + break; + case P_PGID: + if (id < 0 || id == 1) + goto invalid; + pid = (pid_t) -id; + break; + case P_ALL: + pid = -1; + break; + default: + invalid: + __set_errno (EINVAL); + return -1; + } + + /* Technically we're supposed to return EFAULT if infop is bogus, + but that would involve mucking with signals, which is + too much hassle. User will have to deal with SIGSEGV/SIGBUS. + We just check for a null pointer. */ + + if (infop == NULL) + { + __set_errno (EFAULT); + return -1; + } + + child = kwaitpid (&status, pid, options, NULL, infop); + + if (child == -1) + /* `waitpid' set `errno' for us. */ + return -1; + + return 0; +} +weak_alias (__waitid, waitid) diff --git a/ports/sysdeps/unix/sysv/aix/waitpid.c b/ports/sysdeps/unix/sysv/aix/waitpid.c new file mode 100644 index 000000000..19bcbab72 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/waitpid.c @@ -0,0 +1,53 @@ +/* Copyright (C) 1991,95,96,97,2000,02 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stddef.h> +#include <sys/wait.h> +#include <sys/types.h> + +extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options, + struct rusage *ru_loc, siginfo_t *infop); + + +/* Wait for a child matching PID to die. + If PID is greater than 0, match any process whose process ID is PID. + If PID is (pid_t) -1, match any process. + If PID is (pid_t) 0, match any process with the + same process group as the current process. + If PID is less than -1, match any process whose + process group is the absolute value of PID. + If the WNOHANG bit is set in OPTIONS, and that child + is not already dead, return (pid_t) 0. If successful, + return PID and store the dead child's status in STAT_LOC. + Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS, + return status for stopped children; otherwise don't. */ +pid_t +__libc_waitpid (pid_t pid, int *stat_loc, int options) +{ + if ((options & ~(WNOHANG|WUNTRACED)) != 0) + { + __set_errno (EINVAL); + return (pid_t) -1; + } + + return kwaitpid (stat_loc, pid, options, NULL, NULL); +} +weak_alias (__libc_waitpid, __waitpid) +libc_hidden_weak (__waitpid) +weak_alias (__libc_waitpid, waitpid) diff --git a/ports/sysdeps/unix/sysv/aix/write.c b/ports/sysdeps/unix/sysv/aix/write.c new file mode 100644 index 000000000..0cc5d33ac --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/write.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> + +#include "kernel_proto.h" + +ssize_t +__write (fd, ptr, n) + int fd; + const void *ptr; + size_t n; +{ + return kwrite (fd, ptr, n); +} +libc_hidden_def (__write) +/* AIX has no weak aliases (yet) but let's hope for better times. */ +weak_alias (__write, write) +strong_alias (__write, __libc_write) +libc_hidden_def (__libc_write) diff --git a/ports/sysdeps/unix/sysv/aix/writev.c b/ports/sysdeps/unix/sysv/aix/writev.c new file mode 100644 index 000000000..d0e574159 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/writev.c @@ -0,0 +1,38 @@ +/* Copyright (C) 1991, 1995-1998, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/uio.h> + +extern ssize_t kwritev (int fd, const struct iovec *iovp, size_t iovcnt, + long int ext); + +/* Read data from file descriptor FD, and put the result in the + buffers described by VECTOR, which is a vector of COUNT `struct iovec's. + The buffers are filled in the order specified. + Operates just like `read' (see <unistd.h>) except that data are + put in VECTOR instead of a contiguous buffer. */ +ssize_t +__libc_writev (fd, vector, count) + int fd; + const struct iovec *vector; + int count; +{ + return kwritev (fd, vector, count, 0); +} +strong_alias (__libc_writev, __writev) +weak_alias (__libc_writev, writev) diff --git a/ports/sysdeps/unix/sysv/aix/xstat.c b/ports/sysdeps/unix/sysv/aix/xstat.c new file mode 100644 index 000000000..c76ad0799 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/xstat.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/stat.h> + +#define STX_NORMAL 0x00 + +extern int statx (const char *pathname, struct stat *st, int len, int cmd); + +int +__xstat (int ver, const char *pathname, struct stat *st) +{ + assert (ver == 0); + return statx (pathname, st, sizeof (*st), STX_NORMAL); +} +hidden_def (__xstat) diff --git a/ports/sysdeps/unix/sysv/aix/xstat64.c b/ports/sysdeps/unix/sysv/aix/xstat64.c new file mode 100644 index 000000000..cb1bea118 --- /dev/null +++ b/ports/sysdeps/unix/sysv/aix/xstat64.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1999, 2000, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <sys/stat.h> + +#define STX_NORMAL 0x00 +#define STX_64 0x08 + + +extern int statx (const char *pathname, struct stat64 *st, int len, int cmd); + +int +__xstat64 (int ver, const char *pathname, struct stat64 *st) +{ + assert (ver == 0); + return statx (pathname, st, sizeof (*st), STX_NORMAL | STX_64); +} +hidden_def (__xstat64) diff --git a/ports/sysdeps/unix/sysv/hpux/bits/errno.h b/ports/sysdeps/unix/sysv/hpux/bits/errno.h new file mode 100644 index 000000000..c9903c6df --- /dev/null +++ b/ports/sysdeps/unix/sysv/hpux/bits/errno.h @@ -0,0 +1,34 @@ +/* Copyright (C) 1991, 1994, 1996, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file defines the `errno' constants. */ + +#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath) +#undef __need_Emath +#define __Emath_defined 1 + +#endif + +#ifdef _ERRNO_H +#define EBADF 9 +#define ENOMEM 12 +#define EINVAL 22 +#define ERANGE 34 +#define ENOMSG 35 +#define ENOSYS 251 +#endif diff --git a/ports/sysdeps/unix/sysv/hpux/bits/setjmp.h b/ports/sysdeps/unix/sysv/hpux/bits/setjmp.h new file mode 100644 index 000000000..216d7bdd6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/hpux/bits/setjmp.h @@ -0,0 +1,16 @@ +/* Define the machine-dependent type `jmp_buf'. Stub version. */ + +#ifndef _SETJMP_H +# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." +#endif + +/* XXX This should go into different files!!! */ + +#ifdef __hp9000s300 +typedef int __jmp_buf[100]; +#endif /* __hp9000s300 */ + +#ifdef __hp9000s800 +typedef double __jmp_buf[25]; +#endif /* __hp9000s800 */ + diff --git a/ports/sysdeps/unix/sysv/hpux/bits/stat.h b/ports/sysdeps/unix/sysv/hpux/bits/stat.h new file mode 100644 index 000000000..845b29765 --- /dev/null +++ b/ports/sysdeps/unix/sysv/hpux/bits/stat.h @@ -0,0 +1,128 @@ +/* Copyright (C) 1992, 95, 96, 97, 98, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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_SVR4 1 +#define _STAT_VER _STAT_VER_SVR4 /* The one defined below. */ + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_SVR4 1 +#define _MKNOD_VER _MKNOD_VER_SVR4 /* 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 + unsigned long int 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. */ + unsigned long int 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. */ + +/* POSIX.1b objects. */ +#define __S_TYPEISMQ(buf) (0) +#define __S_TYPEISSEM(buf) (0) +#define __S_TYPEISSHM(buf) (0) + +/* 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. */ diff --git a/ports/sysdeps/unix/sysv/hpux/bits/types.h b/ports/sysdeps/unix/sysv/hpux/bits/types.h new file mode 100644 index 000000000..e231841a8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/hpux/bits/types.h @@ -0,0 +1,128 @@ +/* Copyright (C) 1991,1992,1994-1998,2000,2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use <sys/types.h> instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include <features.h> + +#define __need_size_t +#include <stddef.h> + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; +#ifdef __GNUC__ +__extension__ typedef unsigned long long int __u_quad_t; +__extension__ typedef long long int __quad_t; +#else +typedef struct + { + long int __val[2]; + } __quad_t; +typedef struct + { + __u_long __val[2]; + } __u_quad_t; +#endif +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#ifdef __GNUC__ +__extension__ typedef signed long long int __int64_t; +__extension__ typedef unsigned long long int __uint64_t; +#endif +typedef __quad_t *__qaddr_t; + +typedef long int __dev_t; /* Type of device numbers. */ +typedef long int __uid_t; /* Type of user identifications. */ +typedef long int __gid_t; /* Type of group identifications. */ +typedef __u_long __ino_t; /* Type of file serial numbers. */ +typedef __u_short __mode_t; /* Type of file attribute bitmasks. */ +typedef short __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef long int __pid_t; /* Type of process identifications. */ +typedef long int __ssize_t; /* Type of a byte count, or error. */ +typedef __u_long __rlim_t; /* Type of resource counts. */ +typedef __quad_t __rlim64_t; /* Type of resource counts (LFS). */ +typedef long int __id_t; /* General type for ID. */ + +typedef struct + { + long int __val[2]; + } __fsid_t; /* Type of file system IDs. */ + +/* Everythin' else. */ +typedef long int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ + +typedef __u_long __clock_t; + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 2048 + + +typedef long int __key_t; + +/* Used in `struct shmid_ds'. */ +typedef unsigned short int __ipc_pid_t; + + +/* Types from the Large File Support interface. */ + +/* Type to count number os disk blocks. */ +typedef __u_long __blkcnt_t; +typedef __u_quad_t __blkcnt64_t; + +/* Type to count file system blocks. */ +typedef long int __fsblkcnt_t; +typedef __quad_t __fsblkcnt64_t; + +/* Type to count file system inodes. */ +typedef __u_long __fsfilcnt_t; +typedef __u_quad_t __fsfilcnt64_t; + +/* Type of file serial numbers. */ +typedef __u_long __ino64_t; + +/* Type of file sizes and offsets. */ +typedef __loff_t __off64_t; + +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + +/* Duplicates info from stdint.h but this is used in unistd.h. */ +typedef int __intptr_t; + +/* Duplicate info from sys/socket.h. */ +typedef unsigned int __socklen_t; + +#endif /* bits/types.h */ diff --git a/ports/sysdeps/unix/sysv/hpux/sysdep.h b/ports/sysdeps/unix/sysv/hpux/sysdep.h new file mode 100644 index 000000000..89a337711 --- /dev/null +++ b/ports/sysdeps/unix/sysv/hpux/sysdep.h @@ -0,0 +1,26 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* No underscores necessary. */ +#define NO_UNDERSCORES + +#include <sysdeps/hppa/sysdep.h> + +/* HPUX uses the usual syscall naming. */ +#define SYS_ify(name) SYS_##name diff --git a/ports/sysdeps/unix/sysv/irix4/Dist b/ports/sysdeps/unix/sysv/irix4/Dist new file mode 100644 index 000000000..09026af26 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/Dist @@ -0,0 +1,2 @@ +__handler.S +sigtramp.c diff --git a/ports/sysdeps/unix/sysv/irix4/Implies b/ports/sysdeps/unix/sysv/irix4/Implies new file mode 100644 index 000000000..35e1edd83 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/Implies @@ -0,0 +1,4 @@ +# Irix 4 has the set of things which are also common to BSD and SVR4. +unix/common +# Irix 4 has the canonical set of <sys/mman.h> system calls. +unix/mman diff --git a/ports/sysdeps/unix/sysv/irix4/Makefile b/ports/sysdeps/unix/sysv/irix4/Makefile new file mode 100644 index 000000000..d07981e8f --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/Makefile @@ -0,0 +1,25 @@ +# Copyright (C) 1993, 1997 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 Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +ifeq ($(subdir),signal) +sysdep_routines := $(sysdep_routines) sigtramp __handler +endif + +ifeq ($(subdir),misc) +sysdep_routines := $(sysdep_routines) syssgi sysmp +endif diff --git a/ports/sysdeps/unix/sysv/irix4/__handler.S b/ports/sysdeps/unix/sysv/irix4/__handler.S new file mode 100644 index 000000000..f02121a0c --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/__handler.S @@ -0,0 +1,117 @@ +/* Copyright (C) 1992, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@cs.widener.edu). + Also hacked by Ian Lance Taylor (ian@airs.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +/* This function saves all the registers, calls the + user function, and then executes a sigreturn system call. The + sigreturn call wants the address of a sigcontext structure. This + is all hideously system dependent and, for all intents and + purposes, undocumented. + + When we enter here, a3 holds the user's signal handler. We are + supposed to fill in the context given in a2, and then pass it and + the first two arguments to the user's function. If the user's + function returns, we execute a sigreturn system call. + + The sc_onstack, sc_mask and sc_pc elements of the context are + already set by the kernel. For some reason we don't have to save + the floating point state or the coprocessor state; the kernel may + have saved them for us, or it doesn't use them. */ + +.set noat +ENTRY (__handler) +#if 0 + /* Store zero and the asm temp reg. */ + sw $0, 12(a2) + sw AT, 16(a2) + + /* Put v1 in sc_regs[3]. */ + sw v1, 24(a2) + + /* Save the caller saved registers in sc_regs[8..15]. */ + sw t0, 44(a2) + sw t1, 48(a2) + sw t2, 52(a2) + sw t3, 56(a2) + sw t4, 60(a2) + sw t5, 64(a2) + sw t6, 68(a2) + sw t7, 72(a2) + + /* Save the callee saved registers in sc_regs[16..23]. */ + sw s0, 76(a2) + sw s1, 80(a2) + sw s2, 84(a2) + sw s3, 88(a2) + sw s4, 92(a2) + sw s5, 96(a2) + sw s6, 100(a2) + sw s7, 104(a2) + + /* Save the code generator registers in sc_regs[24] & sc_regs[25]. */ + sw t8, 108(a2) + sw t9, 112(a2) + + /* Save the kernel temp regs in sc_regs[26] & sc_regs[27]. */ + sw k0, 116(a2) + sw k1, 120(a2) + + /* Save the global pointer in sc_regs[28]. */ + sw gp, 124(a2) + + /* ... and also the return address in sc_regs[31]. */ + sw ra, 136(a2) + + /* Note: we don't save the stack pointer in sc_regs[29]; + instead, we use the one that was already there. */ +#if 0 + sw sp, 128(a2) +#endif + + /* Save the floating pointer in sc_regs[30]. */ + sw fp, 132(a2) + + /* Save the mul/div stuff in sc_mdlo and sc_mdhi. */ + mflo t0 + sw t0, 140(a2) + mfhi t0 + sw t0, 144(a2) + +#endif + /* Move the stack up six. This will save the context. */ + addu sp, sp, -24 + sw a2, 16(sp) + + /* Call their handler with the signal, code, and context; note + this will clobber the context. */ + .set noreorder + jal ra, a3 + nop + .set reorder + + /* When we come back, restore the context and pass it right + on into sigreturn(). */ + lw a0, 16(sp) + + /* Do a sigreturn syscall; this doesn't return. */ + li v0, SYS_sigreturn + syscall + nop diff --git a/ports/sysdeps/unix/sysv/irix4/bits/confname.h b/ports/sysdeps/unix/sysv/irix4/bits/confname.h new file mode 100644 index 000000000..ed334694c --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/bits/confname.h @@ -0,0 +1,84 @@ +/* `sysconf', `pathconf', and `confstr' NAME values. Irix 4 version. + Copyright (C) 1994, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UNISTD_H +# error "Never use <bits/confname.h> directly; include <unistd.h> instead." +#endif + +/* Values for the NAME argument to `pathconf' and `fpathconf'. */ +enum + { + _PC_LINK_MAX = 1, + _PC_MAX_CANON, + _PC_MAX_INPUT, + _PC_NAME_MAX, + _PC_PATH_MAX, + _PC_PIPE_BUF, + _PC_CHOWN_RESTRICTED, + _PC_NO_TRUNC, + _PC_VDISABLE + }; + +/* Values for the argument to `sysconf'. */ +enum + { + _SC_ARG_MAX = 1, + _SC_CHILD_MAX, + _SC_CLK_TCK, + _SC_NGROUPS_MAX, + _SC_OPEN_MAX, + _SC_JOB_CONTROL, + _SC_SAVED_IDS, + _SC_VERSION, + + /* Above are done by the Irix system call. + The rest are done by the C library (or are not really implemented). */ + + _SC_STREAM_MAX, + _SC_TZNAME_MAX, + _SC_PAGESIZE, + + /* Values for the argument to `sysconf' + corresponding to _POSIX2_* symbols. */ + _SC_BC_BASE_MAX, + _SC_BC_DIM_MAX, + _SC_BC_SCALE_MAX, + _SC_BC_STRING_MAX, + _SC_COLL_WEIGHTS_MAX, + _SC_EQUIV_CLASS_MAX, + _SC_EXPR_NEST_MAX, + _SC_LINE_MAX, + _SC_RE_DUP_MAX, + + _SC_2_VERSION, + _SC_2_C_BIND, + _SC_2_C_DEV, + _SC_2_FORT_DEV, + _SC_2_FORT_RUN, + _SC_2_SW_DEV, + _SC_2_LOCALEDEF + }; + +#ifdef __USE_POSIX2 +/* Values for the NAME argument to `confstr'. */ +enum + { + _CS_PATH /* The default search path. */ + }; +#endif diff --git a/ports/sysdeps/unix/sysv/irix4/bits/fcntl.h b/ports/sysdeps/unix/sysv/irix4/bits/fcntl.h new file mode 100644 index 000000000..5eb7c76eb --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/bits/fcntl.h @@ -0,0 +1,109 @@ +/* O_*, F_*, FD_* bit values for SGI Irix 4. + Copyright (C) 1994, 1997, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FCNTL_H +#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." +#endif + + +/* File access modes for `open' and `fcntl'. */ +#define O_RDONLY 0 /* Open read-only. */ +#define O_WRONLY 1 /* Open write-only. */ +#define O_RDWR 2 /* Open read/write. */ + + +/* Bits OR'd into the second argument to open. */ +#define O_CREAT 00400 /* Create file if it doesn't exist. */ +#define O_EXCL 02000 /* Fail if file already exists. */ +#define O_TRUNC 01000 /* Truncate file to zero length. */ +#ifdef __USE_MISC +#define O_SYNC 00020 /* Synchronous writes. */ +#define O_FSYNC O_SYNC +#define O_ASYNC 00100 /* Send SIGIO to owner when data is ready. */ +#endif + +/* File status flags for `open' and `fcntl'. */ +#define O_APPEND 000010 /* Writes append to the file. */ +#ifdef __USE_BSD +#define O_NDELAY 000004 /* Non-blocking I/O. */ +#endif +#define O_NONBLOCK 000200 /* POSIX.1 non-blocking I/O. */ + +/* Mask for file access modes. This is system-dependent in case + some system ever wants to define some other flavor of access. */ +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#define F_GETLK 5 /* Get record locking info. */ +#define F_SETLK 6 /* Set record locking info. */ +#define F_SETLKW 7 /* Set record locking info, wait. */ +#ifdef __USE_MISC +#define F_CHKFL 8 /* Check legality of file flag changes. */ +#define F_ALLOCSP 10 +#define F_FREESP 11 +#define F_SETBSDLK 12 /* Set Berkeley record lock. */ +#define F_SETBSDLKW 13 /* Set Berkeley record lock and wait. */ +#define F_RGETLK 20 /* Get info on a remote lock. */ +#define F_RSETLK 21 /* Set or unlock a remote lock. */ +#define F_RSETLKW 22 /* Set or unlock a remote lock and wait. */ +#endif +#if defined __USE_BSD || defined __USE_UNIX98 +#define F_GETOWN 10 /* Get owner; only works on sockets. */ +#define F_SETOWN 11 /* Set owner; only works on sockets. */ +#endif + + +/* File descriptor flags used with F_GETFD and F_SETFD. */ +#define FD_CLOEXEC 1 /* Close on exec. */ + + +#include <bits/types.h> + +/* The structure describing an advisory lock. This is the type of the third + argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + short int l_sysid; /* System ID where locking process resides. */ + short int l_pid; /* Process holding the lock. */ + }; + +/* Values for the `l_type' field of a `struct flock'. */ +#define F_RDLCK 1 /* Read lock. */ +#define F_WRLCK 2 /* Write lock. */ +#define F_UNLCK 3 /* Remove lock. */ + + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +#define FAPPEND O_APPEND +#define FFSYNC O_FSYNC +#define FASYNC O_ASYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY +#endif /* Use BSD. */ diff --git a/ports/sysdeps/unix/sysv/irix4/bits/mman.h b/ports/sysdeps/unix/sysv/irix4/bits/mman.h new file mode 100644 index 000000000..1549ff01c --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/bits/mman.h @@ -0,0 +1,64 @@ +/* Definitions for BSD-style memory management. Irix 4 version. + Copyright (C) 1994, 1995, 1996, 1997, 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_MMAN_H +#define _BITS_MMAN_H 1 + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_NONE 0x00 /* No access. */ +#define PROT_READ 0x04 /* Pages can be read. */ +#define PROT_WRITE 0x02 /* Pages can be written. */ +#define PROT_EXEC 0x01 /* Pages can be executed. */ +#ifdef __USE_MISC +# define PROT_EXECUTE PROT_EXEC +#endif + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes private; copy pages on write. */ +#ifdef __USE_BSD +# define MAP_TYPE 0x0f /* Mask for sharing type. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Map address must be exactly as requested. */ +#ifdef __USE_MISC +# define MAP_RENAME 0x20 /* Rename private pages to file. */ +# define MAP_AUTOGROW 0x40 /* Grow file as pages are written. */ +# define MAP_LOCAL 0x80 /* Copy the mapped region on fork. */ +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 0x1 /* Return immediately, don't fsync. */ +#define MS_INVALIDATE 0x2 /* Invalidate caches. */ + +#endif /* bits/mman.h */ diff --git a/ports/sysdeps/unix/sysv/irix4/bits/signum.h b/ports/sysdeps/unix/sysv/irix4/bits/signum.h new file mode 100644 index 000000000..c96ab9d2b --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/bits/signum.h @@ -0,0 +1,69 @@ +/* Signal number definitions. Irix4 version. + Copyright (C) 1994, 1996 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _SIGNAL_H + +/* This file defines the fake signal functions and signal + number constants for SGI Irix 4. */ + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) +#define SIG_DFL ((__sighandler_t) 0) +#define SIG_IGN ((__sighandler_t) 1) + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap. */ +#define SIGEMT 7 /* EMT trap. */ +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* Bus error. */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 /* Bad argument to system call*/ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGPWR 19 /* Power going down. */ +#define SIGSTOP 20 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 21 /* Keyboard stop (POSIX). */ +#define SIGPOLL 22 /* Same as SIGIO? (SVID). */ +#define SIGIO 23 /* I/O now possible. */ +#define SIGURG 24 /* Urgent condition on socket.*/ +#define SIGWINCH 25 /* Window size change. */ +#define SIGVTALRM 26 /* Virtual alarm clock. */ +#define SIGPROF 27 /* Profiling alarm clock. */ +#define SIGCONT 28 /* Continue (POSIX). */ +#define SIGTTIN 29 /* Background read from tty (POSIX). */ +#define SIGTTOU 30 /* Background write to tty (POSIX). */ +#define SIGXCPU 31 /* CPU limit exceeded. */ +#define SIGXFSZ 32 /* File size limit exceeded. */ + +#endif /* <signal.h> included. */ + +#define _NSIG 33 /* Biggest signal number + 1. */ diff --git a/ports/sysdeps/unix/sysv/irix4/bits/stat.h b/ports/sysdeps/unix/sysv/irix4/bits/stat.h new file mode 100644 index 000000000..33f575db1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/bits/stat.h @@ -0,0 +1,65 @@ +/* Copyright (C) 1992, 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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 + +struct stat + { + unsigned long st_ino; + short int st_dev; + unsigned short int st_mode; + short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + short int st_rdev; + long int st_size; + long int st_atime; + long int st_mtime; + long int st_ctime; + }; + +/* 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. */ + +/* POSIX.1b objects. */ +#define __S_TYPEISMQ(buf) (0) +#define __S_TYPEISSEM(buf) (0) +#define __S_TYPEISSHM(buf) (0) + +/* 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. */ diff --git a/ports/sysdeps/unix/sysv/irix4/dup2.c b/ports/sysdeps/unix/sysv/irix4/dup2.c new file mode 100644 index 000000000..86720b1b7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/dup2.c @@ -0,0 +1,3 @@ +#include <sysdeps/posix/__dup2.c> + +weak_alias (__dup2, dup2) diff --git a/ports/sysdeps/unix/sysv/irix4/fpathconf.c b/ports/sysdeps/unix/sysv/irix4/fpathconf.c new file mode 100644 index 000000000..236eb1a6b --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/fpathconf.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1994, 1995, 1997, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stddef.h> +#include <unistd.h> +#include <sys/syssgi.h> + +extern int __syssgi (int, ...); + +/* Get file-specific information about descriptor FD. */ +long int +__fpathconf (fd, name) + int fd; + int name; +{ + return __syssgi (SGI_PATHCONF, FPATHCONF, fd, name); +} + +weak_alias (__fpathconf, fpathconf) diff --git a/ports/sysdeps/unix/sysv/irix4/getgroups.c b/ports/sysdeps/unix/sysv/irix4/getgroups.c new file mode 100644 index 000000000..4c859eac8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/getgroups.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1994, 1995, 1997, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/syssgi.h> +#include <sys/types.h> +#include <grp.h> + +extern int __syssgi (int, ...); + +/* Set the group set for the current user to GROUPS (N of them). */ +int +__getgroups (n, groups) + size_t n; + gid_t *groups; +{ + return __syssgi (SGI_GETGROUPS, n, groups); +} + +weak_alias (__getgroups, getgroups) diff --git a/ports/sysdeps/unix/sysv/irix4/getpriority.c b/ports/sysdeps/unix/sysv/irix4/getpriority.c new file mode 100644 index 000000000..807ac2fba --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/getpriority.c @@ -0,0 +1,47 @@ +/* Copyright (C) 1994,96,97,2000,02, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <sys/resource.h> +#include <sys/sysmp.h> + +extern int __sysmp (int, ...); + +/* Return the highest priority of any process specified by WHICH and WHO + (see <sys/resource.h>); if WHO is zero, the current process, process group, + or user (as specified by WHO) is used. A lower priority number means higher + priority. Priorities range from PRIO_MIN to PRIO_MAX. */ +int +getpriority (which, who) + enum __priority_which which; + id_t who; +{ + switch (which) + { + case PRIO_PROCESS: + return __sysmp (MP_SCHED, MPTS_GTNICE_PROC, who); + case PRIO_PGRP: + return __sysmp (MP_SCHED, MPTS_GTNICE_PGRP, who); + case PRIO_USER: + return __sysmp (MP_SCHED, MPTS_GTNICE_USER, who); + } + + __set_errno (EINVAL); + return -1; +} +libc_hidden_def (getpriority) diff --git a/ports/sysdeps/unix/sysv/irix4/getrusage.c b/ports/sysdeps/unix/sysv/irix4/getrusage.c new file mode 100644 index 000000000..3cabbdf3e --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/getrusage.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1994, 1995, 1997, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/resource.h> +#include <errno.h> +#include <sys/syssgi.h> + +extern int __syssgi (int, ...); + +/* Return resource usage information on process indicated by WHO + and put it in *USAGE. Returns 0 for success, -1 for failure. */ +int +__getrusage (who, usage) + enum __rusage_who who; + struct rusage *usage; +{ + return __syssgi (SGI_RUSAGE, who, usage); +} + +weak_alias (__getrusage, getrusage) diff --git a/ports/sysdeps/unix/sysv/irix4/gettimeofday.c b/ports/sysdeps/unix/sysv/irix4/gettimeofday.c new file mode 100644 index 000000000..d7055be82 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/gettimeofday.c @@ -0,0 +1 @@ +#include <sysdeps/posix/gettimeofday.c> diff --git a/ports/sysdeps/unix/sysv/irix4/pathconf.c b/ports/sysdeps/unix/sysv/irix4/pathconf.c new file mode 100644 index 000000000..51da0c563 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/pathconf.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1994, 1995, 1997, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stddef.h> +#include <unistd.h> +#include <sys/syssgi.h> + +extern int __syssgi (int, ...); + +/* Get file-specific information about PATH. */ +long int +__pathconf (path, name) + const char *path; + int name; +{ + return __syssgi (SGI_PATHCONF, PATHCONF, path, name); +} + +weak_alias (__pathconf, pathconf) diff --git a/ports/sysdeps/unix/sysv/irix4/readv.c b/ports/sysdeps/unix/sysv/irix4/readv.c new file mode 100644 index 000000000..baa976da6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/readv.c @@ -0,0 +1 @@ +#include <sysdeps/posix/readv.c> diff --git a/ports/sysdeps/unix/sysv/irix4/reboot.c b/ports/sysdeps/unix/sysv/irix4/reboot.c new file mode 100644 index 000000000..4d90e6fc5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/reboot.c @@ -0,0 +1 @@ +#include <sysdeps/generic/reboot.c> diff --git a/ports/sysdeps/unix/sysv/irix4/setgroups.c b/ports/sysdeps/unix/sysv/irix4/setgroups.c new file mode 100644 index 000000000..cca816bcf --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/setgroups.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1994,97,2002, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/syssgi.h> +#include <sys/types.h> +#include <grp.h> + +extern int __syssgi (int, ...); + +/* Set the group set for the current user to GROUPS (N of them). */ +int +setgroups (n, groups) + size_t n; + const gid_t *groups; +{ + return __syssgi (SGI_SETGROUPS, n, groups); +} +libc_hidden_def (setgroups) diff --git a/ports/sysdeps/unix/sysv/irix4/setpriority.c b/ports/sysdeps/unix/sysv/irix4/setpriority.c new file mode 100644 index 000000000..99353187f --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/setpriority.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1994,96,97,2000,02 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <sys/resource.h> +#include <sys/sysmp.h> + +int +setpriority (which, who, prio) + enum __priority_which which; + id_t who; + int prio; +{ + switch (which) + { + case PRIO_PROCESS: + return __sysmp (MP_SCHED, MPTS_RENICE_PROC, who, prio); + case PRIO_PGRP: + return __sysmp (MP_SCHED, MPTS_RENICE_PGRP, who, prio); + case PRIO_USER: + return __sysmp (MP_SCHED, MPTS_RENICE_USER, who, prio); + } + + __set_errno (EINVAL); + return -1; +} +libc_hidden_def (setpriority) diff --git a/ports/sysdeps/unix/sysv/irix4/sigreturn.S b/ports/sysdeps/unix/sysv/irix4/sigreturn.S new file mode 100644 index 000000000..296db1d47 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/sigreturn.S @@ -0,0 +1,26 @@ +/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@cs.widener.edu). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +ENTRY(__sigreturn) + li v0, SYS_sigreturn + syscall + +weak_alias (__sigreturn, sigreturn) diff --git a/ports/sysdeps/unix/sysv/irix4/sigtramp.c b/ports/sysdeps/unix/sysv/irix4/sigtramp.c new file mode 100644 index 000000000..f8de75a7c --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/sigtramp.c @@ -0,0 +1,53 @@ +/* Copyright (C) 1992, 1997, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* The sigvec system call on MIPS Ultrix takes an additional + parameter, which is the address that is actually called when the + signal occurs. + + When a signal occurs, we arrange for the kernel to call __handler. + That will save the frame and stack pointers into the context, and + then jump to this routine. See __handler.S. + + This code is based on sysdeps/unix/bsd/sun4/sigtramp.c, but it's + different because since we get passed the user signal handler we + don't actually need a trampoline. */ + +#include <signal.h> +#include <stddef.h> +#include <errno.h> + +/* The user's signal handler is called with three arguments. */ +typedef void (*handler_type) (int sig, int code, struct sigcontext *); + +/* Defined in signal.S. */ +extern __sighandler_t __raw_signal (int sig, __sighandler_t func, + void (*)(int sig, int code, + struct sigcontext *, + handler_type)); + +extern void __handler (int sig, int code, struct sigcontext *, + handler_type); + +__sighandler_t +signal (sig, func) + int sig; + __sighandler_t func; +{ + return __raw_signal (sig, func, __handler); +} diff --git a/ports/sysdeps/unix/sysv/irix4/start.c b/ports/sysdeps/unix/sysv/irix4/start.c new file mode 100644 index 000000000..fdda8809e --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/start.c @@ -0,0 +1,75 @@ +/* Copyright (C) 1991,1992,1995,1996,1997,2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stdlib.h> +#include <unistd.h> + +#ifndef __GNUC__ + #error This file uses GNU C extensions; you must compile with GCC. +#endif + +/* The first piece of initialized data. */ +int __data_start = 0; + +extern void __libc_init (int argc, char **argv, char **envp); +extern int main (int argc, char **argv, char **envp); + +/* Use the stack pointer to access the arguments. This assumes that + we can guess how big the frame will be. */ +register long int sp asm("sp"); +#ifdef __OPTIMIZE__ +#define STACKSIZE 8 +#else +#define STACKSIZE 10 +#endif + +void +__start () +{ + int argc; + char **argv, **envp; + + /* Set up the global pointer. */ + asm volatile ("la $28,_gp"); + argc = ((int *) sp)[STACKSIZE]; + argv = (char **) &((int *) sp)[STACKSIZE + 1]; + envp = &argv[argc + 1]; + __environ = envp; + + __libc_init (argc, argv, envp); + errno = 0; + exit (main (argc, argv, envp)); +} diff --git a/ports/sysdeps/unix/sysv/irix4/swapon.c b/ports/sysdeps/unix/sysv/irix4/swapon.c new file mode 100644 index 000000000..54885a883 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/swapon.c @@ -0,0 +1 @@ +#include <sysdeps/generic/swapon.c> diff --git a/ports/sysdeps/unix/sysv/irix4/syscalls.list b/ports/sysdeps/unix/sysv/irix4/syscalls.list new file mode 100644 index 000000000..a57529e9a --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/syscalls.list @@ -0,0 +1,8 @@ +# File name Caller Syscall name # args Strong name Weak names + +getpgid - bsdgetpgrp 1 __getpgid getpgid +msync - msync 3 msync +setpgid - bsdsetpgrp 2 __setpgid setpgid +signal - signal 3 __raw_signal +sysmp - sysmp 4 __sysmp +syssgi - syssgi 2 __syssgi diff --git a/ports/sysdeps/unix/sysv/irix4/sysconf.c b/ports/sysdeps/unix/sysv/irix4/sysconf.c new file mode 100644 index 000000000..ef7606eda --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/sysconf.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1994, 1995, 1997, 2002, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> +#include <sys/syssgi.h> + +extern int __syssgi ((int, ...); + +/* Get the value of the system variable NAME. */ +long int +__sysconf (name) + int name; +{ + if (name == _SC_TZNAME_MAX) + return __tzname_max (); + + return __syssgi (SGI_SYSCONF, name); +} + +weak_alias (__sysconf, sysconf) +libc_hidden_def (__sysconf) diff --git a/ports/sysdeps/unix/sysv/irix4/uname.S b/ports/sysdeps/unix/sysv/irix4/uname.S new file mode 100644 index 000000000..0b6536fd2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/uname.S @@ -0,0 +1,26 @@ +/* Copyright (C) 1994, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +ENTRY(uname) + li a2, 0 + li a3, 0 +SYSCALL__ (utssys, 1) + j ra + move v0, zero diff --git a/ports/sysdeps/unix/sysv/irix4/wait.S b/ports/sysdeps/unix/sysv/irix4/wait.S new file mode 100644 index 000000000..90cd5948e --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/wait.S @@ -0,0 +1,43 @@ +/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@cs.widener.edu). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +.set noreorder + +ENTRY(__wait) + /* Prep it for wait */ + move a1, zero + move a2, zero + + li v0, SYS_wait + syscall + beq a3, zero, noerror + nop + j syscall_error + nop +noerror: + beq a0, zero, noarg + nop + sw v1, 0(a0) + nop +noarg: + ret + +weak_alias (__wait, wait) diff --git a/ports/sysdeps/unix/sysv/irix4/waitpid.c b/ports/sysdeps/unix/sysv/irix4/waitpid.c new file mode 100644 index 000000000..8378982ac --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/waitpid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/bsd4.4/waitpid.c> diff --git a/ports/sysdeps/unix/sysv/irix4/writev.c b/ports/sysdeps/unix/sysv/irix4/writev.c new file mode 100644 index 000000000..0dc6a7601 --- /dev/null +++ b/ports/sysdeps/unix/sysv/irix4/writev.c @@ -0,0 +1 @@ +#include <sysdeps/posix/writev.c> diff --git a/ports/sysdeps/unix/sysv/isc2.2/syscalls.list b/ports/sysdeps/unix/sysv/isc2.2/syscalls.list new file mode 100644 index 000000000..0ea253e3c --- /dev/null +++ b/ports/sysdeps/unix/sysv/isc2.2/syscalls.list @@ -0,0 +1,2 @@ +# File name Caller Syscall name # args Strong name Weak names + diff --git a/ports/sysdeps/unix/sysv/linux/am33/Makefile b/ports/sysdeps/unix/sysv/linux/am33/Makefile new file mode 100644 index 000000000..ece39e8a4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/Makefile @@ -0,0 +1,3 @@ +ifeq ($(subdir),misc) +sysdep_routines += setfsgid setfsuid +endif diff --git a/ports/sysdeps/unix/sysv/linux/am33/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/am33/bits/fcntl.h new file mode 100644 index 000000000..4c276c548 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/bits/fcntl.h @@ -0,0 +1,179 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 1995, 1996, 1997, 1998, 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 _FCNTL_H +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." +#endif + + +#include <sys/types.h> + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 + +#ifdef __USE_GNU +# define O_DIRECT 040000 /* Direct disk access. */ +# define O_DIRECTORY 0200000 /* Must be a directory. */ +# define O_NOFOLLOW 0400000 /* Do not follow links. */ +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0100000 +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 5 /* Get record locking info. */ +# define F_SETLK 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#endif +#define F_GETLK64 12 /* Get record locking info. */ +#define F_SETLK64 13 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 14 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_XOPEN2K +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* For old implementation of bsd flock(). */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation. */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif diff --git a/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h b/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h new file mode 100644 index 000000000..99fceda88 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h @@ -0,0 +1,97 @@ +/* Definitions for POSIX memory map interface. Linux/AM33 version. + Copyright (C) 1997, 2000, 2001, 2004 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_MMAN_H +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x2000 /* Lock the mapping. */ +# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 1 /* Sync memory asynchronously. */ +#define MS_SYNC 4 /* Synchronous memory sync. */ +#define MS_INVALIDATE 2 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 2 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ +#endif diff --git a/ports/sysdeps/unix/sysv/linux/am33/brk.c b/ports/sysdeps/unix/sysv/linux/am33/brk.c new file mode 100644 index 000000000..f56736359 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/brk.c @@ -0,0 +1,46 @@ +/* brk system call for Linux/am33. + Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Alexandre Oliva <aoliva@redhat.com>. + Based on ../i386/brk.c. + + 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 <unistd.h> +#include <sysdep.h> + +/* This must be initialized data because commons can't have aliases. */ +void *__curbrk = 0; + +int +__brk (void *addr) +{ + void *newbrk; + + newbrk = INLINE_SYSCALL (brk, 1, __ptrvalue (addr)); + + __curbrk = newbrk; + + if (newbrk < addr) + { + __set_errno (ENOMEM); + return -1; + } + + return 0; +} +weak_alias (__brk, brk) diff --git a/ports/sysdeps/unix/sysv/linux/am33/chown.c b/ports/sysdeps/unix/sysv/linux/am33/chown.c new file mode 100644 index 000000000..819923eb4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/chown.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/chown.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/clone.S b/ports/sysdeps/unix/sysv/linux/am33/clone.S new file mode 100644 index 000000000..26ba740d2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/clone.S @@ -0,0 +1,81 @@ +/* Copyright 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Alexandre Oliva <aoliva@redhat.com>. + Based on ../i386/clone.S. + + 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. */ + +/* clone() is even more special than fork() as it mucks with stacks + and invokes a function in the right context after its all over. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <asm-syntax.h> +#include <bp-sym.h> + +/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ + + .text +ENTRY (BP_SYM (__clone)) + /* Sanity check arguments. */ + cmp 0,d0 /* no NULL function pointers */ + beq L(error_inval) + cmp 0,d1 /* no NULL stack pointers */ + beq L(error_inval) + + /* Allocate room for a function call in the new stack, and + store fn and arg in it. They will be read back in + thread_start. */ + mov d1,a0 + sub 12,a0 + mov d0,(a0) + mov (16,sp),d1 + mov d1,(4,a0) + + /* Do the system call */ + mov a0,d1 + mov (12,sp),a0 + mov SYS_ify(clone),d0 + syscall 0 + + cmp 0,d0 + beq thread_start + blt L(to_SYSCALL_ERROR_LABEL) + +L(pseudo_end): + ret + +L(error_inval): + mov -EINVAL,d0 +L(to_SYSCALL_ERROR_LABEL): + jmp SYSCALL_ERROR_LABEL + +thread_start: + mov 0,a3 /* terminate the stack frame */ + mov (4,sp),d0 + mov (sp),a0 + calls (a0) +#ifdef PIC +L(here): + mov pc,a2 + add _GLOBAL_OFFSET_TABLE_-(L(here) - .),a2 +#endif + call JUMPTARGET (_exit),[],0 + +PSEUDO_END (BP_SYM (__clone)) + +weak_alias (BP_SYM (__clone), BP_SYM (clone)) diff --git a/ports/sysdeps/unix/sysv/linux/am33/configure b/ports/sysdeps/unix/sysv/linux/am33/configure new file mode 100755 index 000000000..d4490122b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/configure @@ -0,0 +1,4 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for am33/sysdeps/unix/sysv/linux/am33 + +arch_minimum_kernel=2.4.0 diff --git a/ports/sysdeps/unix/sysv/linux/am33/configure.in b/ports/sysdeps/unix/sysv/linux/am33/configure.in new file mode 100644 index 000000000..a94c370cf --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/configure.in @@ -0,0 +1,4 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for am33/sysdeps/unix/sysv/linux/am33 + +arch_minimum_kernel=2.4.0 diff --git a/ports/sysdeps/unix/sysv/linux/am33/fchown.c b/ports/sysdeps/unix/sysv/linux/am33/fchown.c new file mode 100644 index 000000000..3a69ecc9e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/fchown.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/fchown.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/fcntl.c b/ports/sysdeps/unix/sysv/linux/am33/fcntl.c new file mode 100644 index 000000000..ea951bc4f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/fcntl.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/fcntl.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/fxstat.c b/ports/sysdeps/unix/sysv/linux/am33/fxstat.c new file mode 100644 index 000000000..4f219f0b9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/fxstat.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/fxstat.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getegid.c b/ports/sysdeps/unix/sysv/linux/am33/getegid.c new file mode 100644 index 000000000..37b4b4a53 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getegid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getegid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/geteuid.c b/ports/sysdeps/unix/sysv/linux/am33/geteuid.c new file mode 100644 index 000000000..ebcb555b5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/geteuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/geteuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getgid.c b/ports/sysdeps/unix/sysv/linux/am33/getgid.c new file mode 100644 index 000000000..0a4d6061f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getgroups.c b/ports/sysdeps/unix/sysv/linux/am33/getgroups.c new file mode 100644 index 000000000..20a716610 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getgroups.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getgroups.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getmsg.c b/ports/sysdeps/unix/sysv/linux/am33/getmsg.c new file mode 100644 index 000000000..3a1fa0852 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getmsg.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getmsg.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getresgid.c b/ports/sysdeps/unix/sysv/linux/am33/getresgid.c new file mode 100644 index 000000000..b703a414c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getresgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getresgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getresuid.c b/ports/sysdeps/unix/sysv/linux/am33/getresuid.c new file mode 100644 index 000000000..0b14cefe3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getresuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getresuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getrlimit.c b/ports/sysdeps/unix/sysv/linux/am33/getrlimit.c new file mode 100644 index 000000000..fc06dbd64 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getrlimit.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getrlimit.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/getuid.c b/ports/sysdeps/unix/sysv/linux/am33/getuid.c new file mode 100644 index 000000000..d682c79a4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/getuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/lchown.c b/ports/sysdeps/unix/sysv/linux/am33/lchown.c new file mode 100644 index 000000000..c89de99ba --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/lchown.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/lchown.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/linuxthreads/sysdep-cancel.h b/ports/sysdeps/unix/sysv/linux/am33/linuxthreads/sysdep-cancel.h new file mode 100644 index 000000000..56d3bb62f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/linuxthreads/sysdep-cancel.h @@ -0,0 +1,159 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Alexandre Oliva <aoliva@redhat.com> + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <tls.h> +#include <pt-machine.h> +#ifndef __ASSEMBLER__ +# include <linuxthreads/internals.h> +#endif + +#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt + +# undef PSEUDO +# define PSEUDO(name, syscall_name, args) \ + .text ; \ + ENTRY (name) \ + PUSHARGS_##args \ + DOARGS_##args \ + SINGLE_THREAD_P; \ + bne L(pseudo_cancel); \ + mov SYS_ify (syscall_name),d0; \ + syscall 0 \ + POPARGS_##args ; \ + cmp -126,d0; \ + bls L(pseudo_end); \ + jmp SYSCALL_ERROR_LABEL; \ + L(pseudo_cancel): \ + add -(16+STACK_SPACE (args)),sp; \ + SAVE_ARGS_##args \ + CENABLE \ + mov d0,r0; \ + LOAD_ARGS_##args \ + mov SYS_ify (syscall_name),d0; \ + syscall 0; \ + mov d0,(12,sp); \ + mov r0,d0; \ + CDISABLE \ + mov (12,sp),d0; \ + add +16+STACK_SPACE (args),sp \ + POPARGS_##args ; \ + cmp -126,d0; \ + bls L(pseudo_end); \ + jmp SYSCALL_ERROR_LABEL; \ + L(pseudo_end): \ + mov d0,a0 + +/* Reserve up to 2 stack slots for a0 and d1, but fewer than that if + we don't have that many arguments. */ +# define STACK_SPACE(n) (((((n) < 3) * (2 - (n))) + 2) * 4) + +# define SAVE_ARGS_0 +# define SAVE_ARGS_1 mov a0,(20,sp) ; +# define SAVE_ARGS_2 SAVE_ARGS_1 mov d1,(24,sp) ; +# define SAVE_ARGS_3 SAVE_ARGS_2 +# define SAVE_ARGS_4 SAVE_ARGS_3 +# define SAVE_ARGS_5 SAVE_ARGS_4 +# define SAVE_ARGS_6 SAVE_ARGS_5 + +# define LOAD_ARGS_0 +# define LOAD_ARGS_1 mov (20,sp),a0 ; +# define LOAD_ARGS_2 LOAD_ARGS_1 mov (24,sp),d1 ; +# define LOAD_ARGS_3 LOAD_ARGS_2 +# define LOAD_ARGS_4 LOAD_ARGS_3 +# define LOAD_ARGS_5 LOAD_ARGS_4 +# define LOAD_ARGS_6 LOAD_ARGS_5 + +# ifdef IS_IN_libpthread +# define CENABLE call __pthread_enable_asynccancel,[],0; +# define CDISABLE call __pthread_disable_asynccancel,[],0; +# elif defined IS_IN_librt +# ifdef PIC +# define CENABLE movm [a2],(sp); \ + 1: mov pc,a2; \ + add _GLOBAL_OFFSET_TABLE_-(1b-.),a2; \ + call +__librt_enable_asynccancel@PLT,[],0; \ + movm (sp),[a2]; +# define CENABLE movm [a2],(sp); \ + 1: mov pc,a2; \ + add _GLOBAL_OFFSET_TABLE_-(1b-.),a2; \ + call +__librt_disable_asynccancel@PLT,[],0; \ + movm (sp),[a2]; +# else +# define CENABLE call +__librt_enable_asynccancel,[],0; +# define CDISABLE call +__librt_disable_asynccancel,[],0; +# endif +# else +# define CENABLE call +__libc_enable_asynccancel,[],0; +# define CDISABLE call +__libc_disable_asynccancel,[],0; +# endif + +#if !defined NOT_IN_libc +# define __local_multiple_threads __libc_multiple_threads +#elif defined IS_IN_libpthread +# define __local_multiple_threads __pthread_multiple_threads +#else +# define __local_multiple_threads __librt_multiple_threads +#endif + +# ifndef __ASSEMBLER__ +# if defined FLOATING_STACKS && USE___THREAD && defined PIC +# define SINGLE_THREAD_P \ + __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ + p_header.data.multiple_threads) == 0, 1) +# else +extern int __local_multiple_threads +# if !defined NOT_IN_libc || defined IS_IN_libpthread + attribute_hidden; +# else + ; +# endif +# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) +# endif +# else +# if !defined PIC +# define SINGLE_THREAD_P \ + mov (+__local_multiple_threads),d0; \ + cmp 0,d0 +# elif !defined NOT_IN_libc || defined IS_IN_libpthread +# define SINGLE_THREAD_P \ + movm [a2],(sp); \ + 1: mov pc,a2; \ + add _GLOBAL_OFFSET_TABLE_-(1b-.),a2; \ + mov (+__local_multiple_threads@GOTOFF,a2),d0; \ + movm (sp),[a2]; \ + cmp 0,d0 +# else +# define SINGLE_THREAD_P \ + movm [a2],(sp); \ + 1: mov pc,a2; \ + add _GLOBAL_OFFSET_TABLE_-(1b-.),a2; \ + mov (+__local_multiple_threads@GOT,a2),a2; \ + mov (a2),d0; \ + movm (sp),[a2]; \ + cmp 0,d0 +# endif +# endif + +#elif !defined __ASSEMBLER__ + +/* This code should never be used but we define it anyhow. */ +# define SINGLE_THREAD_P (1) + +#endif diff --git a/ports/sysdeps/unix/sysv/linux/am33/lockf64.c b/ports/sysdeps/unix/sysv/linux/am33/lockf64.c new file mode 100644 index 000000000..a88f5a784 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/lockf64.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/lockf64.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/lxstat.c b/ports/sysdeps/unix/sysv/linux/am33/lxstat.c new file mode 100644 index 000000000..0efa0aea4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/lxstat.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/lxstat.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/profil-counter.h b/ports/sysdeps/unix/sysv/linux/am33/profil-counter.h new file mode 100644 index 000000000..31422bb7e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/profil-counter.h @@ -0,0 +1,27 @@ +/* Low-level statistical profiling support function. Linux/am33 version. + Copyright (C) 1996, 1997, 1998, 2001 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 <signal.h> +#include <sigcontextinfo.h> + +static void +profil_counter (int signo, SIGCONTEXT scp) +{ + profil_count ((void *) GET_PC (scp)); +} diff --git a/ports/sysdeps/unix/sysv/linux/am33/putmsg.c b/ports/sysdeps/unix/sysv/linux/am33/putmsg.c new file mode 100644 index 000000000..ebc1680ca --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/putmsg.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/putmsg.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setegid.c b/ports/sysdeps/unix/sysv/linux/am33/setegid.c new file mode 100644 index 000000000..2e3a54c89 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setegid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setegid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/seteuid.c b/ports/sysdeps/unix/sysv/linux/am33/seteuid.c new file mode 100644 index 000000000..18e41d08c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/seteuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/seteuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setfsgid.c b/ports/sysdeps/unix/sysv/linux/am33/setfsgid.c new file mode 100644 index 000000000..088671256 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setfsgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setfsgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setfsuid.c b/ports/sysdeps/unix/sysv/linux/am33/setfsuid.c new file mode 100644 index 000000000..a9f22eb8a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setfsuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setfsuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setgid.c b/ports/sysdeps/unix/sysv/linux/am33/setgid.c new file mode 100644 index 000000000..377021d9e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setgroups.c b/ports/sysdeps/unix/sysv/linux/am33/setgroups.c new file mode 100644 index 000000000..cb9a7708e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setgroups.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setgroups.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setregid.c b/ports/sysdeps/unix/sysv/linux/am33/setregid.c new file mode 100644 index 000000000..99c57ad20 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setregid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setregid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setresgid.c b/ports/sysdeps/unix/sysv/linux/am33/setresgid.c new file mode 100644 index 000000000..daca1a483 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setresgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setresgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setresuid.c b/ports/sysdeps/unix/sysv/linux/am33/setresuid.c new file mode 100644 index 000000000..3aeabe9ad --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setresuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setresuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setreuid.c b/ports/sysdeps/unix/sysv/linux/am33/setreuid.c new file mode 100644 index 000000000..8ad61226e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setreuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setreuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setrlimit.c b/ports/sysdeps/unix/sysv/linux/am33/setrlimit.c new file mode 100644 index 000000000..bfaef74c3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setrlimit.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setrlimit.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/setuid.c b/ports/sysdeps/unix/sysv/linux/am33/setuid.c new file mode 100644 index 000000000..de394379b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/setuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/am33/socket.S b/ports/sysdeps/unix/sysv/linux/am33/socket.S new file mode 100644 index 000000000..2c09239f3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/socket.S @@ -0,0 +1,73 @@ +/* Copyright 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Alexandre Oliva <aoliva@redhat.com>. + Based on ../i386/socket.S. + + 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 <sysdep.h> +#include <socketcall.h> + +#define P(a, b) P2(a, b) +#define P2(a, b) a##b + + .text +/* The socket-oriented system calls are handled unusally in Linux. + They are all gated through the single `socketcall' system call number. + `socketcall' takes two arguments: the first is the subcode, specifying + which socket function is being called; and the second is a pointer to + the arguments to the specific function. + + The .S files for the other calls just #define socket and #include this. */ + +#ifndef __socket +#ifndef NO_WEAK_ALIAS +#define __socket P(__,socket) +#else +#define __socket socket +#endif +#endif + +.globl __socket +ENTRY (__socket) + + mov d0,(4,sp) + mov d1,(8,sp) + + mov SYS_ify(socketcall),d0 /* System call number in d0. */ + + /* Use ## so `socket' is a separate token that might be #define'd. */ + mov P(SOCKOP_,socket),a0 /* Subcode is first arg to syscall. */ + mov sp,d1 + add 4,d1 /* Address of args is 2nd arg. */ + + /* Do the system call trap. */ + syscall 0 + + /* d0 is < 0 if there was an error. */ + cmp -126,d0 + bls L(pseudo_end) + jmp SYSCALL_ERROR_LABEL + + /* Successful; return the syscall's value. */ +L(pseudo_end): + ret + +PSEUDO_END (__socket) + +#ifndef NO_WEAK_ALIAS +weak_alias (__socket, socket) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/am33/syscall.S b/ports/sysdeps/unix/sysv/linux/am33/syscall.S new file mode 100644 index 000000000..180e5822c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/syscall.S @@ -0,0 +1,43 @@ +/* Copyright (C) 1995, 1996, 1998, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Alexandre Oliva <aoliva@redhat.com>. + Based on ../i386/syscall.S. + + 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 <sysdep.h> + +/* Please consult the file sysdeps/unix/sysv/linux/am33/sysdep.h for + more information about the value -126 used below.*/ + + .text +ENTRY (syscall) + movm [d2,d3,a2,a3],(sp) /* Save register contents. */ + mov d1,a0 + mov (28,sp),d1 + mov (32,sp),a3 + mov (36,sp),a2 + mov (40,sp),d3 + mov (44,sp),d2 + syscall 0 /* Do the system call. */ + movm (sp),[d2,d3,a2,a3] /* Restore register contents. */ + cmp -126,d0 /* Check for error. */ + bls L(pseudo_end) + jmp SYSCALL_ERROR_LABEL /* Jump to error handler if error. */ +L(pseudo_end): + ret /* Return to caller. */ + +PSEUDO_END (syscall) diff --git a/ports/sysdeps/unix/sysv/linux/am33/sysdep.S b/ports/sysdeps/unix/sysv/linux/am33/sysdep.S new file mode 100644 index 000000000..b41bfce40 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/sysdep.S @@ -0,0 +1,42 @@ +/* Copyright (C) 1995, 1996, 1997, 1998, 2001, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Alexandre Oliva <aoliva@redhat.com>. + Based on ../i386/sysdep.S. + + 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 <sysdep.h> + +/* The following code is only used in the shared library when we + compile the reentrant version. Otherwise each system call defines + each own version. */ + +#ifndef PIC + +#undef CALL_MCOUNT +#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %eax. */ + + .text +ENTRY (__syscall_error) + mov d0,d1 + clr d0 + sub d1,d0 + +#define __syscall_error __syscall_error_1 +#include <../../../am33/sysdep.S> + +#endif /* !PIC */ diff --git a/ports/sysdeps/unix/sysv/linux/am33/sysdep.h b/ports/sysdeps/unix/sysv/linux/am33/sysdep.h new file mode 100644 index 000000000..b0ff4ec86 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/sysdep.h @@ -0,0 +1,317 @@ +/* Copyright 2001, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Alexandre Oliva <aoliva@redhat.com>. + Based on ../i386/sysdep.h. + + 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 _LINUX_AM33_SYSDEP_H +#define _LINUX_AM33_SYSDEP_H 1 + +/* There is some commonality. */ +#include "../../../am33/sysdep.h" + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* ELF-like local names start with `.L'. */ +#undef L +#define L(name) .L##name + +#ifdef __ASSEMBLER__ + +/* Linux uses a negative return value to indicate syscall errors, + unlike most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be + negative even if the call succeeded. E.g., the `lseek' system call + might return a large offset. Therefore we must not anymore test + for < 0, but test for a real error by making sure the value in %eax + is a real error number. Linus said he will make sure the no syscall + returns a value in -1 .. -4095 as a valid result so we can savely + test with -4095. */ + +/* We don't want the label for the error handle to be global when we define + it here. */ +#ifdef PIC +# define SYSCALL_ERROR_LABEL 0f +#else +# define SYSCALL_ERROR_LABEL syscall_error +#endif + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); \ + cmp -126,d0; \ + bls L(pseudo_end); \ + jmp SYSCALL_ERROR_LABEL; \ + L(pseudo_end): \ + mov d0,a0; + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + SYSCALL_ERROR_HANDLER \ + END (name) + +#undef PSEUDO_NOERROR +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args) + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(name) \ + END (name) + +#define ret_NOERRNO ret + +/* The function has to return the error code. */ +#undef PSEUDO_ERRVAL +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); \ + clr d1; \ + sub d0,d1,d0 + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + END (name) + +#define ret_ERRVAL ret + +#ifndef PIC +#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ +#else +/* Store (- d0) into errno through the GOT. */ +#ifdef _LIBC_REENTRANT +#define SYSCALL_ERROR_HANDLER \ +0:movm [d2,a2],(sp); \ + add -12,sp; \ +1:mov pc,a2; \ + add _GLOBAL_OFFSET_TABLE_-(1b-.),a2; \ + clr d2; \ + sub d0,d2; \ + call __errno_location@PLT,[],0; \ + mov d2,(a0); \ + add 12,sp; \ + movm (sp),[d2,a2]; \ + mov -1,d0; \ + mov d0,a0; \ + jmp L(pseudo_end); +/* A quick note: it is assumed that the call to `__errno_location' does + not modify the stack! */ +#else +#define SYSCALL_ERROR_HANDLER \ +0:mov pc,a0; \ + add _GLOBAL_OFFSET_TABLE_-(0b-.),a0; \ + clr d1; \ + sub d0,d1; \ + mov (errno@GOT,a0),a1; \ + mov d1,(a0); \ + mov -1,d0; \ + mov d0,a0; \ + jmp L(pseudo_end); +#endif /* _LIBC_REENTRANT */ +#endif /* PIC */ + +/* Linux takes system call arguments in registers: + + syscall number d0 call-clobbered + arg 1 a0 call-clobbered + arg 2 d1 call-clobbered + arg 3 a3 call-saved + arg 4 a2 call-saved + arg 5 d3 call-saved + arg 6 d2 call-saved + + The stack layout upon entering the function is: + + (24,sp) Arg# 6 + (20,sp) Arg# 5 + (16,sp) Arg# 4 + (12,sp) Arg# 3 + d1 Arg# 2 + d0 Arg# 1 + (sp) Return address + + (Of course a function with say 3 arguments does not have entries for + arguments 4, 5 and 6.) */ + +#undef DO_CALL +#define DO_CALL(syscall_name, args) \ + PUSHARGS_##args \ + DOARGS_##args \ + mov SYS_ify (syscall_name),d0; \ + syscall 0 \ + POPARGS_##args + +#define PUSHARGS_0 /* No arguments to push. */ +#define _DOARGS_0(N) /* No arguments to frob. */ +#define DOARGS_0 /* No arguments to frob. */ +#define POPARGS_0 /* No arguments to pop. */ + +#define PUSHARGS_1 /* No arguments to push. */ +#define _DOARGS_1(N) _DOARGS_0 (N-4) mov d0,a0; +#define DOARGS_1 _DOARGS_1 (4) +#define POPARGS_1 /* No arguments to pop. */ + +#define PUSHARGS_2 /* No arguments to push. */ +#define _DOARGS_2(N) _DOARGS_1 (N-4) /* Argument already in d1. */ +#define DOARGS_2 _DOARGS_2 (8) +#define POPARGS_2 /* No arguments to pop. */ + +#define PUSHARGS_3 movm [a3],(sp); +#define _DOARGS_3(N) _DOARGS_2 (N-4) mov (N,sp),a3; +#define DOARGS_3 _DOARGS_3 (16) +#define POPARGS_3 ; movm (sp),[a3] + +#define PUSHARGS_4 movm [a2,a3],(sp); +#define _DOARGS_4(N) _DOARGS_3 (N-4) mov (N,sp),a2; +#define DOARGS_4 _DOARGS_4 (24) +#define POPARGS_4 ; movm (sp),[a2,a3] + +#define PUSHARGS_5 movm [d3,a2,a3],(sp); +#define _DOARGS_5(N) _DOARGS_4 (N-4) mov (N,sp),d3; +#define DOARGS_5 _DOARGS_5 (32) +#define POPARGS_5 ; movm (sp),[d3,a2,a3] + +#define PUSHARGS_6 movm [d2,d3,a2,a3],(sp); +#define _DOARGS_6(N) _DOARGS_5 (N-4) mov (N,sp),d2; +#define DOARGS_6 _DOARGS_6 (40) +#define POPARGS_6 ; movm (sp),[d2,d3,a2,a3] + +#else /* !__ASSEMBLER__ */ + +/* Define a macro which expands inline into the wrapper code for a system + call. */ +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ + resultvar = 0xffffffff; \ + } \ + (int) resultvar; }) + +#define INTERNAL_SYSCALL(name, err, nr, args...) \ +({ \ + register long __sc0 asm ("d0") = __NR_##name; \ + inline_syscall##nr(name, ## args); \ + __sc0; \ +}) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= (unsigned long)-125) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) + +#define inline_syscall0(name,dummy...) \ +__asm__ __volatile__ ("syscall 0" \ + : "+d" (__sc0) \ + : : "memory") + +#define inline_syscall1(name,arg1) \ +register long __sc1 asm ("a0") = (long) (arg1); \ +inline_syscall0 (name); \ +__asm__ __volatile__ ("" : : "r" (__sc1)) + +#define inline_syscall2(name,arg1,arg2) \ +register long __sc2 asm ("d1") = (long) (arg2); \ +inline_syscall1 (name,(arg1)); \ +__asm__ __volatile__ ("" : : "r" (__sc2)) + +/* We can't tell whether a3 is going to be eliminated in the enclosing + function, so we have to assume it isn't. We first load the value + of any arguments into their registers, except for a3 itself, that + may be needed to load the value of the other arguments. Then, we + save a3's value in some other register, and load the argument value + into a3. We have to force both a3 and its copy to be live in + different registers at the same time, to avoid having the copy + spilled and the value reloaded into the same register, in which + case we'd be unable to get the value of a3 back, should the stack + slot reference be (offset,a3). */ +#define inline_syscall3(name,arg1,arg2,arg3) \ +long __sc3v = (long) (arg3); \ +register long __sc1 asm ("a0") = (long) (arg1); \ +register long __sc2 asm ("d1") = (long) (arg2); \ +register long __sc3 asm ("a3") = __sc3; \ +register long __sc3c; \ +__asm__ __volatile__ ("mov %1,%0" : "=&r" (__sc3c) : "r" (__sc3)); \ +__sc3 = __sc3v; \ +__asm__ __volatile__ ("" : : "r" (__sc3c), "r" (__sc3)); \ +inline_syscall0 (name); \ +__sc3 = __sc3c; \ +__asm__ __volatile__ ("" : : "r" (__sc3), "r" (__sc2), "r" (__sc1)) + +#ifdef PIC +/* Since a2 is the PIC register, it requires similar handling as a3 + when we're generating PIC, as a2's value may be needed to load + arguments whose values live in global variables. The difference is + that we don't need to require its value to be live in a register; + it may well be in a stack slot, as long as we save it before + clobbering a3 and restore it after restoring a3. */ +#define inline_syscall4(name,arg1,arg2,arg3,arg4) \ +long __sc4v = (long) (arg4); \ +long __sc3v = (long) (arg3); \ +register long __sc1 asm ("a0") = (long) (arg1); \ +register long __sc2 asm ("d1") = (long) (arg2); \ +register long __sc3 asm ("a3") = __sc3; \ +register long __sc3c; \ +register long __sc4 asm ("a2") = __sc4; \ +long __sc4c = __sc4; \ +__sc4 = __sc4v; \ +__asm__ __volatile__ ("mov %1,%0" : "=&r" (__sc3c) : "r" (__sc3)); \ +__sc3 = __sc3v; \ +__asm__ __volatile__ ("" : : "r" (__sc3c), "r" (__sc3), "r" (__sc4)); \ +inline_syscall0 (name); \ +__sc3 = __sc3c; \ +__sc4 = __sc4c; \ +__asm__ __volatile__ ("" : : "r" (__sc4), "r" (__sc3), \ + "r" (__sc2), "r" (__sc1)) +#else +#define inline_syscall4(name,arg1,arg2,arg3,arg4) \ +register long __sc4 asm ("a2") = (long) (arg4); \ +inline_syscall3 (name,(arg1),(arg2),(arg3)); \ +__asm__ __volatile__ ("" : : "r" (__sc4)) +#endif + +#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ +register long __sc5 asm ("d3") = (long) (arg5); \ +inline_syscall4 (name,(arg1),(arg2),(arg3),(arg4)); \ +__asm__ __volatile__ ("" : : "r" (__sc5)) + +#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ +register long __sc6 asm ("d2") = (long) (arg6); \ +inline_syscall5 (name,(arg1),(arg2),(arg3),(arg4),(arg5)); \ +__asm__ __volatile__ ("" : : "r" (__sc6)) + +#endif /* __ASSEMBLER__ */ + +#endif /* linux/am33/sysdep.h */ diff --git a/ports/sysdeps/unix/sysv/linux/am33/xstat.c b/ports/sysdeps/unix/sysv/linux/am33/xstat.c new file mode 100644 index 000000000..e9869f550 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/am33/xstat.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/xstat.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/Dist b/ports/sysdeps/unix/sysv/linux/cris/Dist new file mode 100644 index 000000000..1b8a7e61a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/Dist @@ -0,0 +1,5 @@ +clone.S +setresuid.c +setresgid.c +setfsuid.c +setfsgid.c diff --git a/ports/sysdeps/unix/sysv/linux/cris/_G_config.h b/ports/sysdeps/unix/sysv/linux/cris/_G_config.h new file mode 100644 index 000000000..083a00abf --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/_G_config.h @@ -0,0 +1,106 @@ +/* This file is needed by libio to define various configuration parameters. + These are always the same in the GNU C library. */ + +/* We have to keep a separate copy for CRIS, because we don't use thunks, + and libstdc++-v2 (which we currently use) cares. The C++ ABI is + changed totally with GCC 3.0, where we should not need a separate file. */ + +#ifndef _G_config_h +#define _G_config_h 1 + +/* Define types for libio in terms of the standard internal type names. */ + +#include <bits/types.h> +#define __need_size_t +#define __need_wchar_t +#define __need_wint_t +#define __need_NULL +#include <stddef.h> +#ifndef _WINT_T +/* Integral type unchanged by default argument promotions that can + hold any value corresponding to members of the extended character + set, as well as at least one value that does not correspond to any + member of the extended character set. */ +# define _WINT_T +typedef unsigned int wint_t; +#endif +#define __need_mbstate_t +#include <wchar.h> +#define _G_size_t size_t +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +#define _G_ssize_t __ssize_t +#define _G_off_t __off_t +#define _G_off64_t __off64_t +#define _G_pid_t __pid_t +#define _G_uid_t __uid_t +#define _G_wchar_t wchar_t +#define _G_wint_t wint_t +#define _G_stat64 stat64 +#include <gconv.h> +typedef union +{ + struct __gconv_info __cd; + struct + { + struct __gconv_info __cd; + struct __gconv_step_data __data; + } __combined; +} _G_iconv_t; + +typedef int _G_int16_t __attribute__ ((__mode__ (__HI__))); +typedef int _G_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); + +#define _G_HAVE_BOOL 1 + + +/* These library features are always available in the GNU C library. */ +#define _G_HAVE_ATEXIT 1 +#define _G_HAVE_SYS_CDEFS 1 +#define _G_HAVE_SYS_WAIT 1 +#define _G_NEED_STDARG_H 1 +#define _G_va_list __gnuc_va_list + +#define _G_HAVE_PRINTF_FP 1 +#define _G_HAVE_MMAP 1 +#define _G_HAVE_LONG_DOUBLE_IO 1 +#define _G_HAVE_IO_FILE_OPEN 1 +#define _G_HAVE_IO_GETLINE_INFO 1 + +#define _G_IO_IO_FILE_VERSION 0x20001 + +#define _G_OPEN64 __open64 +#define _G_LSEEK64 __lseek64 +#define _G_MMAP64 __mmap64 +#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf) + +/* This is defined by <bits/stat.h> if `st_blksize' exists. */ +#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) + +#define _G_BUFSIZ 8192 + +/* These are the vtbl details for ELF. */ +#define _G_NAMES_HAVE_UNDERSCORE 0 +#define _G_VTABLE_LABEL_HAS_LENGTH 1 +#undef _G_USING_THUNKS +#define _G_VTABLE_LABEL_PREFIX "_vt." +#define _G_VTABLE_LABEL_PREFIX_ID _vt. + + +#if defined __cplusplus || defined __STDC__ +# define _G_ARGS(ARGLIST) ARGLIST +#else +# define _G_ARGS(ARGLIST) () +#endif + +#endif /* _G_config.h */ diff --git a/ports/sysdeps/unix/sysv/linux/cris/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/cris/bits/fcntl.h new file mode 100644 index 000000000..36799aa50 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/bits/fcntl.h @@ -0,0 +1,189 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2004 + 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FCNTL_H +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." +#endif + + +#include <sys/types.h> + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 + +#ifdef __USE_GNU +# define O_DIRECT 040000 /* Direct disk access. */ +# define O_DIRECTORY 0200000 /* Must be a directory. */ +# define O_NOFOLLOW 0400000 /* Do not follow links. */ +# define O_NOATIME 01000000 /* Do not set atime. */ +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0100000 +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 5 /* Get record locking info. */ +# define F_SETLK 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#endif +#define F_GETLK64 12 /* Get record locking info. */ +#define F_SETLK64 13 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 14 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_UNIX98 +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* For old implementation of bsd flock(). */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation. */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + +__BEGIN_DECLS + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + +__END_DECLS diff --git a/ports/sysdeps/unix/sysv/linux/cris/bits/mman.h b/ports/sysdeps/unix/sysv/linux/cris/bits/mman.h new file mode 100644 index 000000000..b66c0bdb6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/bits/mman.h @@ -0,0 +1,97 @@ +/* Definitions for POSIX memory map interface. Linux/CRIS version. + Copyright (C) 1997, 2000, 2001, 2003 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MMAN_H +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x2000 /* Lock the mapping. */ +# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 1 /* Sync memory asynchronously. */ +#define MS_SYNC 4 /* Synchronous memory sync. */ +#define MS_INVALIDATE 2 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 2 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ +#endif diff --git a/ports/sysdeps/unix/sysv/linux/cris/brk.c b/ports/sysdeps/unix/sysv/linux/cris/brk.c new file mode 100644 index 000000000..ce4944512 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/brk.c @@ -0,0 +1,44 @@ +/* brk system call for Linux/CRIS. + Copyright (C) 1995, 1996, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <sysdep.h> + +/* This must be initialized data because commons can't have aliases. */ +void *__curbrk = 0; + +int +__brk (void *addr) +{ + unsigned char *newbrk; + + newbrk = (unsigned char *) INLINE_SYSCALL (brk, 1, addr); + + __curbrk = newbrk; + + if (newbrk < (unsigned char *) addr) + { + __set_errno (ENOMEM); + return -1; + } + + return 0; +} +weak_alias (__brk, brk) diff --git a/ports/sysdeps/unix/sysv/linux/cris/chown.c b/ports/sysdeps/unix/sysv/linux/cris/chown.c new file mode 100644 index 000000000..196162256 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/chown.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/m68k/chown.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/clone.S b/ports/sysdeps/unix/sysv/linux/cris/clone.S new file mode 100644 index 000000000..b2016438a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/clone.S @@ -0,0 +1,88 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> + +/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ + + .syntax no_register_prefix + + .text +ENTRY (__clone) + /* Sanity check arguments: No NULL function pointers. Allow a NULL + stack pointer though; it makes the kernel allocate stack. */ + test.d r10 + beq 1f + nop + + /* We need to muck with a few registers. */ + movem r1,[sp=sp-8] + + /* Save the function pointer and argument. We can't save them + onto the new stack since it can be NULL. */ + move.d r10,r0 + move.d r13,r1 + + /* Move the other arguments into place for the system call. */ + move.d r11,r10 + move.d r12,r11 + + /* Do the system call. */ + movu.w SYS_ify (clone),r9 + break 13 + test.d r10 + beq .Lthread_start + nop + + /* Jump to error handler if we get (unsigned) -4096 .. 0xffffffff. */ + cmps.w -4096,r10 + bhs 0f + movem [sp+],r1 + + /* In parent, successful return. (Avoid using "ret" - it's a macro.) */ + Ret + nop + +.Lthread_start: + /* Terminate frame pointers here. */ + moveq 0,r8 + + /* I've told you once. */ + move.d r1,r10 + jsr r0 + + SETUP_PIC + PLTCALL (_exit) + + /* Die horribly. */ + test.d [6809] + + /* Stop the unstoppable. */ +9: + ba 9b + nop + +/* Local error handler. */ +1: + movs.w -EINVAL,r10 + /* Drop through into the ordinary error handler. */ +PSEUDO_END (__clone) + +weak_alias (__clone, clone) diff --git a/ports/sysdeps/unix/sysv/linux/cris/fchown.c b/ports/sysdeps/unix/sysv/linux/cris/fchown.c new file mode 100644 index 000000000..3a69ecc9e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/fchown.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/fchown.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/fcntl.c b/ports/sysdeps/unix/sysv/linux/cris/fcntl.c new file mode 100644 index 000000000..ea951bc4f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/fcntl.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/fcntl.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/fxstat.c b/ports/sysdeps/unix/sysv/linux/cris/fxstat.c new file mode 100644 index 000000000..4f219f0b9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/fxstat.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/fxstat.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getegid.c b/ports/sysdeps/unix/sysv/linux/cris/getegid.c new file mode 100644 index 000000000..37b4b4a53 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getegid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getegid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/geteuid.c b/ports/sysdeps/unix/sysv/linux/cris/geteuid.c new file mode 100644 index 000000000..ebcb555b5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/geteuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/geteuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getgid.c b/ports/sysdeps/unix/sysv/linux/cris/getgid.c new file mode 100644 index 000000000..0a4d6061f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getgroups.c b/ports/sysdeps/unix/sysv/linux/cris/getgroups.c new file mode 100644 index 000000000..102ea24e1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getgroups.c @@ -0,0 +1,2 @@ +/* We also have to rewrite the kernel gid_t to the user land type. */ +#include <sysdeps/unix/sysv/linux/i386/getgroups.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getresgid.c b/ports/sysdeps/unix/sysv/linux/cris/getresgid.c new file mode 100644 index 000000000..b703a414c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getresgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getresgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getresuid.c b/ports/sysdeps/unix/sysv/linux/cris/getresuid.c new file mode 100644 index 000000000..0b14cefe3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getresuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getresuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getrlimit.c b/ports/sysdeps/unix/sysv/linux/cris/getrlimit.c new file mode 100644 index 000000000..fc06dbd64 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getrlimit.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getrlimit.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getrlimit64.c b/ports/sysdeps/unix/sysv/linux/cris/getrlimit64.c new file mode 100644 index 000000000..fef018f47 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getrlimit64.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/getuid.c b/ports/sysdeps/unix/sysv/linux/cris/getuid.c new file mode 100644 index 000000000..d682c79a4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/getuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/lchown.c b/ports/sysdeps/unix/sysv/linux/cris/lchown.c new file mode 100644 index 000000000..c89de99ba --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/lchown.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/lchown.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/lockf64.c b/ports/sysdeps/unix/sysv/linux/cris/lockf64.c new file mode 100644 index 000000000..a88f5a784 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/lockf64.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/lockf64.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/lxstat.c b/ports/sysdeps/unix/sysv/linux/cris/lxstat.c new file mode 100644 index 000000000..2371cd971 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/lxstat.c @@ -0,0 +1,2 @@ +#include <sysdeps/unix/sysv/linux/i386/lxstat.c> + diff --git a/ports/sysdeps/unix/sysv/linux/cris/mmap.S b/ports/sysdeps/unix/sysv/linux/cris/mmap.S new file mode 100644 index 000000000..3c74d590f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/mmap.S @@ -0,0 +1,68 @@ +/* Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +#include "kernel-features.h" + +#include <asm/errno.h> + +/* Rather than dragging in yet another kernel file, <asm/page.h>, we + define it here. Provide for easy override. */ +#ifndef PAGE_SHIFT +#define PAGE_SHIFT 13 +#endif + + .syntax no_register_prefix + +/* This is __ptr_t + __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) */ + + ENTRY (__mmap) + + /* Only accept a offset (and address) being a multiple of PAGE_SIZE, + since we only pass the page part in the system call. */ + move.d [sp+4],r9 + btstq (PAGE_SHIFT - 1),r9 + bne 1f + btstq (PAGE_SHIFT - 1),r10 + + bne 1f + lsrq PAGE_SHIFT,r9 + + move [sp],mof + move srp,[sp] + move r9,srp + + movu.b SYS_ify (mmap2),r9 + break 13 + + cmps.w -4096,r10 + bhs 0f + move [sp],srp + + Ret + nop + +/* Local error handler. */ +1: + movs.w -EINVAL,r10 + /* Drop through into the ordinary error handler. */ +PSEUDO_END (__mmap) + +weak_alias (__mmap, mmap) diff --git a/ports/sysdeps/unix/sysv/linux/cris/mmap64.S b/ports/sysdeps/unix/sysv/linux/cris/mmap64.S new file mode 100644 index 000000000..d71114454 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/mmap64.S @@ -0,0 +1,91 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +#include "kernel-features.h" + +#include <asm/errno.h> + +/* Rather than dragging in yet another kernel file, <asm/page.h>, we + define it here. Provide for easy override. */ +#ifndef PAGE_SHIFT +#define PAGE_SHIFT 13 +#endif + +/* This is: __ptr_t + __mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, + off64_t offset); */ + +/* This was done in C, but the resulting code didn't look anywhere near + nice, and mmap64 is important enough to have fast code. Rather than + fixing (the generic bits in) gcc, we make sure not to depend on it by + writing code that GCC cannot reasonably generate. */ + + .syntax no_register_prefix + +ENTRY (__mmap64) + + move [sp],mof + move.d [sp+4],r9 + + /* Only accept an offset being a multiple of PAGE_SIZE, ditto address. */ + btstq (PAGE_SHIFT - 1),r9 + bne 1f + lsrq PAGE_SHIFT,r9 + + btstq (PAGE_SHIFT - 1),r10 + bne 1f + move.d r9,[sp] + + /* We have to store the adjusted part somewhere we can "or" from. + No registers available, so let's re-use the incoming low-part + parameter location. */ + move.d [sp+8],r9 + + swapwbr r9 + /* Check if the highest bits (now the lowest bits) are zero. They + must be, since we're actually calling a system function + specifying the size in *pages* in a single dword. Thus you can + mmap64 PAGE_SIZE * 4 Gbyte. */ + btstq (PAGE_SHIFT - 1),r9 + bne 1f + swapwbr r9 + + lslq (32 - PAGE_SHIFT),r9 + or.d [sp],r9 + move srp,[sp] + move r9,srp + + movu.b SYS_ify (mmap2),r9 + break 13 + + cmps.w -4096,r10 + bhs 0f + move [sp],srp + + Ret + nop + +/* Local error handler. */ +1: + movs.w -EINVAL,r10 + /* Drop through into the ordinary error handler. */ +PSEUDO_END (__mmap64) + +weak_alias (__mmap64, mmap64) diff --git a/ports/sysdeps/unix/sysv/linux/cris/msgctl.c b/ports/sysdeps/unix/sysv/linux/cris/msgctl.c new file mode 100644 index 000000000..9f9b8431a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/msgctl.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/msgctl.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/profil-counter.h b/ports/sysdeps/unix/sysv/linux/cris/profil-counter.h new file mode 100644 index 000000000..37adc1fee --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/profil-counter.h @@ -0,0 +1,26 @@ +/* Low-level statistical profiling support function. Linux/CRIS version. + Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <signal.h> + +static void +profil_counter (int signo, struct sigcontext *scp) +{ + profil_count ((void *) scp->regs.irp); +} diff --git a/ports/sysdeps/unix/sysv/linux/cris/register-dump.h b/ports/sysdeps/unix/sysv/linux/cris/register-dump.h new file mode 100644 index 000000000..309728bf9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/register-dump.h @@ -0,0 +1,117 @@ +/* Dump registers. + Copyright (C) 1998, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stddef.h> +#include <sys/uio.h> +#include <stdio-common/_itoa.h> + +/* We will print the register dump in this format: + + R0: XXXXXXXX R1: XXXXXXXX R2: XXXXXXXX R3: XXXXXXXX + R4: XXXXXXXX R5: XXXXXXXX R6: XXXXXXXX R7: XXXXXXXX + R8: XXXXXXXX R9: XXXXXXXX R10: XXXXXXXX R11: XXXXXXXX + R12: XXXXXXXX R13: XXXXXXXX SP: XXXXXXXX PC: XXXXXXXX +DCCR: XXXXXXXX SRP: XXXXXXXX */ + +static void +hexvalue (unsigned long int value, char *buf, size_t len) +{ + char *cp = _itoa_word (value, buf + len, 16, 0); + while (cp > buf) + *--cp = '0'; +} + +static void register_dump (int fd, struct sigcontext *ctx) +{ + char regs[18][8]; + struct iovec iov[36], *next_iov = iov; + struct pt_regs *rx = &ctx->regs; + +#define ADD_STRING(str) \ + next_iov->iov_base = (char *) (str); \ + next_iov->iov_len = strlen (str); \ + ++next_iov +#define ADD_MEM(str, len) \ + next_iov->iov_base = (str); \ + next_iov->iov_len = (len); \ + ++next_iov + + /* Generate strings of register contents. */ + hexvalue (rx->r0, regs[0], 8); + hexvalue (rx->r1, regs[1], 8); + hexvalue (rx->r2, regs[2], 8); + hexvalue (rx->r3, regs[3], 8); + hexvalue (rx->r4, regs[4], 8); + hexvalue (rx->r5, regs[5], 8); + hexvalue (rx->r6, regs[6], 8); + hexvalue (rx->r7, regs[7], 8); + hexvalue (rx->r8, regs[8], 8); + hexvalue (rx->r9, regs[9], 8); + hexvalue (rx->r10, regs[10], 8); + hexvalue (rx->r11, regs[11], 8); + hexvalue (rx->r12, regs[12], 8); + hexvalue (rx->r13, regs[13], 8); + hexvalue (ctx->usp, regs[14], 8); + hexvalue (rx->irp, regs[17], 8); + hexvalue (rx->dccr, regs[15], 8); + hexvalue (rx->srp, regs[16], 8); + + /* Generate the output. */ + ADD_STRING ("Register dump:\n\n R0: "); + ADD_MEM (regs[0], 8); + ADD_STRING (" R1: "); + ADD_MEM (regs[1], 8); + ADD_STRING (" R2: "); + ADD_MEM (regs[2], 8); + ADD_STRING (" R3: "); + ADD_MEM (regs[3], 8); + ADD_STRING ("\n R4: "); + ADD_MEM (regs[4], 8); + ADD_STRING (" R5: "); + ADD_MEM (regs[5], 8); + ADD_STRING (" R6: "); + ADD_MEM (regs[6], 8); + ADD_STRING (" R7: "); + ADD_MEM (regs[7], 8); + ADD_STRING ("\n R8: "); + ADD_MEM (regs[8], 8); + ADD_STRING (" R9: "); + ADD_MEM (regs[9], 8); + ADD_STRING (" R10: "); + ADD_MEM (regs[10], 8); + ADD_STRING (" R11: "); + ADD_MEM (regs[11], 8); + ADD_STRING ("\n R12: "); + ADD_MEM (regs[12], 8); + ADD_STRING (" R13: "); + ADD_MEM (regs[13], 8); + ADD_STRING (" SP: "); + ADD_MEM (regs[14], 8); + ADD_STRING (" PC: "); + ADD_MEM (regs[17], 8); + ADD_STRING ("\nDCCR: "); + ADD_MEM (regs[15], 8); + ADD_STRING (" SRP: "); + ADD_MEM (regs[16], 4); + + /* Write the stuff out. */ + writev (fd, iov, next_iov - iov); +} + +#define REGISTER_DUMP register_dump (fd, ctx) diff --git a/ports/sysdeps/unix/sysv/linux/cris/semctl.c b/ports/sysdeps/unix/sysv/linux/cris/semctl.c new file mode 100644 index 000000000..e9b1a483c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/semctl.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/semctl.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setegid.c b/ports/sysdeps/unix/sysv/linux/cris/setegid.c new file mode 100644 index 000000000..2e3a54c89 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setegid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setegid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/seteuid.c b/ports/sysdeps/unix/sysv/linux/cris/seteuid.c new file mode 100644 index 000000000..18e41d08c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/seteuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/seteuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setfsgid.c b/ports/sysdeps/unix/sysv/linux/cris/setfsgid.c new file mode 100644 index 000000000..088671256 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setfsgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setfsgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setfsuid.c b/ports/sysdeps/unix/sysv/linux/cris/setfsuid.c new file mode 100644 index 000000000..a9f22eb8a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setfsuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setfsuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setgid.c b/ports/sysdeps/unix/sysv/linux/cris/setgid.c new file mode 100644 index 000000000..377021d9e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setgroups.c b/ports/sysdeps/unix/sysv/linux/cris/setgroups.c new file mode 100644 index 000000000..0e7086278 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setgroups.c @@ -0,0 +1,2 @@ +/* We also have to rewrite the kernel gid_t to the user land type. */ +#include <sysdeps/unix/sysv/linux/i386/setgroups.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setregid.c b/ports/sysdeps/unix/sysv/linux/cris/setregid.c new file mode 100644 index 000000000..99c57ad20 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setregid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setregid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setresgid.c b/ports/sysdeps/unix/sysv/linux/cris/setresgid.c new file mode 100644 index 000000000..daca1a483 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setresgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setresgid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setresuid.c b/ports/sysdeps/unix/sysv/linux/cris/setresuid.c new file mode 100644 index 000000000..3aeabe9ad --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setresuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setresuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setreuid.c b/ports/sysdeps/unix/sysv/linux/cris/setreuid.c new file mode 100644 index 000000000..8ad61226e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setreuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setreuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setrlimit.c b/ports/sysdeps/unix/sysv/linux/cris/setrlimit.c new file mode 100644 index 000000000..bfaef74c3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setrlimit.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setrlimit.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/setuid.c b/ports/sysdeps/unix/sysv/linux/cris/setuid.c new file mode 100644 index 000000000..de394379b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/setuid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/setuid.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/shmctl.c b/ports/sysdeps/unix/sysv/linux/cris/shmctl.c new file mode 100644 index 000000000..7eac6380d --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/shmctl.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/shmctl.c> diff --git a/ports/sysdeps/unix/sysv/linux/cris/socket.S b/ports/sysdeps/unix/sysv/linux/cris/socket.S new file mode 100644 index 000000000..38b4ac5fb --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/socket.S @@ -0,0 +1,96 @@ +/* Copyright (C) 1995, 1996, 1997, 1999, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <socketcall.h> + +#define P(a, b) P2(a, b) +#define P2(a, b) a##b + +/* The socket-oriented system calls are handled unusally in Linux. + They are all gated through the single `socketcall' system call number. + `socketcall' takes two arguments: the first is the subcode, specifying + which socket function is being called; and the second is a pointer to + the arguments to the specific function. + + The .S files for the other calls just #define socket and #include this. + They also #define a 'number-of-arguments' word in NARGS, which + defaults to 3. */ + +#ifndef NARGS +#ifdef socket +#error NARGS not defined +#endif +#define NARGS 3 +#endif + + .syntax no_register_prefix + +#ifndef __socket +#define __socket P(__,socket) +#endif + +ENTRY(__socket) + subq NARGS*4,sp + +#if NARGS >= 2 + move.d sp,r9 + move.d r10,[r9+] +#else + move.d r10,[sp] +#endif +#if NARGS >= 2 + move.d r11,[r9+] +#endif +#if NARGS >= 3 + move.d r12,[r9+] +#endif +#if NARGS >= 4 + move.d r13,[r9+] +#endif +#if NARGS >= 5 + move.d [sp+NARGS*4],r13 + move.d r13,[r9+] +#endif +#if NARGS >= 6 + move.d [sp+NARGS*4+4],r13 + move.d r13,[r9+] +#endif +#if NARGS >= 7 + move.d [sp+NARGS*4+8],r13 + move.d r13,[r9+] +#endif +#if NARGS >= 8 + move.d [sp+NARGS*4+12],r13 + move.d r13,[r9+] +#endif +#if NARGS >= 9 +#error Too many arguments! +#endif + moveq P(SOCKOP_,socket),r10 + move.d sp,r11 + movu.w SYS_ify(socketcall),r9 + break 13 + cmps.w -4096,r10 + bhs 0f + addq NARGS*4,sp + Ret + nop +PSEUDO_END (__socket) + +weak_alias (__socket, socket) diff --git a/ports/sysdeps/unix/sysv/linux/cris/sys/ucontext.h b/ports/sysdeps/unix/sysv/linux/cris/sys/ucontext.h new file mode 100644 index 000000000..2d3aee076 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/sys/ucontext.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1998, 1999, 2000, 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include <features.h> +#include <signal.h> + +#include <bits/sigcontext.h> + + +/* Type for general register. */ +typedef long int greg_t; + +/* Number of general registers. */ +#define NGREG 20 + +/* Container for all general registers. */ +typedef greg_t gregset_t[NGREG]; + +/* A placeholder type for floating-point register. */ +typedef long int fpreg_t; + +/* A placeholder; CRIS does not have any fp regs. */ +typedef unsigned long fpregset_t; + +/* A machine context is exactly a sigcontext. */ +typedef struct sigcontext mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + } ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/ports/sysdeps/unix/sysv/linux/cris/syscall.S b/ports/sysdeps/unix/sysv/linux/cris/syscall.S new file mode 100644 index 000000000..03626b094 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/syscall.S @@ -0,0 +1,40 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + + .syntax no_register_prefix + +/* Make syscall (callno, ...) into a system call. */ + +ENTRY (syscall) + move.d r10,r9 + move.d r11,r10 + move.d r12,r11 + move.d r13,r12 + move.d [sp],r13 + move srp,[sp] + move [sp+4],mof + move [sp+8],srp + break 13 + cmps.w -4096,r10 + bhs 0f + move [sp],srp + Ret + nop +PSEUDO_END (syscall) diff --git a/ports/sysdeps/unix/sysv/linux/cris/sysdep.S b/ports/sysdeps/unix/sysv/linux/cris/sysdep.S new file mode 100644 index 000000000..e53e7bbfb --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/sysdep.S @@ -0,0 +1,66 @@ +/* Copyright (C) 2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +/* The syscall stubs jump here when they detect an error, bot for PIC and + non-PIC. */ + + .syntax no_register_prefix + +ENTRY (__syscall_error) + neg.d r10,r10 + +#ifdef _LIBC_REENTRANT + push r10 + push srp + + /* Note that __syscall_error is only visible within this library, + and no-one passes it on as a pointer, so can assume that R0 (GOT + pointer) is correctly set up. */ + PLTCALL (__errno_location) + + pop srp + pop r11 + move.d r11,[r10] + +#else /* not _LIBC_REENTRANT */ +# ifdef __PIC__ + move.d [r0+C_SYMBOL_NAME(errno:GOT)],r9 + move.d r10,[r9] +# else + move.d r10,[C_SYMBOL_NAME(errno)] +# endif +#endif /* _LIBC_REENTRANT */ + +#ifdef __PIC__ +/* PIC callers are supposed to have R0 on stack, ready for us to restore. + Callers are only allowed from within this DSO, so the GOT in r0 is the + one we want to use. + + (Don't use "ret" - it's a macro). */ + + moveq -1,r10 + Ret + pop r0 +#else + Ret + moveq -1,r10 +#endif + +END (__syscall_error) diff --git a/ports/sysdeps/unix/sysv/linux/cris/sysdep.h b/ports/sysdeps/unix/sysv/linux/cris/sysdep.h new file mode 100644 index 000000000..5013dd5d3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/sysdep.h @@ -0,0 +1,226 @@ +/* Assembler macros for CRIS. + Copyright (C) 1999, 2001, 2003 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <asm/unistd.h> +#include <sysdeps/cris/sysdep.h> +#include <sys/syscall.h> +#include "config.h" + +#undef SYS_ify +#define SYS_ify(syscall_name) (__NR_##syscall_name) + + +#ifdef __ASSEMBLER__ + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* ELF-like local names start with `.L'. */ +#undef L +#define L(name) .L##name + +/* Linux uses a negative return value to indicate syscall errors, + unlike most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be + negative even if the call succeeded. E.g., the `lseek' system call + might return a large offset. Therefore we must not anymore test + for < 0, but test for a real error by making sure the value in %eax + is a real error number. Linus said he will make sure the no syscall + returns a value in -1 .. -4095 as a valid result so we can safely + test with -4095. */ + +/* Syscall wrappers consist of + #include <sysdep.h> + PSEUDO (...) + ret + PSEUDO_END (...) + + which expand to the following. */ + +/* Linux takes system call arguments in registers: + syscall number R9 + arg 1 R10 + arg 2 R11 + arg 3 R12 + arg 4 R13 + arg 5 MOF + arg 6 SRP + + The compiler calls us by the C convention: + syscall number in the DO_CALL macro + arg 1 R10 + arg 2 R11 + arg 3 R12 + arg 4 R13 + arg 5 [SP] + arg 6 [SP + 4] + */ + +/* Note that we use "bhs", since we want to match + (unsigned) -4096 .. 0xffffffff. Using "ble" would match + -4096 .. -2**31. */ +#define PSEUDO(name, syscall_name, args) \ + ENTRY (name) @ \ + DOARGS_##args @ \ + movu.w SYS_ify (syscall_name),$r9 @ \ + break 13 @ \ + cmps.w -4096,$r10 @ \ + bhs 0f @ \ + nop @ \ + UNDOARGS_return_##args + +/* Ouch! We have to remember not to use "ret" in assembly-code. + ("Luckily", mnemonics are case-insensitive.) + Note that we assume usage is exactly: + PSEUDO (...) + ret + PSEUDO_END (...) + so we can put all payload into PSEUDO (except for error handling). */ + +#define ret + +#define PSEUDO_END(name) \ +0: @ \ + SETUP_PIC @ \ + PLTJUMP (syscall_error) @ \ + END (name) + +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + ENTRY (name) @ \ + DOARGS_##args @ \ + movu.w SYS_ify (syscall_name),$r9 @ \ + break 13 @ \ + UNDOARGS_return_##args + +#define ret_NOERRNO + +#define PSEUDO_END_NOERRNO(name) \ + END (name) + +#define DOARGS_0 +#define DOARGS_1 +#define DOARGS_2 +#define DOARGS_3 +#define DOARGS_4 +#define DOARGS_5 \ + move [$sp],$mof + +/* To avoid allocating stack-space, we re-use the arg 5 (MOF) entry by + storing SRP into it. If called with too-few arguments, we will crash, + but that will happen in the general case too. */ +#define DOARGS_6 \ + DOARGS_5 @ \ + move $srp,[$sp] @ \ + move [$sp+4],$srp + +#define UNDOARGS_return_0 \ + Ret @ \ + nop + +#define UNDOARGS_return_1 UNDOARGS_return_0 +#define UNDOARGS_return_2 UNDOARGS_return_0 +#define UNDOARGS_return_3 UNDOARGS_return_0 +#define UNDOARGS_return_4 UNDOARGS_return_0 +#define UNDOARGS_return_5 UNDOARGS_return_0 + +/* We assume the following code will be "ret" and "PSEUDO_END". */ +#define UNDOARGS_return_return_6 \ + jump [$sp] + +#else /* not __ASSEMBLER__ */ + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + unsigned long __sys_res; \ + register unsigned long __res asm ("r10"); \ + LOAD_ARGS_c_##nr (args) \ + register unsigned long __callno asm ("r9") \ + = SYS_ify (name); \ + asm volatile (LOAD_ARGS_asm_##nr (args) \ + "break 13" \ + : "=r" (__res) \ + : ASM_ARGS_##nr (args) \ + : ASM_CLOBBER_##nr); \ + __sys_res = __res; \ + \ + if (__sys_res >= (unsigned long) -4096) \ + { \ + __set_errno (- __sys_res); \ + __sys_res = (unsigned long) -1; \ + } \ + (long int) __sys_res; \ + }) + +#define LOAD_ARGS_c_0() +#define LOAD_ARGS_asm_0() +#define ASM_CLOBBER_0 "memory" +#define ASM_ARGS_0() "r" (__callno) + +#define LOAD_ARGS_c_1(r10) \ + LOAD_ARGS_c_0() \ + register unsigned long __r10 __asm__ ("r10") = (unsigned long) (r10); +#define LOAD_ARGS_asm_1(r10) LOAD_ARGS_asm_0 () +#define ASM_CLOBBER_1 ASM_CLOBBER_0 +#define ASM_ARGS_1(r10) ASM_ARGS_0 (), "0" (__r10) + +#define LOAD_ARGS_c_2(r10, r11) \ + LOAD_ARGS_c_1(r10) \ + register unsigned long __r11 __asm__ ("r11") = (unsigned long) (r11); +#define LOAD_ARGS_asm_2(r10, r11) LOAD_ARGS_asm_1 (r10) +#define ASM_CLOBBER_2 ASM_CLOBBER_1 +#define ASM_ARGS_2(r10, r11) ASM_ARGS_1 (r10), "r" (__r11) + +#define LOAD_ARGS_c_3(r10, r11, r12) \ + LOAD_ARGS_c_2(r10, r11) \ + register unsigned long __r12 __asm__ ("r12") = (unsigned long) (r12); +#define LOAD_ARGS_asm_3(r10, r11, r12) LOAD_ARGS_asm_2 (r10, r11) +#define ASM_CLOBBER_3 ASM_CLOBBER_2 +#define ASM_ARGS_3(r10, r11, r12) ASM_ARGS_2 (r10, r11), "r" (__r12) + +#define LOAD_ARGS_c_4(r10, r11, r12, r13) \ + LOAD_ARGS_c_3(r10, r11, r12) \ + register unsigned long __r13 __asm__ ("r13") = (unsigned long) (r13); +#define LOAD_ARGS_asm_4(r10, r11, r12, r13) LOAD_ARGS_asm_3 (r10, r11, r12) +#define ASM_CLOBBER_4 ASM_CLOBBER_3 +#define ASM_ARGS_4(r10, r11, r12, r13) ASM_ARGS_3 (r10, r11, r12), "r" (__r13) + +#define LOAD_ARGS_c_5(r10, r11, r12, r13, mof) \ + LOAD_ARGS_c_4(r10, r11, r12, r13) +#define LOAD_ARGS_asm_5(r10, r11, r12, r13, mof) \ + LOAD_ARGS_asm_4 (r10, r11, r12, r13) "move %6,$mof\n\t" +#define ASM_CLOBBER_5 ASM_CLOBBER_4 +#define ASM_ARGS_5(r10, r11, r12, r13, mof) \ + ASM_ARGS_4 (r10, r11, r12, r13), "g" (mof) + +#define LOAD_ARGS_c_6(r10, r11, r12, r13, mof, srp) \ + LOAD_ARGS_c_5(r10, r11, r12, r13, mof) +#define LOAD_ARGS_asm_6(r10, r11, r12, r13, mof, srp) \ + LOAD_ARGS_asm_5(r10, r11, r12, r13, mof) \ + "move %7,$srp\n\t" +#define ASM_CLOBBER_6 ASM_CLOBBER_5, "srp" +#define ASM_ARGS_6(r10, r11, r12, r13, mof, srp) \ + ASM_ARGS_5 (r10, r11, r12, r13, mof), "g" (srp) + +#endif /* not __ASSEMBLER__ */ diff --git a/ports/sysdeps/unix/sysv/linux/cris/vfork.S b/ports/sysdeps/unix/sysv/linux/cris/vfork.S new file mode 100644 index 000000000..74a855676 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/vfork.S @@ -0,0 +1,27 @@ +/* Copyright (C) 1999, 2001, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +PSEUDO (__vfork, vfork, 0) + Ret + nop +PSEUDO_END (__vfork) +libc_hidden_def (__vfork) + +weak_alias (__vfork, vfork) diff --git a/ports/sysdeps/unix/sysv/linux/cris/xstat.c b/ports/sysdeps/unix/sysv/linux/cris/xstat.c new file mode 100644 index 000000000..e9869f550 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/cris/xstat.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/xstat.c> diff --git a/ports/sysdeps/unix/sysv/minix/bits/sigaction.h b/ports/sysdeps/unix/sysv/minix/bits/sigaction.h new file mode 100644 index 000000000..4b04b7b55 --- /dev/null +++ b/ports/sysdeps/unix/sysv/minix/bits/sigaction.h @@ -0,0 +1,53 @@ +/* Copyright (C) 1992, 1996, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Signal handler. */ + __sighandler_t sa_handler; + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* Special flags. */ + int sa_flags; + }; + +/* Bits in `sa_flags'. */ +#ifdef __USE_MISC +# define SA_ONSTACK 0x1 /* Take signal on signal stack. */ +# define SA_RESETHAND 0x2 /* Reset signal handler when signal caught. */ +# define SA_NODEFER 0x4 /* Don't block signal while catching it. */ +# define SA_RESTART 0x8 /* Restart syscall on signal return. */ +# define SA_SIGINFO 0x10 /* Extended signal handling. */ +# define SA_NOCLDWAIT 0x20 /* Don't create zombies. */ +# define SA_COMPAT 0x80 /* Internal flag for old signal catchers. */ +# define SA_DISABLE 0x100 /* Disable alternate signal stack. */ +#endif +#define SA_NOCLDSTOP 0x40 /* Don't send SIGCHLD when children stop. */ + + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_BLOCK 0 /* Block signals. */ +#define SIG_UNBLOCK 1 /* Unblock signals. */ +#define SIG_SETMASK 2 /* Set the set of blocked signals. */ diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/Dist b/ports/sysdeps/unix/sysv/sco3.2.4/Dist new file mode 100644 index 000000000..984b47334 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/Dist @@ -0,0 +1 @@ +__setpgid.c diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/Makefile b/ports/sysdeps/unix/sysv/sco3.2.4/Makefile new file mode 100644 index 000000000..a199ba900 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/Makefile @@ -0,0 +1,17 @@ +ifeq (posix,$(subdir)) +sysdep_routines := $(sysdep_routines) pgrpsys sco_getgrp +endif + +ifeq (csu,$(subdir)) + +# SCO uses crt1.o, and expects that single initializer file to also start +# the .init and .fini sections as crti.o normally does. +start-installed-name = crt1.o +start-installed-name-rule = yes + +# Link together start.o and crti.o into the expected crt1.o. +# Now crt1.o as initializer and crtn.o as finalizer will work. +$(objpfx)crt1.o: $(objpfx)start.o $(objpfx)crti.o + $(CC) -nostdlib -nostartfiles -Wl,-r -o $@ $^ + +endif diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/__setpgid.c b/ports/sysdeps/unix/sysv/sco3.2.4/__setpgid.c new file mode 100644 index 000000000..d51fa602c --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/__setpgid.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1994, 1997, 2002, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> + +extern int __pgrpsys (int type, ...); + +/* Get the process group ID of process PID. */ +int +__setpgid (pid, pgid) + pid_t pid; + pid_t pgid; +{ + return __pgrpsys (2, pid, pgid); +} +libc_hidden_def (__setpgid) diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/bits/confname.h b/ports/sysdeps/unix/sysv/sco3.2.4/bits/confname.h new file mode 100644 index 000000000..42e6ed0ea --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/bits/confname.h @@ -0,0 +1,54 @@ +/* `sysconf', `pathconf', and `confstr' NAME values. Generic version. + Copyright (C) 1993, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UNISTD_H +# error "Never use <bits/confname.h> directly; include <unistd.h> instead." +#endif + +/* Values for the NAME argument to `pathconf' and `fpathconf'. */ +#define _PC_LINK_MAX 0 +#define _PC_MAX_CANON 1 +#define _PC_MAX_INPUT 2 +#define _PC_NAME_MAX 3 +#define _PC_PATH_MAX 4 +#define _PC_PIPE_BUF 5 +#define _PC_CHOWN_RESTRICTED 6 +#define _PC_NO_TRUNC 7 +#define _PC_VDISABLE 8 + +/* Values for the argument to `sysconf'. */ +#define _SC_ARG_MAX 0 +#define _SC_CHILD_MAX 1 +#define _SC_CLK_TCK 2 +#define _SC_NGROUPS_MAX 3 +#define _SC_OPEN_MAX 4 +#define _SC_JOB_CONTROL 5 +#define _SC_SAVED_IDS 6 +#define _SC_VERSION 7 +#define _SC_PASS_MAX 8 +#define _SC_XOPEN_VERSION 9 +#define _SC_TZNAME_MAX 666 /* Not handled by SCO's system call. */ + +#ifdef __USE_POSIX2 +/* Values for the NAME argument to `confstr'. */ +enum + { + _CS_PATH /* The default search path. */ + }; +#endif diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h b/ports/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h new file mode 100644 index 000000000..f08738855 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h @@ -0,0 +1,43 @@ +/* The proper definitions for SCO's sigaction. + Copyright (C) 1993, 1994, 1996, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Signal handler. */ + __sighandler_t sa_handler; + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* Special flags. */ + int sa_flags; + }; + +/* Bits in `sa_flags'. */ +#define SA_NOCLDSTOP 0x01 /* Don't send SIGCHLD when children stop. */ + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_SETMASK 0 /* Set the set of blocked signals. */ +#define SIG_BLOCK 1 /* Block signals. */ +#define SIG_UNBLOCK 2 /* Unblock signals. */ diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/getgroups.c b/ports/sysdeps/unix/sysv/sco3.2.4/getgroups.c new file mode 100644 index 000000000..2aac40bdd --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/getgroups.c @@ -0,0 +1,45 @@ +/* Copyright (C) 1994, 1995, 1997, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/types.h> +#include <unistd.h> +#include <limits.h> +#include <alloca.h> + +extern int __sco_getgroups (int size, unsigned short int *list); + +int +__getgroups (size, list) + int size; gid_t *list; +{ + int i; + unsigned short int *shortlist; + + if (size <= 0) + return __sco_getgroups (size, NULL); + + shortlist = __alloca (size * sizeof (*shortlist)); + + size = __sco_getgroups (size, shortlist); + for (i = 0; i < size; ++i) + list[i] = shortlist[i]; + + return size; +} + +weak_alias (__getgroups, getgroups) diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/getpgid.c b/ports/sysdeps/unix/sysv/sco3.2.4/getpgid.c new file mode 100644 index 000000000..3b47d9dee --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/getpgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/sysv4/getpgid.c> diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/setpgid.c b/ports/sysdeps/unix/sysv/sco3.2.4/setpgid.c new file mode 100644 index 000000000..cc9c4cd61 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/setpgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/sysv4/setpgid.c> diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/setsid.c b/ports/sysdeps/unix/sysv/sco3.2.4/setsid.c new file mode 100644 index 000000000..633765255 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/setsid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/sysv4/setsid.c> diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/sigaction.S b/ports/sysdeps/unix/sysv/sco3.2.4/sigaction.S new file mode 100644 index 000000000..ae50c17d9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/sigaction.S @@ -0,0 +1,30 @@ +/* Copyright (C) 1993, 1994, 1995, 1997, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +.globl C_SYMBOL_NAME(__sigreturn) + +ENTRY (__sigaction) + movl $C_SYMBOL_NAME(__sigreturn), %ecx + DO_CALL (sigaction, 3) + jb syscall_error + ret + +libc_hidden_def (__sigaction) +weak_alias (__sigaction, sigaction) diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/sys/syscall.h b/ports/sysdeps/unix/sysv/sco3.2.4/sys/syscall.h new file mode 100644 index 000000000..05bbb89f3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/sys/syscall.h @@ -0,0 +1,125 @@ +/* Copyright (C) 1994, 1996 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* From Scott Bartram. */ + +#ifndef _SYSCALL_H +#define _SYSCALL_H + +#define SYS_access 33 +#define SYS_acct 51 +#define SYS_advfs 70 +#define SYS_alarm 27 +#define SYS_break 17 +#define SYS_brk 17 +#define SYS_chdir 12 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_chroot 61 +#define SYS_chsize 0x0a28 +#define SYS_close 6 +#define SYS_creat 8 +#define SYS_dup 41 +#define SYS_exec 11 +#define SYS_exece 59 +#define SYS_exit 1 +#define SYS_fcntl 62 +#define SYS_fork 2 +#define SYS_fpathconf 0x2f28 +#define SYS_fstat 28 +#define SYS_fstatfs 38 +#define SYS_ftime 0x0b28 +#define SYS_getdents 81 +#define SYS_getgid 47 +#define SYS_getgroups 0x2b28 +#define SYS_getitimer 0x3728 +#define SYS_getmsg 85 +#define SYS_getpid 20 +#define SYS_getuid 24 +#define SYS_gtty 32 +#define SYS_ioctl 54 +#define SYS_kill 37 +#define SYS_link 9 +#define SYS_lock 45 +#define SYS_lseek 19 +#define SYS_lstat 91 +#define SYS_mkdir 80 +#define SYS_mknod 14 +#define SYS_mount 21 +#define SYS_msgsys 49 +#define SYS_nap 0x0c28 +#define SYS_nice 34 +#define SYS_open 5 +#define SYS_pathconf 0x2e28 +#define SYS_pause 29 +#define SYS_pgrpsys 39 +#define SYS_pipe 42 +#define SYS_plock 45 +#define SYS_poll 87 +#define SYS_prof 44 +#define SYS_ptrace 26 +#define SYS_putmsg 86 +#define SYS_rdebug 76 +#define SYS_read 3 +#define SYS_readlink 92 +#define SYS_rename 0x3028 +#define SYS_rfstart 74 +#define SYS_rfstop 77 +#define SYS_rfsys 78 +#define SYS_rmdir 79 +#define SYS_rmount 72 +#define SYS_rumount 73 +#define SYS_seek 19 +#define SYS_select 0x2428 +#define SYS_semsys 53 +#define SYS_setgid 46 +#define SYS_setgroups 0x2c28 +#define SYS_setitimer 0x3828 +#define SYS_setpgrp 39 +#define SYS_setuid 23 +#define SYS_shmsys 52 +#define SYS_sigaction 0x2728 +#define SYS_signal 48 +#define SYS_sigpending 0x2928 +#define SYS_sigprocmask 0x2828 +#define SYS_sigsuspend 0x2a28 +#define SYS_stat 18 +#define SYS_statfs 35 +#define SYS_stime 25 +#define SYS_stty 31 +#define SYS_symlink 90 +#define SYS_sync 36 +#define SYS_sys3b 50 +#define SYS_sysacct 51 +#define SYS_sysconf 0x2d28 +#define SYS_sysfs 84 +#define SYS_sysi86 50 +#define SYS_time 13 +#define SYS_times 43 +#define SYS_uadmin 55 +#define SYS_ulimit 63 +#define SYS_umask 60 +#define SYS_umount 22 +#define SYS_unadvfs 71 +#define SYS_unlink 10 +#define SYS_utime 30 +#define SYS_utssys 57 +#define SYS_wait 7 +#define SYS_write 4 + +#endif diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/syscalls.list b/ports/sysdeps/unix/sysv/sco3.2.4/syscalls.list new file mode 100644 index 000000000..bda6c16c7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/syscalls.list @@ -0,0 +1,8 @@ +# File name Caller Syscall name # args Strong name Weak names + +pathconf - pathconf 2 __pathconf pathconf +pgrpsys - pgrpsys 3 __pgrpsys +sco_getgrp getgroups getgroups 2 __sco_getgroups +sigpending - sigpending 1 sigpending +sigprocmask - sigprocmask 3 __sigprocmask sigprocmask +sigsuspend - sigsuspend 1 sigsuspend diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/sysconf.S b/ports/sysdeps/unix/sysv/sco3.2.4/sysconf.S new file mode 100644 index 000000000..9780bd488 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/sysconf.S @@ -0,0 +1,30 @@ +/* Copyright (C) 1993, 1994, 1995, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <bits/confname.h> + +.globl __tzname_max +ENTRY (__sysconf) + cmpl $_SC_TZNAME_MAX, 4(%esp) /* Is the arg _SC_TZNAME_MAX? */ + je tzname + DO_CALL (sysconf, 1) /* No; use the SCO system call. */ + ret +tzname: jmp C_SYMBOL_NAME(__tzname_max) /* Yes; bounce to __tzname_max (). */ + +weak_alias (__sysconf, sysconf) diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/system.c b/ports/sysdeps/unix/sysv/sco3.2.4/system.c new file mode 100644 index 000000000..06dc066b8 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/system.c @@ -0,0 +1,10 @@ +/* SCO has a bug where `waitpid' will never return if SIGCHLD is blocked. + They have acknowledged that this is a bug but I have not seen nor heard + of any forthcoming fix. */ + +#define WAITPID_CANNOT_BLOCK_SIGCHLD + +/* SCO 3.2v4 does have `waitpid'. + Avoid unix/system.c, which says we don't. */ + +#include <sysdeps/posix/system.c> diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/uname.S b/ports/sysdeps/unix/sysv/sco3.2.4/uname.S new file mode 100644 index 000000000..bc61089d6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/uname.S @@ -0,0 +1,41 @@ +/* Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc. + Contributed by Scott Bartram. + 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +/* + before lcall, stack contents should be: + + 4(%esp) -> name + 8(%esp) -> unspecified + 12(%esp) -> 0 + */ + +ENTRY (uname) + pushl $0x0 /* Push the discriminator flag. */ + pushl $0x0 /* Push dummy placeholder. */ + pushl 12(%esp,1) /* Push NAME (ptr to struct utsname) */ + subl $0x4, %esp /* Adjust stack pointer. */ + DO_CALL (utssys, 3) + jb error /* Test for error. */ + addl $0x10, %esp /* Adjust the stack pointer. */ + xorl %eax, %eax /* Clear return value. */ + ret +error: addl $0x10, %esp /* Adjust the stack pointer. */ + jmp syscall_error diff --git a/ports/sysdeps/unix/sysv/sco3.2.4/waitpid.S b/ports/sysdeps/unix/sysv/sco3.2.4/waitpid.S new file mode 100644 index 000000000..ccbc81274 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2.4/waitpid.S @@ -0,0 +1,37 @@ +/* Copyright (C) 1993,94,95,97,2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +ENTRY (__waitpid) + /* The `waitpid' system call is distinguished from plain + `wait' by setting lots of bits in the processor flags. */ + pushfl /* Push the flags word. */ + popl %eax /* Pop it into the accumulator. */ + orl $0x8c4, %eax /* Set lots of bits. */ + pushl %eax /* Push the new flags word. */ + popfl /* Pop it into the flags. */ + DO_CALL (wait, 2) + movl 8(%esp), scratch /* Put status pointer in scratch register. */ + testl scratch, scratch /* Is it non-nil? */ + je null + movl r1, (scratch) /* Yes; store the status there. */ +null: ret + +libc_hidden_def (__waitpid) +weak_alias (__waitpid, waitpid) diff --git a/ports/sysdeps/unix/sysv/sco3.2/Dist b/ports/sysdeps/unix/sysv/sco3.2/Dist new file mode 100644 index 000000000..60fab2bde --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2/Dist @@ -0,0 +1 @@ +__fltused.c diff --git a/ports/sysdeps/unix/sysv/sco3.2/Makefile b/ports/sysdeps/unix/sysv/sco3.2/Makefile new file mode 100644 index 000000000..c4d9da7a0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2/Makefile @@ -0,0 +1,23 @@ +# Copyright (C) 1993, 1997 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 Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +ifeq ($(subdir),misc) + +sysdep_routines := $(sysdep_routines) __fltused + +endif diff --git a/ports/sysdeps/unix/sysv/sco3.2/__fltused.c b/ports/sysdeps/unix/sysv/sco3.2/__fltused.c new file mode 100644 index 000000000..5d1d67f0b --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2/__fltused.c @@ -0,0 +1,3 @@ +/* Code compiled by the SCO compiler apparently likes this to be defined. */ + +int __fltused = 1; diff --git a/ports/sysdeps/unix/sysv/sco3.2/bits/local_lim.h b/ports/sysdeps/unix/sysv/sco3.2/bits/local_lim.h new file mode 100644 index 000000000..b4141d0db --- /dev/null +++ b/ports/sysdeps/unix/sysv/sco3.2/bits/local_lim.h @@ -0,0 +1,37 @@ +/* Copyright (C) 1993, 1996 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_LOCAL_LIM_H +#define _BITS_LOCAL_LIM_H 1 + +#define NGROUPS_MAX 8 /* Maximum number of supplementary groups. */ +#define ARG_MAX 5120 +#define CHILD_MAX 25 +#define OPEN_MAX 60 +#define LINK_MAX 1000 +#define MAX_CANON 256 + +/* For SVR3, this is 14. For SVR4, it is 255, at least on ufs + file systems, even though the System V limits.h incorrectly + defines it as 14. Giving it a value which is too large + is harmless (it is a maximum). */ +#define NAME_MAX 255 + +#define PATH_MAX 1024 + +#endif /* bits/local_lim.h */ diff --git a/ports/sysdeps/unix/sysv/sysv4/Dist b/ports/sysdeps/unix/sysv/sysv4/Dist new file mode 100644 index 000000000..639506450 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/Dist @@ -0,0 +1,4 @@ +__getpgid.c +__setpgid.c +sysconfig.h +siginfo.h diff --git a/ports/sysdeps/unix/sysv/sysv4/Implies b/ports/sysdeps/unix/sysv/sysv4/Implies new file mode 100644 index 000000000..953822ea4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/Implies @@ -0,0 +1,3 @@ +# The directory unix/common contains things which are common to both BSD +# and SVR4. +unix/common diff --git a/ports/sysdeps/unix/sysv/sysv4/Makefile b/ports/sysdeps/unix/sysv/sysv4/Makefile new file mode 100644 index 000000000..6f7155c71 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/Makefile @@ -0,0 +1,29 @@ +# Copyright (C) 1992, 1993, 1995, 1996, 1997 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 Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +ifeq ($(subdir),posix) + +sysdep_routines := $(sysdep_routines) sysconfig pgrpsys __waitid + +endif + +ifeq ($(subdir),misc) + +sysdep_routines := $(sysdep_routines) sysinfo + +endif diff --git a/ports/sysdeps/unix/sysv/sysv4/__getpgid.c b/ports/sysdeps/unix/sysv/sysv4/__getpgid.c new file mode 100644 index 000000000..74ca3e0f9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/__getpgid.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1993, 1997, 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> + +extern int __pgrpsys (int type, ...); + +/* Get the process group ID of process PID. */ +int +__getpgid (pid) + pid_t pid; +{ + return __pgrpsys (4, pid); +} +libc_hidden_def (__getpgid) diff --git a/ports/sysdeps/unix/sysv/sysv4/__setpgid.c b/ports/sysdeps/unix/sysv/sysv4/__setpgid.c new file mode 100644 index 000000000..36ad5cc77 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/__setpgid.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1993, 1997, 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> + +extern int __pgrpsys (int type, ...); + +/* Get the process group ID of process PID. */ +int +__setpgid (pid, pgid) + pid_t pid; + pid_t pgid; +{ + return __pgrpsys (5, pid, pgid); +} +libc_hidden_def (__setpgid) diff --git a/ports/sysdeps/unix/sysv/sysv4/bits/sigaction.h b/ports/sysdeps/unix/sysv/sysv4/bits/sigaction.h new file mode 100644 index 000000000..faf07e5ff --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/bits/sigaction.h @@ -0,0 +1,55 @@ +/* The proper definitions for SVR4's sigaction. + Copyright (C) 1993, 1994, 1996, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Special flags. */ + int sa_flags; + + /* Signal handler. */ + __sighandler_t sa_handler; + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* Padding. */ + int sa_resv[2]; + }; + +/* Bits in `sa_flags'. */ +#ifdef __USE_MISC +# define SA_ONSTACK 0x1 /* Take signal on signal stack. */ +# define SA_RESETHAND 0x2 /* Reset to SIG_DFL on entry to handler. */ +# define SA_RESTART 0x4 /* Restart syscall on signal return. */ +# define SA_SIGINFO 0x8 /* Provide additional info to the handler. */ +# define SA_NODEFER 0x10 /* Don't automatically block the signal when + its handler is being executed. */ +# define SA_NOCLDWAIT 0x10000 /* Don't save zombie processes. */ +#endif +#define SA_NOCLDSTOP 0x20000 /* Don't send SIGCHLD when children stop. */ + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_BLOCK 1 /* Block signals. */ +#define SIG_UNBLOCK 2 /* Unblock signals. */ +#define SIG_SETMASK 3 /* Set the set of blocked signals. */ diff --git a/ports/sysdeps/unix/sysv/sysv4/bits/signum.h b/ports/sysdeps/unix/sysv/sysv4/bits/signum.h new file mode 100644 index 000000000..07f900a78 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/bits/signum.h @@ -0,0 +1,66 @@ +/* Signal number definitions. SVR4 version. + Copyright (C) 1994, 1996 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGEMT 7 /* EMT trap (4.2 BSD). */ +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* Bus error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 /* Bad argument to system call (4.2 BSD)*/ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGPWR 19 /* Power failure restart (System V). */ +#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ +#define SIGURG 21 /* Urgent condition on socket (4.2 BSD).*/ +#define SIGPOLL 22 /* Pollable event occurred (System V). */ +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */ +#define SIGSTOP 23 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 24 /* Keyboard stop (POSIX). */ +#define SIGCONT 25 /* Continue (POSIX). */ +#define SIGTTIN 26 /* Background read from tty (POSIX). */ +#define SIGTTOU 27 /* Background write to tty (POSIX). */ +#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ +#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ + +#endif /* <signal.h> included. */ + +#define _NSIG 32 /* Biggest signal number + 1. */ diff --git a/ports/sysdeps/unix/sysv/sysv4/bits/sigset.h b/ports/sysdeps/unix/sysv/sysv4/bits/sigset.h new file mode 100644 index 000000000..9093c7295 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/bits/sigset.h @@ -0,0 +1,98 @@ +/* __sig_atomic_t, __sigset_t, and related definitions. SVR4 version. + Copyright (C) 1994-1996, 2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGSET_H_types +#define _SIGSET_H_types 1 + +typedef int __sig_atomic_t; + +/* A `sigset_t' has a bit for each signal. */ +typedef struct + { + unsigned long int __sigbits[4]; + } __sigset_t; + +#endif /* ! _SIGSET_H_types */ + +/* We only want to define these functions if <signal.h> was actually + included; otherwise we were included just to define the types. Since we + are namespace-clean, it wouldn't hurt to define extra macros. But + trouble can be caused by functions being defined (e.g., any global + register vars declared later will cause compilation errors). */ + +#if !defined (_SIGSET_H_fns) && defined (_SIGNAL_H) +#define _SIGSET_H_fns 1 + +/* Return a mask that includes SIG only. */ +#define __sigmask(sig) (1 << ((sig) - 1)) + + +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NSSBITS (sizeof (unsigned long int) * 8) +#define __SSELT(s) ((s) / __NSSBITS) +#define __SSMASK(s) (1 << ((s) % __NSSBITS)) + +#ifdef __USE_EXTERN_INLINES +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +# endif + +_EXTERN_INLINE int +__sigemptyset (__sigset_t *__set) +{ + __set->__sigbits[0] = __set->__sigbits[1] = + __set->__sigbits[2] = __set->__sigbits[3] = 0L; + return 0; +} + +_EXTERN_INLINE int +__sigfillset (__sigset_t *__set) +{ + /* SVR4 has a system call for `sigfillset' (!), and it only sets the bits + for signals [1,31]. Setting bits for unimplemented signals seems + harmless (and we will find out if it really is). */ + __set->__sigbits[0] = __set->__sigbits[1] = + __set->__sigbits[2] = __set->__sigbits[3] = ~0L; + return 0; +} + +_EXTERN_INLINE int +__sigaddset (__sigset_t *__set, int __sig) +{ + __set->__sigbits[__SSELT (__sig)] |= __SSMASK (__sig); + return 0; +} + +_EXTERN_INLINE int +__sigdelset (__sigset_t *__set, int __sig) +{ + __set->__sigbits[__SSELT (__sig)] &= ~__SSMASK (__sig); + return 0; +} + +_EXTERN_INLINE int +__sigismember (__const __sigset_t *__set, int __sig) +{ + if (__set->__sigbits[__SSELT (__sig)] & __SSMASK (__sig)) + return 1; + return 0; +} +#endif /* use extern inlines. */ + +#endif /* ! _SIGSET_H_fns */ diff --git a/ports/sysdeps/unix/sysv/sysv4/bits/utsname.h b/ports/sysdeps/unix/sysv/sysv4/bits/utsname.h new file mode 100644 index 000000000..891ae6862 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/bits/utsname.h @@ -0,0 +1,23 @@ +/* Copyright (C) 1995, 1996, 1997, 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UTSNAME_H +# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead." +#endif + +#define _UTSNAME_LENGTH 257 diff --git a/ports/sysdeps/unix/sysv/sysv4/bits/waitflags.h b/ports/sysdeps/unix/sysv/sysv4/bits/waitflags.h new file mode 100644 index 000000000..40bc823de --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/bits/waitflags.h @@ -0,0 +1,34 @@ +/* Definitions of flag bits for `waitpid' et al. + Copyright (C) 1993, 1996, 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _SYS_WAIT_H && !defined _STDLIB_H +# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead." +#endif + + +/* Bits in the third argument to `waitpid'. */ +#define WNOHANG 64 /* Don't block waiting. */ +#define WUNTRACED 4 /* Report status of stopped children. */ + +#ifdef __USE_SVID +# define WEXITED 1 /* Look for children that have exited. */ +# define WTRAPPED 2 /* Look for processes that stopped + while tracing. */ +#endif diff --git a/ports/sysdeps/unix/sysv/sysv4/dup2.c b/ports/sysdeps/unix/sysv/sysv4/dup2.c new file mode 100644 index 000000000..7d36e0e35 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/dup2.c @@ -0,0 +1,2 @@ +/* SVR4 uses the POSIX dup2. */ +#include <sysdeps/posix/dup2.c> diff --git a/ports/sysdeps/unix/sysv/sysv4/ftruncate.c b/ports/sysdeps/unix/sysv/sysv4/ftruncate.c new file mode 100644 index 000000000..47e040eb2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/ftruncate.c @@ -0,0 +1,37 @@ +/* ftruncate for SVR4 using the fcntl F_FREESP command. + Copyright (C) 1995, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> +#include <string.h> + +/* Truncate the file FD refers to to LENGTH bytes. */ +int +ftruncate (fd, length) + int fd; + off_t length; +{ + struct flock fl; + + memset (&fl, 0, sizeof fl); + fl.l_type = F_WRLCK; + fl.l_start = length; + return fcntl (fd, F_FREESP, &fl); +} diff --git a/ports/sysdeps/unix/sysv/sysv4/gethostname.c b/ports/sysdeps/unix/sysv/sysv4/gethostname.c new file mode 100644 index 000000000..4a058b51c --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/gethostname.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1994, 1995, 1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/systeminfo.h> + +extern int __sysinfo (int command, char *buf, long int count); + +int +__gethostname (name, namelen) + char *name; + size_t namelen; +{ + return __sysinfo (SI_HOSTNAME, name, namelen); +} + +weak_alias (__gethostname, gethostname) diff --git a/ports/sysdeps/unix/sysv/sysv4/getpagesize.c b/ports/sysdeps/unix/sysv/sysv4/getpagesize.c new file mode 100644 index 000000000..611964075 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/getpagesize.c @@ -0,0 +1,2 @@ +/* Solaris uses sysconf ala POSIX.1. */ +#include <sysdeps/posix/getpagesize.c> diff --git a/ports/sysdeps/unix/sysv/sysv4/getpgid.c b/ports/sysdeps/unix/sysv/sysv4/getpgid.c new file mode 100644 index 000000000..95f96417c --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/getpgid.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1993,1995,1997,1999,2002,2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <unistd.h> +#include <sys/types.h> + +extern pid_t __pgrpsys (int type, ...); + +/* Get the process group ID of process PID. */ +pid_t +__getpgid (pid) + pid_t pid; +{ + return __pgrpsys (4, pid); +} +libc_hidden_def (__getpgid) +weak_alias (__getpgid, getpgid) diff --git a/ports/sysdeps/unix/sysv/sysv4/i386/Dist b/ports/sysdeps/unix/sysv/sysv4/i386/Dist new file mode 100644 index 000000000..69d16ac6b --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/i386/Dist @@ -0,0 +1 @@ +sys-sig.S diff --git a/ports/sysdeps/unix/sysv/sysv4/i386/Makefile b/ports/sysdeps/unix/sysv/sysv4/i386/Makefile new file mode 100644 index 000000000..56f0a37de --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/i386/Makefile @@ -0,0 +1,3 @@ +ifeq ($(subdir),signal) +sysdep_routines := $(sysdep_routines) sys-sig +endif diff --git a/ports/sysdeps/unix/sysv/sysv4/i386/bits/stat.h b/ports/sysdeps/unix/sysv/sysv4/i386/bits/stat.h new file mode 100644 index 000000000..c1016a922 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/i386/bits/stat.h @@ -0,0 +1,93 @@ +/* Copyright (C) 1993, 1996, 1997, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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 + +#include <bits/types.h> + +/* Versions of the `struct stat' data structure and + the bits of the `xmknod' interface. */ +#define _STAT_VER 2 +#define _MKNOD_VER 2 + +/* Structure describing file characteristics. */ +struct stat + { + unsigned long itn st_dev; /* Device. */ + long int st_filler1[3]; + unsigned long int st_ino; /* File serial number. */ + unsigned long int st_mode; /* File mode. */ + unsigned long int st_nlink; /* Link count. */ + long int st_uid; /* User ID of the file's owner. */ + long int st_gid; /* Group ID of the file's group.*/ + unsigned long int st_rdev; /* Device number, if device. */ + long int st_filler2[2]; + + long int st_size; /* Size of file, in bytes. */ + /* SVR4 added this extra long to allow for expansion of off_t. */ + long int st_filler3; + + long int st_atime; /* Time of last access. */ + unsigned long int st_atime_usec; + long int st_mtime; /* Time of last modification. */ + unsigned long int st_mtime_usec; + long int st_ctime; /* Time of last status change. */ + unsigned long int st_ctime_usec; + + __blksize_t st_blksize; /* Optimal block size for I/O. */ +#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ + + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ + char st_fstype[16]; /* The type of this filesystem. */ + int st_aclcnt; + unsigned long int st_level; + unsigned long int st_flags; + unsigned long int st_cmwlevel; + long int st_filler4[4]; + }; + +/* 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. */ + +/* POSIX.1b objects. */ +#define __S_TYPEISMQ(buf) (0) +#define __S_TYPEISSEM(buf) (0) +#define __S_TYPEISSHM(buf) (0) + +/* 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. */ diff --git a/ports/sysdeps/unix/sysv/sysv4/i386/sys-sig.S b/ports/sysdeps/unix/sysv/sysv4/i386/sys-sig.S new file mode 100644 index 000000000..6e2d1abde --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/i386/sys-sig.S @@ -0,0 +1,30 @@ +/* Copyright (C) 1994, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +.globl C_SYMBOL_NAME(__sigreturn) + +ENTRY (__sigaction_syscall) + movl $C_SYMBOL_NAME(__sigreturn), %edx + DO_CALL (sigaction, 3) + jb syscall_error + ret + +PSEUDO (__context_syscall, context, 2) + ret diff --git a/ports/sysdeps/unix/sysv/sysv4/i386/syscalls.list b/ports/sysdeps/unix/sysv/sysv4/i386/syscalls.list new file mode 100644 index 000000000..560cd8366 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/i386/syscalls.list @@ -0,0 +1,6 @@ +# File name Caller Syscall name # args Strong name Weak names + +xstat - xstat 3 __xstat _xstat +fxstat - fxstat 3 __fxstat _fxstat +lxstat - lxstat 3 __lxstat _lxstat +xmknod - xmknod 4 __xmknod _xmknod diff --git a/ports/sysdeps/unix/sysv/sysv4/i386/sysdep.h b/ports/sysdeps/unix/sysv/sysv4/i386/sysdep.h new file mode 100644 index 000000000..daecdb622 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/i386/sysdep.h @@ -0,0 +1,38 @@ +/* Copyright (C) 1994, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdeps/unix/sysv/i386/sysdep.h> + +/* In SVR4 some system calls can fail with the error ERESTART, + and this means the call should be retried. */ + +#ifndef _ERRNO_H +#define _ERRNO_H +#endif +#include <bits/errno.h> + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + .globl syscall_error; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); \ + jae noerror; \ + cmpb $ERESTART, %al; \ + je C_SYMBOL_NAME (name); \ + jmp syscall_error; \ + noerror: diff --git a/ports/sysdeps/unix/sysv/sysv4/i386/vfork.S b/ports/sysdeps/unix/sysv/sysv4/i386/vfork.S new file mode 100644 index 000000000..bbe99fbc4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/i386/vfork.S @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/i386/vfork.S> diff --git a/ports/sysdeps/unix/sysv/sysv4/sethostname.c b/ports/sysdeps/unix/sysv/sysv4/sethostname.c new file mode 100644 index 000000000..d74b0f4f3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/sethostname.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1994, 1997, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/systeminfo.h> + +extern int __sysinfo (int command, const char *buf, long count); + +int +sethostname (name, namelen) + const char *name; + size_t namelen; +{ + return __sysinfo (SI_SET_HOSTNAME, name, namelen); +} diff --git a/ports/sysdeps/unix/sysv/sysv4/setpgid.c b/ports/sysdeps/unix/sysv/sysv4/setpgid.c new file mode 100644 index 000000000..80f4ad643 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/setpgid.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1993,1995-1997,1999,2002,2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> + +extern int __pgrpsys (pid_t type, ...); + +/* Set the process group ID of the process matching PID to PGID. + If PID is zero, the current process's process group ID is set. + If PGID is zero, the process ID of the process is used. */ +int +__setpgid (pid, pgid) + pid_t pid, pgid; +{ + return __pgrpsys (5, pid, pgid); +} +libc_hidden_def (__setpgid) +weak_alias (__setpgid, setpgid) diff --git a/ports/sysdeps/unix/sysv/sysv4/setsid.c b/ports/sysdeps/unix/sysv/sysv4/setsid.c new file mode 100644 index 000000000..faa2c42d7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/setsid.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1993, 1995, 1997, 1999, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> + +extern pid_t __pgrpsys (int type, ...); + +/* Create a new session with the calling process as its leader. + The process group IDs of the session and the calling process + are set to the process ID of the calling process, which is returned. */ +pid_t +__setsid () +{ + return __pgrpsys (3); +} + +weak_alias (__setsid, setsid) diff --git a/ports/sysdeps/unix/sysv/sysv4/sigaction.c b/ports/sysdeps/unix/sysv/sysv4/sigaction.c new file mode 100644 index 000000000..d5926b3d4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/sigaction.c @@ -0,0 +1,80 @@ +/* Copyright (C) 1994,1995,1996,1997,2002 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <signal.h> +#include <stddef.h> + +static __sighandler_t user_handlers[NSIG]; + +extern int __context_syscall (int, struct sigcontext *); +extern int __sigaction_syscall (int, + const struct sigaction *, struct sigaction *); + +static void +trampoline (int sig, int code, struct sigcontext *context) +{ + (*(void (*) (int, int, struct sigcontext *)) user_handlers[sig]) + (sig, code, context); + __context_syscall (1, context); +} + +/* If ACT is not NULL, change the action for SIG to *ACT. + If OACT is not NULL, put the old action for SIG in *OACT. */ +int +__sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; +{ + struct sigaction myact; + __sighandler_t ohandler; + + if (sig <= 0 || sig >= NSIG) + { + __set_errno (EINVAL); + return -1; + } + + ohandler = user_handlers[sig]; + + if (act != NULL) + { + user_handlers[sig] = act->sa_handler; + if (act->sa_handler != SIG_DFL && act->sa_handler != SIG_IGN) + { + myact = *act; + act = &myact; + act->sa_handler = (__sighandler_t) trampoline; + } + } + + if (__sigaction_syscall (sig, act, oact) < 0) + { + /* The syscall got an error. Restore the old handler and return -1. */ + user_handlers[sig] = ohandler; + return -1; + } + + if (oact != NULL && oact->sa_handler == (__sighandler_t) trampoline) + oact->sa_handler = ohandler; + + return 0; +} +libc_hidden_def (__sigaction) +weak_alias (__sigaction, sigaction) diff --git a/ports/sysdeps/unix/sysv/sysv4/siginfo.h b/ports/sysdeps/unix/sysv/sysv4/siginfo.h new file mode 100644 index 000000000..2bb925738 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/siginfo.h @@ -0,0 +1,59 @@ +/* Definitions of the siginfo structure. + Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGINFO_H +#define _SIGINFO_H 1 + +#ifdef __USE_SVID +/* SVR4 puts a ton of other stuff in this structure. For now, we'll just + define the two things we really need out of it, and hope for the best. */ + +/* These define the different states a child can have on exit. + We need these to build the status return for things like waitpid. */ +#define EXITED 1 +#define KILLED 2 +#define CORED 3 +#define TRAPPED 4 +#define STOPPED 5 +#define CONTINUED 6 + +typedef struct __siginfo + { + int filler1; + + /* Code indicating child's status */ + int __code; + + int filler2; + + /* The PID of the child. */ + long __pid; + + int filler3; + + /* The child's status. */ + int __status; + + int filler4[26]; + + } __siginfo_t; + +#endif /* __USE_SVID */ +#endif /* siginfo.h */ diff --git a/ports/sysdeps/unix/sysv/sysv4/sigset-cvt-mask.h b/ports/sysdeps/unix/sysv/sysv4/sigset-cvt-mask.h new file mode 100644 index 000000000..5b7ea2588 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/sigset-cvt-mask.h @@ -0,0 +1,37 @@ +/* Convert between lowlevel sigmask and libc representation of sigset_t. + SysVr4 version. + Copyright (C) 1998, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Joe Keane <jgk@jgk.org>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +static inline int __attribute__ ((unused)) +sigset_set_old_mask (sigset_t *set, int mask) +{ + set->__sigbits[0] = (unsigned int) mask; + set->__sigbits[1] = 0ul; + set->__sigbits[2] = 0ul; + set->__sigbits[3] = 0ul; + + return 0; +} + +static inline int __attribute__ ((unused)) +sigset_get_old_mask (const sigset_t *set) +{ + return (unsigned int) set->__sigbits[0]; +} diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/Makefile b/ports/sysdeps/unix/sysv/sysv4/solaris2/Makefile new file mode 100644 index 000000000..3ad90f748 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/Makefile @@ -0,0 +1,6 @@ +# The linker supplied with Solaris looks in the current directory +# before searching others. Compiling the various programs that come +# along the way (e.g., glue-ctype) will fail because it'll try to link +# with the libc.a being *constructed* in $(objdir). As a work-around, +# we add this to each native-compile. +ALL_BUILD_CFLAGS += -L/lib diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/dirent.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/dirent.h new file mode 100644 index 000000000..fa0250eb3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/dirent.h @@ -0,0 +1,50 @@ +/* Copyright (C) 1996, 1997, 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DIRENT_H +# error "Never use <bits/dirent.h> directly; include <dirent.h> instead." +#endif + +struct dirent + { +#ifndef __USE_FILE_OFFSET64 + __ino_t d_ino; + __off_t d_off; +#else + __ino64_t d_ino; + __off64_t d_off; +#endif + unsigned short int d_reclen; + char d_name[256]; /* We must not include limits.h! */ + }; + +#ifdef __USE_LARGEFILE64 +struct dirent64 + { + __ino64_t d_ino; + __off64_t d_off; + unsigned short int d_reclen; + char d_name[256]; /* We must not include limits.h! */ + }; +#endif + +#define d_fileno d_ino /* Backwards compatibility. */ + +#undef _DIRENT_HAVE_D_NAMLEN +#define _DIRENT_HAVE_D_RECLEN +#define _DIRENT_HAVE_D_OFF diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/errno.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/errno.h new file mode 100644 index 000000000..6c0de9215 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/errno.h @@ -0,0 +1,168 @@ +/* Copyright (C) 1991, 1994, 1996, 1997, 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file defines the `errno' constants. */ + +#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath) +#undef __need_Emath +#define __Emath_defined 1 + +# define EDOM 33 /* Math argument out of domain of function. */ +# define EILSEQ 88 /* Illegal byte sequence. */ +# define ERANGE 34 /* Math result not representable. */ +#endif + +#ifdef _ERRNO_H +/* All error codes the system knows about. */ + +# define EPERM 1 /* Not super-user. */ +# define ENOENT 2 /* No such file or directory. */ +# define ESRCH 3 /* No such process. */ +# define EINTR 4 /* Interrupted system call. */ +# define EIO 5 /* I/O error. */ +# define ENXIO 6 /* No such device or address. */ +# define E2BIG 7 /* Arg list too long. */ +# define ENOEXEC 8 /* Exec format error. */ +# define EBADF 9 /* Bad file number. */ +# define ECHILD 10 /* No children. */ +# define EAGAIN 11 /* Resource temporarily unavailable. */ +# define EWOULDBLOCK EAGAIN +# define ENOMEM 12 /* Not enough core. */ +# define EACCES 13 /* Permission denied. */ +# define EFAULT 14 /* Bad address. */ +# define ENOTBLK 15 /* Block device required. */ +# define EBUSY 16 /* Mount device busy. */ +# define EEXIST 17 /* File exists. */ +# define EXDEV 18 /* Cross-device link. */ +# define ENODEV 19 /* No such device. */ +# define ENOTDIR 20 /* Not a directory. */ +# define EISDIR 21 /* Is a directory. */ +# define EINVAL 22 /* Invalid argument. */ +# define ENFILE 23 /* File table overflow. */ +# define EMFILE 24 /* Too many open files. */ +# define ENOTTY 25 /* Inappropriate ioctl for device. */ +# define ETXTBSY 26 /* Text file busy. */ +# define EFBIG 27 /* File too large. */ +# define ENOSPC 28 /* No space left on device. */ +# define ESPIPE 29 /* Illegal seek. */ +# define EROFS 30 /* Read only file system. */ +# define EMLINK 31 /* Too many links. */ +# define EPIPE 32 /* Broken pipe. */ +# define ENOMSG 35 /* No message of desired type. */ +# define EIDRM 36 /* Identifier removed. */ +# define ECHRNG 37 /* Channel number out of range. */ +# define EL2NSYNC 38 /* Level 2 not synchronized. */ +# define EL3HLT 39 /* Level 3 halted. */ +# define EL3RST 40 /* Level 3 reset. */ +# define ELNRNG 41 /* Link number out of range. */ +# define EUNATCH 42 /* Protocol driver not attached. */ +# define ENOCSI 43 /* No CSI structure available. */ +# define EL2HLT 44 /* Level 2 halted. */ +# define EDEADLK 45 /* Deadlock condition. */ +# define ENOLCK 46 /* No record locks available. */ +# define ECANCELED 47 /* Operation canceled. */ +# define ENOTSUP 48 /* Operation not supported. */ + +/* Filesystem Quotas. */ +# define EDQUOT 49 /* Disc quota exceeded. */ + +/* Convergent Error Returns. */ +# define EBADE 50 /* Invalid exchange. */ +# define EBADR 51 /* Invalid request descriptor. */ +# define EXFULL 52 /* Exchange full. */ +# define ENOANO 53 /* No anode. */ +# define EBADRQC 54 /* Invalid request code. */ +# define EBADSLT 55 /* Invalid slot. */ +# define EDEADLOCK 56 /* File locking deadlock error. */ + +# define EBFONT 57 /* Bad font file fmt. */ + +/* STREAM problems. */ +# define ENOSTR 60 /* Device not a stream. */ +# define ENODATA 61 /* No data (for no delay io). */ +# define ETIME 62 /* Timer expired. */ +# define ENOSR 63 /* Out of streams resources. */ + +# define ENONET 64 /* Machine is not on the network. */ +# define ENOPKG 65 /* Package not installed. */ +# define EREMOTE 66 /* The object is remote. */ +# define ENOLINK 67 /* The link has been severed. */ +# define EADV 68 /* Advertise error. */ +# define ESRMNT 69 /* Srmount error. */ + +# define ECOMM 70 /* Communication error on send. */ +# define EPROTO 71 /* Protocol error. */ +# define EMULTIHOP 74 /* Multihop attempted. */ +# define EBADMSG 77 /* Trying to read unreadable message. */ +# define ENAMETOOLONG 78 /* Path name is too long. */ +# define EOVERFLOW 79 /* Value too large to be stored in data type.*/ +# define ENOTUNIQ 80 /* Given log. name not unique. */ +# define EBADFD 81 /* F.d. invalid for this operation. */ +# define EREMCHG 82 /* Remote address changed. */ + +/* Shared library problems. */ +# define ELIBACC 83 /* Can't access a needed shared lib. */ +# define ELIBBAD 84 /* Accessing a corrupted shared lib. */ +# define ELIBSCN 85 /* .lib section in a.out corrupted. */ +# define ELIBMAX 86 /* Attempting to link in too many libs. */ +# define ELIBEXEC 87 /* Attempting to exec a shared library. */ +# define ENOSYS 89 /* Unsupported file system operation. */ +# define ELOOP 90 /* Symbolic link loop. */ +# define ERESTART 91 /* Restartable system call. */ +# define ESTRPIPE 92 /* If pipe/FIFO, don't sleep in stream head. */ +# define ENOTEMPTY 93 /* Directory not empty. */ +# define EUSERS 94 /* Too many users (for UFS). */ + +/* BSD Networking Software: argument errors. */ +# define ENOTSOCK 95 /* Socket operation on non-socket. */ +# define EDESTADDRREQ 96 /* Destination address required. */ +# define EMSGSIZE 97 /* Message too long. */ +# define EPROTOTYPE 98 /* Protocol wrong type for socket. */ +# define ENOPROTOOPT 99 /* Protocol not available. */ +# define EPROTONOSUPPORT 120 /* Protocol not supported. */ +# define ESOCKTNOSUPPORT 121 /* Socket type not supported. */ +# define EOPNOTSUPP 122 /* Operation not supported on socket. */ +# define EPFNOSUPPORT 123 /* Protocol family not supported. */ +# define EAFNOSUPPORT 124 /* Address family not supported by + protocol family. */ +# define EADDRINUSE 125 /* Address already in use. */ +# define EADDRNOTAVAIL 126 /* Can't assign requested address. */ +/* BSD Networking Software: operational errors. */ +# define ENETDOWN 127 /* Network is down. */ +# define ENETUNREACH 128 /* Network is unreachable. */ +# define ENETRESET 129 /* Network dropped connection because + of reset. */ +# define ECONNABORTED 130 /* Software caused connection abort. */ +# define ECONNRESET 131 /* Connection reset by peer. */ +# define ENOBUFS 132 /* No buffer space available. */ +# define EISCONN 133 /* Socket is already connected. */ +# define ENOTCONN 134 /* Socket is not connected. */ +/* XENIX has 135 - 142. */ +# define ESHUTDOWN 143 /* Can't send after socket shutdown. */ +# define ETOOMANYREFS 144 /* Too many references: can't splice. */ +# define ETIMEDOUT 145 /* Connection timed out. */ +# define ECONNREFUSED 146 /* Connection refused. */ +# define EHOSTDOWN 147 /* Host is down. */ +# define EHOSTUNREACH 148 /* No route to host. */ +# define EALREADY 149 /* operation already in progress. */ +# define EINPROGRESS 150 /* operation now in progress. */ + +/* SUN Network File System. */ +# define ESTALE 151 /* Stale NFS file handle. */ + +#endif diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/signum.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/signum.h new file mode 100644 index 000000000..a2659530b --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/signum.h @@ -0,0 +1,76 @@ +/* Signal number definitions. Solaris 2 version. + Copyright (C) 1994, 1996, 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGEMT 7 /* EMT trap (4.2 BSD). */ +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* Bus error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 /* Bad argument to system call (4.2 BSD)*/ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGPWR 19 /* Power failure restart (System V). */ +#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ +#define SIGURG 21 /* Urgent condition on socket (4.2 BSD).*/ +#define SIGPOLL 22 /* Pollable event occurred (System V). */ +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */ +#define SIGSTOP 23 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 24 /* Keyboard stop (POSIX). */ +#define SIGCONT 25 /* Continue (POSIX). */ +#define SIGTTIN 26 /* Background read from tty (POSIX). */ +#define SIGTTOU 27 /* Background write to tty (POSIX). */ +#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ +#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ +/* The following signals are new in Solaris 2. */ +#define SIGWAITING 32 /* Process's lwps are blocked. */ +#define SIGLWP 33 /* Special signal used by thread library. */ +#define SIGFREEZE 34 /* Special signal used by CPR. */ +#define SIGTHAW 35 /* Special signal used by CPR. */ +#define _SIGRTMIN 36 /* First (highest-priority) realtime signal. */ +#define _SIGRTMAX 43 /* Last (lowest-priority) realtime signal. */ + +#endif /* <signal.h> included. */ + +#define _NSIG 44 /* Biggest signal number + 1. */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/sigstack.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/sigstack.h new file mode 100644 index 000000000..753caac8a --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/sigstack.h @@ -0,0 +1,55 @@ +/* sigstack, sigaltstack definitions. + Copyright (C) 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include this file directly. Use <signal.h> instead" +#endif + + +/* Structure describing a signal stack (obsolete). */ +struct sigstack + { + __ptr_t ss_sp; /* Signal stack pointer. */ + int ss_onstack; /* Nonzero if executing on this stack. */ + }; + + +/* Possible values for `ss_flags.'. */ +enum +{ + SS_ONSTACK = 1, +#define SS_ONSTACK SS_ONSTACK + SS_DISABLE +#define SS_DISABLE SS_DISABLE +}; + +/* Minimum stack size for a signal handler. */ +#define MINSIGSTKSZ 2048 + +/* System default stack size. */ +#define SIGSTKSZ 8192 + + +/* Alternate, preferred interface. */ +typedef struct sigaltstack + { + __ptr_t ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h new file mode 100644 index 000000000..22c1c1f85 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h @@ -0,0 +1,119 @@ +/* Copyright (C) 1993, 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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 + +#include <bits/types.h> + +/* Length of array allocated for file system type name. */ +#define _ST_FSTYPSZ 16 + + +/* Structure describing file characteristics. */ +struct stat + { + __dev_t st_dev; + long int st_filler1[3]; + __ino_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. */ + long int st_filler2[2]; + + __off_t st_size; /* Size of file, in bytes. */ + /* SVR4 added this extra long to allow for expansion of off_t. */ + long int st_filler3; + + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atime_usec; + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtime_usec; + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctime_usec; + + __blksize_t st_blksize; /* Optimal block size for I/O. */ +#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ + + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ + char st_fstype[_ST_FSTYPSZ]; + long int st_filler4[8]; + }; + +#ifdef __USE_LARGEFILE64 +/* struct stat64 has the shape as stat */ +struct stat64 + { + __dev_t st_dev; /* Device */ + long int st_filler1[2]; + __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 */ + long int st_filler2; + + __off64_t st_size; /* Size of file, in bytes. */ + + __time_t st_atime; /* Time of last access */ + unsigned long int st_atime_usec; + __time_t st_mtime; /* Time of last modification */ + unsigned long int st_mtime_usec; + __time_t st_ctime; /* Time of last status change */ + unsigned long int st_ctime_usec; + + __blksize_t st_blksize; + __blkcnt64_t st_blocks; + char st_fstype[_ST_FSTYPSZ]; + long int st_filler3[8]; +}; +#endif + + +/* 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. */ + +/* POSIX.1b objects. */ +#define __S_TYPEISMQ(buf) (0) +#define __S_TYPEISSEM(buf) (0) +#define __S_TYPEISSHM(buf) (0) + +/* 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. */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/types.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/types.h new file mode 100644 index 000000000..a9ce216c6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/bits/types.h @@ -0,0 +1,120 @@ +/* Copyright (C) 1991,92,1994-1999,2000,2001 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use <sys/types.h> instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include <features.h> + +#define __need_size_t +#include <stddef.h> + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; +#ifdef __GNUC__ +typedef unsigned long long int __u_quad_t; +typedef long long int __quad_t; +#else +typedef struct +{ + long __val[2]; +} __quad_t; +typedef struct +{ + __u_long __val[2]; +} __u_quad_t; +#endif +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#ifdef __GNUC__ +typedef signed long long int __int64_t; +typedef unsigned long long int __uint64_t; +#endif +typedef __quad_t *__qaddr_t; +typedef unsigned long int __dev_t; /* Type of device numbers. */ +typedef long int __uid_t; /* Type of user identifications. */ +typedef long int __gid_t; /* Type of group identifications. */ +typedef unsigned long int __ino_t; /* Type of file serial numbers. */ +typedef unsigned long int __mode_t; /* Type of file attribute bitmasks. */ +typedef unsigned long int __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef long int __pid_t; /* Type of process identifications. */ +typedef int __ssize_t; /* Type of a byte count, or error. */ +typedef __u_quad_t __fsid_t; /* Type of file system IDs. */ +typedef long int __clock_t; /* Type of CPU usage counts. */ +typedef long int __rlim_t; /* Type for resource measurement. */ +typedef __quad_t __rlim64_t; /* Type for resource measurement (LFS). */ +typedef __quad_t __ino64_t; /* Type for file serial numbers. */ +typedef __loff_t __off64_t; /* Type of file izes and offsets. */ +typedef unsigned int __id_t; /* General type for IDs. */ + +/* Everythin' else. */ +typedef long int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef int __suseconds_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ +typedef int __key_t; /* Type of an IPC key */ + +/* fd_set for select. */ + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +/* Type to represent block size. */ +typedef long int __blksize_t; + +/* Types from the Large File Support interface. */ + +/* Type to count number os disk blocks. */ +typedef long int __blkcnt_t; +typedef __quad_t __blkcnt64_t; + +/* Type to count file system blocks. */ +typedef unsigned int __fsblkcnt_t; +typedef __u_quad_t __fsblkcnt64_t; + +/* Type to count file system inodes. */ +typedef unsigned long int __fsfilcnt_t; +typedef __u_quad_t __fsfilcnt64_t; + +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + +/* Duplicates info from stdint.h but this is used in unistd.h. */ +typedef long int __intptr_t; + +/* Duplicate info from sys/socket.h. */ +typedef unsigned int __socklen_t; + +#endif /* bits/types.h */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/fsync.S b/ports/sysdeps/unix/sysv/sysv4/solaris2/fsync.S new file mode 100644 index 000000000..493926a98 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/fsync.S @@ -0,0 +1,30 @@ +/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +/* Solaris uses fdsync for the normal fsync. */ +ENTRY(fsync) + mov 16, %i1 + mov SYS_ify(fdsync), %g1 + ta 8 + bcs syscall_error + nop + mov %g0, %o0 + ret diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/getdents.c b/ports/sysdeps/unix/sysv/sysv4/solaris2/getdents.c new file mode 100644 index 000000000..ab782ffaa --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/getdents.c @@ -0,0 +1,114 @@ +/* Copyright (C) 1993,95,96,97,98, 2004 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <alloca.h> +#include <dirent.h> +#include <stddef.h> +#include <string.h> +#include <unistd.h> +#include <sys/param.h> +#include <sys/types.h> + +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + + +extern int __getdents (int fd, char *buf, size_t nbytes); + +/* For Solaris we need a special version of this file since the + definition of `struct dirent' is not the same for the kernel and + the libc. There is one additional field which might be introduced + in the kernel structure in the future. + + He is the system definition of `struct dirent' as of 2.6: */ + +struct kernel_dirent + { + ino_t d_ino; + off_t d_off; + unsigned short int d_reclen; + char d_name[256]; + }; + +#ifdef GETDENTS64 +#define __getdirentries __getdirentries64 +#define dirent dirent64 +#endif + +/* The problem here is that we cannot simply read the next NBYTES + bytes. We need to take the additional field into account. We use + some heuristic. Assuming the directory contains names with 14 + characters on average we can compute an estimate number of entries + which fit in the buffer. Taking this number allows us to specify a + correct number of bytes to read. If we should be wrong, we can reset + the file descriptor. */ +ssize_t +__getdirentries (int fd, char *buf, size_t nbytes, off_t *basep) +{ + off_t base = __lseek (fd, (off_t) 0, SEEK_CUR); + off_t last_offset = base; + size_t red_nbytes; + struct kernel_dirent *skdp, *kdp; + struct dirent *dp; + int retval; + const size_t size_diff = (offsetof (struct dirent, d_name) + - offsetof (struct kernel_dirent, d_name)); + + red_nbytes = nbytes - ((nbytes / (offsetof (struct dirent, d_name) + 14)) + * size_diff); + + dp = (struct dirent *) buf; + skdp = kdp = __alloca (red_nbytes); + + retval = __getdents (fd, (char *) kdp, red_nbytes); + + while ((char *) kdp < (char *) skdp + retval) + { + const size_t alignment = __alignof__ (struct dirent); + /* Since kdp->d_reclen is already aligned for the kernel structure + this may compute a value that is bigger than necessary. */ + size_t new_reclen = ((kdp->d_reclen + size_diff + alignment - 1) + & ~(alignment - 1)); + if ((char *) dp + new_reclen > buf + nbytes) + { + /* Our heuristic failed. We read too many entries. Reset + the stream. */ + __lseek (fd, last_offset, SEEK_SET); + break; + } + + last_offset = kdp->d_off; + dp->d_ino = kdp->d_ino; + dp->d_off = kdp->d_off; + dp->d_reclen = new_reclen; + dp->d_type = DT_UNKNOWN; + memcpy (dp->d_name, kdp->d_name, + kdp->d_reclen - offsetof (struct kernel_dirent, d_name)); + + dp = (struct dirent *) ((char *) dp + new_reclen); + kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen); + } + + if (basep) + *basep = base; + + return (char *) dp - buf; +} + +#ifndef GETDENTS64 +weak_alias (__getdirentries, getdirentries) +#endif diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sigpending.c b/ports/sysdeps/unix/sysv/sysv4/solaris2/sigpending.c new file mode 100644 index 000000000..2723d79f7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sigpending.c @@ -0,0 +1,37 @@ +/* Copyright (C) 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stddef.h> +#include <signal.h> + +extern int __syscall_sigpending (int subcode, sigset_t *set); + + +/* Store in SET all signals that are blocked and pending. */ +int +sigpending (sigset_t *set) +{ + if (set == NULL) + { + __set_errno (EINVAL); + return -1; + } + + return __syscall_sigpending (1, set); +} diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sigstack.c b/ports/sysdeps/unix/sysv/sysv4/solaris2/sigstack.c new file mode 100644 index 000000000..5aa73c8dc --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sigstack.c @@ -0,0 +1,3 @@ +/* We can reuse the Linux implementation with some tricks. */ +#define __NR_sigaltstack 1 +#include <sysdeps/unix/sysv/linux/sigstack.c> diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sigwaitinfo.c b/ports/sysdeps/unix/sysv/sysv4/solaris2/sigwaitinfo.c new file mode 100644 index 000000000..f24664002 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sigwaitinfo.c @@ -0,0 +1,2 @@ +/* We can reuse the Linux implementation. */ +#include <sysdeps/unix/sysv/linux/sigwaitinfo.c> diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist new file mode 100644 index 000000000..783250777 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist @@ -0,0 +1 @@ +sys/trap.h diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile new file mode 100644 index 000000000..1c17ea168 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile @@ -0,0 +1,11 @@ +# This flag is necessary because GCC now tries to call _Q_{mul, etc...} +# instead of doing the stuff the hard way. For now, printf_fp.o, __vfscanf.o, +# and difftime.o don't work because of this. The long-term fix is to actually +# implement what they're doing, but for the short-term, we must do this. +sysdep-CFLAGS := $(sysdep-CFLAGS) -mhard-quad-float + +ifeq ($(subdir),crypt) + +crypt := crypt.solar + +endif diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h new file mode 100644 index 000000000..7c4bca604 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h @@ -0,0 +1,34 @@ +/* Structure describing state saved while handling a signal. Sparc version. + Copyright (C) 1992, 1994, 1997 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." +#endif + +struct sigcontext + { + int sc_onstack; + __sigset_t sc_mask; + +#define SPARC_MAXREGWINDOW 31 /* Maximum usable register windows. */ + int sc_sp, sc_pc, sc_npc, sc_psr, sc_g1, sc_o0; + int sc_wbcnt; /* Number of outstanding windows. */ + __ptr_t sc_spbuf[SPARC_MAXREGWINDOW]; /* SP's for each window. */ + int sc_wbuf[SPARC_MAXREGWINDOW][16]; /* Saved register windows. */ + }; diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/errlist.c b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/errlist.c new file mode 100644 index 000000000..3c75e3f01 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/errlist.c @@ -0,0 +1,185 @@ +/* Copyright (C) 1999 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stddef.h> +#include <libintl.h> + + +/* This is a list of all known `errno' codes. */ + + +const int _sys_nerr = 152; + +const char *const _sys_errlist[] = +{ + N_("Error 0"), + N_("Not owner"), + N_("No such file or directory"), + N_("No such process"), + N_("Interrupted system call"), + N_("I/O error"), + N_("No such device or address"), + N_("Arg list too long"), + N_("Exec format error"), + N_("Bad file number"), + N_("No child processes"), + N_("Resource temporarily unavailable"), + N_("Not enough space"), + N_("Permission denied"), + N_("Bad address"), + N_("Block device required"), + N_("Device busy"), + N_("File exists"), + N_("Cross-device link"), + N_("No such device"), + N_("Not a directory"), + N_("Is a directory"), + N_("Invalid argument"), + N_("File table overflow"), + N_("Too many open files"), + N_("Inappropriate ioctl for device"), + N_("Text file busy"), + N_("File too large"), + N_("No space left on device"), + N_("Illegal seek"), + N_("Read-only file system"), + N_("Too many links"), + N_("Broken pipe"), + N_("Argument out of domain"), + N_("Result too large"), + N_("No message of desired type"), + N_("Identifier removed"), + N_("Channel number out of range"), + N_("Level 2 not synchronized"), + N_("Level 3 halted"), + N_("Level 3 reset"), + N_("Link number out of range"), + N_("Protocol driver not attached"), + N_("No CSI structure available"), + N_("Level 2 halted"), + N_("Deadlock situation detected/avoided"), + N_("No record locks available"), + N_("Operation canceled"), + N_("Operation not supported"), + N_("Disc quota exceeded"), + N_("Bad exchange descriptor"), + N_("Bad request descriptor"), + N_("Message tables full"), + N_("Anode table overflow"), + N_("Bad request code"), + N_("Invalid slot"), + N_("File locking deadlock"), + N_("Bad font file format"), + N_("Error 58"), + N_("Error 59"), + N_("Not a stream device"), + N_("No data available"), + N_("Timer expired"), + N_("Out of stream resources"), + N_("Machine is not on the network"), + N_("Package not installed"), + N_("Object is remote"), + N_("Link has been severed"), + N_("Advertise error"), + N_("Srmount error"), + N_("Communication error on send"), + N_("Protocol error"), + N_("Error 72"), + N_("Error 73"), + N_("Multihop attempted"), + N_("Error 75"), + N_("Error 76"), + N_("Not a data message"), + N_("File name too long"), + N_("Value too large for defined data type"), + N_("Name not unique on network"), + N_("File descriptor in bad state"), + N_("Remote address changed"), + N_("Can not access a needed shared library"), + N_("Accessing a corrupted shared library"), + N_(".lib section in a.out corrupted"), + N_("Attempting to link in more shared libraries than system limit"), + N_("Can not exec a shared library directly"), + N_("Illegal byte sequence"), + N_("Operation not applicable"), + N_("Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS"), + N_("Error 91"), + N_("Error 92"), + N_("Directory not empty"), + N_("Too many users"), + N_("Socket operation on non-socket"), + N_("Destination address required"), + N_("Message too long"), + N_("Protocol wrong type for socket"), + N_("Option not supported by protocol"), + N_("Error 100"), + N_("Error 101"), + N_("Error 102"), + N_("Error 103"), + N_("Error 104"), + N_("Error 105"), + N_("Error 106"), + N_("Error 107"), + N_("Error 108"), + N_("Error 109"), + N_("Error 110"), + N_("Error 111"), + N_("Error 112"), + N_("Error 113"), + N_("Error 114"), + N_("Error 115"), + N_("Error 116"), + N_("Error 117"), + N_("Error 118"), + N_("Error 119"), + N_("Protocol not supported"), + N_("Socket type not supported"), + N_("Operation not supported on transport endpoint"), + N_("Protocol family not supported"), + N_("Address family not supported by protocol family"), + N_("Address already in use"), + N_("Cannot assign requested address"), + N_("Network is down"), + N_("Network is unreachable"), + N_("Network dropped connection because of reset"), + N_("Software caused connection abort"), + N_("Connection reset by peer"), + N_("No buffer space available"), + N_("Transport endpoint is already connected"), + N_("Transport endpoint is not connected"), + N_("Structure needs cleaning"), + N_("Error 136"), + N_("Not a name file"), + N_("Not available"), + N_("Is a name file"), + N_("Remote I/O error"), + N_("Reserved for future use"), + N_("Error 142"), + N_("Cannot send after socket shutdown"), + N_("Too many references: cannot splice"), + N_("Connection timed out"), + N_("Connection refused"), + N_("Host is down"), + N_("No route to host"), + N_("Operation already in progress"), + N_("Operation now in progress"), + N_("Stale NFS file handle") +}; + +weak_alias (_sys_errlist, sys_errlist) +weak_alias (_sys_nerr, sys_nerr) diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sparc32/syscall.S b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sparc32/syscall.S new file mode 100644 index 000000000..b9f2996e3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sparc32/syscall.S @@ -0,0 +1,2 @@ +/* Bets are that the Linux code works... */ +#include <sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S> diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c new file mode 100644 index 000000000..afdfaaa2e --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c @@ -0,0 +1,4 @@ +#define NO_SHLIB +/* Solaris needs start named `_start', not `start'. */ +#define NO_EXPLICIT_START +#include <sysdeps/unix/sparc/start.c> diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys/trap.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys/trap.h new file mode 100644 index 000000000..39d264597 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys/trap.h @@ -0,0 +1,36 @@ +/* Copyright (C) 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_TRAP_H +#define _SYS_TRAP_H 1 + +/* Solaris2 software traps. */ + +#define ST_OSYSCALL 0x00 +#define ST_BREAKPOINT 0x01 +#define ST_DIV0 0x02 +#define ST_FLUSH_WINDOWS 0x03 +#define ST_CLEAN_WINDOWS 0x04 +#define ST_RANGE_CHECK 0x05 +#define ST_FIX_ALIGN 0x06 +#define ST_INT_OVERFLOW 0x07 +#define ST_SYSCALL 0x08 + +/* Traps 0x10 through 0x1f are allotted to the user. */ + +#endif /* sys/trap.h */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys/ucontext.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys/ucontext.h new file mode 100644 index 000000000..6e9f69067 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys/ucontext.h @@ -0,0 +1,42 @@ +/* Copyright (C) 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include <features.h> +#include <signal.h> +#include <sys/types.h> + +typedef struct +{ + long int mc_filler[78]; +} mcontext_t; + +struct ucontext +{ + unsigned long int uc_flags; + struct ucontext *uc_link; + sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long int uc_filler[23]; +}; +typedef struct ucontext ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/syscalls.list b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/syscalls.list new file mode 100644 index 000000000..d96fbba7e --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/syscalls.list @@ -0,0 +1,3 @@ +# File name Caller Syscall name # args Strong name Weak names + +sys-sig - context 2 __context_syscall diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S new file mode 100644 index 000000000..2ac767c98 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S @@ -0,0 +1,47 @@ +/* Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H +#include <bits/errno.h> + +ENTRY(syscall_error) + /* If it was a syscall that got interrupted, but can + be restarted, drop EINTR in. */ + cmp %o0, ERESTART + be,a notint + mov EINTR, %o0 + +notint: +#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN + /* We translate the system's EWOULDBLOCK error into EAGAIN. + The GNU C library always defines EWOULDBLOCK==EAGAIN. + EWOULDBLOCK_sys is the original number. */ + cmp %o0, EWOULDBLOCK_sys + be,a notblock + mov EAGAIN, %o0 +#endif + +notblock:/* Store it in errno... */ + sethi %hi(C_SYMBOL_NAME(errno)), %g1 + st %o0, [%g1 + %lo(C_SYMBOL_NAME(errno))] + + /* And just kick back a -1. */ + retl + mov -1, %o0 diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h new file mode 100644 index 000000000..9a0db6afe --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1993,1994,1995,1997,1998,2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Solaris 2 does not precede the asm names of C symbols with a `_'. */ +#ifndef NO_UNDERSCORES +#define NO_UNDERSCORES +#endif + +#include <sysdeps/unix/sysdep.h> + +#ifdef __ASSEMBLER__ + +/* As of gcc-2.6.0, it complains about pound signs in front of things + that aren't arguments to the macro. So we use this to pull it off + instead. */ +#define cat(a,b) a##b +#define poundfnc cat(#,function) + +#define ENTRY(name) \ + .section ".text"; \ + .align 4; \ + .global C_SYMBOL_NAME(name); \ + .type C_SYMBOL_NAME(name), poundfnc; \ + C_LABEL(name) + +#define PSEUDO(name, syscall_name, args) \ + ENTRY (name) \ + mov SYS_ify(syscall_name), %g1; \ + ta 8; \ + bcs C_SYMBOL_NAME(syscall_error); \ + nop + +#define ret retl; nop +#define r0 %o0 +#define r1 %o1 +#define MOVE(x,y) mov x, y + +#define LOC(name) .L##name + +#endif /* __ASSEMBLER__ */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sys/param.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/sys/param.h new file mode 100644 index 000000000..bbd7b06a1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sys/param.h @@ -0,0 +1,59 @@ +/* Copyright (C) 1995, 1996, 1997, 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H 1 + +#include <limits.h> + +/* BSD names for some <limits.h> values. */ + +#define NBBY CHAR_BIT +#ifndef NGROUPS +# define NGROUPS NGROUPS_MAX +#endif +#define MAXSYMLINKS 5 +#define CANBSIZ MAX_CANON +#define NCARGS ARG_MAX +#define MAXPATHLEN PATH_MAX +#define NOFILE OPEN_MAX + + +#include <sys/types.h> + +/* Bit map related macros. */ +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) + +/* Macros for counting and rounding. */ +#ifndef howmany +# define howmany(x, y) (((x)+((y)-1))/(y)) +#endif +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#define powerof2(x) ((((x)-1)&(x))==0) + +/* Macros for min/max. */ +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) + +/* Unit of `st_blocks'. */ +#define DEV_BSIZE 512 + +#endif /* sys/param.h */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/sys/syscall.h b/ports/sysdeps/unix/sysv/sysv4/solaris2/sys/syscall.h new file mode 100644 index 000000000..15c43a3c3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/sys/syscall.h @@ -0,0 +1,245 @@ +/* Copyright (C) 1998 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYSCALL_H +#define _SYSCALL_H 1 + +/* Solaris 2 syscall numbers */ + +#define SYS_syscall 0 +#define SYS_exit 1 +#define SYS_fork 2 +#define SYS_read 3 +#define SYS_write 4 +#define SYS_open 5 +#define SYS_close 6 +#define SYS_wait 7 +#define SYS_creat 8 +#define SYS_link 9 +#define SYS_unlink 10 +#define SYS_exec 11 +#define SYS_chdir 12 +#define SYS_time 13 +#define SYS_mknod 14 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_brk 17 +#define SYS_stat 18 +#define SYS_lseek 19 +#define SYS_getpid 20 +#define SYS_mount 21 +#define SYS_umount 22 +#define SYS_setuid 23 +#define SYS_getuid 24 +#define SYS_stime 25 +#define SYS_ptrace 26 +#define SYS_alarm 27 +#define SYS_fstat 28 +#define SYS_pause 29 +#define SYS_utime 30 +#define SYS_stty 31 +#define SYS_gtty 32 +#define SYS_access 33 +#define SYS_nice 34 +#define SYS_statfs 35 +#define SYS_sync 36 +#define SYS_kill 37 +#define SYS_fstatfs 38 +#define SYS_pgrpsys 39 +#define SYS_xenix 40 +#define SYS_dup 41 +#define SYS_pipe 42 +#define SYS_times 43 +#define SYS_profil 44 +#define SYS_plock 45 +#define SYS_setgid 46 +#define SYS_getgid 47 +#define SYS_signal 48 +#define SYS_msgsys 49 +#define SYS_syssun 50 +#define SYS_sysi86 50 +#define SYS_sysppc 50 +#define SYS_acct 51 +#define SYS_shmsys 52 +#define SYS_semsys 53 +#define SYS_ioctl 54 +#define SYS_uadmin 55 +#define SYS_utssys 57 +#define SYS_fdsync 58 +#define SYS_execve 59 +#define SYS_umask 60 +#define SYS_chroot 61 +#define SYS_fcntl 62 +#define SYS_ulimit 63 +#define SYS_rmdir 79 +#define SYS_mkdir 80 +#define SYS_getdents 81 +#define SYS_sysfs 84 +#define SYS_getmsg 85 +#define SYS_putmsg 86 +#define SYS_poll 87 +#define SYS_lstat 88 +#define SYS_symlink 89 +#define SYS_readlink 90 +#define SYS_setgroups 91 +#define SYS_getgroups 92 +#define SYS_fchmod 93 +#define SYS_fchown 94 +#define SYS_sigprocmask 95 +#define SYS_sigsuspend 96 +#define SYS_sigaltstack 97 +#define SYS_sigaction 98 +#define SYS_sigpending 99 +#define SYS_context 100 +#define SYS_evsys 101 +#define SYS_evtrapret 102 +#define SYS_statvfs 103 +#define SYS_fstatvfs 104 +#define SYS_nfssys 106 +#define SYS_waitsys 107 +#define SYS_sigsendsys 108 +#define SYS_hrtsys 109 +#define SYS_acancel 110 +#define SYS_async 111 +#define SYS_priocntlsys 112 +#define SYS_pathconf 113 +#define SYS_mincore 114 +#define SYS_mmap 115 +#define SYS_mprotect 116 +#define SYS_munmap 117 +#define SYS_fpathconf 118 +#define SYS_vfork 119 +#define SYS_fchdir 120 +#define SYS_readv 121 +#define SYS_writev 122 +#define SYS_xstat 123 +#define SYS_lxstat 124 +#define SYS_fxstat 125 +#define SYS_xmknod 126 +#define SYS_clocal 127 +#define SYS_setrlimit 128 +#define SYS_getrlimit 129 +#define SYS_lchown 130 +#define SYS_memcntl 131 +#define SYS_getpmsg 132 +#define SYS_putpmsg 133 +#define SYS_rename 134 +#define SYS_uname 135 +#define SYS_setegid 136 +#define SYS_sysconfig 137 +#define SYS_adjtime 138 +#define SYS_systeminfo 139 +#define SYS_seteuid 141 +#define SYS_vtrace 142 +#define SYS_fork1 143 +#define SYS_sigtimedwait 144 +#define SYS_lwp_info 145 +#define SYS_yield 146 +#define SYS_lwp_sema_wait 147 +#define SYS_lwp_sema_post 148 +#define SYS_lwp_sema_trywait 149 +#define SYS_modctl 152 +#define SYS_fchroot 153 +#define SYS_utimes 154 +#define SYS_vhangup 155 +#define SYS_gettimeofday 156 +#define SYS_getitimer 157 +#define SYS_setitimer 158 +#define SYS_lwp_create 159 +#define SYS_lwp_exit 160 +#define SYS_lwp_suspend 161 +#define SYS_lwp_continue 162 +#define SYS_lwp_kill 163 +#define SYS_lwp_self 164 +#define SYS_lwp_setprivate 165 +#define SYS_lwp_getprivate 166 +#define SYS_lwp_wait 167 +#define SYS_lwp_mutex_unlock 168 +#define SYS_lwp_mutex_lock 169 +#define SYS_lwp_cond_wait 170 +#define SYS_lwp_cond_signal 171 +#define SYS_lwp_cond_broadcast 172 +#define SYS_pread 173 +#define SYS_pwrite 174 +#define SYS_llseek 175 +#define SYS_inst_sync 176 +#define SYS_kaio 178 +#define SYS_tsolsys 184 +#define SYS_acl 185 +#define SYS_auditsys 186 +#define SYS_processor_bind 187 +#define SYS_processor_info 188 +#define SYS_p_online 189 +#define SYS_sigqueue 190 +#define SYS_clock_gettime 191 +#define SYS_clock_settime 192 +#define SYS_clock_getres 193 +#define SYS_timer_create 194 +#define SYS_timer_delete 195 +#define SYS_timer_settime 196 +#define SYS_timer_gettime 197 +#define SYS_timer_getoverrun 198 +#define SYS_nanosleep 199 +#define SYS_facl 200 +#define SYS_door 201 +#define SYS_setreuid 202 +#define SYS_setregid 203 +#define SYS_install_utrap 204 +#define SYS_signotify 205 +#define SYS_schedctl 206 +#define SYS_pset 207 +#define SYS_resolvepath 209 +#define SYS_signotifywait 210 +#define SYS_lwp_sigredirect 211 +#define SYS_lwp_alarm 212 +#define SYS_getdents64 213 +#define SYS_mmap64 214 +#define SYS_stat64 215 +#define SYS_lstat64 216 +#define SYS_fstat64 217 +#define SYS_statvfs64 218 +#define SYS_fstatvfs64 219 +#define SYS_setrlimit64 220 +#define SYS_getrlimit64 221 +#define SYS_pread64 222 +#define SYS_pwrite64 223 +#define SYS_creat64 224 +#define SYS_open64 225 +#define SYS_rpcsys 226 +#define SYS_so_socket 230 +#define SYS_so_socketpair 231 +#define SYS_bind 232 +#define SYS_listen 233 +#define SYS_accept 234 +#define SYS_connect 235 +#define SYS_shutdown 236 +#define SYS_recv 237 +#define SYS_recvfrom 238 +#define SYS_recvmsg 239 +#define SYS_send 240 +#define SYS_sendmsg 241 +#define SYS_sendto 242 +#define SYS_getpeername 243 +#define SYS_getsockname 244 +#define SYS_getsockopt 245 +#define SYS_setsockopt 246 +#define SYS_sockconfig 247 +#define SYS_ntp_gettime 248 +#define SYS_ntp_adjtime 249 + +#endif /* sys/syscall.h */ diff --git a/ports/sysdeps/unix/sysv/sysv4/solaris2/syscalls.list b/ports/sysdeps/unix/sysv/sysv4/solaris2/syscalls.list new file mode 100644 index 000000000..092d869ef --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/solaris2/syscalls.list @@ -0,0 +1,7 @@ +# File name Caller Syscall name # args Strong name Weak names + +sigaction - sigaction 3 __sigaction sigaction +sigaltstack - sigaltstack 2 sigaltstack +sigpending - sigpending 2 __syscall_sigpending +sigqueue - sigqueue 3 __sigqueue sigqueue +sigtimedwait - sigtimedwait 3 __sigtimedwait sigtime diff --git a/ports/sysdeps/unix/sysv/sysv4/syscalls.list b/ports/sysdeps/unix/sysv/sysv4/syscalls.list new file mode 100644 index 000000000..7b75d5524 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/syscalls.list @@ -0,0 +1,7 @@ +# File name Caller Syscall name # args Strong name Weak names + +pgrpsys - pgrpsys 3 __pgrpsys +sigprocmask - sigprocmask 3 __sigprocmask sigprocmask +sysconfig - sysconfig 1 __sysconfig +sysinfo - systeminfo 3 __sysinfo +__waitid waitpid waitsys 3 __waitid diff --git a/ports/sysdeps/unix/sysv/sysv4/sysconf.c b/ports/sysdeps/unix/sysv/sysv4/sysconf.c new file mode 100644 index 000000000..bfe7823c4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/sysconf.c @@ -0,0 +1,366 @@ +/* Copyright (C) 1993,1995,1996,1997,2002,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <limits.h> +#include <unistd.h> +#include <stdio.h> +#include <time.h> +#include <sysconfig.h> + +extern int __sysconfig (int); + +/* Get the value of the system variable NAME. */ +long int +__sysconf (name) + int name; +{ + switch (name) + { + default: + __set_errno (EINVAL); + return -1; + + case _SC_ARG_MAX: +#ifdef ARG_MAX + return ARG_MAX; +#else + return -1; +#endif + + case _SC_CHILD_MAX: +#ifdef CHILD_MAX + return CHILD_MAX; +#else + return -1; +#endif + + case _SC_CLK_TCK: + return __sysconfig (_CONFIG_CLK_TCK); + + case _SC_NGROUPS_MAX: +#ifdef NGROUPS_MAX + return NGROUPS_MAX; +#else + return -1; +#endif + + /* Both of these are looking for _CONFIG_OPEN_FILES. */ + case _SC_OPEN_MAX: + case _SC_STREAM_MAX: + return __sysconfig (_CONFIG_OPEN_FILES); + + case _SC_TZNAME_MAX: + return __tzname_max (); + + case _SC_JOB_CONTROL: +#ifdef _POSIX_JOB_CONTROL + return 1; +#else + return -1; +#endif + + case _SC_SAVED_IDS: +#ifdef _POSIX_SAVED_IDS + return 1; +#else + return -1; +#endif + + case _SC_REALTIME_SIGNALS: +#ifdef _POSIX_REALTIME_SIGNALS + return 1; +#else + return -1; +#endif + + case _SC_PRIORITY_SCHEDULING: +#ifdef _POSIX_PRIORITY_SCHEDULING + return 1; +#else + return -1; +#endif + + case _SC_TIMERS: +#ifdef _POSIX_TIMERS + return 1; +#else + return -1; +#endif + + case _SC_ASYNCHRONOUS_IO: +#ifdef _POSIX_ASYNCHRONOUS_IO + return 1; +#else + return -1; +#endif + + case _SC_PRIORITIZED_IO: +#ifdef _POSIX_PRIORITIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_SYNCHRONIZED_IO: +#ifdef _POSIX_SYNCHRONIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_FSYNC: +#ifdef _POSIX_FSYNC + return 1; +#else + return -1; +#endif + + case _SC_MAPPED_FILES: +#ifdef _POSIX_MAPPED_FILES + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK: +#ifdef _POSIX_MEMLOCK + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK_RANGE: +#ifdef _POSIX_MEMLOCK_RANGE + return 1; +#else + return -1; +#endif + + case _SC_MEMORY_PROTECTION: +#ifdef _POSIX_MEMORY_PROTECTION + return 1; +#else + return -1; +#endif + + case _SC_MESSAGE_PASSING: +#ifdef _POSIX_MESSAGE_PASSING + return 1; +#else + return -1; +#endif + + case _SC_SEMAPHORES: +#ifdef _POSIX_SEMAPHORES + return 1; +#else + return -1; +#endif + + case _SC_SHARED_MEMORY_OBJECTS: +#ifdef _POSIX_SHARED_MEMORY_OBJECTS + return 1; +#else + return -1; +#endif + + case _SC_VERSION: + return _POSIX_VERSION; + + case _SC_PAGESIZE: + return __sysconfig (_CONFIG_PAGESIZE); + + case _SC_AIO_LISTIO_MAX: +#ifdef AIO_LISTIO_MAX + return AIO_LISTIO_MAX; +#else + return -1; +#endif + + case _SC_AIO_MAX: +#ifdef AIO_MAX + return AIO_MAX; +#else + return -1; +#endif + + case _SC_AIO_PRIO_DELTA_MAX: +#ifdef AIO_PRIO_DELTA_MAX + return AIO_PRIO_DELTA_MAX; +#else + return -1; +#endif + + case _SC_DELAYTIMER_MAX: +#ifdef DELAYTIMER_MAX + return DELAYTIMER_MAX; +#else + return -1; +#endif + + case _SC_MQ_OPEN_MAX: +#ifdef MQ_OPEN_MAX + return MQ_OPEN_MAX; +#else + return -1; +#endif + + case _SC_MQ_PRIO_MAX: +#ifdef MQ_PRIO_MAX + return MQ_PRIO_MAX; +#else + return -1; +#endif + + case _SC_RTSIG_MAX: +#ifdef RTSIG_MAX + return RTSIG_MAX; +#else + return -1; +#endif + + case _SC_SEM_NSEMS_MAX: +#ifdef SEM_NSEMS_MAX + return SEM_NSEMS_MAX; +#else + return -1; +#endif + + case _SC_SEM_VALUE_MAX: +#ifdef SEM_VALUE_MAX + return SEM_VALUE_MAX; +#else + return -1; +#endif + + case _SC_SIGQUEUE_MAX: +#ifdef SIGQUEUE_MAX + return SIGQUEUE_MAX; +#else + return -1; +#endif + + case _SC_TIMER_MAX: +#ifdef TIMER_MAX + return TIMER_MAX; +#else + return -1; +#endif + + case _SC_BC_BASE_MAX: +#ifdef BC_BASE_MAX + return BC_BASE_MAX; +#else + return -1; +#endif + + case _SC_BC_DIM_MAX: +#ifdef BC_DIM_MAX + return BC_DIM_MAX; +#else + return -1; +#endif + + case _SC_BC_SCALE_MAX: +#ifdef BC_SCALE_MAX + return BC_SCALE_MAX; +#else + return -1; +#endif + + case _SC_BC_STRING_MAX: +#ifdef BC_STRING_MAX + return BC_STRING_MAX; +#else + return -1; +#endif + + case _SC_EQUIV_CLASS_MAX: +#ifdef EQUIV_CLASS_MAX + return EQUIV_CLASS_MAX; +#else + return -1; +#endif + + case _SC_EXPR_NEST_MAX: +#ifdef EXPR_NEST_MAX + return EXPR_NEST_MAX; +#else + return -1; +#endif + + case _SC_LINE_MAX: +#ifdef LINE_MAX + return LINE_MAX; +#else + return -1; +#endif + + case _SC_RE_DUP_MAX: +#ifdef RE_DUP_MAX + return RE_DUP_MAX; +#else + return -1; +#endif + + case _SC_CHARCLASS_NAME_MAX: +#ifdef CHARCLASS_NAME_MAX + return CHARCLASS_NAME_MAX; +#else + return -1; +#endif + + case _SC_2_VERSION: + /* This is actually supposed to return the version + of the 1003.2 utilities on the system {POSIX2_VERSION}. */ + return _POSIX2_C_VERSION; + + case _SC_2_C_BIND: +#ifdef _POSIX2_C_BIND + return _POSIX2_C_BIND; +#else + return -1; +#endif + + case _SC_2_C_DEV: +#ifdef _POSIX2_C_DEV + return _POSIX2_C_DEV; +#else + return -1; +#endif + + case _SC_2_FORT_DEV: +#ifdef _POSIX2_FORT_DEV + return _POSIX2_FORT_DEV; +#else + return -1; +#endif + + case _SC_2_SW_DEV: +#ifdef _POSIX2_SW_DEV + return _POSIX2_SW_DEV; +#else + return -1; +#endif + } +} + +weak_alias (__sysconf, sysconf) +libc_hidden_def (__sysconf) diff --git a/ports/sysdeps/unix/sysv/sysv4/sysconfig.h b/ports/sysdeps/unix/sysv/sysv4/sysconfig.h new file mode 100644 index 000000000..b51a3649a --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/sysconfig.h @@ -0,0 +1,28 @@ +/* `__sysconfig' NAME values. + Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __SYSCONFIG_H +#define __SYSCONFIG_H + +#define _CONFIG_OPEN_FILES 4 /* process limit on open files */ +#define _CONFIG_PAGESIZE 6 /* MMU page size */ +#define _CONFIG_CLK_TCK 7 /* all times are in CLK_TCKths of a second */ + +#endif diff --git a/ports/sysdeps/unix/sysv/sysv4/system.c b/ports/sysdeps/unix/sysv/sysv4/system.c new file mode 100644 index 000000000..fbfe43f19 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/system.c @@ -0,0 +1,2 @@ +/* SVR4 does have `waitpid'. Avoid unix/system.c, which says we don't. */ +#include <sysdeps/posix/system.c> diff --git a/ports/sysdeps/unix/sysv/sysv4/waitpid.c b/ports/sysdeps/unix/sysv/sysv4/waitpid.c new file mode 100644 index 000000000..23f9ceb02 --- /dev/null +++ b/ports/sysdeps/unix/sysv/sysv4/waitpid.c @@ -0,0 +1,120 @@ +/* Copyright (C) 1993,94,95,96,97,2002,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <sys/wait.h> +#include <sys/types.h> +#include <stddef.h> +#include "siginfo.h" + +typedef enum __idtype + { + /* Look for processes based upon a given PID. */ + P_PID, + + /* Look for processes based upon a given process-group ID. */ + P_PGID = 2, + + /* Look for any process. */ + P_ALL = 7, + } __idtype_t; + +extern __pid_t __getpgid (__pid_t pid); +extern int __waitid (__idtype_t idtype, __pid_t id, + __siginfo_t *infop, int options); + +/* Wait for a child matching PID to die. + If PID is greater than 0, match any process whose process ID is PID. + If PID is (pid_t) -1, match any process. + If PID is (pid_t) 0, match any process with the + same process group as the current process. + If PID is less than -1, match any process whose + process group is the absolute value of PID. + If the WNOHANG bit is set in OPTIONS, and that child + is not already dead, return (pid_t) 0. If successful, + return PID and store the dead child's status in STAT_LOC. + Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS, + return status for stopped children; otherwise don't. */ + +__pid_t +__libc_waitpid (__pid_t pid, int *stat_loc, int options) +{ + __idtype_t idtype; + __pid_t tmp_pid = pid; + __siginfo_t infop; + + if (pid <= WAIT_MYPGRP) + { + if (pid == WAIT_ANY) + { + /* Request the status for any child. */ + idtype = P_ALL; + } + else if (pid == WAIT_MYPGRP) + { + /* Request the status for any child process that has + a pgid that's equal to that of our parent. */ + tmp_pid = __getpgid (0); + idtype = P_PGID; + } + else /* PID < -1 */ + { + /* Request the status for any child whose pgid is equal + to the absolute value of PID. */ + tmp_pid = pid & ~0; /* XXX not pseudo-insn */ + idtype = P_PGID; + } + } + else + { + /* Request the status for the child whose pid is PID. */ + idtype = P_PID; + } + + if (__waitid (idtype, tmp_pid, &infop, options | WEXITED | WTRAPPED) < 0) + return -1; + + switch (infop.__code) + { + case EXITED: + *stat_loc = W_EXITCODE (infop.__status, 0); + break; + case STOPPED: + case TRAPPED: + *stat_loc = W_STOPCODE (infop.__status); + break; + case KILLED: + /* Don't know what to do with continue, since it isn't documented. + Putting it here seemed the right place though. */ + case CONTINUED: + *stat_loc = infop.__status; + /* FALLTHROUGH */ + case CORED: + *stat_loc |= WCOREFLAG; + break; + } + + /* Return the PID out of the INFOP structure instead of the one we were + called with, to account for cases of being called with -1 to signify + any PID. */ + return infop.__pid; +} +weak_alias (__libc_waitpid, __waitpid) +weak_alias (__libc_waitpid, waitpid) +libc_hidden_weak (__waitpid) |