diff options
author | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
commit | 28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch) | |
tree | 15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/unix/sysv/sysv4 | |
download | glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz |
initial import
Diffstat (limited to 'sysdeps/unix/sysv/sysv4')
59 files changed, 1872 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/sysv4/Dist b/sysdeps/unix/sysv/sysv4/Dist new file mode 100644 index 0000000000..f603d8b8ff --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/Dist @@ -0,0 +1,7 @@ +sysconfig.h +sysconfig.S +pgrpsys.S +__waitid.S +siginfo.h +__getpgid.c __setpgid.c +sysinfo.S diff --git a/sysdeps/unix/sysv/sysv4/Implies b/sysdeps/unix/sysv/sysv4/Implies new file mode 100644 index 0000000000..953822ea48 --- /dev/null +++ b/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/sysdeps/unix/sysv/sysv4/Makefile b/sysdeps/unix/sysv/sysv4/Makefile new file mode 100644 index 0000000000..0c149da85c --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/Makefile @@ -0,0 +1,36 @@ +# Copyright (C) 1992, 1993, 1995 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., 675 Mass Ave, +# Cambridge, MA 02139, USA. + +ifeq ($(subdir),posix) + +sysdep_routines := $(sysdep_routines) sysconfig pgrpsys __waitid + +endif + + +ifeq ($(subdir),signal) + +sysdep_routines := $(sysdep_routines) sys-sig + +endif + +ifeq ($(subdir),misc) + +sysdep_routines := $(sysdep_routines) sysinfo + +endif diff --git a/sysdeps/unix/sysv/sysv4/__getpgid.c b/sysdeps/unix/sysv/sysv4/__getpgid.c new file mode 100644 index 0000000000..76a6e80f59 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/__getpgid.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> + +extern int __pgrpsys __P ((int type, ...)); + +/* Get the process group ID of process PID. */ +int +DEFUN(__getpgid, (pid), pid_t pid) +{ + return __pgrpsys (4, pid); +} diff --git a/sysdeps/unix/sysv/sysv4/__setpgid.c b/sysdeps/unix/sysv/sysv4/__setpgid.c new file mode 100644 index 0000000000..594e4e9fe6 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/__setpgid.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> + +extern int __pgrpsys __P ((int type, ...)); + +/* Get the process group ID of process PID. */ +int +DEFUN(__setpgid, (pid, pgid), pid_t pid AND pid_t pgid) +{ + return __pgrpsys (5, pid, pgid); +} diff --git a/sysdeps/unix/sysv/sysv4/__waitid.S b/sysdeps/unix/sysv/sysv4/__waitid.S new file mode 100644 index 0000000000..845bec85e2 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/__waitid.S @@ -0,0 +1,25 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +/* XXX */ +#define SYS_waitid SYS_waitsys + +SYSCALL__ (waitid, 3) + ret diff --git a/sysdeps/unix/sysv/sysv4/dup2.c b/sysdeps/unix/sysv/sysv4/dup2.c new file mode 100644 index 0000000000..c7015fce7e --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/dup2.c @@ -0,0 +1,4 @@ +/* SVR4 uses the POSIX dup2. */ +#include <sysdeps/posix/__dup2.c> + +weak_alias (__dup2, dup2) diff --git a/sysdeps/unix/sysv/sysv4/fchdir.S b/sysdeps/unix/sysv/sysv4/fchdir.S new file mode 100644 index 0000000000..ef11d55bc0 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/fchdir.S @@ -0,0 +1,2 @@ +/* SVR4 uses the BSD 4.4 fchdir(2) syscall. */ +#include <sysdeps/unix/bsd/bsd4.4/fchdir.S> diff --git a/sysdeps/unix/sysv/sysv4/ftruncate.c b/sysdeps/unix/sysv/sysv4/ftruncate.c new file mode 100644 index 0000000000..45f2614257 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/ftruncate.c @@ -0,0 +1,37 @@ +/* ftruncate for SVR4 using the fcntl F_FREESP command. +Copyright (C) 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> +#include <string.h> + +/* Truncate the file FD refers to to LENGTH bytes. */ +int +DEFUN(ftruncate, (fd, length), + int fd AND 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/sysdeps/unix/sysv/sysv4/getdtsz.c b/sysdeps/unix/sysv/sysv4/getdtsz.c new file mode 100644 index 0000000000..c1ae6108fb --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/getdtsz.c @@ -0,0 +1,2 @@ +/* Solaris uses sysconf ala POSIX.1. */ +#include <sysdeps/posix/getdtsz.c> diff --git a/sysdeps/unix/sysv/sysv4/gethostname.c b/sysdeps/unix/sysv/sysv4/gethostname.c new file mode 100644 index 0000000000..cce1149e7f --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/gethostname.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1994, 1995 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/systeminfo.h> + +extern int __sysinfo __P ((int command, char *buf, long count)); + +int +DEFUN(__gethostname, (name, namelen), char *name AND size_t namelen) +{ + return __sysinfo (SI_HOSTNAME, name, namelen); +} + +weak_alias (__gethostname, gethostname) diff --git a/sysdeps/unix/sysv/sysv4/getpagesize.c b/sysdeps/unix/sysv/sysv4/getpagesize.c new file mode 100644 index 0000000000..6119640758 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/getpagesize.c @@ -0,0 +1,2 @@ +/* Solaris uses sysconf ala POSIX.1. */ +#include <sysdeps/posix/getpagesize.c> diff --git a/sysdeps/unix/sysv/sysv4/getpgid.c b/sysdeps/unix/sysv/sysv4/getpgid.c new file mode 100644 index 0000000000..309e2f11e4 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/getpgid.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1993, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> + +extern int __pgrpsys __P ((int type, ...)); + +/* Get the process group ID of process PID. */ +int +DEFUN(__getpgid, (pid), pid_t pid) +{ + return __pgrpsys (4, pid); +} + +weak_alias (__getpgid, getpgid) diff --git a/sysdeps/unix/sysv/sysv4/i386/Dist b/sysdeps/unix/sysv/sysv4/i386/Dist new file mode 100644 index 0000000000..69d16ac6bf --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/Dist @@ -0,0 +1 @@ +sys-sig.S diff --git a/sysdeps/unix/sysv/sysv4/i386/Makefile b/sysdeps/unix/sysv/sysv4/i386/Makefile new file mode 100644 index 0000000000..56f0a37de1 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/Makefile @@ -0,0 +1,3 @@ +ifeq ($(subdir),signal) +sysdep_routines := $(sysdep_routines) sys-sig +endif diff --git a/sysdeps/unix/sysv/sysv4/i386/fstat.S b/sysdeps/unix/sysv/sysv4/i386/fstat.S new file mode 100644 index 0000000000..11743b3fc3 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/fstat.S @@ -0,0 +1,37 @@ +/* Copyright (C) 1994, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +/* In SVR4 the `stat' call is actually done by the `xstat' system call, + which takes an additional first argument giving a version number for + `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' and + `lxstat' system calls. This macro gives the SVR4 version number that + corresponds to the definition of `struct stat' in <statbuf.h>. */ +#define _STAT_VER 2 + +.globl syscall_error +ENTRY (__fstat) + popl %eax /* Pop return address into %eax. */ + pushl $_STAT_VER /* Push extra first arg to syscall. */ + pushl %eax /* Push back the return address. */ + DO_CALL (fxstat, 3) /* Do the syscall. */ + jb syscall_error /* Check for error. */ + ret /* Return success. */ + +weak_alias (__fstat, fstat) diff --git a/sysdeps/unix/sysv/sysv4/i386/lstat.S b/sysdeps/unix/sysv/sysv4/i386/lstat.S new file mode 100644 index 0000000000..52ffdbadfd --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/lstat.S @@ -0,0 +1,37 @@ +/* Copyright (C) 1994, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +/* In SVR4 the `stat' call is actually done by the `xstat' system call, + which takes an additional first argument giving a version number for + `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' and + `lxstat' system calls. This macro gives the SVR4 version number that + corresponds to the definition of `struct stat' in <statbuf.h>. */ +#define _STAT_VER 2 + +.globl syscall_error +ENTRY (__lstat) + popl %eax /* Pop return address into %eax. */ + pushl $_STAT_VER /* Push extra first arg to syscall. */ + pushl %eax /* Push back the return address. */ + DO_CALL (lxstat, 3) /* Do the syscall. */ + jb syscall_error /* Check for error. */ + ret /* Return success. */ + +weak_alias (__lstat, lstat) diff --git a/sysdeps/unix/sysv/sysv4/i386/mknod.S b/sysdeps/unix/sysv/sysv4/i386/mknod.S new file mode 100644 index 0000000000..21f932c921 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/mknod.S @@ -0,0 +1,36 @@ +/* Copyright (C) 1994, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +/* In SVR4 the `mknod' call is actually done by the `xmknod' system call, + which takes an additional first argument giving a version number for + the interface. This macro gives the SVR4 version number that + corresponds to the modern interface. */ +#define _MKNOD_VER 2 + +.globl syscall_error +ENTRY (__mknod) + popl %eax /* Pop return address into %eax. */ + pushl $_MKNOD_VER /* Push extra first arg to syscall. */ + pushl %eax /* Push back the return address. */ + DO_CALL (xmknod, 3) /* Do the syscall. */ + jb syscall_error /* Check for error. */ + ret /* Return success. */ + +weak_alias (__mknod, mknod) diff --git a/sysdeps/unix/sysv/sysv4/i386/stat.S b/sysdeps/unix/sysv/sysv4/i386/stat.S new file mode 100644 index 0000000000..3a5107c267 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/stat.S @@ -0,0 +1,37 @@ +/* Copyright (C) 1994, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +/* In SVR4 the `stat' call is actually done by the `xstat' system call, + which takes an additional first argument giving a version number for + `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' and + `lxstat' system calls. This macro gives the SVR4 version number that + corresponds to the definition of `struct stat' in <statbuf.h>. */ +#define _STAT_VER 2 + +.globl syscall_error +ENTRY (__stat) + popl %eax /* Pop return address into %eax. */ + pushl $_STAT_VER /* Push extra first arg to syscall. */ + pushl %eax /* Push back the return address. */ + DO_CALL (xstat, 3) /* Do the syscall. */ + jb syscall_error /* Check for error. */ + ret /* Return success. */ + +weak_alias (__stat, stat) diff --git a/sysdeps/unix/sysv/sysv4/i386/statbuf.h b/sysdeps/unix/sysv/sysv4/i386/statbuf.h new file mode 100644 index 0000000000..6f1bfed850 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/statbuf.h @@ -0,0 +1,84 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _STATBUF_H +#define _STATBUF_H + +#include <gnu/types.h> + +/* Structure describing file characteristics. */ +struct stat + { + unsigned long st_dev; /* Device. */ + long st_filler1[3]; + unsigned long st_ino; /* File serial number. */ + unsigned long st_mode; /* File mode. */ + unsigned long st_nlink; /* Link count. */ + long st_uid; /* User ID of the file's owner. */ + long st_gid; /* Group ID of the file's group.*/ + unsigned long st_rdev; /* Device number, if device. */ + long st_filler2[2]; + + long st_size; /* Size of file, in bytes. */ + /* SVR4 added this extra long to allow for expansion of off_t. */ + long st_filler3; + + long st_atime; /* Time of last access. */ + unsigned long st_atime_usec; + long st_mtime; /* Time of last modification. */ + unsigned long st_mtime_usec; + long st_ctime; /* Time of last status change. */ + unsigned long st_ctime_usec; + + long st_blksize; /* Optimal block size for I/O. */ +#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ + + long st_blocks; /* Number of 512-byte blocks allocated. */ + char st_fstype[16]; /* The type of this filesystem. */ + int st_aclcnt; + unsigned long st_level; + unsigned long st_flags; + unsigned long st_cmwlevel; + long 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. */ + +/* 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. */ + +#endif /* statbuf.h */ diff --git a/sysdeps/unix/sysv/sysv4/i386/sys-sig.S b/sysdeps/unix/sysv/sysv4/i386/sys-sig.S new file mode 100644 index 0000000000..58430e494f --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/sys-sig.S @@ -0,0 +1,30 @@ +/* Copyright (C) 1994 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., 675 Mass Ave, +Cambridge, MA 02139, 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/sysdeps/unix/sysv/sysv4/i386/sysdep.h b/sysdeps/unix/sysv/sysv4/i386/sysdep.h new file mode 100644 index 0000000000..1e0cd69f74 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/sysdep.h @@ -0,0 +1,38 @@ +/* Copyright (C) 1994 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., 675 Mass Ave, +Cambridge, MA 02139, 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 <errnos.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/sysdeps/unix/sysv/sysv4/i386/vfork.S b/sysdeps/unix/sysv/sysv4/i386/vfork.S new file mode 100644 index 0000000000..bbe99fbc41 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/i386/vfork.S @@ -0,0 +1 @@ +#include <sysdeps/unix/bsd/i386/vfork.S> diff --git a/sysdeps/unix/sysv/sysv4/pgrpsys.S b/sysdeps/unix/sysv/sysv4/pgrpsys.S new file mode 100644 index 0000000000..dcfb487e54 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/pgrpsys.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1993 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +SYSCALL__ (pgrpsys, 3) + ret diff --git a/sysdeps/unix/sysv/sysv4/pipestream.c b/sysdeps/unix/sysv/sysv4/pipestream.c new file mode 100644 index 0000000000..6a32f9507c --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/pipestream.c @@ -0,0 +1,2 @@ +/* We deliberately avoid having NO_WAITPID set. */ +#include <sysdeps/posix/pipestream.c> diff --git a/sysdeps/unix/sysv/sysv4/setegid.S b/sysdeps/unix/sysv/sysv4/setegid.S new file mode 100644 index 0000000000..f8fd7633a5 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/setegid.S @@ -0,0 +1,2 @@ +/* SVR4 uses the BSD 4.4 setegid() system call. */ +#include <sysdeps/unix/bsd/bsd4.4/setegid.S> diff --git a/sysdeps/unix/sysv/sysv4/seteuid.S b/sysdeps/unix/sysv/sysv4/seteuid.S new file mode 100644 index 0000000000..4ff110610f --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/seteuid.S @@ -0,0 +1,2 @@ +/* SVR4 uses the BSD 4.4 seteuid() system call. */ +#include <sysdeps/unix/bsd/bsd4.4/seteuid.S> diff --git a/sysdeps/unix/sysv/sysv4/sethostname.c b/sysdeps/unix/sysv/sysv4/sethostname.c new file mode 100644 index 0000000000..4cebc456e1 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sethostname.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/systeminfo.h> + +extern int __sysinfo __P ((int command, const char *buf, long count)); + +int +DEFUN(sethostname, (name, namelen), const char *name AND size_t namelen) +{ + return __sysinfo (SI_SET_HOSTNAME, name, namelen); +} diff --git a/sysdeps/unix/sysv/sysv4/setpgid.c b/sysdeps/unix/sysv/sysv4/setpgid.c new file mode 100644 index 0000000000..b9e06dc719 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/setpgid.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1993, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> + +extern int __pgrpsys __P ((int 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 +DEFUN(__setpgid, (pid, pgid), int pid AND int pgid) +{ + return __pgrpsys (5, pid, pgid); +} + +weak_alias (__setpgid, setpgid) +weak_alias (__setpgid, setpgrp) diff --git a/sysdeps/unix/sysv/sysv4/setsid.c b/sysdeps/unix/sysv/sysv4/setsid.c new file mode 100644 index 0000000000..f0d6c8a4cd --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/setsid.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1993, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <unistd.h> + +extern int __pgrpsys __P ((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. */ +int +DEFUN_VOID(__setsid) +{ + return __pgrpsys (3); +} + +weak_alias (__setsid, setsid) diff --git a/sysdeps/unix/sysv/sysv4/sigaction.c b/sysdeps/unix/sysv/sysv4/sigaction.c new file mode 100644 index 0000000000..68fd7a1846 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sigaction.c @@ -0,0 +1,79 @@ +/* Copyright (C) 1994, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#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 +DEFUN(__sigaction, (sig, act, oact), + int sig AND CONST struct sigaction *act AND struct sigaction *oact) +{ + struct sigaction myact; + __sighandler_t ohandler; + + if (sig <= 0 || sig >= NSIG) + { + 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; +} + +weak_alias (__sigaction, sigaction) diff --git a/sysdeps/unix/sysv/sysv4/sigaction.h b/sysdeps/unix/sysv/sysv4/sigaction.h new file mode 100644 index 0000000000..dbb31f1077 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sigaction.h @@ -0,0 +1,51 @@ +/* The proper definitions for SVR4's sigaction. +Copyright (C) 1993, 1994 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, 1992 Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* 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 /* Don't 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/sysdeps/unix/sysv/sysv4/sigaltstack.S b/sysdeps/unix/sysv/sysv4/sigaltstack.S new file mode 100644 index 0000000000..e7e4060fba --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sigaltstack.S @@ -0,0 +1,2 @@ +/* SVR4 uses the BSD 4.4 sigaltstack syscall. */ +#include <sysdeps/unix/bsd/bsd4.4/sigaltstk.S> diff --git a/sysdeps/unix/sysv/sysv4/siginfo.h b/sysdeps/unix/sysv/sysv4/siginfo.h new file mode 100644 index 0000000000..ce8dd35bf1 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/siginfo.h @@ -0,0 +1,58 @@ +/* Definitions of the siginfo structure. + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, 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/sysdeps/unix/sysv/sysv4/signum.h b/sysdeps/unix/sysv/sysv4/signum.h new file mode 100644 index 0000000000..aa3dc7fa25 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/signum.h @@ -0,0 +1,66 @@ +/* Signal number definitions. SVR4 version. +Copyright (C) 1994 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., 675 Mass Ave, +Cambridge, MA 02139, 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/sysdeps/unix/sysv/sysv4/sigprocmask.S b/sysdeps/unix/sysv/sysv4/sigprocmask.S new file mode 100644 index 0000000000..51fddb0bee --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sigprocmask.S @@ -0,0 +1,24 @@ +/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +SYSCALL__ (sigprocmask, 3) + ret + +weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/sysv4/sigset.h b/sysdeps/unix/sysv/sysv4/sigset.h new file mode 100644 index 0000000000..a007a43470 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sigset.h @@ -0,0 +1,97 @@ +/* __sig_atomic_t, __sigset_t, and related definitions. SVR4 version. +Copyright (C) 1994 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, 1992 Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, 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 (__sigset_t) * 8) +#define __SSELT(s) ((s) / __NSSBITS) +#define __SSMASK(s) (1 << ((s) % __NSSBITS)) + +#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] = -1; + 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 /* ! _SIGSET_H_fns */ + diff --git a/sysdeps/unix/sysv/sysv4/sigsuspend.S b/sysdeps/unix/sysv/sysv4/sigsuspend.S new file mode 100644 index 0000000000..85d36017b8 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sigsuspend.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1993 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +SYSCALL (sigsuspend, 1) + ret diff --git a/sysdeps/unix/sysv/sysv4/solaris2/Makefile b/sysdeps/unix/sysv/sysv4/solaris2/Makefile new file mode 100644 index 0000000000..3f86c46cc8 --- /dev/null +++ b/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. +BUILD_CFLAGS := $(BUILD_CFLAGS) -L/lib diff --git a/sysdeps/unix/sysv/sysv4/solaris2/direct.h b/sysdeps/unix/sysv/sysv4/solaris2/direct.h new file mode 100644 index 0000000000..f9822dcbc5 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/direct.h @@ -0,0 +1,39 @@ +/* Copyright (C) 1992, 1993 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _BSDDIR_H +#define _BSDDIR_H 1 + +#include <limits.h> + +/* This is the Solaris direct; it's the same as that in + sysdeps/unix/sysv/sysv4/direct.h, but it uses the length given by d_namlen, + since we can't reliably use tyhe sysv4/direct.h method of computing + the length. */ + +struct direct + { + unsigned long int d_fileno; + long int d_off; + unsigned short int d_reclen; + char d_name[NAME_MAX + 1]; + }; + +#define D_NAMLEN(d) (strlen ((d)->d_name)) + +#endif diff --git a/sysdeps/unix/sysv/sysv4/solaris2/fsync.S b/sysdeps/unix/sysv/sysv4/solaris2/fsync.S new file mode 100644 index 0000000000..aefa3e3af7 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/fsync.S @@ -0,0 +1,29 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, 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/sysdeps/unix/sysv/sysv4/solaris2/signum.h b/sysdeps/unix/sysv/sysv4/solaris2/signum.h new file mode 100644 index 0000000000..8219626c3e --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/signum.h @@ -0,0 +1,73 @@ +/* Signal number definitions. Solaris 2 version. +Copyright (C) 1994 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., 675 Mass Ave, +Cambridge, MA 02139, 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). */ +/* 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/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist new file mode 100644 index 0000000000..69d16ac6bf --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist @@ -0,0 +1 @@ +sys-sig.S diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile new file mode 100644 index 0000000000..7ad4bb1633 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile @@ -0,0 +1,5 @@ +# 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 diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c b/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c new file mode 100644 index 0000000000..afdfaaa2e5 --- /dev/null +++ b/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/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys-sig.S b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys-sig.S new file mode 100644 index 0000000000..8baa997e80 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys-sig.S @@ -0,0 +1,25 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +PSEUDO (__sigaction_syscall, sigaction, 3) + ret + +PSEUDO (__context_syscall, context, 2) + ret diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S new file mode 100644 index 0000000000..da3cd6b8be --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S @@ -0,0 +1,46 @@ +/* Copyright (C) 1993, 1994 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> +#define _ERRNO_H +#include <errnos.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/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h new file mode 100644 index 0000000000..edb98309e6 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h @@ -0,0 +1,51 @@ +/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* Solaris 2 does not precede the asm names of C symbols with a `_'. */ +#define NO_UNDERSCORES + +#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 + +#endif /* ASSEMBLER */ diff --git a/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h b/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h new file mode 100644 index 0000000000..ac74cdffa7 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h @@ -0,0 +1,82 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _STATBUF_H +#define _STATBUF_H + +#include <gnu/types.h> + +/* Structure describing file characteristics. */ +struct stat + { + unsigned long int st_dev; + long st_filler1[3]; + __ino_t st_ino; /* File serial number. */ + unsigned long int st_mode; /* File mode. */ + /* This is unsigned long instead of __nlink_t, since SVR4 has + a long nlink_t, not a short one. */ + unsigned long int 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.*/ + unsigned long int st_rdev; /* Device number, if device. */ + long 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 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; + + long st_blksize; /* Optimal block size for I/O. */ +#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ + + long st_blocks; /* Number of 512-byte blocks allocated. */ + char st_fstype[16]; + long st_filler4[8]; + }; + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ + +/* These don't actually exist on System V, but having them doesn't hurt. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ + +#endif /* statbuf.h */ diff --git a/sysdeps/unix/sysv/sysv4/solaris2/utimes.S b/sysdeps/unix/sysv/sysv4/solaris2/utimes.S new file mode 100644 index 0000000000..54a043c835 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/solaris2/utimes.S @@ -0,0 +1,2 @@ +/* Solaris has the BSD `utimes' function. */ +#include <sysdeps/unix/bsd/utimes.S> diff --git a/sysdeps/unix/sysv/sysv4/sysconf.c b/sysdeps/unix/sysv/sysv4/sysconf.c new file mode 100644 index 0000000000..607cd05d14 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sysconf.c @@ -0,0 +1,181 @@ +/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <errno.h> +#include <limits.h> +#include <unistd.h> +#include <stdio.h> +#include <time.h> +#include <sysconfig.h> + +extern int EXFUN(__sysconfig, (int)); + +/* Get the value of the system variable NAME. */ +long int +DEFUN(__sysconf, (name), int name) +{ + switch (name) + { + default: + 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_VERSION: + return _POSIX_VERSION; + + case _SC_PAGESIZE: + return __sysconfig (_CONFIG_PAGESIZE); + + 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_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) diff --git a/sysdeps/unix/sysv/sysv4/sysconfig.S b/sysdeps/unix/sysv/sysv4/sysconfig.S new file mode 100644 index 0000000000..034e012e84 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sysconfig.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +SYSCALL__ (sysconfig, 1) + ret diff --git a/sysdeps/unix/sysv/sysv4/sysconfig.h b/sysdeps/unix/sysv/sysv4/sysconfig.h new file mode 100644 index 0000000000..77c84c7af6 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sysconfig.h @@ -0,0 +1,28 @@ +/* `__sysconfig' NAME values. + Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, 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/sysdeps/unix/sysv/sysv4/sysinfo.S b/sysdeps/unix/sysv/sysv4/sysinfo.S new file mode 100644 index 0000000000..c279c96e9c --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/sysinfo.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +PSEUDO (__sysinfo, systeminfo, 3) + ret diff --git a/sysdeps/unix/sysv/sysv4/system.c b/sysdeps/unix/sysv/sysv4/system.c new file mode 100644 index 0000000000..fbfe43f19a --- /dev/null +++ b/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/sysdeps/unix/sysv/sysv4/time.S b/sysdeps/unix/sysv/sysv4/time.S new file mode 100644 index 0000000000..61f3514fb7 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/time.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> + +SYSCALL (time, 1) + ret diff --git a/sysdeps/unix/sysv/sysv4/utsnamelen.h b/sysdeps/unix/sysv/sysv4/utsnamelen.h new file mode 100644 index 0000000000..9dcc618068 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/utsnamelen.h @@ -0,0 +1 @@ +#define _UTSNAME_LENGTH 257 diff --git a/sysdeps/unix/sysv/sysv4/waitflags.h b/sysdeps/unix/sysv/sysv4/waitflags.h new file mode 100644 index 0000000000..cdb6f29e1d --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/waitflags.h @@ -0,0 +1,34 @@ +/* Definitions of flag bits for `waitpid' et al. + Copyright (C) 1993 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _WAITFLAGS_H + +#define _WAITFLAGS_H 1 + +/* 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 + +#endif /* waitflags.h */ diff --git a/sysdeps/unix/sysv/sysv4/waitpid.c b/sysdeps/unix/sysv/sysv4/waitpid.c new file mode 100644 index 0000000000..f54df4bf6b --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/waitpid.c @@ -0,0 +1,120 @@ +/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. + 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 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#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 __P ((__pid_t pid)); +extern int __waitid __P ((__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 +DEFUN(__waitpid, (pid, stat_loc, options), + __pid_t pid AND int *stat_loc AND 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 (__waitpid, waitpid) |