diff options
28 files changed, 28 insertions, 1534 deletions
@@ -1,5 +1,33 @@ 2013-12-17 Joseph Myers <joseph@codesourcery.com> + * sysdeps/unix/bsd/bits/posix_opt.h: Remove file. + * sysdeps/unix/bsd/bits/stat.h: Likewise. + * sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h: Likewise. + * sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h: Likewise. + * sysdeps/unix/bsd/bsd4.4/freebsd/sys/sysmacros.h: Likewise. + * sysdeps/unix/bsd/bsdstat.h: Likewise. + * sysdeps/unix/bsd/clock.c: Likewise. + * sysdeps/unix/bsd/i386/vfork.S: Likewise. + * sysdeps/unix/bsd/i386/wait3.S: Likewise. + * sysdeps/unix/bsd/init-posix.c: Likewise. + * sysdeps/unix/bsd/poll.c: Likewise. + * sysdeps/unix/bsd/ptsname.c: Likewise. + * sysdeps/unix/bsd/seekdir.c: Likewise. + * sysdeps/unix/bsd/setegid.c: Likewise. + * sysdeps/unix/bsd/seteuid.c: Likewise. + * sysdeps/unix/bsd/setgid.c: Likewise. + * sysdeps/unix/bsd/setrgid.c: Likewise. + * sysdeps/unix/bsd/setruid.c: Likewise. + * sysdeps/unix/bsd/setsid.c: Likewise. + * sysdeps/unix/bsd/setuid.c: Likewise. + * sysdeps/unix/bsd/sigaction.c: Likewise. + * sysdeps/unix/bsd/sigprocmask.c: Likewise. + * sysdeps/unix/bsd/sigsuspend.c: Likewise. + * sysdeps/unix/bsd/sys/reboot.h: Likewise. + * sysdeps/unix/bsd/telldir.c: Likewise. + * sysdeps/unix/bsd/times.c: Likewise. + * sysdeps/unix/bsd/usleep.c: Likewise. + * misc/Makefile (install-lib): Remove libbsd-compat.a. ($(objpfx)libbsd-compat.a): Remove rule. diff --git a/sysdeps/unix/bsd/bits/posix_opt.h b/sysdeps/unix/bsd/bits/posix_opt.h deleted file mode 100644 index 7d5e578..0000000 --- a/sysdeps/unix/bsd/bits/posix_opt.h +++ /dev/null @@ -1,5 +0,0 @@ -#define _POSIX_JOB_CONTROL 1 -#undef _POSIX_SAVED_IDS -#define _POSIX_CHOWN_RESTRICTED 1 -#define _POSIX_NO_TRUNC -1 -#define _POSIX_VDISABLE ((unsigned char) -1) diff --git a/sysdeps/unix/bsd/bits/stat.h b/sysdeps/unix/bsd/bits/stat.h deleted file mode 100644 index ff197fc..0000000 --- a/sysdeps/unix/bsd/bits/stat.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -#include <bits/types.h> - -/* Structure describing file characteristics. */ -struct stat - { - /* This is a short instead of dev_t for compatibility with 4.3. */ - short int st_dev; /* Device containing the file. */ - __ino_t st_ino; /* File serial number. */ - - /* This is a short instead of mode_t for compatibility with 4.3. */ - unsigned short int st_mode; /* File mode. */ - - __nlink_t st_nlink; /* Link count. */ - - /* These are shorts instead of uid_t/gid_t for compatibility with 4.3. */ - unsigned short int st_uid; /* User ID of the file's owner. */ - unsigned short int st_gid; /* Group ID of the file's group.*/ - - /* This is a short instead of dev_t for compatibility with 4.3. */ - short int st_rdev; /* Device number, if device. */ - - __off_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; /* 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. */ - - long int st_spare[2]; - }; - -/* 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_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ -#define __S_IFIFO 0010000 /* FIFO. */ - -/* 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. */ - -#endif /* bits/stat.h */ diff --git a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h deleted file mode 100644 index f3db33b..0000000 --- a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1999-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _UNISTD_H -# error "Never include this file directly. Use <unistd.h> instead" -#endif - -#include <bits/wordsize.h> - -/* This header should define the following symbols under the described - situations. A value `1' means that the model is always supported, - `-1' means it is never supported. Undefined means it cannot be - statically decided. - - _POSIX_V6_ILP32_OFF32 32bit int, long, pointers, and off_t type - _POSIX_V6_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type - - _POSIX_V6_LP64_OFF32 64bit long and pointers and 32bit off_t type - _POSIX_V6_LPBIG_OFFBIG 64bit long and pointers and large off_t type - - The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and - _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard - and are available only for compatibility. -*/ - -#if __WORDSIZE == 64 - -/* We can never provide environments with 32-bit wide pointers. */ -# define _POSIX_V6_ILP32_OFF32 -1 -# define _POSIX_V6_ILP32_OFFBIG -1 -# define _XBS5_ILP32_OFF32 -1 -# define _XBS5_ILP32_OFFBIG -1 -/* We also have no use (for now) for an environment with bigger pointers - and offsets. */ -# define _POSIX_V6_LPBIG_OFFBIG -1 -# define _XBS5_LPBIG_OFFBIG -1 - -/* By default we have 64-bit wide `long int', pointers and `off_t'. */ -# define _POSIX_V6_LP64_OFF64 1 -# define _XBS5_LP64_OFF64 1 - -#else /* __WORDSIZE == 32 */ - -/* By default we have 32-bit wide `int', `long int', pointers - and 64-bit `off_t'. */ -# define _POSIX_V6_ILP32_OFF32 -1 -# define _POSIX_V6_ILP32_OFFBIG 1 -# define _XBS5_ILP32_OFF32 -1 -# define _XBS5_ILP32_OFFBIG 1 - -/* We can never provide environments with 64-bit wide pointers. */ -# define _POSIX_V6_LP64_OFF64 -1 -# define _POSIX_V6_LPBIG_OFFBIG -1 -# define _XBS5_LP64_OFF64 -1 -# define _XBS5_LPBIG_OFFBIG -1 - -#endif /* __WORDSIZE == 32 */ diff --git a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h deleted file mode 100644 index b2eaa13..0000000 --- a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h +++ /dev/null @@ -1,72 +0,0 @@ -/* bits/typesizes.h -- underlying types for *_t. FreeBSD version. - Copyright (C) 2002-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _BITS_TYPES_H -# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." -#endif - -#ifndef _BITS_TYPESIZES_H -#define _BITS_TYPESIZES_H 1 - -/* See <bits/types.h> for the meaning of these macros. This file exists so - that <bits/types.h> need not vary across different GNU platforms. */ - -#define __DEV_T_TYPE __U32_TYPE -#define __UID_T_TYPE __U32_TYPE -#define __GID_T_TYPE __U32_TYPE -#define __INO_T_TYPE __U32_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE -#define __MODE_T_TYPE __U16_TYPE -#define __NLINK_T_TYPE __U16_TYPE -#define __OFF_T_TYPE __SQUAD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE -#define __PID_T_TYPE __S32_TYPE -#define __RLIM_T_TYPE __SQUAD_TYPE -#define __RLIM64_T_TYPE __SQUAD_TYPE -#define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE -#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE -#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE -#define __FSWORD_T_TYPE __SWORD_TYPE -#define __ID_T_TYPE __U32_TYPE -#define __CLOCK_T_TYPE __S32_TYPE -#define __TIME_T_TYPE __SLONGWORD_TYPE -#define __USECONDS_T_TYPE __U32_TYPE -#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE -#define __KEY_T_TYPE __S32_TYPE -#define __CLOCKID_T_TYPE __S32_TYPE -#define __TIMER_T_TYPE __S32_TYPE -#define __BLKSIZE_T_TYPE __U32_TYPE -#define __FSID_T_TYPE struct { int __val[2]; } -#define __SSIZE_T_TYPE __SWORD_TYPE -#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE -#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE - - -/* Tell the libc code that off_t and off64_t are actually the same type. */ -#define __OFF_T_MATCHES_OFF64_T 1 - - -/* Number of descriptors that can fit in an `fd_set'. */ -#define __FD_SETSIZE 1024 - - -#endif /* bits/typesizes.h */ diff --git a/sysdeps/unix/bsd/bsd4.4/freebsd/sys/sysmacros.h b/sysdeps/unix/bsd/bsd4.4/freebsd/sys/sysmacros.h deleted file mode 100644 index 2b5f9e0..0000000 --- a/sysdeps/unix/bsd/bsd4.4/freebsd/sys/sysmacros.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Definitions of macros to access `dev_t' values. FreeBSD version. - Copyright (C) 2002-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _SYS_SYSMACROS_H -#define _SYS_SYSMACROS_H 1 - -/* For compatibility we provide alternative names. */ -#define major(dev) ((int)(((unsigned int) (dev) >> 8) & 0xff)) -#define minor(dev) ((int)((dev) & 0xffff00ff)) -#define makedev(major, minor) (((major) << 8) | (minor)) - -#endif /* sys/sysmacros.h */ diff --git a/sysdeps/unix/bsd/bsdstat.h b/sysdeps/unix/bsd/bsdstat.h deleted file mode 100644 index 3c9f837..0000000 --- a/sysdeps/unix/bsd/bsdstat.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <stddef.h> -#include <sys/types.h> - -/* This will make it not define major, minor, makedev, and S_IF*. */ -#undef __USE_BSD -#undef __USE_MISC -#include <sys/stat.h> - -#undef stat -#undef fstat - -#undef S_IRWXU -#undef S_IRUSR -#undef S_IWUSR -#undef S_IXUSR -#undef S_IRWXG -#undef S_IRGRP -#undef S_IWGRP -#undef S_IXGRP -#undef S_IRWXO -#undef S_IROTH -#undef S_IWOTH -#undef S_IXOTH -#undef S_ISBLK -#undef S_ISCHR -#undef S_ISDIR -#undef S_ISFIFO -#undef S_ISREG -#undef S_ISUID -#undef S_ISGID -#define stat system_stat -#define fstat system_fstat -#define KERNEL /* Try to avoid misc decls. */ -#include "/usr/include/sys/stat.h" -#undef KERNEL -#undef stat -#undef fstat - -#define member_same(statbufp, sysbufp, member) \ - (offsetof(struct __stat, member) == offsetof(struct system_stat, member) && \ - sizeof((statbufp)->member) == sizeof((sysbufp)->member)) -#define need_stat_mapping(statbufp, sysbufp) \ - (!(member_same(statbufp, sysbufp, st_dev) && \ - member_same(statbufp, sysbufp, st_ino) && \ - member_same(statbufp, sysbufp, st_mode) && \ - member_same(statbufp, sysbufp, st_nlink) && \ - member_same(statbufp, sysbufp, st_uid) && \ - member_same(statbufp, sysbufp, st_gid) && \ - member_same(statbufp, sysbufp, st_rdev) && \ - member_same(statbufp, sysbufp, st_size) && \ - member_same(statbufp, sysbufp, st_atime) && \ - member_same(statbufp, sysbufp, st_mtime) && \ - member_same(statbufp, sysbufp, st_ctime) && \ - member_same(statbufp, sysbufp, st_blksize) && \ - member_same(statbufp, sysbufp, st_blocks))) - -/* Map a system `struct stat' to our `struct stat'. */ -#ifdef __GNUC__ -inline -#endif -static int -mapstat (sysbuf, statbuf) - const struct system_stat *sysbuf; - struct __stat *buf; -{ - if (buf == NULL) - { - errno = EINVAL; - return -1; - } - - if (!need_stat_mapping(buf, sysbuf)) - /* Hopefully this will be optimized out. */ - *buf = *(struct __stat *) sysbuf; - else - { - buf->st_dev = (dev_t) sysbuf->st_dev; - buf->st_ino = (ino_t) sysbuf->st_ino; - buf->st_mode = (mode_t) sysbuf->st_mode; - buf->st_nlink = (nlink_t) sysbuf->st_nlink; - buf->st_uid = (uid_t) sysbuf->st_uid; - buf->st_gid = (gid_t) sysbuf->st_gid; - buf->st_rdev = (dev_t) sysbuf->st_rdev; - buf->st_size = (size_t) sysbuf->st_size; - buf->st_atime = (time_t) sysbuf->st_atime; - buf->st_mtime = (time_t) sysbuf->st_mtime; - buf->st_ctime = (time_t) sysbuf->st_ctime; - buf->st_blksize = (size_t) sysbuf->st_blksize; - buf->st_blocks = (size_t) sysbuf->st_blocks; - } - - return 0; -} diff --git a/sysdeps/unix/bsd/clock.c b/sysdeps/unix/bsd/clock.c deleted file mode 100644 index a46cf9c..0000000 --- a/sysdeps/unix/bsd/clock.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/resource.h> -#include <sys/time.h> -#include <time.h> - -#ifdef __GNUC__ -__inline -#endif -static clock_t -timeval_to_clock_t (const struct timeval *tv) -{ - return (clock_t) ((tv->tv_sec * CLOCKS_PER_SEC) + - (tv->tv_usec * CLOCKS_PER_SEC / 1000000)); -} - -/* Return the time used by the program so far (user time + system time). */ -clock_t -clock (void) -{ - struct rusage usage; - - if (__getrusage (RUSAGE_SELF, &usage) < 0) - return (clock_t) -1; - - return (timeval_to_clock_t (&usage.ru_stime) + - timeval_to_clock_t (&usage.ru_utime)); -} diff --git a/sysdeps/unix/bsd/i386/vfork.S b/sysdeps/unix/bsd/i386/vfork.S deleted file mode 100644 index 69cbeed..0000000 --- a/sysdeps/unix/bsd/i386/vfork.S +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1993-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - -/* Since vfork shares the address space between the parent and child, - we must take care to avoid the child unwinding the stack frame and - clobbering it for the parent. */ - -.text -ENTRY (__vfork) - popl scratch /* Save the return PC in a register. */ - DO_CALL (vfork, 0) /* Do the system call. */ - pushl scratch /* Put the return PC back on the stack. */ - jb syscall_error /* Branch if error. */ - /* R1 is now 0 for the parent and 1 for the child. Decrement it to - make it -1 (all bits set) for the parent, and 0 (no bits set) - for the child. Then AND it with R0, so the parent gets - R0&-1==R0, and the child gets R0&0==0. */ - decl r1 - andl r1, r0 - ret -libc_hidden_def (__vfork) - -weak_alias (__vfork, vfork) diff --git a/sysdeps/unix/bsd/i386/wait3.S b/sysdeps/unix/bsd/i386/wait3.S deleted file mode 100644 index 3f3cbdc..0000000 --- a/sysdeps/unix/bsd/i386/wait3.S +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - -/* <sysdeps/unix/bsd/sequent/i386/sysdep.h> defines this to put the first - two arguments into registers. Since the arguments to wait3 are - transferred magically through the same registers, we want to disable this. - This allows us to avoid rewriting this file for that system. */ - -#undef ARGS_2 -#define ARGS_2 /* Special-case no-op. */ - -.text -.globl syscall_error -.align 4 -ENTRY (__wait3) - mov 8(%esp), %ecx /* Flags. */ - mov 12(%esp), %edx /* rusage pointer. */ - pushl $0xdf; popf /* Set all the condition codes. */ - DO_CALL (wait, 2) /* Do the system call. */ - je syscall_error /* Check for error. */ - mov 4(%esp), scratch /* Status pointer. */ - orl scratch, scratch /* Is it nil? */ - je done /* Yup; return. */ - mov r1, 0(scratch) /* Non-nil; store the status in it. */ -done: ret - -weak_alias (__wait3, wait3) diff --git a/sysdeps/unix/bsd/init-posix.c b/sysdeps/unix/bsd/init-posix.c deleted file mode 100644 index c4e9742..0000000 --- a/sysdeps/unix/bsd/init-posix.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <stddef.h> -#include <time.h> - -/* This must be initialized data or its presence will not be sufficient to - merit linkage of this file, which is necessary for the real - initialization function below to be called. */ -time_t _posix_start_time = -1; - -void -__init_posix (void) -{ - _posix_start_time = time ((time_t *) NULL); -} - -text_set_element(__libc_subinit, __init_posix); diff --git a/sysdeps/unix/bsd/poll.c b/sysdeps/unix/bsd/poll.c deleted file mode 100644 index b6d306c..0000000 --- a/sysdeps/unix/bsd/poll.c +++ /dev/null @@ -1,197 +0,0 @@ -/* Copyright (C) 1994-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <alloca.h> -#include <sys/poll.h> -#include <sys/types.h> -#include <errno.h> -#include <string.h> -#include <sys/time.h> -#include <sys/param.h> -#include <unistd.h> - -/* Poll the file descriptors described by the NFDS structures starting at - FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for - an event to occur; if TIMEOUT is -1, block until an event occurs. - Returns the number of file descriptors with events, zero if timed out, - or -1 for errors. */ - -int -__poll (fds, nfds, timeout) - struct pollfd *fds; - nfds_t nfds; - int timeout; -{ - static int max_fd_size; - struct timeval tv; - fd_set *rset, *wset, *xset; - struct pollfd *f; - int ready; - int maxfd = 0; - int bytes; - - if (!max_fd_size) - max_fd_size = __getdtablesize (); - - bytes = howmany (max_fd_size, __NFDBITS); - rset = alloca (bytes); - wset = alloca (bytes); - xset = alloca (bytes); - - /* We can't call FD_ZERO, since FD_ZERO only works with sets - of exactly __FD_SETSIZE size. */ - __bzero (rset, bytes); - __bzero (wset, bytes); - __bzero (xset, bytes); - - for (f = fds; f < &fds[nfds]; ++f) - { - f->revents = 0; - if (f->fd >= 0) - { - if (f->fd >= max_fd_size) - { - /* The user provides a file descriptor number which is higher - than the maximum we got from the `getdtablesize' call. - Maybe this is ok so enlarge the arrays. */ - fd_set *nrset, *nwset, *nxset; - int nbytes; - - max_fd_size = roundup (f->fd, __NFDBITS); - nbytes = howmany (max_fd_size, __NFDBITS); - - nrset = alloca (nbytes); - nwset = alloca (nbytes); - nxset = alloca (nbytes); - - __bzero ((char *) nrset + bytes, nbytes - bytes); - __bzero ((char *) nwset + bytes, nbytes - bytes); - __bzero ((char *) nxset + bytes, nbytes - bytes); - - rset = memcpy (nrset, rset, bytes); - wset = memcpy (nwset, wset, bytes); - xset = memcpy (nxset, xset, bytes); - - bytes = nbytes; - } - - if (f->events & POLLIN) - FD_SET (f->fd, rset); - if (f->events & POLLOUT) - FD_SET (f->fd, wset); - if (f->events & POLLPRI) - FD_SET (f->fd, xset); - if (f->fd > maxfd && (f->events & (POLLIN|POLLOUT|POLLPRI))) - maxfd = f->fd; - } - } - - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - - while (1) - { - ready = __select (maxfd + 1, rset, wset, xset, - timeout == -1 ? NULL : &tv); - - /* It might be that one or more of the file descriptors is invalid. - We now try to find and mark them and then try again. */ - if (ready == -1 && errno == EBADF) - { - fd_set *sngl_rset = alloca (bytes); - fd_set *sngl_wset = alloca (bytes); - fd_set *sngl_xset = alloca (bytes); - struct timeval sngl_tv; - - /* Clear the original set. */ - __bzero (rset, bytes); - __bzero (wset, bytes); - __bzero (xset, bytes); - - /* This means we don't wait for input. */ - sngl_tv.tv_sec = 0; - sngl_tv.tv_usec = 0; - - maxfd = -1; - - /* Reset the return value. */ - ready = 0; - - for (f = fds; f < &fds[nfds]; ++f) - if (f->fd != -1 && (f->events & (POLLIN|POLLOUT|POLLPRI)) - && (f->revents & POLLNVAL) == 0) - { - int n; - - __bzero (sngl_rset, bytes); - __bzero (sngl_wset, bytes); - __bzero (sngl_xset, bytes); - - if (f->events & POLLIN) - FD_SET (f->fd, sngl_rset); - if (f->events & POLLOUT) - FD_SET (f->fd, sngl_wset); - if (f->events & POLLPRI) - FD_SET (f->fd, sngl_xset); - - n = __select (f->fd + 1, sngl_rset, sngl_wset, sngl_xset, - &sngl_tv); - if (n != -1) - { - /* This descriptor is ok. */ - if (f->events & POLLIN) - FD_SET (f->fd, rset); - if (f->events & POLLOUT) - FD_SET (f->fd, wset); - if (f->events & POLLPRI) - FD_SET (f->fd, xset); - if (f->fd > maxfd) - maxfd = f->fd; - if (n > 0) - /* Count it as being available. */ - ++ready; - } - else if (errno == EBADF) - f->revents |= POLLNVAL; - } - /* Try again. */ - continue; - } - - break; - } - - if (ready > 0) - for (f = fds; f < &fds[nfds]; ++f) - { - if (f->fd >= 0) - { - if (FD_ISSET (f->fd, rset)) - f->revents |= POLLIN; - if (FD_ISSET (f->fd, wset)) - f->revents |= POLLOUT; - if (FD_ISSET (f->fd, xset)) - f->revents |= POLLPRI; - } - } - - return ready; -} -#ifndef __poll -libc_hidden_def (__poll) -weak_alias (__poll, poll) -#endif diff --git a/sysdeps/unix/bsd/ptsname.c b/sysdeps/unix/bsd/ptsname.c deleted file mode 100644 index 60e38d7..0000000 --- a/sysdeps/unix/bsd/ptsname.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (C) 1998-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <paths.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <unistd.h> - -/* Static buffer for `ptsname'. */ -static char buffer[sizeof (_PATH_TTY) + 2]; - - -/* Return the pathname of the pseudo terminal slave associated with - the master FD is open on, or NULL on errors. - The returned storage is good until the next call to this function. */ -char * -ptsname (int fd) -{ - return __ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer; -} - - -/* Store at most BUFLEN characters of the pathname of the slave pseudo - terminal associated with the master FD is open on in BUF. - Return 0 on success, otherwise an error number. */ -int -__ptsname_r (int fd, char *buf, size_t buflen) -{ - int save_errno = errno; - int err; - struct stat st; - - if (buf == NULL) - { - __set_errno (EINVAL); - return EINVAL; - } - - if (!__isatty (fd)) - /* We rely on isatty to set errno properly (i.e. EBADF or ENOTTY). */ - return errno; - - if (buflen < strlen (_PATH_TTY) + 3) - { - __set_errno (ERANGE); - return ERANGE; - } - - err = __ttyname_r (fd, buf, buflen); - if (err != 0) - { - __set_errno (err); - return errno; - } - - buf[sizeof (_PATH_DEV) - 1] = 't'; - - if (__stat (buf, &st) < 0) - return errno; - - __set_errno (save_errno); - return 0; -} -weak_alias (__ptsname_r, ptsname_r) diff --git a/sysdeps/unix/bsd/seekdir.c b/sysdeps/unix/bsd/seekdir.c deleted file mode 100644 index 4d244f5..0000000 --- a/sysdeps/unix/bsd/seekdir.c +++ /dev/null @@ -1 +0,0 @@ -/* Because they share a private data structure, seekdir is in telldir.c. */ diff --git a/sysdeps/unix/bsd/setegid.c b/sysdeps/unix/bsd/setegid.c deleted file mode 100644 index 5624d08..0000000 --- a/sysdeps/unix/bsd/setegid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1995-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> - -int -setegid (gid) - gid_t gid; -{ - if (gid == (gid_t) ~0) - { - __set_errno (EINVAL); - return -1; - } - - return __setregid (-1, gid); -} -libc_hidden_def (setegid) diff --git a/sysdeps/unix/bsd/seteuid.c b/sysdeps/unix/bsd/seteuid.c deleted file mode 100644 index 18d2e4b..0000000 --- a/sysdeps/unix/bsd/seteuid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1995-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> - -int -seteuid (uid) - uid_t uid; -{ - if (uid == (uid_t) ~0) - { - __set_errno (EINVAL); - return -1; - } - - return __setreuid (-1, uid); -} -libc_hidden_def (seteuid) diff --git a/sysdeps/unix/bsd/setgid.c b/sysdeps/unix/bsd/setgid.c deleted file mode 100644 index f01ae6c..0000000 --- a/sysdeps/unix/bsd/setgid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> - -/* Set the group ID of the calling process to GID. - If the calling process is the super-user, the real - and effective group IDs, and the saved set-group-ID to GID; - if not, the effective group ID is set to GID. */ -int -__setgid (gid) - gid_t gid; -{ - return __setregid (gid, gid); -} - -weak_alias (__setgid, setgid) diff --git a/sysdeps/unix/bsd/setrgid.c b/sysdeps/unix/bsd/setrgid.c deleted file mode 100644 index 01002cc..0000000 --- a/sysdeps/unix/bsd/setrgid.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 1993-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <unistd.h> -#include <sys/types.h> - -int -setrgid (gid) - gid_t gid; -{ - return __setregid (gid, -1); -} diff --git a/sysdeps/unix/bsd/setruid.c b/sysdeps/unix/bsd/setruid.c deleted file mode 100644 index 38ebaac..0000000 --- a/sysdeps/unix/bsd/setruid.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 1993-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <unistd.h> -#include <sys/types.h> - -int -setruid (uid) - uid_t uid; -{ - return __setreuid (uid, -1); -} diff --git a/sysdeps/unix/bsd/setsid.c b/sysdeps/unix/bsd/setsid.c deleted file mode 100644 index a42dc1d..0000000 --- a/sysdeps/unix/bsd/setsid.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <unistd.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <fcntl.h> - -/* 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 -__setsid (void) -{ - pid_t pid = getpid (); - int tty; - int save = errno; - - if (__getpgid (pid) == pid) - { - /* Already the leader. */ - __set_errno (EPERM); - return -1; - } - - if (setpgid (pid, pid) < 0) - return -1; - - tty = open ("/dev/tty", 0); - if (tty < 0) - { - __set_errno (save); - return 0; - } - (void) __ioctl (tty, TIOCNOTTY, 0); - (void) __close (tty); - - __set_errno (save); - return 0; -} - -weak_alias (__setsid, setsid) diff --git a/sysdeps/unix/bsd/setuid.c b/sysdeps/unix/bsd/setuid.c deleted file mode 100644 index d19d9f1..0000000 --- a/sysdeps/unix/bsd/setuid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> - -/* Set the user ID of the calling process to UID. - If the calling process is the super-user, the real - and effective user IDs, and the saved set-user-ID to UID; - if not, the effective user ID is set to UID. */ -int -__setuid (uid) - uid_t uid; -{ - return __setreuid (uid, uid); -} - -weak_alias (__setuid, setuid) diff --git a/sysdeps/unix/bsd/sigaction.c b/sysdeps/unix/bsd/sigaction.c deleted file mode 100644 index 84ad17e..0000000 --- a/sysdeps/unix/bsd/sigaction.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <errno.h> -#include <stddef.h> -#include <signal.h> - - -/* 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 sigvec vec, ovec; - - if (sig <= 0 || sig >= NSIG) - { - __set_errno (EINVAL); - return -1; - } - - if (act != NULL) - { - vec.sv_mask = act->sa_mask; - vec.sv_handler = act->sa_handler; - vec.sv_flags = (((act->sa_flags & SA_ONSTACK) ? SV_ONSTACK : 0) | - (!(act->sa_flags & SA_RESTART) ? SV_INTERRUPT : 0)); - } - - if (__sigvec(sig, act != NULL ? &vec : (struct sigvec *) NULL, &ovec) < 0) - return -1; - - if (oact != NULL) - { - oact->sa_handler = (void (*) (int)) ovec.sv_handler; - oact->sa_mask = ovec.sv_mask; - oact->sa_flags = (((ovec.sv_flags & SV_ONSTACK) ? SA_ONSTACK : 0) | - (!(ovec.sv_flags & SV_INTERRUPT) ? SA_RESTART : 0)); - } - - return 0; -} -libc_hidden_def (__sigaction) -weak_alias (__sigaction, sigaction) diff --git a/sysdeps/unix/bsd/sigprocmask.c b/sysdeps/unix/bsd/sigprocmask.c deleted file mode 100644 index 683dbf0..0000000 --- a/sysdeps/unix/bsd/sigprocmask.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <stddef.h> -#include <signal.h> - - -/* If SET is not NULL, modify the current set of blocked signals - according to HOW, which may be SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK. - If OSET is not NULL, store the old set of blocked signals in *OSET. */ -int -__sigprocmask (how, set, oset) - int how; - const sigset_t *set; - sigset_t *oset; -{ - int mask; - - if (set != NULL) - { - mask = *set; - switch (how) - { - case SIG_BLOCK: - mask = __sigblock (mask); - break; - - case SIG_UNBLOCK: - mask = __sigblock (0) & ~mask; - /* Fall through. */ - - case SIG_SETMASK: - mask = __sigsetmask (mask); - break; - - default: - __set_errno (EINVAL); - return -1; - } - } - else - mask = __sigblock (0); - - if (oset != NULL) - *oset = mask; - - return 0; -} - -weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/bsd/sigsuspend.c b/sysdeps/unix/bsd/sigsuspend.c deleted file mode 100644 index e35a579..0000000 --- a/sysdeps/unix/bsd/sigsuspend.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <signal.h> -#include <stddef.h> -#include <unistd.h> - - -/* 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; -{ - int mask; - int sig; - - if (set == NULL) - { - __set_errno (EINVAL); - return -1; - } - - mask = 0; - for (sig = 1; sig <= NSIG; ++sig) - if (__sigismember (set, sig)) - mask |= sigmask (sig); - - return __sigpause (mask, 0); -} -libc_hidden_def (__sigsuspend) -weak_alias (__sigsuspend, sigsuspend) diff --git a/sysdeps/unix/bsd/sys/reboot.h b/sysdeps/unix/bsd/sys/reboot.h deleted file mode 100644 index 76c2380..0000000 --- a/sysdeps/unix/bsd/sys/reboot.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)reboot.h 8.1 (Berkeley) 6/2/93 - */ - -/* - * Arguments to reboot system call. - * These are passed to boot program in r11, - * and on to init. - */ -#define RB_AUTOBOOT 0 /* flags for system auto-booting itself */ - -#define RB_ASKNAME 0x01 /* ask for file name to reboot from */ -#define RB_SINGLE 0x02 /* reboot to single user only */ -#define RB_NOSYNC 0x04 /* don't sync before reboot */ -#define RB_HALT 0x08 /* don't reboot, just halt */ -#define RB_INITNAME 0x10 /* name given for /etc/init (unused) */ -#define RB_DFLTROOT 0x20 /* use compiled-in rootdev */ -#define RB_KDB 0x40 /* give control to kernel debugger */ -#define RB_RDONLY 0x80 /* mount root fs read-only */ -#define RB_DUMP 0x100 /* dump kernel memory before reboot */ -#define RB_MINIROOT 0x200 /* mini-root present in memory at boot time */ - -/* - * Constants for converting boot-style device number to type, - * adaptor (uba, mba, etc), unit number and partition number. - * Type (== major device number) is in the low byte - * for backward compatibility. Except for that of the "magic - * number", each mask applies to the shifted value. - * Format: - * (4) (4) (4) (4) (8) (8) - * -------------------------------- - * |MA | AD| CT| UN| PART | TYPE | - * -------------------------------- - */ -#define B_ADAPTORSHIFT 24 -#define B_ADAPTORMASK 0x0f -#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK) -#define B_CONTROLLERSHIFT 20 -#define B_CONTROLLERMASK 0xf -#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK) -#define B_UNITSHIFT 16 -#define B_UNITMASK 0xf -#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK) -#define B_PARTITIONSHIFT 8 -#define B_PARTITIONMASK 0xff -#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) -#define B_TYPESHIFT 0 -#define B_TYPEMASK 0xff -#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) - -#define B_MAGICMASK ((u_long)0xf0000000) -#define B_DEVMAGIC ((u_long)0xa0000000) - -#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \ - (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \ - ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \ - ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC) diff --git a/sysdeps/unix/bsd/telldir.c b/sysdeps/unix/bsd/telldir.c deleted file mode 100644 index 87e3653..0000000 --- a/sysdeps/unix/bsd/telldir.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 1994-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <stddef.h> -#include <dirent.h> -#include <unistd.h> -#include <sys/types.h> -#include <stdlib.h> -#include "dirstream.h" - -/* Internal data structure for telldir and seekdir. */ -struct record - { - struct record *next; /* Link in chain. */ - off_t cookie; /* Value returned by `telldir'. */ - off_t pos; - size_t offset; - }; -#define NBUCKETS 32 -static struct record *records[32]; -static off_t lastpos; -__libc_lock_define_initialized(static, lock) /* Locks above data. */ - - -/* Return the current position of DIRP. */ -long int -telldir (dirp) - DIR *dirp; -{ - struct record *new; - long int pos; - - new = malloc (sizeof *new); - if (new == NULL) - return -1l; - - __libc_lock_lock (lock); - - new->pos = dirp->filepos; - new->offset = dirp->offset; - new->cookie = ++lastpos; - new->next = records[new->cookie % NBUCKETS]; - records[new->cookie % NBUCKETS] = new; - - pos = new->cookie; - - __libc_lock_unlock (lock); - - return pos; -} - - - -/* Seek to position POS in DIRP. */ -void -seekdir (dirp, pos) - DIR *dirp; - long int pos; -{ - struct record *r, **prevr; - - __libc_lock_lock (lock); - - for (prevr = &records[pos % NBUCKETS], r = *prevr; - r != NULL; - prevr = &r->next, r = r->next) - if (r->cookie == pos) - { - __libc_lock_lock (dirp->__lock); - if (dirp->filepos != r->pos || dirp->offset != r->offset) - { - dirp->size = 0; /* Must read a fresh buffer. */ - /* Move to the saved position. */ - __lseek (dirp->fd, r->pos, SEEK_SET); - dirp->filepos = r->pos; - dirp->offset = 0; - /* Read entries until we reach the saved offset. */ - while (dirp->offset < r->offset) - { - struct dirent *scan; - __libc_lock_unlock (dirp->__lock); - scan = readdir (dirp); - __libc_lock_lock (dirp->__lock); - if (! scan) - break; - } - } - __libc_lock_unlock (dirp->__lock); - - /* To prevent leaking memory, cookies returned from telldir - can only be used once. So free this one's record now. */ - *prevr = r->next; - free (r); - break; - } - - __libc_lock_unlock (lock); - - /* If we lost there is no way to indicate it. Oh well. */ -} diff --git a/sysdeps/unix/bsd/times.c b/sysdeps/unix/bsd/times.c deleted file mode 100644 index f0765bd..0000000 --- a/sysdeps/unix/bsd/times.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1991-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <stddef.h> -#include <sys/resource.h> -#include <sys/times.h> -#include <sys/time.h> -#include <time.h> - - -/* Time the program started. */ -extern time_t _posix_start_time; - -#ifdef __GNUC__ -__inline -#endif -static clock_t -timeval_to_clock_t (const struct timeval *tv, clock_t clk_tck) -{ - return (clock_t) ((tv->tv_sec * clk_tck) + - (tv->tv_usec * clk_tck / 1000000L)); -} - -/* 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; -{ - struct rusage usage; - clock_t clk_tck; - - if (buffer == NULL) - { - __set_errno (EINVAL); - return (clock_t) -1; - } - - clk_tck = __getclktck (); - - if (__getrusage (RUSAGE_SELF, &usage) < 0) - return (clock_t) -1; - buffer->tms_utime = (clock_t) timeval_to_clock_t (&usage.ru_utime, clk_tck); - buffer->tms_stime = (clock_t) timeval_to_clock_t (&usage.ru_stime, clk_tck); - - if (__getrusage (RUSAGE_CHILDREN, &usage) < 0) - return (clock_t) -1; - buffer->tms_cutime = (clock_t) timeval_to_clock_t (&usage.ru_utime, clk_tck); - buffer->tms_cstime = (clock_t) timeval_to_clock_t (&usage.ru_stime, clk_tck); - - return (time ((time_t *) NULL) - _posix_start_time) * clk_tck; -} - -weak_alias (__times, times) diff --git a/sysdeps/unix/bsd/usleep.c b/sysdeps/unix/bsd/usleep.c deleted file mode 100644 index 709030b..0000000 --- a/sysdeps/unix/bsd/usleep.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1992-2013 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, see - <http://www.gnu.org/licenses/>. */ - -#include <unistd.h> -#include <sys/types.h> -#include <sys/time.h> - -/* Sleep USECONDS microseconds, or until a previously set timer goes off. */ -int -usleep (useconds) - useconds_t useconds; -{ - struct timeval delay; - - delay.tv_sec = 0; - delay.tv_usec = useconds; - - return __select (0, (fd_set *) NULL, (fd_set *) NULL, (fd_set *) NULL, - &delay); -} |