From af69217fea009d28a9dca78796147a05d3cffb01 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 25 Jan 1998 17:01:47 +0000 Subject: Update. 1998-01-26 00:57 Ulrich Drepper * db2/Makefile (routines): Add os_alloc. * db2/db.h: Update from db-2.3.16. * db2/db_185.h: Likewise. * db2/db_int.h: Likewise. * db2/btree/bt_close.c: Likewise. * db2/btree/bt_cursor.c: Likewise. * db2/btree/bt_delete.c: Likewise. * db2/btree/bt_open.c: Likewise. * db2/btree/bt_page.c: Likewise. * db2/btree/bt_put.c: Likewise. * db2/btree/bt_rec.c: Likewise. * db2/btree/bt_recno.c: Likewise. * db2/btree/btree_auto.c: Likewise. * db2/common/db_appinit.c: Likewise. * db2/common/db_apprec.c: Likewise. * db2/common/db_err.c: Likewise. * db2/common/db_region.c: Likewise. * db2/common/db_shash.c: Likewise. * db2/db/db.c: Likewise. * db2/db/db_auto.c: Likewise. * db2/db/db_conv.c: Likewise. * db2/db/db_dispatch.c: Likewise. * db2/db/db_dup.c: Likewise. * db2/db/db_pr.c: Likewise. * db2/db/db_rec.c: Likewise. * db2/db185/db185.c: Likewise. * db2/dbm/dbm.c: Likewise. * db2/hash/hash.c: Likewise. * db2/hash/hash_auto.c: Likewise. * db2/hash/hash_dup.c: Likewise. * db2/hash/hash_page.c: Likewise. * db2/hash/hash_rec.c: Likewise. * db2/include/btree_ext.h: Likewise. * db2/include/clib_ext.h: Likewise. * db2/include/common_ext.h: Likewise. * db2/include/db.h.src: Likewise. * db2/include/db_185.h.src: Likewise. * db2/include/db_am.h: Likewise. * db2/include/db_ext.h: Likewise. * db2/include/db_int.h.src: Likewise. * db2/include/hash_ext.h: Likewise. * db2/include/lock_ext.h: Likewise. * db2/include/log.h: Likewise. * db2/include/log_auto.h: Likewise. * db2/include/log_ext.h: Likewise. * db2/include/mp.h: Likewise. * db2/include/mp_ext.h: Likewise. * db2/include/mutex_ext.h: Likewise. * db2/include/os_ext.h: Likewise. * db2/include/os_func.h: Likewise. * db2/include/txn_ext.h: Likewise. * db2/lock/lock.c: Likewise. * db2/lock/lock_util.c: Likewise. * db2/log/log.c: Likewise. * db2/log/log.src: Likewise. * db2/log/log_archive.c: Likewise. * db2/log/log_auto.c: Likewise. * db2/log/log_get.c: Likewise. * db2/log/log_put.c: Likewise. * db2/log/log_rec.c: Likewise. * db2/log/log_register.c: Likewise. * db2/mp/mp_bh.c: Likewise. * db2/mp/mp_fget.c: Likewise. * db2/mp/mp_fopen.c: Likewise. * db2/mp/mp_fput.c: Likewise. * db2/mp/mp_pr.c: Likewise. * db2/mp/mp_sync.c: Likewise. * db2/mutex/mutex.c: Likewise. * db2/os/os_alloc.c: Likewise. * db2/os/os_config.c: Likewise. * db2/os/os_stat.c: Likewise. * db2/progs/db_checkpoint/db_checkpoint.c: Likewise. * db2/progs/db_deadlock/db_deadlock.c: Likewise. * db2/progs/db_load/db_load.c: Likewise. * db2/progs/db_printlog/db_printlog.c: Likewise. * db2/progs/db_recover/db_recover.c: Likewise. * db2/progs/db_stat/db_stat.c: Likewise. * db2/txn/txn.c: Likewise. * elf/dl-close.c (_dl_close): Rename inner variable named map to imap. Unmap memory blocks in reverse order of allocation. Call munmap with load address added to offset. Bug reported by Miguel de Icaza. * locale/programs/ld-collate.c (collate_end_weight): Correctly fill up weight array. * localedata/locales/cs_CZ: Update by Michael Mraka . * misc/sys/syslog.h: Reformat a bit. Don't declare vsyslog unless __USE_BSD. * nis/nss_compat/compat-grp.c: Correctly handle buffer overflow while reading line with fgets. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/compat-spwd.c: Likewise. * nss/nss_files/files-XXX.c: Likewise. * nss/nss_files/files-alias.c: Likewise. * shadow/fgetspent_r.c: Likewise. * string/strerror_r.c: Correct comment. Patch by Andreas Jaeger. * sysdeps/unix/sysv/linux/bits/stat.h: Define _STATBUF_ST_RDEV. * sysdeps/unix/sysv/linux/alpha/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/i386/sys/ucontext.h: Allocate room for FP register content in ucontext_t. 1998-01-22 Andreas Jaeger * sysdeps/libm-ieee754/s_modfl.c (modf): Correct calculation. Patch by Markus Schoder . * math/libm-test.c (modf_test): Add more tests for modf. * sysdeps/unix/sysv/linux/sys/mman.h: Add const to mlock and munlock according to Unix98. 1998-01-25 Andreas Jaeger * nss/nss_files/files-network.c (LINE_PARSER): Set n_addrtype to AF_INET. 1998-01-21 07:22 H.J. Lu * sysdeps/posix/ttyname.c: Handle symbolic links. * sysdeps/posix/ttyname_r.c: Ditto. 1998-01-25 19:39 Ulrich Drepper * db2/makedb.c (process_input): Write terminating \0 for value. (print_database): Simply print value string, don't use length. 1998-01-24 Andreas Jaeger * nss/nsswitch.c (__nss_configure_lookup): Correct test for early exit of loop. 1998-01-25 Thorsten Kukuk * nis/ypclnt.c: Don't set dom_client to NULL, or we will not close all sockets. 1998-01-25 14:54 Ulrich Drepper * signal/Makefile (routines): Add sighold, sigrelse, sigignore, and sigset. * signal/sighold.c: New file. * signal/sigrelse.c: New file. * sysdeps/generic/sigignore.c: New file. * sysdeps/generic/sigset.c: New file. * sysdeps/posix/sigignore.c: New file. * sysdeps/posix/sigset.c: New file. * signal/signal.h: Add prototypes for new functions. * sysdeps/unix/sysv/linux/alpha/bits/signum.h: Define SIG_HOLD. * sysdeps/unix/sysv/linux/bits/signum.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/signum.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/signum.h: Likewise. 1998-01-23 00:16 Tim Waugh * posix/wordexp.c: Added IFS field-splitting in parameter and command substitution. Fixed an IFS-related bug that caused an infinite loop. 1998-01-25 12:38 Ulrich Drepper * stdlib/Makefile (routines): Add getcontext, setcontext, makecontext, and swapcontext. * stdlib/ucontext.h: Correct prototypes. * sysdeps/generic/getcontext.c: New file. * sysdeps/generic/setcontext.c: New file. * sysdeps/generic/makecontext.c: New file. * sysdeps/generic/swapcontext.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: Removed. 1998-01-25 04:07 Ulrich Drepper * resource/sys/resource.h: Remove #include of ulimit.h which is not allowed by SUSv2 and not available on other systems. * sysdeps/unix/sysv/linux/ulimit.c: Include ulimit.h. * streams/Makefile: New file. * streams/stropts.h: New file. * sysdeps/generic/bits/stropts.h: New file. * sysdeps/generic/isastream.c: New file. * sysdeps/generic/getmsg.c: New file. * sysdeps/generic/getpmsg.c: New file. * sysdeps/generic/putmsg.c: New file. * sysdeps/generic/putpmsg.c: New file. * sysdeps/generic/fattach.c: New file. * sysdeps/generic/fdetach.c: New file. * sysdeps/unix/inet/Subdirs: Add streams. * sysdeps/generic/bits/types.h: Add definition of __t_scalar_t and __t_uscalar_t. * sysdeps/unix/sysv/linux/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise. * sysdeps/mach/_strerror.c: Follow changes of generic version to handle small buffers correctly. 1998-01-24 17:31 H.J. Lu * sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE): Remove the 3rd arg and add declaration for _dl_runtime_resolve and _dl_runtime_profile. 1998-01-25 02:42 Ulrich Drepper * include/cpio.h: New file. Mainly copied from GNU cpio. * posix/Makefile (headers): Add cpio.h. --- sysdeps/alpha/dl-machine.h | 6 +- sysdeps/generic/bits/stropts.h | 211 +++++++++++++++++++++ sysdeps/generic/bits/types.h | 6 +- sysdeps/generic/fattach.c | 33 ++++ sysdeps/generic/fdetach.c | 32 ++++ sysdeps/generic/getcontext.c | 32 ++++ sysdeps/generic/getmsg.c | 35 ++++ sysdeps/generic/getpmsg.c | 36 ++++ sysdeps/generic/isastream.c | 32 ++++ sysdeps/generic/makecontext.c | 30 +++ sysdeps/generic/putmsg.c | 35 ++++ sysdeps/generic/putpmsg.c | 36 ++++ sysdeps/generic/setcontext.c | 32 ++++ sysdeps/generic/sigignore.c | 33 ++++ sysdeps/generic/sigset.c | 34 ++++ sysdeps/generic/swapcontext.c | 33 ++++ sysdeps/libm-ieee754/s_modfl.c | 4 +- sysdeps/mach/_strerror.c | 62 ++++-- sysdeps/posix/sigignore.c | 36 ++++ sysdeps/posix/sigset.c | 66 +++++++ sysdeps/posix/ttyname.c | 79 ++++++-- sysdeps/posix/ttyname_r.c | 128 +++++++++---- sysdeps/unix/inet/Subdirs | 1 + sysdeps/unix/sysv/linux/alpha/bits/signum.h | 6 +- sysdeps/unix/sysv/linux/alpha/bits/stat.h | 6 +- sysdeps/unix/sysv/linux/alpha/bits/types.h | 6 +- sysdeps/unix/sysv/linux/bits/signum.h | 6 +- sysdeps/unix/sysv/linux/bits/stat.h | 6 +- sysdeps/unix/sysv/linux/bits/types.h | 6 +- sysdeps/unix/sysv/linux/i386/sys/ucontext.h | 3 +- sysdeps/unix/sysv/linux/mips/bits/signum.h | 6 +- sysdeps/unix/sysv/linux/mips/bits/stat.h | 6 +- sysdeps/unix/sysv/linux/mips/bits/types.h | 6 +- sysdeps/unix/sysv/linux/sparc/bits/signum.h | 6 +- sysdeps/unix/sysv/linux/sparc/sparc64/Makefile | 4 - sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h | 6 +- sysdeps/unix/sysv/linux/sys/mman.h | 6 +- sysdeps/unix/sysv/linux/ulimit.c | 3 +- 38 files changed, 1019 insertions(+), 95 deletions(-) create mode 100644 sysdeps/generic/bits/stropts.h create mode 100644 sysdeps/generic/fattach.c create mode 100644 sysdeps/generic/fdetach.c create mode 100644 sysdeps/generic/getcontext.c create mode 100644 sysdeps/generic/getmsg.c create mode 100644 sysdeps/generic/getpmsg.c create mode 100644 sysdeps/generic/isastream.c create mode 100644 sysdeps/generic/makecontext.c create mode 100644 sysdeps/generic/putmsg.c create mode 100644 sysdeps/generic/putpmsg.c create mode 100644 sysdeps/generic/setcontext.c create mode 100644 sysdeps/generic/sigignore.c create mode 100644 sysdeps/generic/sigset.c create mode 100644 sysdeps/generic/swapcontext.c create mode 100644 sysdeps/posix/sigignore.c create mode 100644 sysdeps/posix/sigset.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/Makefile (limited to 'sysdeps') diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index cd4f86a69c..e42ed3db68 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Alpha version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson . @@ -205,7 +205,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) #else #define ELF_MACHINE_RUNTIME_TRAMPOLINE \ TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup, imb); \ - strong_alias (_dl_runtime_resolve, _dl_runtime_profile, #nop); + extern void _dl_runtime_resolve (void); \ + extern void _dl_runtime_profile (void); \ + strong_alias (_dl_runtime_resolve, _dl_runtime_profile); #endif /* Initial entry point code for the dynamic linker. diff --git a/sysdeps/generic/bits/stropts.h b/sysdeps/generic/bits/stropts.h new file mode 100644 index 0000000000..026df21a48 --- /dev/null +++ b/sysdeps/generic/bits/stropts.h @@ -0,0 +1,211 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _BITS_STROPTS_H +#define _BITS_STROPTS_H 1 + +#include + +/* Macros used as `request' argument to `ioctl'. */ +#define I_PUSH 1 /* Push STREAMS module onto top of the current + STREAM, just below the STREAM head. */ +#define I_POP 2 /* Remove STREAMS module from just below the + STREAM head. */ +#define I_LOOK 3 /* Retrieve the name of the module just below + the STREAM head and place it in a character + string. */ +#define I_FLUSH 4 /* Flush all input and/or output. */ +#define I_FLUSHBAND 5 /* Flush only band specified. */ +#define I_SETSIG 6 /* Inform the STREAM head that the process + wants the SIGPOLL signal issued. */ +#define I_GETSIG 7 /* Return the events for which the calling + process is currently registered to be sent + a SIGPOLL signal. */ +#define I_FIND 8 /* Compares the names of all modules currently + present in the STREAM to the name pointed to + by `arg'. */ +#define I_PEEK 9 /* Allows a process to retrieve the information + in the first message on the STREAM head read + queue without taking the message off the + queue. */ +#define I_SRDOPT 10 /* Sets the read mode. */ +#define I_GRDOPT 11 /* Returns the current read mode setting. */ +#define I_NREAD 12 /* Counts the number of data bytes in the data + block in the first message. */ +#define I_FDINSERT 13 /* Create a message from the specified + buffer(s), adds information about another + STREAM, and send the message downstream. */ +#define I_STR 14 /* Construct an internal STREAMS `ioctl' + message and send that message downstream. */ +#define I_SWROPT 15 /* Set the write mode. */ +#define I_GWRSET 16 /* Return the current write mode setting. */ +#define I_SENDFD 17 /* Requests the STREAM associated with `fildes' + to send a message, containing a file + pointer, to the STREAM head at the other end + of a STREAMS pipe. */ +#define I_RECVFD 18 /* Retrieve the file descriptor associated with + the message sent by an I_SENDFD `ioctl' + over a STREAMS pipe. */ +#define I_LIST 19 /* List all the module names on the STREAM, up + to and including the topmost driver name. */ +#define I_ATMARK 20 /* See if the current message on the STREAM + head read queue is "marked" by some module + downstream. */ +#define I_CKBAND 21 /* Check if the message of a given priority + band exists on the STREAM head read + queue. */ +#define I_GETBAND 22 /* Return the priority band of the first + message on the STREAM head read queue. */ +#define I_CANPUT 23 /* Check if a certain band is writable. */ +#define I_SETCLTIME 24 /* Set the time the STREAM head will delay when + a STREAM is closing and there is data on + the write queues. */ +#define I_LINK 25 /* Connect two STREAMs. */ +#define I_UNLINK 26 /* Disconnects the two STREAMs. */ +#define I_PLINK 27 /* Connect two STREAMs with a persistent + link. */ +#define I_PUNLINK 28 /* Disconnect the two STREAMs that were + connected with a persistent link. */ + + +/* Used in `I_LOOK' request. */ +#define FMNAMESZ 255 + +/* Flush options. */ +#define FLUSHR 1 /* Flush read queues. */ +#define FLUSHW 2 /* Flush write queues. */ +#define FLUSHRW 3 /* Flush read and write queues. */ + +/* Possible arguments for `I_SETSIG'. */ +#define S_RDNORM 0x0001 /* A normal message has arrived. */ +#define S_RDBAND 0x0002 /* A message with a non-zero priority has + arrived. */ +#define S_INPUT 0x0004 /* A message, other than a high-priority + message, has arrived. */ +#define S_HIPRI 0x0008 /* A high-priority message is present. */ +#define S_OUTPUT 0x0010 /* The write queue for normal data is no longer + full. */ +#define S_WRNORM S_OUTPUT +#define S_WRBAND 0x0020 /* The write queue for a non-zero priority + band is no longer full. */ +#define S_MSG 0x0040 /* A STREAMS signal message that contains the + SIGPOLL signal reaches the front of the + STREAM head read queue. */ +#define S_ERROR 0x0080 /* Notification of an error condition. */ +#define S_HANGUP 0x0100 /* Notification of a hangup. */ +#define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND, + SIGURG is generated instead of SIGPOLL when + a priority message reaches the front of the + STREAM head read queue. */ + +/* Option for `I_PEEK'. */ +#define RS_HIPRI 1 /* Only look for high-priority messages. */ + +/* Options for `I_SRDOPT'. */ +#define RDNORM 1 /* Byte-STREAM mode, the default. */ +#define RMSGD 2 /* Message-discard mode. */ +#define RMSGN 3 /* Message-nondiscard mode. */ +#define RPROTNORM 4 /* Fail `read' with EBADMSG if a message + containing a control part is at the front + of the STREAM head read queue. */ +#define RPROTDAT 5 /* Deliver the control part of a message as + data. */ +#define RPROTDIS 6 /* Discard the control part of a message, + delivering any data part. */ + +/* Possible mode for `I_SWROPT'. */ +#define SNDZERO 1 /* Send a zero-length message downstream when a + `write' of 0 bytes occurs. */ + +/* Arguments for `I_ATMARK'. */ +#define ANYMARK 1 /* Check if the message is marked. */ +#define LASTMARK 2 /* Check if the message is the last one marked + on the queue. */ + +/* Argument for `I_UNLINK'. */ +#define MUXID_ALL 1 /* Unlink all STREAMs linked to the STREAM + associated with `fildes'. */ + + +/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */ +#define MSG_ANY 1 /* Receive any message. */ +#define MSG_BAND 2 /* Receive message from specified band. */ +#define MSG_HIPRI 3 /* Send/receive high priority message. */ +#define MORECTL 4 /* More control information is left in + message. */ +#define MOREDATA 5 /* More data is left in message. */ + + +/* Structure used for the I_FLUSHBAND ioctl on streams. */ +struct bandinfo + { + unsigned char bi_pri; + int bi_flag; + }; + +struct strbuf + { + int maxlen; /* Maximum buffer length. */ + int len; /* Length of data. */ + char *buf; /* Pointer to buffer. */ + }; + +struct strpeek + { + struct strbuf ctlbuf; + struct strbuf databuf; + __t_uscalar_t flags; + }; + +struct strfdinsert + { + struct strbuf ctlbuf; + struct strbuf databuf; + __t_uscalar_t flags; + int fildes; + int offset; + }; + +struct strioctl + { + int ic_cmd; + int ic_timout; + int ic_len; + char *ic_dp; + }; + +struct strrecvfd + { + int fd; + __uid_t uid; + __gid_t gid; + }; + + +struct str_mlist + { + char l_name[FMNAMESZ + 1]; + }; + +struct str_list + { + int sl_nmods; + struct str_mlist *sl_modlist; + }; + +#endif /* bits/stropts.h */ diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h index 5315a092ac..b985a3a49f 100644 --- a/sysdeps/generic/bits/types.h +++ b/sysdeps/generic/bits/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -111,4 +111,8 @@ typedef __u_quad_t __fsblkcnt64_t; typedef unsigned long int __fsfilcnt_t; typedef __u_quad_t __fsfilcnt64_t; +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + #endif /* bits/types.h */ diff --git a/sysdeps/generic/fattach.c b/sysdeps/generic/fattach.c new file mode 100644 index 0000000000..2c9abab4dd --- /dev/null +++ b/sysdeps/generic/fattach.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +fattach (fildes, path) + int fildes; + const char *path; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (fattach) +#include diff --git a/sysdeps/generic/fdetach.c b/sysdeps/generic/fdetach.c new file mode 100644 index 0000000000..2a15d577d2 --- /dev/null +++ b/sysdeps/generic/fdetach.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +fdetach (path) + const char *path; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (fdetach) +#include diff --git a/sysdeps/generic/getcontext.c b/sysdeps/generic/getcontext.c new file mode 100644 index 0000000000..ce59b49716 --- /dev/null +++ b/sysdeps/generic/getcontext.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +getcontext (ucp) + ucontext_t *ucp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (getcontext) +#include diff --git a/sysdeps/generic/getmsg.c b/sysdeps/generic/getmsg.c new file mode 100644 index 0000000000..119b50c189 --- /dev/null +++ b/sysdeps/generic/getmsg.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +getmsg (fildes, ctlptr, dataptr, flagsp) + int fildes; + struct strbuf *ctlptr; + struct strbuf *dataptr; + int *flagsp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (getmsg) +#include diff --git a/sysdeps/generic/getpmsg.c b/sysdeps/generic/getpmsg.c new file mode 100644 index 0000000000..c35c03c034 --- /dev/null +++ b/sysdeps/generic/getpmsg.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +getpmsg (fildes, ctlptr, dataptr, bandp, flagsp) + int fildes; + struct strbuf *ctlptr; + struct strbuf *dataptr; + int *bandp; + int *flagsp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (getpmsg) +#include diff --git a/sysdeps/generic/isastream.c b/sysdeps/generic/isastream.c new file mode 100644 index 0000000000..4e595808ea --- /dev/null +++ b/sysdeps/generic/isastream.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +isastream (fildes) + int fildes; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (isastream) +#include diff --git a/sysdeps/generic/makecontext.c b/sysdeps/generic/makecontext.c new file mode 100644 index 0000000000..16ed5b0dbf --- /dev/null +++ b/sysdeps/generic/makecontext.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +void +makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) +{ + __set_errno (ENOSYS); +} + + +stub_warning (makecontext) +#include diff --git a/sysdeps/generic/putmsg.c b/sysdeps/generic/putmsg.c new file mode 100644 index 0000000000..3d4f0d1127 --- /dev/null +++ b/sysdeps/generic/putmsg.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +putmsg (fildes, ctlptr, dataptr, flags) + int fildes; + const struct strbuf *ctlptr; + const struct strbuf *dataptr; + int flags; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (putmsg) +#include diff --git a/sysdeps/generic/putpmsg.c b/sysdeps/generic/putpmsg.c new file mode 100644 index 0000000000..767f39b094 --- /dev/null +++ b/sysdeps/generic/putpmsg.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +putpmsg (fildes, ctlptr, dataptr, band, flags) + int fildes; + const struct strbuf *ctlptr; + const struct strbuf *dataptr; + int band; + int flags; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (putpmsg) +#include diff --git a/sysdeps/generic/setcontext.c b/sysdeps/generic/setcontext.c new file mode 100644 index 0000000000..d6965fa38e --- /dev/null +++ b/sysdeps/generic/setcontext.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +setcontext (ucp) + const ucontext_t *ucp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (setcontext) +#include diff --git a/sysdeps/generic/sigignore.c b/sysdeps/generic/sigignore.c new file mode 100644 index 0000000000..04fe9569cc --- /dev/null +++ b/sysdeps/generic/sigignore.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +/* Set the disposition for SIG to SIG_IGN. */ +int +sigignore (sig) + int sig; +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (sigignore) +#include diff --git a/sysdeps/generic/sigset.c b/sysdeps/generic/sigset.c new file mode 100644 index 0000000000..ed2d2dd760 --- /dev/null +++ b/sysdeps/generic/sigset.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +/* Set the disposition for SIG. */ +__sighandler_t +sigset (sig, disp) + int sig; + __sighandler_t disp; +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (sigset) +#include diff --git a/sysdeps/generic/swapcontext.c b/sysdeps/generic/swapcontext.c new file mode 100644 index 0000000000..6a414d7285 --- /dev/null +++ b/sysdeps/generic/swapcontext.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +swapcontext (oucp, ucp) + ucontext_t *oucp; + const ucontext_t *ucp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (swapcontext) +#include diff --git a/sysdeps/libm-ieee754/s_modfl.c b/sysdeps/libm-ieee754/s_modfl.c index 324fe9fde6..5f2b4b5e2c 100644 --- a/sysdeps/libm-ieee754/s_modfl.c +++ b/sysdeps/libm-ieee754/s_modfl.c @@ -53,7 +53,7 @@ static long double one = 1.0; SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */ return x; } else { - i = (0xffffffff)>>j0; + i = (0x7fffffff)>>j0; if(((i0&i)|i1)==0) { /* x is integral */ *iptr = x; SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ @@ -71,7 +71,7 @@ static long double one = 1.0; SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ return x; } else { /* fraction part in low x */ - i = ((u_int32_t)(0xffffffff))>>(j0-20); + i = ((u_int32_t)(0x7fffffff))>>(j0-32); if((i1&i)==0) { /* x is integral */ *iptr = x; INSERT_WORDS(x,se&0x8000,0); /* return +-0 */ diff --git a/sysdeps/mach/_strerror.c b/sysdeps/mach/_strerror.c index 4db1e74a80..7bca7e8bd9 100644 --- a/sysdeps/mach/_strerror.c +++ b/sysdeps/mach/_strerror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,7 +20,8 @@ #include #include #include -#include "../stdio-common/_itoa.h" +#include +#include /* It is critical here that we always use the `dcgettext' function for the message translation. Since only defines the macro @@ -49,12 +50,27 @@ _strerror_internal (int errnum, char *buf, size_t buflen) if (system > err_max_system || ! __mach_error_systems[system].bad_sub) { + /* Buffer we use to print the number in. For a maximum size for + `int' of 8 bytes we never need more than 20 digits. */ + char numbuf[21]; const char *unk = _("Error in unknown error system: "); const size_t unklen = strlen (unk); - char *p = buf + buflen; - *--p = '\0'; - p = _itoa (errnum, p, 16, 1); - return memcpy (p - unklen, unk, unklen); + char *p, *q; + + numbuf[20] = '\0'; + p = _itoa_word (errnum, &numbuf[20], 16, 1); + + /* Now construct the result while taking care for the destination + buffer size. */ + q = __mempcpy (buf, unk, MIN (unklen, buflen)); + if (unklen < buflen) + __stpncpy (q, p, buflen - unklen); + + /* Terminate the string in any case. */ + if (buflen > 0) + buf[buflen - 1] = '\0'; + + return buf; } es = &__mach_error_systems[system]; @@ -64,15 +80,37 @@ _strerror_internal (int errnum, char *buf, size_t buflen) if (code >= es->subsystem[sub].max_code) { + /* Buffer we use to print the number in. For a maximum size for + `int' of 8 bytes we never need more than 20 digits. */ + char numbuf[21]; const char *unk = _("Unknown error "); const size_t unklen = strlen (unk); - char *p = buf + buflen; + char *p, *q; size_t len = strlen (es->subsystem[sub].subsys_name); - *--p = '\0'; - p = _itoa (errnum, p, 16, 1); - *p-- = ' '; - p = memcpy (p - len, es->subsystem[sub].subsys_name, len); - return memcpy (p - unklen, unk, unklen); + + numbuf[20] = '\0'; + p = _itoa_word (errnum, &numbuf[20], 10, 0); + + /* Now construct the result while taking care for the destination + buffer size. */ + q = __mempcpy (buf, unk, MIN (unklen, buflen)); + if (unklen < buflen) + { + q = __mempcpy (q, es->subsystem[sub].subsys_name, + MIN (len, buflen - unklen)); + if (unklen + len < buflen) + { + *q++ = ' '; + if (unklen + len + 1 < buflen) + __stpncpy (q, p, buflen - unklen - len - 1); + } + } + + /* Terminate the string in any case. */ + if (buflen > 0) + buf[buflen - 1] = '\0'; + + return buf; } return (char *) _(es->subsystem[sub].codes[code]); diff --git a/sysdeps/posix/sigignore.c b/sysdeps/posix/sigignore.c new file mode 100644 index 0000000000..f24aca70c9 --- /dev/null +++ b/sysdeps/posix/sigignore.c @@ -0,0 +1,36 @@ +/* Set the disposition of SIG to SIG_IGN. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +int +sigignore (sig) + int sig; +{ + struct sigaction act; + + act.sa_handler = SIG_IGN; + if (__sigemptyset (&act.sa_mask) < 0) + return -1; + act.sa_flags = 0; + + return __sigaction (sig, &act, NULL); +} diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c new file mode 100644 index 0000000000..4bd3bf38c8 --- /dev/null +++ b/sysdeps/posix/sigset.c @@ -0,0 +1,66 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +/* Set the disposition for SIG. */ +__sighandler_t +sigset (sig, disp) + int sig; + __sighandler_t disp; +{ + struct sigaction act, oact; + + /* Handle SIG_HOLD first. */ + if (disp == SIG_HOLD) + { + sigset_t set; + + /* Retrieve current signal set. */ + if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0) + return SIG_ERR; + + /* Add the specified signal. */ + if (sigaddset (&set, sig) < 0) + return SIG_ERR; + + /* Set the new mask. */ + if (__sigprocmask (SIG_SETMASK, &set, NULL) < 0) + return SIG_ERR; + + return SIG_HOLD; + } + + /* Check signal extents to protect __sigismember. */ + if (disp == SIG_ERR || sig < 1 || sig >= NSIG) + { + __set_errno (EINVAL); + return SIG_ERR; + } + + act.sa_handler = disp; + if (__sigemptyset (&act.sa_mask) < 0) + return SIG_ERR; + act.sa_flags = 0; + if (__sigaction (sig, &act, &oact) < 0) + return SIG_ERR; + + return oact.sa_handler; +} diff --git a/sysdeps/posix/ttyname.c b/sysdeps/posix/ttyname.c index a4e4f30526..6a046ea652 100644 --- a/sysdeps/posix/ttyname.c +++ b/sysdeps/posix/ttyname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,36 +28,34 @@ char *__ttyname = NULL; -/* Return the pathname of the terminal FD is open on, or NULL on errors. - The returned storage is good only until the next call to this function. */ -char * -ttyname (fd) +static char * getttyname __P ((int fd, dev_t mydev, ino_t myino, + int save, int *dostat)) internal_function; + +static char * +internal_function +getttyname (fd, mydev, myino, save, dostat) int fd; + dev_t mydev; + ino_t myino; + int save; + int *dostat; { static const char dev[] = "/dev"; static char *name; static size_t namelen = 0; struct stat st; - dev_t mydev; - ino_t myino; DIR *dirstream; struct dirent *d; - int save = errno; - - if (!__isatty (fd)) - return NULL; - - if (fstat (fd, &st) < 0) - return NULL; - mydev = st.st_dev; - myino = st.st_ino; dirstream = opendir (dev); if (dirstream == NULL) - return NULL; + { + *dostat = -1; + return NULL; + } while ((d = readdir (dirstream)) != NULL) - if ((ino_t) d->d_fileno == myino) + if ((ino_t) d->d_fileno == myino || *dostat) { size_t dlen = _D_ALLOC_NAMLEN (d); if (sizeof (dev) + dlen > namelen) @@ -67,6 +65,7 @@ ttyname (fd) name = malloc (namelen); if (! name) { + *dostat = -1; /* Perhaps it helps to free the directory stream buffer. */ (void) closedir (dirstream); return NULL; @@ -74,7 +73,13 @@ ttyname (fd) *((char *) __mempcpy (name, dev, sizeof (dev) - 1)) = '/'; } (void) __mempcpy (&name[sizeof (dev)], d->d_name, dlen); - if (stat (name, &st) == 0 && st.st_dev == mydev) + if (stat (name, &st) == 0 +#ifdef _STATBUF_ST_RDEV + && S_ISCHR (st.st_mode) && st.st_rdev == mydev +#else + && (ino_t) d->d_fileno == myino && st.st_dev == mydev +#endif + ) { (void) closedir (dirstream); __ttyname = name; @@ -87,3 +92,39 @@ ttyname (fd) __set_errno (save); return NULL; } + +/* Return the pathname of the terminal FD is open on, or NULL on errors. + The returned storage is good only until the next call to this function. */ +char * +ttyname (fd) + int fd; +{ + struct stat st; + int dostat = 0; + char *name; + int save = errno; + + if (!__isatty (fd)) + return NULL; + + if (fstat (fd, &st) < 0) + return NULL; + +#ifdef _STATBUF_ST_RDEV + name = getttyname (fd, st.st_rdev, st.st_ino, save, &dostat); +#else + name = getttyname (fd, st.st_dev, st.st_ino, save, &dostat); +#endif + + if (!name && dostat != -1) + { + dostat = 1; +#ifdef _STATBUF_ST_RDEV + name = getttyname (fd, st.st_rdev, st.st_ino, save, &dostat); +#else + name = getttyname (fd, st.st_dev, st.st_ino, save, &dostat); +#endif + } + + return name; +} diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c index b3a15d13d1..ad747ad35b 100644 --- a/sysdeps/posix/ttyname_r.c +++ b/sysdeps/posix/ttyname_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,58 +30,43 @@ # define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif -/* Store at most BUFLEN character of the pathname of the terminal FD is - open on in BUF. Return 0 on success, otherwise an error number. */ -int -__ttyname_r (fd, buf, buflen) +static const char dev[] = "/dev"; + +static int getttyname_r __P ((int fd, char *buf, size_t buflen, + dev_t mydev, ino_t myino, int save, + int *dostat)) internal_function; + +static int +internal_function +getttyname_r (fd, buf, buflen, mydev, myino, save, dostat) int fd; char *buf; size_t buflen; + dev_t mydev; + ino_t myino; + int save; + int *dostat; { - static const char dev[] = "/dev"; struct stat st; - dev_t mydev; - ino_t myino; DIR *dirstream; struct dirent *d; - int save = errno; - - /* Test for the absolute minimal size. This makes life easier inside - the loop. */ - if (buflen < (int) (sizeof (dev) + 1)) - { - __set_errno (ERANGE); - return ERANGE; - } - - if (!__isatty (fd)) - { - __set_errno (ENOTTY); - return ENOTTY; - } - - if (fstat (fd, &st) < 0) - return errno; - mydev = st.st_dev; - myino = st.st_ino; dirstream = opendir (dev); if (dirstream == NULL) - return errno; - - /* Prepare the result buffer. */ - memcpy (buf, dev, sizeof (dev) - 1); - buf[sizeof (dev) - 1] = '/'; - buflen -= sizeof (dev); + { + *dostat = -1; + return errno; + } while ((d = readdir (dirstream)) != NULL) - if ((ino_t) d->d_fileno == myino) + if ((ino_t) d->d_fileno == myino || *dostat) { char *cp; size_t needed = _D_EXACT_NAMLEN (d) + 1; if (needed > buflen) { + *dostat = -1; (void) closedir (dirstream); __set_errno (ERANGE); return ERANGE; @@ -90,7 +75,13 @@ __ttyname_r (fd, buf, buflen) cp = __stpncpy (&buf[sizeof (dev)], d->d_name, needed); cp[0] = '\0'; - if (stat (buf, &st) == 0 && st.st_dev == mydev) + if (stat (buf, &st) == 0 +#ifdef _STATBUF_ST_RDEV + && S_ISCHR (st.st_mode) && st.st_rdev == mydev +#else + && (ino_t) d->d_fileno == myino && st.st_dev == mydev +#endif + ) { (void) closedir (dirstream); __set_errno (save); @@ -104,4 +95,69 @@ __ttyname_r (fd, buf, buflen) refers to a TTY but no entry in /dev has this inode. */ return ENOTTY; } + +/* Store at most BUFLEN character of the pathname of the terminal FD is + open on in BUF. Return 0 on success, otherwise an error number. */ +int +__ttyname_r (fd, buf, buflen) + int fd; + char *buf; + size_t buflen; +{ + struct stat st; + int dostat = 0; + int save = errno; + int ret; + + /* Test for the absolute minimal size. This makes life easier inside + the loop. */ + if (!buf) + { + __set_errno (EINVAL); + return EINVAL; + } + + if (buflen < (int) (sizeof (dev) + 1)) + { + __set_errno (ERANGE); + return ERANGE; + } + + if (!__isatty (fd)) + { + __set_errno (ENOTTY); + return ENOTTY; + } + + if (fstat (fd, &st) < 0) + return errno; + + /* Prepare the result buffer. */ + memcpy (buf, dev, sizeof (dev) - 1); + buf[sizeof (dev) - 1] = '/'; + buflen -= sizeof (dev); + +#ifdef _STATBUF_ST_RDEV + ret = getttyname_r (fd, buf, buflen, st.st_rdev, st.st_ino, save, + &dostat); +#else + ret = getttyname_r (fd, buf, buflen, st.st_dev, st.st_ino, save, + &dostat); +#endif + + if (ret && dostat != -1) + { + dostat = 1; +#ifdef _STATBUF_ST_RDEV + ret = getttyname_r (fd, buf, buflen, st.st_rdev, st.st_ino, + save, &dostat); +#else + ret = getttyname_r (fd, buf, buflen, st.st_dev, st.st_ino, + save, &dostat); +#endif + } + + return ret; +} + weak_alias (__ttyname_r, ttyname_r) diff --git a/sysdeps/unix/inet/Subdirs b/sysdeps/unix/inet/Subdirs index 647ec6a4a6..0dc102b03f 100644 --- a/sysdeps/unix/inet/Subdirs +++ b/sysdeps/unix/inet/Subdirs @@ -3,3 +3,4 @@ resolv hesiod sunrpc nis +streams diff --git a/sysdeps/unix/sysv/linux/alpha/bits/signum.h b/sysdeps/unix/sysv/linux/alpha/bits/signum.h index ac5c34cd1a..6b1399eb12 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/signum.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/signum.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/Alpha version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,10 @@ #define SIG_DFL ((__sighandler_t) 0) /* Default action. */ #define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + /* * Linux/AXP has different signal numbers that Linux/i386: I'm trying * to make it OSF/1 binary compatible, at least for normal binaries. diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h index 319ff96c51..cb4ab78268 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -84,7 +84,9 @@ struct stat64 }; #endif -#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV /* Encoding of the file mode. */ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h index 9033fdb362..70b7d7294f 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/types.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -103,4 +103,8 @@ typedef struct __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; } __fd_set; +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + #endif /* bits/types.h */ diff --git a/sysdeps/unix/sysv/linux/bits/signum.h b/sysdeps/unix/sysv/linux/bits/signum.h index f625f468e9..1054f9aad6 100644 --- a/sysdeps/unix/sysv/linux/bits/signum.h +++ b/sysdeps/unix/sysv/linux/bits/signum.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux version. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,10 @@ #define SIG_DFL ((__sighandler_t) 0) /* Default action. */ #define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + /* Signals. */ #define SIGHUP 1 /* Hangup (POSIX). */ diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h index 18432fd09e..c175668a06 100644 --- a/sysdeps/unix/sysv/linux/bits/stat.h +++ b/sysdeps/unix/sysv/linux/bits/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -98,7 +98,9 @@ struct stat64 }; #endif -#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV /* Encoding of the file mode. */ diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h index 723e0ff223..68cbf8ca7d 100644 --- a/sysdeps/unix/sysv/linux/bits/types.h +++ b/sysdeps/unix/sysv/linux/bits/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -127,4 +127,8 @@ typedef __u_long __ino64_t; /* Type of file sizes and offsets. */ typedef __loff_t __off64_t; +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + #endif /* bits/types.h */ diff --git a/sysdeps/unix/sysv/linux/i386/sys/ucontext.h b/sysdeps/unix/sysv/linux/i386/sys/ucontext.h index ccc32b661a..f8c8e26e17 100644 --- a/sysdeps/unix/sysv/linux/i386/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/i386/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -101,6 +101,7 @@ typedef struct ucontext stack_t uc_stack; mcontext_t uc_mcontext; __sigset_t uc_sigmask; + struct _fpstate __fpregs_mem; } ucontext_t; #endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h index 5254a2b420..c30abe3841 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/signum.h +++ b/sysdeps/unix/sysv/linux/mips/bits/signum.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux version. - Copyright (C) 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,10 @@ #define __need_signums #include +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + #endif /* included. */ #define __need__nsig diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h index cd586d4433..3bcf1a9299 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/stat.h +++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -112,7 +112,9 @@ struct stat64 }; #endif -#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV /* Encoding of the file mode. */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h index 56075d13c2..1d72de0321 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -127,4 +127,8 @@ typedef __u_long __ino64_t; /* Type of file sizes and offsets. */ typedef __loff_t __off64_t; +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + #endif /* bits/types.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/signum.h b/sysdeps/unix/sysv/linux/sparc/bits/signum.h index 3437c16113..fae3826023 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/signum.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/signum.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/SPARC version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,10 @@ #define SIG_DFL ((__sighandler_t) 0) /* Default action. */ #define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + /* * Linux/SPARC has different signal numbers that Linux/i386: I'm trying * to make it OSF/1 binary compatible, at least for normal binaries. diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile deleted file mode 100644 index c4d83226a2..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -ifeq ($(subdir),misc) -sysdep_headers += ucontext.h -sysdep_routines += getcontext setcontext -endif diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h index 5ee6c0ee7a..5c77f9a84d 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -113,4 +113,8 @@ typedef __u_quad_t __fsblkcnt64_t; typedef unsigned long int __fsfilcnt_t; typedef __u_quad_t __fsfilcnt64_t; +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + #endif /* bits/types.h */ diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h index 70f95d080f..92cc3d2f66 100644 --- a/sysdeps/unix/sysv/linux/sys/mman.h +++ b/sysdeps/unix/sysv/linux/sys/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX-style memory management. Linux version. - Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -91,10 +91,10 @@ extern int munlockall __P ((void)); /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to be memory resident. */ -extern int mlock __P ((__ptr_t __addr, size_t __len)); +extern int mlock __P ((__const __ptr_t __addr, size_t __len)); /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */ -extern int munlock __P ((__ptr_t __addr, size_t __len)); +extern int munlock __P ((__const __ptr_t __addr, size_t __len)); #ifdef __USE_MISC /* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c index 58ff111612..2d9e86a63a 100644 --- a/sysdeps/unix/sysv/linux/ulimit.c +++ b/sysdeps/unix/sysv/linux/ulimit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ #include #include #include +#include #include #include -- cgit 1.4.1