diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-04-19 16:57:17 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-04-19 16:57:17 +0000 |
commit | 2c008571c3ad156479307b7e23185ae566b5776a (patch) | |
tree | f3bad7f0e95a6d172e6577b7e2d557602e1f446c | |
parent | Update. (diff) | |
download | glibc-2c008571c3ad156479307b7e23185ae566b5776a.tar.gz glibc-2c008571c3ad156479307b7e23185ae566b5776a.tar.bz2 glibc-2c008571c3ad156479307b7e23185ae566b5776a.zip |
Update.
2003-04-19 Ulrich Drepper <drepper@redhat.com>
* catgets/nl_types.h: Remove __THROW marker from cancellation points.
* dirent/dirent.h: Likewise.
* dlfcn/dlfcn.h: Likewise.
* grp/grp.h: Likewise.
* iconv/iconv.h: Likewise.
* io/fcntl.h: Likewise.
* io/ftw.h: Likewise.
* libio/stdio.h: Likewise.
* misc/sys/mman.h: Likewise.
* misc/sys/select.h: Likewise.
* misc/sys/syslog.h: Likewise.
* misc/sys/uio.h: Likewise.
* posix/spawn.h: Likewise.
* posix/unistd.h: Likewise.
* posix/sys/wait.h: Likewise.
* pwd/pwd.h: Likewise.
* resolv/netdb.h: Likewise.
* rt/aio.h: Likewise.
* shadow/shadow.h: Likewise.
* signal/signal.h: Likewise.
* socket/sys/socket.h: Likewise.
* stdlib/stdlib.h: Likewise.
* streams/stropts.h: Likewise.
* string/string.h: Likewise.
* sysdeps/gnu/utmpx.h: Likewise.
* sysvipc/sys/msg.h: Likewise.
* termios/termios.h: Likewise.
* time/time.h: Likewise.
* wcsmbs/wchar.h: Likewise.
* iconv/gconv_cache.c: Include <not-cancel.h> and use non-cancelable
functions.
* misc/daemon.c: Likewise.
* sysdeps/generic/backtracesymsfd.c: Likewise.
* sysdeps/generic/check_fds.c: Likewise.
* sysdeps/unix/sysv/linux/gethostid.c: Likewise.
* sysdeps/unix/sysv/linux/not-cancel.h: New file.
* sysdeps/generic/not-cancel.h: New file.
* csu/Makefile (distribute): Add not-cancel.h.
* sysdeps/unix/sysv/linux/fatal-prepare.h: New file.
* sysdeps/unix/sysv/linux/Makefile: Define FATAL_PREPARE_INCLUDE
for assert.c and assert-perr.c to include <fatal-prepare.h>.
* sysdeps/unix/sysv/linux/Dist: Add fatal-prepare.h.
* sysdeps/posix/remove.c (remove): Rewrite. No need to restore
errno and unlink first.
* io/ftw.c (ftw_dir): In all places assume fchdir is available.
2003-04-18 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/libc_fatal.c (__libc_fatal): Use
INTERNAL_SYSCALL instead of INLINE_SYSCALL.
45 files changed, 1560 insertions, 615 deletions
@@ -1,3 +1,58 @@ +2003-04-19 Ulrich Drepper <drepper@redhat.com> + + * catgets/nl_types.h: Remove __THROW marker from cancellation points. + * dirent/dirent.h: Likewise. + * dlfcn/dlfcn.h: Likewise. + * grp/grp.h: Likewise. + * iconv/iconv.h: Likewise. + * io/fcntl.h: Likewise. + * io/ftw.h: Likewise. + * libio/stdio.h: Likewise. + * misc/sys/mman.h: Likewise. + * misc/sys/select.h: Likewise. + * misc/sys/syslog.h: Likewise. + * misc/sys/uio.h: Likewise. + * posix/spawn.h: Likewise. + * posix/unistd.h: Likewise. + * posix/sys/wait.h: Likewise. + * pwd/pwd.h: Likewise. + * resolv/netdb.h: Likewise. + * rt/aio.h: Likewise. + * shadow/shadow.h: Likewise. + * signal/signal.h: Likewise. + * socket/sys/socket.h: Likewise. + * stdlib/stdlib.h: Likewise. + * streams/stropts.h: Likewise. + * string/string.h: Likewise. + * sysdeps/gnu/utmpx.h: Likewise. + * sysvipc/sys/msg.h: Likewise. + * termios/termios.h: Likewise. + * time/time.h: Likewise. + * wcsmbs/wchar.h: Likewise. + * iconv/gconv_cache.c: Include <not-cancel.h> and use non-cancelable + functions. + * misc/daemon.c: Likewise. + * sysdeps/generic/backtracesymsfd.c: Likewise. + * sysdeps/generic/check_fds.c: Likewise. + * sysdeps/unix/sysv/linux/gethostid.c: Likewise. + * sysdeps/unix/sysv/linux/not-cancel.h: New file. + * sysdeps/generic/not-cancel.h: New file. + * csu/Makefile (distribute): Add not-cancel.h. + * sysdeps/unix/sysv/linux/fatal-prepare.h: New file. + * sysdeps/unix/sysv/linux/Makefile: Define FATAL_PREPARE_INCLUDE + for assert.c and assert-perr.c to include <fatal-prepare.h>. + * sysdeps/unix/sysv/linux/Dist: Add fatal-prepare.h. + + * sysdeps/posix/remove.c (remove): Rewrite. No need to restore + errno and unlink first. + + * io/ftw.c (ftw_dir): In all places assume fchdir is available. + +2003-04-18 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/unix/sysv/linux/libc_fatal.c (__libc_fatal): Use + INTERNAL_SYSCALL instead of INLINE_SYSCALL. + 2003-04-17 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/Makefile: Remove db2 directory handling. diff --git a/catgets/nl_types.h b/catgets/nl_types.h index 9322aa2461..838fe7e867 100644 --- a/catgets/nl_types.h +++ b/catgets/nl_types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1999, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,8 +36,11 @@ typedef void *nl_catd; /* Type used by `nl_langinfo'. */ typedef int nl_item; -/* Open message catalog for later use, returning descriptor. */ -extern nl_catd catopen (__const char *__cat_name, int __flag) __THROW; +/* Open message catalog for later use, returning descriptor. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern nl_catd catopen (__const char *__cat_name, int __flag); /* Return translation with NUMBER in SET of CATALOG; if not found return STRING. */ diff --git a/csu/Makefile b/csu/Makefile index eebf41c0a3..213f135f71 100644 --- a/csu/Makefile +++ b/csu/Makefile @@ -38,7 +38,7 @@ omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \ b$(start-installed-name) $(csu-dummies)) install-lib = $(start-installed-name) g$(start-installed-name) $(csu-dummies) distribute = initfini.c gmon-start.c start.c defs.awk munch.awk \ - abi-note.S init.c munch-tmpl.c + abi-note.S init.c munch-tmpl.c not-cancel.h generated = version-info.h before-compile = $(objpfx)version-info.h diff --git a/dirent/dirent.h b/dirent/dirent.h index 8079d70979..9f7c380b40 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991-1999, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -128,12 +128,18 @@ enum typedef struct __dirstream DIR; /* Open a directory stream on NAME. - Return a DIR stream on the directory, or NULL if it could not be opened. */ -extern DIR *opendir (__const char *__name) __THROW; + Return a DIR stream on the directory, or NULL if it could not be opened. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern DIR *opendir (__const char *__name); /* Close the directory stream DIRP. - Return 0 if successful, -1 if not. */ -extern int closedir (DIR *__dirp) __THROW; + Return 0 if successful, -1 if not. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int closedir (DIR *__dirp); /* Read a directory entry from DIRP. Return a pointer to a `struct dirent' describing the entry, or NULL for EOF or error. The @@ -141,34 +147,40 @@ extern int closedir (DIR *__dirp) __THROW; same DIR stream. If the Large File Support API is selected we have to use the - appropriate interface. */ + appropriate interface. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern struct dirent *readdir (DIR *__dirp) __THROW; +extern struct dirent *readdir (DIR *__dirp); #else # ifdef __REDIRECT -extern struct dirent *__REDIRECT (readdir, (DIR *__dirp) __THROW, readdir64); +extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64); # else # define readdir readdir64 # endif #endif #ifdef __USE_LARGEFILE64 -extern struct dirent64 *readdir64 (DIR *__dirp) __THROW; +extern struct dirent64 *readdir64 (DIR *__dirp); #endif #if defined __USE_POSIX || defined __USE_MISC /* Reentrant version of `readdir'. Return in RESULT a pointer to the - next entry. */ + next entry. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int readdir_r (DIR *__restrict __dirp, struct dirent *__restrict __entry, - struct dirent **__restrict __result) __THROW; + struct dirent **__restrict __result); # else # ifdef __REDIRECT extern int __REDIRECT (readdir_r, (DIR *__restrict __dirp, struct dirent *__restrict __entry, - struct dirent **__restrict __result) __THROW, + struct dirent **__restrict __result), readdir64_r); # else # define readdir_r readdir64_r @@ -178,7 +190,7 @@ extern int __REDIRECT (readdir_r, # ifdef __USE_LARGEFILE64 extern int readdir64_r (DIR *__restrict __dirp, struct dirent64 *__restrict __entry, - struct dirent64 **__restrict __result) __THROW; + struct dirent64 **__restrict __result); # endif #endif /* POSIX or misc */ diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h index 9d8ee0d6d1..ad51bb9233 100644 --- a/dlfcn/dlfcn.h +++ b/dlfcn/dlfcn.h @@ -45,8 +45,11 @@ __BEGIN_DECLS /* Open the shared object FILE and map it in; return a handle that can be - passed to `dlsym' to get symbol values from it. */ -extern void *dlopen (__const char *__file, int __mode) __THROW; + passed to `dlsym' to get symbol values from it. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void *dlopen (__const char *__file, int __mode); /* Unmap and close a shared object opened by `dlopen'. The handle cannot be used again after calling `dlclose'. */ @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,95,96,97,98,99,2000,01 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1995-2001, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -56,32 +56,57 @@ struct group #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED -/* Rewind the group-file stream. */ -extern void setgrent (void) __THROW; +/* Rewind the group-file stream. -/* Close the group-file stream. */ -extern void endgrent (void) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setgrent (void); -/* Read an entry from the group-file stream, opening it if necessary. */ -extern struct group *getgrent (void) __THROW; +/* Close the group-file stream. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endgrent (void); + +/* Read an entry from the group-file stream, opening it if necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct group *getgrent (void); #endif #ifdef __USE_SVID -/* Read a group entry from STREAM. */ -extern struct group *fgetgrent (FILE *__stream) __THROW; +/* Read a group entry from STREAM. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct group *fgetgrent (FILE *__stream); #endif #ifdef __USE_GNU -/* Write the given entry onto the given stream. */ +/* Write the given entry onto the given stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int putgrent (__const struct group *__restrict __p, - FILE *__restrict __f) __THROW; + FILE *__restrict __f); #endif -/* Search for an entry with a matching group ID. */ -extern struct group *getgrgid (__gid_t __gid) __THROW; +/* Search for an entry with a matching group ID. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct group *getgrgid (__gid_t __gid); + +/* Search for an entry with a matching group name. -/* Search for an entry with a matching group name. */ -extern struct group *getgrnam (__const char *__name) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct group *getgrnam (__const char *__name); #if defined __USE_POSIX || defined __USE_MISC @@ -97,32 +122,48 @@ extern struct group *getgrnam (__const char *__name) __THROW; The interface may change in later versions of this library. But the interface is designed following the principals used for the other reentrant functions so the chances are good this is what the - POSIX people would choose. */ + POSIX people would choose. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ # ifdef __USE_GNU extern int getgrent_r (struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) __THROW; + struct group **__restrict __result); # endif -/* Search for an entry with a matching group ID. */ +/* Search for an entry with a matching group ID. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) __THROW; + struct group **__restrict __result); + +/* Search for an entry with a matching group name. -/* Search for an entry with a matching group name. */ + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int getgrnam_r (__const char *__restrict __name, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) __THROW; + struct group **__restrict __result); # ifdef __USE_SVID /* Read a group entry from STREAM. This function is not standardized - an probably never will. */ + an probably never will. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int fgetgrent_r (FILE *__restrict __stream, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) __THROW; + struct group **__restrict __result); # endif #endif /* POSIX or reentrant */ @@ -138,14 +179,24 @@ extern int setgroups (size_t __n, __const __gid_t *__groups) __THROW; /* Store at most *NGROUPS members of the group set for USER into *GROUPS. Also include GROUP. The actual number of groups found is - returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */ + returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int getgrouplist (__const char *__user, __gid_t __group, - __gid_t *__groups, int *__ngroups) __THROW; + __gid_t *__groups, int *__ngroups); /* Initialize the group set for the current user by reading the group database and using all groups - of which USER is a member. Also include GROUP. */ -extern int initgroups (__const char *__user, __gid_t __group) __THROW; + of which USER is a member. Also include GROUP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int initgroups (__const char *__user, __gid_t __group); #endif /* Use BSD. */ diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c index 882acc6fa4..8038f5fd99 100644 --- a/iconv/gconv_cache.c +++ b/iconv/gconv_cache.c @@ -1,5 +1,5 @@ /* Cache handling for iconv modules. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001. @@ -19,6 +19,7 @@ 02111-1307 USA. */ #include <dlfcn.h> +#include <errno.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> @@ -28,6 +29,7 @@ #include <gconv_int.h> #include <iconvconfig.h> +#include <not-cancel.h> #include "../intl/hash-string.h" @@ -58,7 +60,7 @@ __gconv_load_cache (void) return -1; /* See whether the cache file exists. */ - fd = __open (GCONV_MODULES_CACHE, O_RDONLY); + fd = open_not_cancel (GCONV_MODULES_CACHE, O_RDONLY); if (__builtin_expect (fd, 0) == -1) /* Not available. */ return -1; @@ -70,7 +72,7 @@ __gconv_load_cache (void) || (size_t) st.st_size < sizeof (struct gconvcache_header)) { close_and_exit: - __close (fd); + close_not_cancel_no_status (fd); return -1; } @@ -107,7 +109,7 @@ __gconv_load_cache (void) } /* We don't need the file descriptor anymore. */ - __close (fd); + close_not_cancel_no_status (fd); /* Check the consistency. */ header = (struct gconvcache_header *) gconv_cache; diff --git a/iconv/iconv.h b/iconv/iconv.h index 5a795dc5df..9aebf9bc7b 100644 --- a/iconv/iconv.h +++ b/iconv/iconv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,9 +31,11 @@ typedef void *iconv_t; /* Allocate descriptor for code conversion from codeset FROMCODE to - codeset TOCODE. */ -extern iconv_t iconv_open (__const char *__tocode, __const char *__fromcode) - __THROW; + codeset TOCODE. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern iconv_t iconv_open (__const char *__tocode, __const char *__fromcode); /* Convert at most *INBYTESLEFT bytes from *INBUF according to the code conversion algorithm specified by CD and place up to @@ -43,8 +45,11 @@ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, char **__restrict __outbuf, size_t *__restrict __outbytesleft); -/* Free resources allocated for descriptor CD for code conversion. */ -extern int iconv_close (iconv_t __cd) __THROW; +/* Free resources allocated for descriptor CD for code conversion. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int iconv_close (iconv_t __cd); __END_DECLS diff --git a/io/fcntl.h b/io/fcntl.h index 951fd80161..8131c24d88 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1994-2001,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -56,41 +56,48 @@ __BEGIN_DECLS #endif /* XPG */ /* Do the file control operation described by CMD on FD. - The remaining arguments are interpreted depending on CMD. */ -extern int fcntl (int __fd, int __cmd, ...) __THROW; + The remaining arguments are interpreted depending on CMD. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int fcntl (int __fd, int __cmd, ...); /* Open FILE and return a new file descriptor for it, or -1 on error. OFLAG determines the type of access used. If O_CREAT is on OFLAG, - the third argument is taken as a `mode_t', the mode of the created file. */ + the third argument is taken as a `mode_t', the mode of the created file. + + This function is a cancellation point and therefore not marked with + __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern int open (__const char *__file, int __oflag, ...) __THROW; +extern int open (__const char *__file, int __oflag, ...); #else # ifdef __REDIRECT -extern int __REDIRECT (open, (__const char *__file, int __oflag, ...) __THROW, - open64); +extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64); # else # define open open64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int open64 (__const char *__file, int __oflag, ...) __THROW; +extern int open64 (__const char *__file, int __oflag, ...); #endif -/* Create and open FILE, with mode MODE. - This takes an `int' MODE argument because that is - what `mode_t' will be widened to. */ +/* Create and open FILE, with mode MODE. This takes an `int' MODE + argument because that is what `mode_t' will be widened to. + + This function is a cancellation point and therefore not marked with + __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern int creat (__const char *__file, __mode_t __mode) __THROW; +extern int creat (__const char *__file, __mode_t __mode); #else # ifdef __REDIRECT -extern int __REDIRECT (creat, (__const char *__file, __mode_t __mode) __THROW, +extern int __REDIRECT (creat, (__const char *__file, __mode_t __mode), creat64); # else # define creat creat64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int creat64 (__const char *__file, __mode_t __mode) __THROW; +extern int creat64 (__const char *__file, __mode_t __mode); #endif #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ @@ -482,17 +482,6 @@ ftw_dir (struct ftw_data *data, struct STAT *st) { if (__fchdir (dirfd (dir.stream)) < 0) { - if (errno == ENOSYS) - { - if (__chdir (data->dirbuf) < 0) - result = -1; - } - else - result = -1; - } - - if (result != 0) - { int save_err = errno; __closedir (dir.stream); __set_errno (save_err); @@ -501,7 +490,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st) data->actdir = data->maxdir - 1; data->dirstreams[data->actdir] = NULL; - return result; + return -1; } } @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1992,1996,1997,1998,1999,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -103,40 +103,45 @@ typedef int (*__nftw64_func_t) (__const char *__filename, # endif #endif -/* Call a function on every element in a directory tree. */ +/* Call a function on every element in a directory tree. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern int ftw (__const char *__dir, __ftw_func_t __func, int __descriptors) - __THROW; +extern int ftw (__const char *__dir, __ftw_func_t __func, int __descriptors); #else # ifdef __REDIRECT extern int __REDIRECT (ftw, (__const char *__dir, __ftw_func_t __func, - int __descriptors) __THROW, ftw64); + int __descriptors), ftw64); # else # define ftw ftw64 # endif #endif #ifdef __USE_LARGEFILE64 extern int ftw64 (__const char *__dir, __ftw64_func_t __func, - int __descriptors) __THROW; + int __descriptors); #endif #ifdef __USE_XOPEN_EXTENDED /* Call a function on every element in a directory tree. FLAG allows - to specify the behaviour more detailed. */ + to specify the behaviour more detailed. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int nftw (__const char *__dir, __nftw_func_t __func, int __descriptors, - int __flag) __THROW; + int __flag); # else # ifdef __REDIRECT extern int __REDIRECT (nftw, (__const char *__dir, __nftw_func_t __func, - int __descriptors, int __flag) __THROW, nftw64); + int __descriptors, int __flag), nftw64); # else # define nftw nftw64 # endif # endif # ifdef __USE_LARGEFILE64 extern int nftw64 (__const char *__dir, __nftw64_func_t __func, - int __descriptors, int __flag) __THROW; + int __descriptors, int __flag); # endif #endif diff --git a/libio/stdio.h b/libio/stdio.h index 3acaa8bd97..f98d38ff32 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -1,5 +1,5 @@ /* Define ISO C stdio on top of C++ iostreams. - Copyright (C) 1991,1994-1999,2000,01,02 Free Software Foundation, Inc. + Copyright (C) 1991,1994-2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -156,25 +156,28 @@ __END_NAMESPACE_STD __BEGIN_NAMESPACE_STD -/* Create a temporary file and open it read/write. */ +/* Create a temporary file and open it read/write. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern FILE *tmpfile (void) __THROW; +extern FILE *tmpfile (void); #else # ifdef __REDIRECT -extern FILE *__REDIRECT (tmpfile, (void) __THROW, tmpfile64); +extern FILE *__REDIRECT (tmpfile, (void), tmpfile64); # else # define tmpfile tmpfile64 # endif #endif +#ifdef __USE_LARGEFILE64 +extern FILE *tmpfile64 (void); +#endif + /* Generate a temporary filename. */ extern char *tmpnam (char *__s) __THROW; __END_NAMESPACE_STD -#ifdef __USE_LARGEFILE64 -extern FILE *tmpfile64 (void) __THROW; -#endif - #ifdef __USE_MISC /* This is the reentrant variant of `tmpnam'. The only difference is that it does not allow S to be NULL. */ @@ -196,41 +199,61 @@ extern char *tempnam (__const char *__dir, __const char *__pfx) __BEGIN_NAMESPACE_STD -/* Close STREAM. */ -extern int fclose (FILE *__stream) __THROW; -/* Flush STREAM, or all streams if STREAM is NULL. */ -extern int fflush (FILE *__stream) __THROW; +/* Close STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fclose (FILE *__stream); +/* Flush STREAM, or all streams if STREAM is NULL. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fflush (FILE *__stream); __END_NAMESPACE_STD #ifdef __USE_MISC -/* Faster versions when locking is not required. */ -extern int fflush_unlocked (FILE *__stream) __THROW; +/* Faster versions when locking is not required. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fflush_unlocked (FILE *__stream); #endif #ifdef __USE_GNU -/* Close all streams. */ -extern int fcloseall (void) __THROW; +/* Close all streams. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fcloseall (void); #endif __BEGIN_NAMESPACE_STD #ifndef __USE_FILE_OFFSET64 -/* Open a file and create a new stream for it. */ +/* Open a file and create a new stream for it. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern FILE *fopen (__const char *__restrict __filename, - __const char *__restrict __modes) __THROW; -/* Open a file, replacing an existing stream with it. */ + __const char *__restrict __modes); +/* Open a file, replacing an existing stream with it. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream) __THROW; + FILE *__restrict __stream); #else # ifdef __REDIRECT extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename, - __const char *__restrict __modes) __THROW, - fopen64); + __const char *__restrict __modes), fopen64); extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream) __THROW, - freopen64); + FILE *__restrict __stream), freopen64); # else # define fopen fopen64 # define freopen freopen64 @@ -239,10 +262,10 @@ extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename, __END_NAMESPACE_STD #ifdef __USE_LARGEFILE64 extern FILE *fopen64 (__const char *__restrict __filename, - __const char *__restrict __modes) __THROW; + __const char *__restrict __modes); extern FILE *freopen64 (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream) __THROW; + FILE *__restrict __stream); #endif #ifdef __USE_POSIX @@ -291,21 +314,32 @@ extern void setlinebuf (FILE *__stream) __THROW; __BEGIN_NAMESPACE_STD -/* Write formatted output to STREAM. */ +/* Write formatted output to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int fprintf (FILE *__restrict __stream, - __const char *__restrict __format, ...) __THROW; -/* Write formatted output to stdout. */ -extern int printf (__const char *__restrict __format, ...) __THROW; + __const char *__restrict __format, ...); +/* Write formatted output to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int printf (__const char *__restrict __format, ...); /* Write formatted output to S. */ extern int sprintf (char *__restrict __s, __const char *__restrict __format, ...) __THROW; -/* Write formatted output to S from argument list ARG. */ +/* Write formatted output to S from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format, - _G_va_list __arg) __THROW; -/* Write formatted output to stdout from argument list ARG. */ -extern int vprintf (__const char *__restrict __format, _G_va_list __arg) - __THROW; + _G_va_list __arg); +/* Write formatted output to stdout from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vprintf (__const char *__restrict __format, _G_va_list __arg); /* Write formatted output to S from argument list ARG. */ extern int vsprintf (char *__restrict __s, __const char *__restrict __format, _G_va_list __arg) __THROW; @@ -337,21 +371,32 @@ extern int asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 2, 3))); -/* Write formatted output to a file descriptor. */ +/* Write formatted output to a file descriptor. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern int vdprintf (int __fd, __const char *__restrict __fmt, _G_va_list __arg) - __THROW __attribute__ ((__format__ (__printf__, 2, 0))); + __attribute__ ((__format__ (__printf__, 2, 0))); extern int dprintf (int __fd, __const char *__restrict __fmt, ...) - __THROW __attribute__ ((__format__ (__printf__, 2, 3))); + __attribute__ ((__format__ (__printf__, 2, 3))); #endif __BEGIN_NAMESPACE_STD -/* Read formatted input from STREAM. */ +/* Read formatted input from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int fscanf (FILE *__restrict __stream, - __const char *__restrict __format, ...) __THROW; -/* Read formatted input from stdin. */ -extern int scanf (__const char *__restrict __format, ...) __THROW; + __const char *__restrict __format, ...); +/* Read formatted input from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int scanf (__const char *__restrict __format, ...); /* Read formatted input from S. */ extern int sscanf (__const char *__restrict __s, __const char *__restrict __format, ...) __THROW; @@ -359,14 +404,20 @@ __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 -/* Read formatted input from S into argument list ARG. */ +/* Read formatted input from S into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format, _G_va_list __arg) - __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); + __attribute__ ((__format__ (__scanf__, 2, 0))); -/* Read formatted input from stdin into argument list ARG. */ +/* Read formatted input from stdin into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vscanf (__const char *__restrict __format, _G_va_list __arg) - __THROW __attribute__ ((__format__ (__scanf__, 1, 0))); + __attribute__ ((__format__ (__scanf__, 1, 0))); /* Read formatted input from S into argument list ARG. */ extern int vsscanf (__const char *__restrict __s, @@ -377,12 +428,18 @@ __END_NAMESPACE_C99 __BEGIN_NAMESPACE_STD -/* Read a character from STREAM. */ -extern int fgetc (FILE *__stream) __THROW; -extern int getc (FILE *__stream) __THROW; +/* Read a character from STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); -/* Read a character from stdin. */ -extern int getchar (void) __THROW; +/* Read a character from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int getchar (void); __END_NAMESPACE_STD /* The C standard explicitly says this is a macro, so we always do the @@ -390,24 +447,38 @@ __END_NAMESPACE_STD #define getc(_fp) _IO_getc (_fp) #if defined __USE_POSIX || defined __USE_MISC -/* These are defined in POSIX.1:1996. */ -extern int getc_unlocked (FILE *__stream) __THROW; -extern int getchar_unlocked (void) __THROW; +/* These are defined in POSIX.1:1996. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); #endif /* Use POSIX or MISC. */ #ifdef __USE_MISC -/* Faster version when locking is not necessary. */ -extern int fgetc_unlocked (FILE *__stream) __THROW; +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fgetc_unlocked (FILE *__stream); #endif /* Use MISC. */ __BEGIN_NAMESPACE_STD -/* Write a character to STREAM. */ +/* Write a character to STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ extern int fputc (int __c, FILE *__stream) __THROW; extern int putc (int __c, FILE *__stream) __THROW; -/* Write a character to stdout. */ -extern int putchar (int __c) __THROW; +/* Write a character to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int putchar (int __c); __END_NAMESPACE_STD /* The C standard explicitly says this can be a macro, @@ -415,18 +486,27 @@ __END_NAMESPACE_STD #define putc(_ch, _fp) _IO_putc (_ch, _fp) #ifdef __USE_MISC -/* Faster version when locking is not necessary. */ -extern int fputc_unlocked (int __c, FILE *__stream) __THROW; +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fputc_unlocked (int __c, FILE *__stream); #endif /* Use MISC. */ #if defined __USE_POSIX || defined __USE_MISC -/* These are defined in POSIX.1:1996. */ -extern int putc_unlocked (int __c, FILE *__stream) __THROW; -extern int putchar_unlocked (int __c) __THROW; +/* These are defined in POSIX.1:1996. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); #endif /* Use POSIX or MISC. */ -#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +#if defined __USE_SVID || defined __USE_MISC \ + || (defined __USE_XOPEN && !defined __USE_XOPEN2K) /* Get a word (int) from STREAM. */ extern int getw (FILE *__stream) __THROW; @@ -436,19 +516,29 @@ extern int putw (int __w, FILE *__stream) __THROW; __BEGIN_NAMESPACE_STD -/* Get a newline-terminated string of finite length from STREAM. */ -extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) - __THROW; +/* Get a newline-terminated string of finite length from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream); /* Get a newline-terminated string from stdin, removing the newline. - DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */ -extern char *gets (char *__s) __THROW; + DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern char *gets (char *__s); __END_NAMESPACE_STD #ifdef __USE_GNU -/* This function does the same as `fgets' but does not lock the stream. */ +/* This function does the same as `fgets' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern char *fgets_unlocked (char *__restrict __s, int __n, - FILE *__restrict __stream) __THROW; + FILE *__restrict __stream); #endif @@ -457,50 +547,84 @@ extern char *fgets_unlocked (char *__restrict __s, int __n, (and null-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *N characters of space. It is realloc'd as necessary. Returns the number of characters read (not including the - null terminator), or -1 on error or EOF. */ + null terminator), or -1 on error or EOF. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern _IO_ssize_t __getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, - FILE *__restrict __stream) __THROW; + FILE *__restrict __stream); extern _IO_ssize_t getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, - FILE *__restrict __stream) __THROW; + FILE *__restrict __stream); + +/* Like `getdelim', but reads up to a newline. -/* Like `getdelim', but reads up to a newline. */ + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern _IO_ssize_t getline (char **__restrict __lineptr, size_t *__restrict __n, - FILE *__restrict __stream) __THROW; + FILE *__restrict __stream); #endif __BEGIN_NAMESPACE_STD -/* Write a string to STREAM. */ -extern int fputs (__const char *__restrict __s, FILE *__restrict __stream) - __THROW; +/* Write a string to STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int fputs (__const char *__restrict __s, FILE *__restrict __stream); + +/* Write a string, followed by a newline, to stdout. -/* Write a string, followed by a newline, to stdout. */ -extern int puts (__const char *__s) __THROW; + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int puts (__const char *__s); -/* Push a character back onto the input buffer of STREAM. */ -extern int ungetc (int __c, FILE *__stream) __THROW; +/* Push a character back onto the input buffer of STREAM. + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int ungetc (int __c, FILE *__stream); -/* Read chunks of generic data from STREAM. */ + +/* Read chunks of generic data from STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern size_t fread (void *__restrict __ptr, size_t __size, - size_t __n, FILE *__restrict __stream) __THROW; -/* Write chunks of generic data to STREAM. */ + size_t __n, FILE *__restrict __stream); +/* Write chunks of generic data to STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern size_t fwrite (__const void *__restrict __ptr, size_t __size, - size_t __n, FILE *__restrict __s) __THROW; + size_t __n, FILE *__restrict __s); __END_NAMESPACE_STD #ifdef __USE_GNU -/* This function does the same as `fputs' but does not lock the stream. */ +/* This function does the same as `fputs' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int fputs_unlocked (__const char *__restrict __s, - FILE *__restrict __stream) __THROW; + FILE *__restrict __stream); #endif #ifdef __USE_MISC -/* Faster versions when locking is not necessary. */ +/* Faster versions when locking is not necessary. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) __THROW; extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size, @@ -509,12 +633,21 @@ extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size, __BEGIN_NAMESPACE_STD -/* Seek to a certain position on STREAM. */ -extern int fseek (FILE *__stream, long int __off, int __whence) __THROW; -/* Return the current position of STREAM. */ -extern long int ftell (FILE *__stream) __THROW; -/* Rewind to the beginning of STREAM. */ -extern void rewind (FILE *__stream) __THROW; +/* Seek to a certain position on STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fseek (FILE *__stream, long int __off, int __whence); +/* Return the current position of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern long int ftell (FILE *__stream); +/* Rewind to the beginning of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void rewind (FILE *__stream); __END_NAMESPACE_STD /* The Single Unix Specification, Version 2, specifies an alternative, @@ -524,16 +657,22 @@ __END_NAMESPACE_STD #ifdef __USE_LARGEFILE # ifndef __USE_FILE_OFFSET64 -/* Seek to a certain position on STREAM. */ -extern int fseeko (FILE *__stream, __off_t __off, int __whence) __THROW; -/* Return the current position of STREAM. */ -extern __off_t ftello (FILE *__stream) __THROW; +/* Seek to a certain position on STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fseeko (FILE *__stream, __off_t __off, int __whence); +/* Return the current position of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern __off_t ftello (FILE *__stream); # else # ifdef __REDIRECT extern int __REDIRECT (fseeko, - (FILE *__stream, __off64_t __off, int __whence) __THROW, + (FILE *__stream, __off64_t __off, int __whence), fseeko64); -extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64); +extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64); # else # define fseeko fseeko64 # define ftello ftello64 @@ -543,18 +682,22 @@ extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64); __BEGIN_NAMESPACE_STD #ifndef __USE_FILE_OFFSET64 -/* Get STREAM's position. */ -extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos) - __THROW; -/* Set STREAM's position. */ -extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __THROW; +/* Get STREAM's position. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); +/* Set STREAM's position. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fsetpos (FILE *__stream, __const fpos_t *__pos); #else # ifdef __REDIRECT extern int __REDIRECT (fgetpos, (FILE *__restrict __stream, - fpos_t *__restrict __pos) __THROW, fgetpos64); + fpos_t *__restrict __pos), fgetpos64); extern int __REDIRECT (fsetpos, - (FILE *__stream, __const fpos_t *__pos) __THROW, - fsetpos64); + (FILE *__stream, __const fpos_t *__pos), fsetpos64); # else # define fgetpos fgetpos64 # define fsetpos fsetpos64 @@ -563,11 +706,10 @@ extern int __REDIRECT (fsetpos, __END_NAMESPACE_STD #ifdef __USE_LARGEFILE64 -extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) __THROW; -extern __off64_t ftello64 (FILE *__stream) __THROW; -extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos) - __THROW; -extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) __THROW; +extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence); +extern __off64_t ftello64 (FILE *__stream); +extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos); +extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos); #endif __BEGIN_NAMESPACE_STD @@ -588,8 +730,11 @@ extern int ferror_unlocked (FILE *__stream) __THROW; __BEGIN_NAMESPACE_STD -/* Print a message describing the meaning of the value of errno. */ -extern void perror (__const char *__s) __THROW; +/* Print a message describing the meaning of the value of errno. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void perror (__const char *__s); __END_NAMESPACE_STD /* Provide the declarations for `sys_errlist' and `sys_nerr' if they @@ -612,11 +757,17 @@ extern int fileno_unlocked (FILE *__stream) __THROW; #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \ defined __USE_MISC) -/* Create a new stream connected to a pipe running the given command. */ -extern FILE *popen (__const char *__command, __const char *__modes) __THROW; +/* Create a new stream connected to a pipe running the given command. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *popen (__const char *__command, __const char *__modes); + +/* Close a stream opened by popen and return the status of its child. -/* Close a stream opened by popen and return the status of its child. */ -extern int pclose (FILE *__stream) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int pclose (FILE *__stream); #endif diff --git a/misc/daemon.c b/misc/daemon.c index 8cffdde1ce..bc93956e85 100644 --- a/misc/daemon.c +++ b/misc/daemon.c @@ -31,12 +31,14 @@ static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#include <errno.h> #include <fcntl.h> #include <paths.h> #include <unistd.h> #include <sys/stat.h> #include <device-nrs.h> +#include <not-cancel.h> int daemon(nochdir, noclose) @@ -59,7 +61,8 @@ daemon(nochdir, noclose) if (!nochdir) (void)__chdir("/"); - if (!noclose && (fd = __open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + if (!noclose + && (fd = open_not_cancel(_PATH_DEVNULL, O_RDWR, 0)) != -1) { struct stat64 st; if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) == 0 @@ -74,7 +77,7 @@ daemon(nochdir, noclose) if (fd > 2) (void)__close (fd); } else { - (void)__close (fd); + close_not_cancel_no_status (fd); return -1; } } diff --git a/misc/sys/mman.h b/misc/sys/mman.h index 8ca6539e19..5e37278df3 100644 --- a/misc/sys/mman.h +++ b/misc/sys/mman.h @@ -83,8 +83,11 @@ extern int mprotect (void *__addr, size_t __len, int __prot) __THROW; /* Synchronize the region starting at ADDR and extending LEN bytes with the file it maps. Filesystem operations on a file being mapped are - unpredictable before this is done. Flags are from the MS_* set. */ -extern int msync (void *__addr, size_t __len, int __flags) __THROW; + unpredictable before this is done. Flags are from the MS_* set. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int msync (void *__addr, size_t __len, int __flags); #ifdef __USE_BSD /* Advise the system about particular usage patterns the program follows diff --git a/misc/sys/select.h b/misc/sys/select.h index dc58ec6c2d..2a408433ec 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -1,5 +1,5 @@ /* `fd_set' type and related macros, and `select'/`pselect' declarations. - Copyright (C) 1996,97,98,99,2000,01,02 Free Software Foundation, Inc. + Copyright (C) 1996,97,98,99,2000,01,02,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -102,21 +102,27 @@ __BEGIN_DECLS readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out after waiting the interval specified therein. Returns the number of ready - descriptors, or -1 for errors. */ + descriptors, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, - struct timeval *__restrict __timeout) __THROW; + struct timeval *__restrict __timeout); #ifdef __USE_XOPEN2K /* Same as above only that the TIMEOUT value is given with higher resolution and a sigmask which is been set temporarily. This version - should be used. */ + should be used. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, const struct timespec *__restrict __timeout, - const __sigset_t *__restrict __sigmask) __THROW; + const __sigset_t *__restrict __sigmask); #endif __END_DECLS diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h index 940ee2dec3..8d501cfbd3 100644 --- a/misc/sys/syslog.h +++ b/misc/sys/syslog.h @@ -168,22 +168,35 @@ CODE facilitynames[] = __BEGIN_DECLS -/* Close desriptor used to write to system logger. */ -extern void closelog (void) __THROW; +/* Close desriptor used to write to system logger. -/* Open connection to system logger. */ -extern void openlog (__const char *__ident, int __option, int __facility) - __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void closelog (void); + +/* Open connection to system logger. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void openlog (__const char *__ident, int __option, int __facility); /* Set the log mask level. */ extern int setlogmask (int __mask) __THROW; -/* Generate a log message using FMT string and option arguments. */ -extern void syslog (int __pri, __const char *__fmt, ...) __THROW +/* Generate a log message using FMT string and option arguments. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void syslog (int __pri, __const char *__fmt, ...) __attribute__ ((__format__(__printf__, 2, 3))); #ifdef __USE_BSD -/* Generate a log message using FMT and using arguments pointed to by AP. */ +/* Generate a log message using FMT and using arguments pointed to by AP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap) __THROW __attribute__ ((__format__(__printf__, 2, 0))); #endif diff --git a/misc/sys/uio.h b/misc/sys/uio.h index 4b31380880..53add9f2e2 100644 --- a/misc/sys/uio.h +++ b/misc/sys/uio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 96, 97, 98, 99 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,17 +33,21 @@ __BEGIN_DECLS buffers described by VECTOR, which is a vector of COUNT `struct iovec's. The buffers are filled in the order specified. Operates just like `read' (see <unistd.h>) except that data are - put in VECTOR instead of a contiguous buffer. */ -extern ssize_t readv (int __fd, __const struct iovec *__vector, int __count) - __THROW; + put in VECTOR instead of a contiguous buffer. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t readv (int __fd, __const struct iovec *__vector, int __count); /* Write data pointed by the buffers described by VECTOR, which is a vector of COUNT `struct iovec's, to file descriptor FD. The data is written in the order specified. Operates just like `write' (see <unistd.h>) except that the data - are taken from VECTOR instead of a contiguous buffer. */ -extern ssize_t writev (int __fd, __const struct iovec *__vector, int __count) - __THROW; + are taken from VECTOR instead of a contiguous buffer. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t writev (int __fd, __const struct iovec *__vector, int __count); __END_DECLS diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h index b8073d83b9..ceb1077617 100644 --- a/nptl/sysdeps/pthread/pthread.h +++ b/nptl/sysdeps/pthread/pthread.h @@ -362,7 +362,11 @@ extern int pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)) __THROW; -/* Functions for handling cancellation. */ +/* Functions for handling cancellation. + + Note that these functions are explicitly not marked to not throw an + exception in C++ code. If cancellation is implemented by unwinding + this is necessary to have the compiler generate the unwind information. */ /* Set cancelability state of current thread to STATE, returning old state in *OLDSTATE if OLDSTATE is not NULL. */ @@ -377,11 +381,7 @@ extern int pthread_cancel (pthread_t __th); /* Test for pending cancellation for the current thread and terminate the thread as per pthread_exit(PTHREAD_CANCELED) if it has been - cancelled. - - Note that this function is explicitly not marked to not throw an - exception in C++ code. If cancellation is implemented by unwinding - this is necessary to have the compiler generate the unwind information. */ + cancelled. */ extern void pthread_testcancel (void); diff --git a/posix/spawn.h b/posix/spawn.h index 92ee94007e..09b1e9f8e4 100644 --- a/posix/spawn.h +++ b/posix/spawn.h @@ -1,5 +1,5 @@ /* Definitions for POSIX spawn interface. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -62,20 +62,26 @@ typedef struct __BEGIN_DECLS /* Spawn a new process executing PATH with the attributes describes in *ATTRP. - Before running the process perform the actions described in FILE-ACTIONS. */ + Before running the process perform the actions described in FILE-ACTIONS. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern int posix_spawn (pid_t *__restrict __pid, __const char *__restrict __path, __const posix_spawn_file_actions_t *__restrict __file_actions, __const posix_spawnattr_t *__restrict __attrp, char *__const argv[__restrict_arr], - char *__const envp[__restrict_arr]) __THROW; + char *__const envp[__restrict_arr]); + +/* Similar to `posix_spawn' but search for FILE in the PATH. -/* Similar to `posix_spawn' but search for FILE in the PATH. */ + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern int posix_spawnp (pid_t *__pid, __const char *__file, __const posix_spawn_file_actions_t *__file_actions, __const posix_spawnattr_t *__attrp, - char *__const argv[], char *__const envp[]) __THROW; + char *__const argv[], char *__const envp[]); /* Initialize data structure with attributes for `spawn' to default values. */ diff --git a/posix/sys/wait.h b/posix/sys/wait.h index 03ac5fe35d..e758f9e3ff 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991-1994,1996-2001,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -105,8 +105,11 @@ typedef enum /* Wait for a child to die. When one does, put its status in *STAT_LOC - and return its process ID. For errors, return (pid_t) -1. */ -extern __pid_t wait (__WAIT_STATUS __stat_loc) __THROW; + and return its process ID. For errors, return (pid_t) -1. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern __pid_t wait (__WAIT_STATUS __stat_loc); #ifdef __USE_BSD /* Special values for the PID argument to `waitpid' and `wait4'. */ @@ -125,8 +128,11 @@ extern __pid_t wait (__WAIT_STATUS __stat_loc) __THROW; is not already dead, return (pid_t) 0. If successful, return PID and store the dead child's status in STAT_LOC. Return (pid_t) -1 for errors. If the WUNTRACED bit is - set in OPTIONS, return status for stopped children; otherwise don't. */ -extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options) __THROW; + set in OPTIONS, return status for stopped children; otherwise don't. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); #if defined __USE_SVID || defined __USE_XOPEN # define __need_siginfo_t @@ -138,9 +144,12 @@ extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options) __THROW; If IDTYPE is P_ALL, match any process. If the WNOHANG bit is set in OPTIONS, and that child is not already dead, clear *INFOP and return 0. If successful, store - exit code and status in *INFOP. */ + exit code and status in *INFOP. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop, - int __options) __THROW; + int __options); #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED diff --git a/posix/unistd.h b/posix/unistd.h index e2bcf8d3fc..6fdfa0d937 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -298,31 +298,51 @@ extern __off64_t __REDIRECT (lseek, extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) __THROW; #endif -/* Close the file descriptor FD. */ -extern int close (int __fd) __THROW; +/* Close the file descriptor FD. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int close (int __fd); /* Read NBYTES into BUF from FD. Return the - number read, -1 for errors or 0 for EOF. */ -extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __THROW; + number read, -1 for errors or 0 for EOF. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t read (int __fd, void *__buf, size_t __nbytes); + +/* Write N bytes of BUF to FD. Return the number written, or -1. -/* Write N bytes of BUF to FD. Return the number written, or -1. */ -extern ssize_t write (int __fd, __const void *__buf, size_t __n) __THROW; + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t write (int __fd, __const void *__buf, size_t __n); #ifdef __USE_UNIX98 # ifndef __USE_FILE_OFFSET64 -extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) - __THROW; +/* Read NBYTES into BUF from FD at the given position OFFSET without + changing the file pointer. Return the number read, -1 for errors + or 0 for EOF. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset); + +/* Write N bytes of BUF to FD at the given position OFFSET without + changing the file pointer. Return the number written, or -1. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n, - __off_t __offset) __THROW; + __off_t __offset); # else # ifdef __REDIRECT extern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes, - __off64_t __offset) __THROW, + __off64_t __offset), pread64); extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf, - size_t __nbytes, __off64_t __offset) - __THROW, - pwrite64); + size_t __nbytes, __off64_t __offset), + pwrite64); # else # define pread pread64 # define pwrite pwrite64 @@ -334,11 +354,11 @@ extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf, changing the file pointer. Return the number read, -1 for errors or 0 for EOF. */ extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, - __off64_t __offset) __THROW; + __off64_t __offset); /* Write N bytes of BUF to FD at the given position OFFSET without changing the file pointer. Return the number written, or -1. */ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, - __off64_t __offset) __THROW; + __off64_t __offset); # endif #endif @@ -363,8 +383,11 @@ extern unsigned int alarm (unsigned int __seconds) __THROW; If a signal handler does a `longjmp' or modifies the handling of the SIGALRM signal while inside `sleep' call, the handling of the SIGALRM signal afterwards is undefined. There is no return value to indicate - error, but if `sleep' returns SECONDS, it probably didn't work. */ -extern unsigned int sleep (unsigned int __seconds) __THROW; + error, but if `sleep' returns SECONDS, it probably didn't work. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern unsigned int sleep (unsigned int __seconds); #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Set an alarm to go off (generating a SIGALRM signal) in VALUE @@ -375,14 +398,20 @@ extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) __THROW; /* Sleep USECONDS microseconds, or until a signal arrives that is not blocked - or ignored. */ -extern int usleep (__useconds_t __useconds) __THROW; + or ignored. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int usleep (__useconds_t __useconds); #endif /* Suspend the process until a signal arrives. - This always returns -1 and sets `errno' to EINTR. */ -extern int pause (void) __THROW; + This always returns -1 and sets `errno' to EINTR. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pause (void); /* Change the owner and group of FILE. */ @@ -670,12 +699,18 @@ extern __pid_t vfork (void) __THROW; /* 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. */ -extern char *ttyname (int __fd) __THROW; + The returned storage is good only until the next call to this function. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern char *ttyname (int __fd); /* Store at most BUFLEN characters of the pathname of the terminal FD is - open on in BUF. Return 0 on success, otherwise an error number. */ -extern int ttyname_r (int __fd, char *__buf, size_t __buflen) __THROW; + open on in BUF. Return 0 on success, otherwise an error number. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int ttyname_r (int __fd, char *__buf, size_t __buflen); /* Return 1 if FD is a valid descriptor associated with a terminal, zero if not. */ @@ -717,13 +752,19 @@ extern __pid_t tcgetpgrp (int __fd) __THROW; extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW; -/* Return the login name of the user. */ -extern char *getlogin (void) __THROW; +/* Return the login name of the user. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern char *getlogin (void); #if defined __USE_REENTRANT || defined __USE_UNIX98 /* Return at most NAME_LEN characters of the login name of the user in NAME. If it cannot be determined or some other error occurred, return the error - code. Otherwise return 0. */ -extern int getlogin_r (char *__name, size_t __name_len) __THROW; + code. Otherwise return 0. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int getlogin_r (char *__name, size_t __name_len); #endif #ifdef __USE_BSD @@ -815,8 +856,11 @@ extern char *getpass (__const char *__prompt) __THROW; #if defined __USE_BSD || defined __USE_XOPEN -/* Make all changes done to FD actually appear on disk. */ -extern int fsync (int __fd) __THROW; +/* Make all changes done to FD actually appear on disk. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int fsync (int __fd); #endif /* Use BSD || X/Open. */ @@ -910,7 +954,10 @@ extern long int syscall (long int __sysno, ...) __THROW; /* `lockf' is a simpler interface to the locking facilities of `fcntl'. LEN is always relative to the current file position. - The CMD argument is one of the following. */ + The CMD argument is one of the following. + + This function is a cancellation point and therefore not marked with + __THROW. */ # define F_ULOCK 0 /* Unlock a previously locked region. */ # define F_LOCK 1 /* Lock a region for exclusive use. */ @@ -918,17 +965,17 @@ extern long int syscall (long int __sysno, ...) __THROW; # define F_TEST 3 /* Test a region for other processes locks. */ # ifndef __USE_FILE_OFFSET64 -extern int lockf (int __fd, int __cmd, __off_t __len) __THROW; +extern int lockf (int __fd, int __cmd, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len) __THROW, +extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64); # else # define lockf lockf64 # endif # endif # ifdef __USE_LARGEFILE64 -extern int lockf64 (int __fd, int __cmd, __off64_t __len) __THROW; +extern int lockf64 (int __fd, int __cmd, __off64_t __len); # endif #endif /* Use misc and F_LOCK not already defined. */ @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,95,96,97,98,99,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1995-2001,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -66,30 +66,55 @@ struct passwd #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED -/* Rewind the password-file stream. */ -extern void setpwent (void) __THROW; +/* Rewind the password-file stream. -/* Close the password-file stream. */ -extern void endpwent (void) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setpwent (void); -/* Read an entry from the password-file stream, opening it if necessary. */ -extern struct passwd *getpwent (void) __THROW; +/* Close the password-file stream. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endpwent (void); + +/* Read an entry from the password-file stream, opening it if necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct passwd *getpwent (void); #endif #ifdef __USE_SVID -/* Read an entry from STREAM. */ -extern struct passwd *fgetpwent (FILE *__stream) __THROW; +/* Read an entry from STREAM. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct passwd *fgetpwent (FILE *__stream); + +/* Write the given entry onto the given stream. -/* Write the given entry onto the given stream. */ + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int putpwent (__const struct passwd *__restrict __p, - FILE *__restrict __f) __THROW; + FILE *__restrict __f); #endif -/* Search for an entry with a matching user ID. */ -extern struct passwd *getpwuid (__uid_t __uid) __THROW; +/* Search for an entry with a matching user ID. -/* Search for an entry with a matching username. */ -extern struct passwd *getpwnam (__const char *__name) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct passwd *getpwuid (__uid_t __uid); + +/* Search for an entry with a matching username. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct passwd *getpwnam (__const char *__name); #if defined __USE_POSIX || defined __USE_MISC @@ -108,29 +133,38 @@ extern struct passwd *getpwnam (__const char *__name) __THROW; POSIX people would choose. */ # if defined __USE_SVID || defined __USE_MISC +/* This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int getpwent_r (struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) __THROW; + struct passwd **__restrict __result); # endif extern int getpwuid_r (__uid_t __uid, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) __THROW; + struct passwd **__restrict __result); extern int getpwnam_r (__const char *__restrict __name, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) __THROW; + struct passwd **__restrict __result); # ifdef __USE_SVID /* Read an entry from STREAM. This function is not standardized and - probably never will. */ + probably never will. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int fgetpwent_r (FILE *__restrict __stream, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) __THROW; + struct passwd **__restrict __result); # endif #endif /* POSIX or reentrant */ @@ -138,8 +172,13 @@ extern int fgetpwent_r (FILE *__restrict __stream, #ifdef __USE_GNU /* Re-construct the password-file line for the given uid in the given buffer. This knows the format that the caller - will expect, but this need not be the format of the password file. */ -extern int getpw (__uid_t __uid, char *__buffer) __THROW; + will expect, but this need not be the format of the password file. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getpw (__uid_t __uid, char *__buffer); #endif __END_DECLS diff --git a/resolv/netdb.h b/resolv/netdb.h index d153c9b325..69c2f8a11c 100644 --- a/resolv/netdb.h +++ b/resolv/netdb.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,97,98,99,2000,01,02 Free Software Foundation, Inc. + /* Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -104,102 +104,146 @@ struct hostent }; /* Open host data base files and mark them as staying open even after - a later search if STAY_OPEN is non-zero. */ -extern void sethostent (int __stay_open) __THROW; + a later search if STAY_OPEN is non-zero. -/* Close host data base files and clear `stay open' flag. */ -extern void endhostent (void) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void sethostent (int __stay_open); + +/* Close host data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endhostent (void); /* Get next entry from host data base file. Open data base if - necessary. */ -extern struct hostent *gethostent (void) __THROW; + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct hostent *gethostent (void); /* Return entry from host data base which address match ADDR with - length LEN and type TYPE. */ + length LEN and type TYPE. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len, - int __type) __THROW; + int __type); -/* Return entry from host data base for host with NAME. */ -extern struct hostent *gethostbyname (__const char *__name) __THROW; +/* Return entry from host data base for host with NAME. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct hostent *gethostbyname (__const char *__name); #ifdef __USE_MISC /* Return entry from host data base for host with NAME. AF must be set to the address type which is `AF_INET' for IPv4 or `AF_INET6' - for IPv6. */ -extern struct hostent *gethostbyname2 (__const char *__name, int __af) __THROW; + for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct hostent *gethostbyname2 (__const char *__name, int __af); /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. The last argument is a pointer to a variable which gets the value which would be stored in the global variable `herrno' by the - non-reentrant functions. */ + non-reentrant functions. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern int gethostent_r (struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, - int *__restrict __h_errnop) __THROW; + int *__restrict __h_errnop); extern int gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, - int *__restrict __h_errnop) __THROW; + int *__restrict __h_errnop); extern int gethostbyname_r (__const char *__restrict __name, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, - int *__restrict __h_errnop) __THROW; + int *__restrict __h_errnop); extern int gethostbyname2_r (__const char *__restrict __name, int __af, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, - int *__restrict __h_errnop) __THROW; + int *__restrict __h_errnop); #endif /* misc */ /* Open network data base files and mark them as staying open even - after a later search if STAY_OPEN is non-zero. */ -extern void setnetent (int __stay_open) __THROW; + after a later search if STAY_OPEN is non-zero. -/* Close network data base files and clear `stay open' flag. */ -extern void endnetent (void) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setnetent (int __stay_open); + +/* Close network data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endnetent (void); /* Get next entry from network data base file. Open data base if - necessary. */ -extern struct netent *getnetent (void) __THROW; + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct netent *getnetent (void); /* Return entry from network data base which address match NET and - type TYPE. */ -extern struct netent *getnetbyaddr (uint32_t __net, int __type) - __THROW; + type TYPE. -/* Return entry from network data base for network with NAME. */ -extern struct netent *getnetbyname (__const char *__name) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct netent *getnetbyaddr (uint32_t __net, int __type); + +/* Return entry from network data base for network with NAME. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct netent *getnetbyname (__const char *__name); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. The last argument is a pointer to a variable which gets the value which would be stored in the global variable `herrno' by the - non-reentrant functions. */ + non-reentrant functions. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern int getnetent_r (struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, - int *__restrict __h_errnop) __THROW; + int *__restrict __h_errnop); extern int getnetbyaddr_r (uint32_t __net, int __type, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, - int *__restrict __h_errnop) __THROW; + int *__restrict __h_errnop); extern int getnetbyname_r (__const char *__restrict __name, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, - int *__restrict __h_errnop) __THROW; + int *__restrict __h_errnop); #endif /* misc */ @@ -213,44 +257,63 @@ struct servent }; /* Open service data base files and mark them as staying open even - after a later search if STAY_OPEN is non-zero. */ -extern void setservent (int __stay_open) __THROW; + after a later search if STAY_OPEN is non-zero. -/* Close service data base files and clear `stay open' flag. */ -extern void endservent (void) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setservent (int __stay_open); + +/* Close service data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endservent (void); /* Get next entry from service data base file. Open data base if - necessary. */ -extern struct servent *getservent (void) __THROW; + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct servent *getservent (void); /* Return entry from network data base for network with NAME and - protocol PROTO. */ + protocol PROTO. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern struct servent *getservbyname (__const char *__name, - __const char *__proto) __THROW; + __const char *__proto); /* Return entry from service data base which matches port PORT and - protocol PROTO. */ -extern struct servent *getservbyport (int __port, __const char *__proto) - __THROW; + protocol PROTO. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct servent *getservbyport (int __port, __const char *__proto); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional - arguments specify a buffer of BUFLEN starting at BUF. */ + arguments specify a buffer of BUFLEN starting at BUF. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern int getservent_r (struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, - struct servent **__restrict __result) __THROW; + struct servent **__restrict __result); extern int getservbyname_r (__const char *__restrict __name, __const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, - struct servent **__restrict __result) __THROW; + struct servent **__restrict __result); extern int getservbyport_r (int __port, __const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, - struct servent **__restrict __result) __THROW; + struct servent **__restrict __result); #endif /* misc */ @@ -263,64 +326,108 @@ struct protoent }; /* Open protocol data base files and mark them as staying open even - after a later search if STAY_OPEN is non-zero. */ -extern void setprotoent (int __stay_open) __THROW; + after a later search if STAY_OPEN is non-zero. -/* Close protocol data base files and clear `stay open' flag. */ -extern void endprotoent (void) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setprotoent (int __stay_open); + +/* Close protocol data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endprotoent (void); /* Get next entry from protocol data base file. Open data base if - necessary. */ -extern struct protoent *getprotoent (void) __THROW; + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct protoent *getprotoent (void); -/* Return entry from protocol data base for network with NAME. */ -extern struct protoent *getprotobyname (__const char *__name) __THROW; +/* Return entry from protocol data base for network with NAME. -/* Return entry from protocol data base which number is PROTO. */ -extern struct protoent *getprotobynumber (int __proto) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct protoent *getprotobyname (__const char *__name); + +/* Return entry from protocol data base which number is PROTO. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct protoent *getprotobynumber (int __proto); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional - arguments specify a buffer of BUFLEN starting at BUF. */ + arguments specify a buffer of BUFLEN starting at BUF. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern int getprotoent_r (struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, - struct protoent **__restrict __result) __THROW; + struct protoent **__restrict __result); extern int getprotobyname_r (__const char *__restrict __name, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, - struct protoent **__restrict __result) __THROW; + struct protoent **__restrict __result); extern int getprotobynumber_r (int __proto, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, - struct protoent **__restrict __result) __THROW; -#endif /* misc */ + struct protoent **__restrict __result); + + +/* Establish network group NETGROUP for enumeration. + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int setnetgrent (__const char *__netgroup); -/* Establish network group NETGROUP for enumeration. */ -extern int setnetgrent (__const char *__netgroup) __THROW; +/* Free all space allocated by previous `setnetgrent' call. -/* Free all space allocated by previous `setnetgrent' call. */ -extern void endnetgrent (void) __THROW; + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void endnetgrent (void); /* Get next member of netgroup established by last `setnetgrent' call - and return pointers to elements in HOSTP, USERP, and DOMAINP. */ + and return pointers to elements in HOSTP, USERP, and DOMAINP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int getnetgrent (char **__restrict __hostp, char **__restrict __userp, - char **__restrict __domainp) __THROW; + char **__restrict __domainp); -#ifdef __USE_MISC -/* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). */ + +/* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int innetgr (__const char *__netgroup, __const char *__host, - __const char *__user, __const char *domain) __THROW; + __const char *__user, __const char *domain); + +/* Reentrant version of `getnetgrent' where result is placed in BUFFER. -/* Reentrant version of `getnetgrent' where result is placed in BUFFER. */ + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int getnetgrent_r (char **__restrict __hostp, char **__restrict __userp, char **__restrict __domainp, - char *__restrict __buffer, size_t __buflen) __THROW; + char *__restrict __buffer, size_t __buflen); #endif /* misc */ @@ -330,60 +437,98 @@ extern int getnetgrent_r (char **__restrict __hostp, executed as REMUSER. In *FD2P the descriptor to the socket for the connection is returned. The caller must have the right to use a reserved port. When the function returns *AHOST contains the - official host name. */ + official host name. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int rcmd (char **__restrict __ahost, unsigned short int __rport, __const char *__restrict __locuser, __const char *__restrict __remuser, - __const char *__restrict __cmd, int *__restrict __fd2p) - __THROW; + __const char *__restrict __cmd, int *__restrict __fd2p); /* This is the equivalent function where the protocol can be selected - and which therefore can be used for IPv6. */ + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport, __const char *__restrict __locuser, __const char *__restrict __remuser, __const char *__restrict __cmd, int *__restrict __fd2p, - sa_family_t __af) __THROW; + sa_family_t __af); /* Call `rexecd' at port RPORT on remote machine *AHOST to execute CMD. The process runs at the remote machine using the ID of user NAME whose cleartext password is PASSWD. In *FD2P the descriptor to the socket for the connection is returned. When the function - returns *AHOST contains the official host name. */ + returns *AHOST contains the official host name. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int rexec (char **__restrict __ahost, int __rport, __const char *__restrict __name, __const char *__restrict __pass, - __const char *__restrict __cmd, int *__restrict __fd2p) - __THROW; + __const char *__restrict __cmd, int *__restrict __fd2p); /* This is the equivalent function where the protocol can be selected - and which therefore can be used for IPv6. */ + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int rexec_af (char **__restrict __ahost, int __rport, __const char *__restrict __name, __const char *__restrict __pass, __const char *__restrict __cmd, int *__restrict __fd2p, - sa_family_t __af) __THROW; + sa_family_t __af); /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. If SUSER is not zero the user tries to become superuser. Return 0 if - it is possible. */ + it is possible. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int ruserok (__const char *__rhost, int __suser, - __const char *__remuser, __const char *__locuser) __THROW; + __const char *__remuser, __const char *__locuser); /* This is the equivalent function where the protocol can be selected - and which therefore can be used for IPv6. */ + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int ruserok_af (__const char *__rhost, int __suser, __const char *__remuser, __const char *__locuser, - sa_family_t __af) __THROW; + sa_family_t __af); /* Try to allocate reserved port, returning a descriptor for a socket opened at this port or -1 if unsuccessful. The search for an available port - will start at ALPORT and continues with lower numbers. */ -extern int rresvport (int *__alport) __THROW; + will start at ALPORT and continues with lower numbers. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rresvport (int *__alport); /* This is the equivalent function where the protocol can be selected - and which therefore can be used for IPv6. */ -extern int rresvport_af (int *__alport, sa_family_t __af) __THROW; + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rresvport_af (int *__alport, sa_family_t __af); #endif @@ -455,11 +600,14 @@ struct gaicb # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ /* Translate name of a service location and/or a service name to set of - socket addresses. */ + socket addresses. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int getaddrinfo (__const char *__restrict __name, __const char *__restrict __service, __const struct addrinfo *__restrict __req, - struct addrinfo **__restrict __pai) __THROW; + struct addrinfo **__restrict __pai); /* Free `addrinfo' structure AI including associated storage. */ extern void freeaddrinfo (struct addrinfo *__ai) __THROW; @@ -467,33 +615,45 @@ extern void freeaddrinfo (struct addrinfo *__ai) __THROW; /* Convert error return from getaddrinfo() to a string. */ extern __const char *gai_strerror (int __ecode) __THROW; -/* Translate a socket address to a location and service name. */ +/* Translate a socket address to a location and service name. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int getnameinfo (__const struct sockaddr *__restrict __sa, socklen_t __salen, char *__restrict __host, socklen_t __hostlen, char *__restrict __serv, - socklen_t __servlen, unsigned int __flags) __THROW; + socklen_t __servlen, unsigned int __flags); +#endif /* POSIX */ -# ifdef __USE_GNU +#ifdef __USE_GNU /* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all requests are handled. If WAIT is GAI_NOWAIT return immediately after - queueing the requests and signal completion according to SIG. */ + queueing the requests and signal completion according to SIG. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr], - int __ent, struct sigevent *__restrict __sig) - __THROW; + int __ent, struct sigevent *__restrict __sig); /* Suspend execution of the thread until at least one of the ENT requests in LIST is handled. If TIMEOUT is not a null pointer it specifies the - longest time the function keeps waiting before returning with an error. */ + longest time the function keeps waiting before returning with an error. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int gai_suspend (__const struct gaicb *__const __list[], int __ent, - __const struct timespec *__timeout) __THROW; + __const struct timespec *__timeout); /* Get the error status of the request REQ. */ extern int gai_error (struct gaicb *__req) __THROW; /* Cancel the requests associated with GAICBP. */ extern int gai_cancel (struct gaicb *__gaicbp) __THROW; -# endif /* GNU */ -#endif /* POSIX */ +#endif /* GNU */ __END_DECLS @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -161,9 +161,12 @@ extern __ssize_t aio_return (struct aiocb *__aiocbp) __THROW; extern int aio_cancel (int __fildes, struct aiocb *__aiocbp) __THROW; /* Suspend calling thread until at least one of the asynchronous I/O - operations referenced by LIST has completed. */ + operations referenced by LIST has completed. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int aio_suspend (__const struct aiocb *__const __list[], int __nent, - __const struct timespec *__restrict __timeout) __THROW; + __const struct timespec *__restrict __timeout); /* Force all operations associated with file desriptor described by `aio_fildes' member of AIOCBP. */ diff --git a/shadow/shadow.h b/shadow/shadow.h index 81ddc71f1a..778df52b9a 100644 --- a/shadow/shadow.h +++ b/shadow/shadow.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -54,46 +54,90 @@ struct spwd }; -/* Open database for reading. */ -extern void setspent (void) __THROW; +/* Open database for reading. -/* Close database. */ -extern void endspent (void) __THROW; + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void setspent (void); -/* Get next entry from database, perhaps after opening the file. */ -extern struct spwd *getspent (void) __THROW; +/* Close database. -/* Get shadow entry matching NAME. */ -extern struct spwd *getspnam (__const char *__name) __THROW; + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void endspent (void); -/* Read shadow entry from STRING. */ -extern struct spwd *sgetspent (__const char *__string) __THROW; +/* Get next entry from database, perhaps after opening the file. -/* Read next shadow entry from STREAM. */ -extern struct spwd *fgetspent (FILE *__stream) __THROW; + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *getspent (void); -/* Write line containing shadow password entry to stream. */ -extern int putspent (__const struct spwd *__p, FILE *__stream) __THROW; +/* Get shadow entry matching NAME. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *getspnam (__const char *__name); + +/* Read shadow entry from STRING. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *sgetspent (__const char *__string); + +/* Read next shadow entry from STREAM. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *fgetspent (FILE *__stream); + +/* Write line containing shadow password entry to stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int putspent (__const struct spwd *__p, FILE *__stream); #ifdef __USE_MISC -/* Reentrant versions of some of the functions above. */ +/* Reentrant versions of some of the functions above. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ extern int getspent_r (struct spwd *__result_buf, char *__buffer, - size_t __buflen, struct spwd **__result) __THROW; + size_t __buflen, struct spwd **__result); extern int getspnam_r (__const char *__name, struct spwd *__result_buf, char *__buffer, size_t __buflen, - struct spwd **__result)__THROW; + struct spwd **__result); extern int sgetspent_r (__const char *__string, struct spwd *__result_buf, char *__buffer, size_t __buflen, - struct spwd **__result) __THROW; + struct spwd **__result); extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, char *__buffer, size_t __buflen, - struct spwd **__result) __THROW; + struct spwd **__result); #endif /* misc */ + +/* The simple locking functionality provided here is not suitable for + multi-threaded applications. */ + /* Protect password file against multi writers. */ extern int lckpwdf (void) __THROW; diff --git a/signal/signal.h b/signal/signal.h index f0cd50e8e3..8263d3a84f 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -142,8 +142,11 @@ extern void psignal (int __sig, __const char *__s) __THROW; BSD definition defines the argument as a mask of the signal, while the more modern interface in X/Open defines it as the signal number. We go with the BSD version unless the user explicitly - selects the X/Open version. */ -extern int __sigpause (int __sig_or_mask, int __is_sig) __THROW; + selects the X/Open version. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int __sigpause (int __sig_or_mask, int __is_sig); #ifdef __USE_BSD /* Set the mask of blocked signals to MASK, @@ -153,7 +156,7 @@ extern int sigpause (int __mask) __THROW; #else # ifdef __USE_XOPEN # ifdef __GNUC__ -extern int sigpause (int __sig) __THROW __asm__ ("__xpg_sigpause"); +extern int sigpause (int __sig) __asm__ ("__xpg_sigpause"); # endif /* Remove a signal from the signal mask and suspend the process. */ # define sigpause(sig) __sigpause ((sig), 1) @@ -242,8 +245,11 @@ extern int sigprocmask (int __how, __const sigset_t *__restrict __set, sigset_t *__restrict __oset) __THROW; /* Change the set of blocked signals to SET, - wait until a signal arrives, and restore the set of blocked signals. */ -extern int sigsuspend (__const sigset_t *__set) __THROW; + wait until a signal arrives, and restore the set of blocked signals. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sigsuspend (__const sigset_t *__set); /* Get and/or set the action for signal SIG. */ extern int sigaction (int __sig, __const struct sigaction *__restrict __act, @@ -253,21 +259,28 @@ extern int sigaction (int __sig, __const struct sigaction *__restrict __act, extern int sigpending (sigset_t *__set) __THROW; -/* Select any of pending signals from SET or wait for any to arrive. */ -extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig) - __THROW; +/* Select any of pending signals from SET or wait for any to arrive. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig); # ifdef __USE_POSIX199309 -/* Select any of pending signals from SET and place information in INFO. */ +/* Select any of pending signals from SET and place information in INFO. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int sigwaitinfo (__const sigset_t *__restrict __set, - siginfo_t *__restrict __info) __THROW; + siginfo_t *__restrict __info); /* Select any of pending signals from SET and place information in INFO. - Wait the time specified by TIMEOUT if no signal is pending. */ + Wait the time specified by TIMEOUT if no signal is pending. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int sigtimedwait (__const sigset_t *__restrict __set, siginfo_t *__restrict __info, - __const struct timespec *__restrict __timeout) - __THROW; + __const struct timespec *__restrict __timeout); /* Send signal SIG to the process PID. Associate data in VAL with the signal. */ diff --git a/socket/sys/socket.h b/socket/sys/socket.h index b57b633499..4ae1ea9808 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -1,5 +1,5 @@ /* Declarations of socket constants, types, and functions. - Copyright (C) 1991,92,1994-1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1991,92,1994-2001,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -117,9 +117,11 @@ extern int getsockname (int __fd, __SOCKADDR_ARG __addr, /* Open a connection on socket FD to peer at ADDR (which LEN bytes long). For connectionless socket types, just set the default address to send to and the only address from which to accept transmissions. - Return 0 on success, -1 for errors. */ -extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) - __THROW; + Return 0 on success, -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len); /* Put the address of the peer connected to socket FD into *ADDR (which is *LEN bytes long), and its actual length into *LEN. */ @@ -127,39 +129,54 @@ extern int getpeername (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len) __THROW; -/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */ -extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags) - __THROW; +/* Send N bytes of BUF to socket FD. Returns the number sent or -1. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags); /* Read N bytes into BUF from socket FD. - Returns the number read or -1 for errors. */ -extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) - __THROW; + Returns the number read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags); /* Send N bytes of BUF on socket FD to peer at address ADDR (which is - ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */ + ADDR_LEN bytes long). Returns the number sent, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern ssize_t sendto (int __fd, __const void *__buf, size_t __n, int __flags, __CONST_SOCKADDR_ARG __addr, - socklen_t __addr_len) __THROW; + socklen_t __addr_len); /* Read N bytes into BUF through socket FD. If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of the sender, and store the actual size of the address in *ADDR_LEN. - Returns the number of bytes read or -1 for errors. */ -extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, - __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) - __THROW; + Returns the number of bytes read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, + int __flags, __SOCKADDR_ARG __addr, + socklen_t *__restrict __addr_len); /* Send a message described MESSAGE on socket FD. - Returns the number of bytes sent, or -1 for errors. */ -extern ssize_t sendmsg (int __fd, __const struct msghdr *__message, int __flags) - __THROW; + Returns the number of bytes sent, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t sendmsg (int __fd, __const struct msghdr *__message, + int __flags); /* Receive a message as described by MESSAGE from socket FD. - Returns the number of bytes read or -1 for errors. */ -extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags) - __THROW; + Returns the number of bytes read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL @@ -185,10 +202,12 @@ extern int listen (int __fd, int __n) __THROW; When a connection arrives, open a new socket to communicate with it, set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting peer and *ADDR_LEN to the address's actual length, and return the - new socket's descriptor, or -1 for errors. */ + new socket's descriptor, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int accept (int __fd, __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len) - __THROW; + socklen_t *__restrict __addr_len); /* Shut down all or part of the connection open on socket FD. HOW determines what to shut down: diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 87b559abc0..a6f1e5e8a0 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-99,2000,01,02 Free Software Foundation, Inc. +/* Copyright (C) 1991-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -666,18 +666,21 @@ extern char *mktemp (char *__template) __THROW; The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the filename unique. Returns a file descriptor open on the file for reading and writing, - or -1 if it cannot create a uniquely-named file. */ + or -1 if it cannot create a uniquely-named file. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 -extern int mkstemp (char *__template) __THROW; +extern int mkstemp (char *__template); # else # ifdef __REDIRECT -extern int __REDIRECT (mkstemp, (char *__template) __THROW, mkstemp64); +extern int __REDIRECT (mkstemp, (char *__template), mkstemp64); # else # define mkstemp mkstemp64 # endif # endif # ifdef __USE_LARGEFILE64 -extern int mkstemp64 (char *__template) __THROW; +extern int mkstemp64 (char *__template); # endif #endif @@ -692,8 +695,11 @@ extern char *mkdtemp (char *__template) __THROW; __BEGIN_NAMESPACE_STD -/* Execute the given line as a shell command. */ -extern int system (__const char *__command) __THROW; +/* Execute the given line as a shell command. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int system (__const char *__command); __END_NAMESPACE_STD diff --git a/streams/stropts.h b/streams/stropts.h index e174186dab..192c09b408 100644 --- a/streams/stropts.h +++ b/streams/stropts.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,31 +44,41 @@ __BEGIN_DECLS /* Test whether FILDES is associated with a STREAM-based file. */ extern int isastream (int __fildes) __THROW; -/* Receive next message from a STREAMS file. */ +/* Receive next message from a STREAMS file. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int getmsg (int __fildes, struct strbuf *__restrict __ctlptr, struct strbuf *__restrict __dataptr, - int *__restrict __flagsp) __THROW; + int *__restrict __flagsp); /* Receive next message from a STREAMS file, with *FLAGSP allowing to - control which message. */ + control which message. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int getpmsg (int __fildes, struct strbuf *__restrict __ctlptr, struct strbuf *__restrict __dataptr, - int *__restrict __bandp, int *__restrict __flagsp) - __THROW; + int *__restrict __bandp, int *__restrict __flagsp); /* Perform the I/O control operation specified by REQUEST on FD. One argument may follow; its presence and type depend on REQUEST. Return value depends on REQUEST. Usually -1 indicates error. */ extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; -/* Send a message on a STREAM. */ +/* Send a message on a STREAM. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int putmsg (int __fildes, __const struct strbuf *__ctlptr, - __const struct strbuf *__dataptr, int __flags) __THROW; + __const struct strbuf *__dataptr, int __flags); + +/* Send a message on a STREAM to the BAND. -/* Send a message on a STREAM to the BAND. */ + This function is a cancellation point and therefore not marked with + __THROW. */ extern int putpmsg (int __fildes, __const struct strbuf *__ctlptr, - __const struct strbuf *__dataptr, int __band, int __flags) - __THROW; + __const struct strbuf *__dataptr, int __band, int __flags); /* Attach a STREAMS-based file descriptor FILDES to a file PATH in the file system name space. */ diff --git a/string/string.h b/string/string.h index db9bc00e5c..ecfc4c7060 100644 --- a/string/string.h +++ b/string/string.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993, 1995-2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1995-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -239,13 +239,19 @@ extern size_t strnlen (__const char *__string, size_t __maxlen) __BEGIN_NAMESPACE_STD -/* Return a string describing the meaning of the `errno' code in ERRNUM. */ -extern char *strerror (int __errnum) __THROW; +/* Return a string describing the meaning of the `errno' code in ERRNUM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern char *strerror (int __errnum); __END_NAMESPACE_STD #if defined __USE_XOPEN2K || defined __USE_MISC /* Reentrant version of `strerror'. If a temporary buffer is required, at - most BUFLEN bytes of BUF will be used. */ -extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW; + most BUFLEN bytes of BUF will be used. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern char *strerror_r (int __errnum, char *__buf, size_t __buflen); #endif /* We define this function always since `bzero' is sometimes needed when diff --git a/sysdeps/generic/backtracesymsfd.c b/sysdeps/generic/backtracesymsfd.c index a730607a3d..c704362ec7 100644 --- a/sysdeps/generic/backtracesymsfd.c +++ b/sysdeps/generic/backtracesymsfd.c @@ -1,5 +1,5 @@ /* Write formatted list with names for addresses in backtrace to a file. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -23,11 +23,12 @@ #include <sys/uio.h> #include <stdio-common/_itoa.h> +#include <not-cancel.h> #if __ELF_NATIVE_CLASS == 32 # define WORD_WIDTH 8 #else -/* We assyme 64bits. */ +/* We assume 64bits. */ # define WORD_WIDTH 16 #endif @@ -55,7 +56,8 @@ __backtrace_symbols_fd (array, size, fd) iov[2].iov_base = (void *) "]\n"; iov[2].iov_len = 2; - __writev (fd, iov, 3); + /* We prefer to use the non-cancelable interface if it is available. */ + writev_not_cancel_no_status (fd, iov, 3); } } weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd) diff --git a/sysdeps/generic/check_fds.c b/sysdeps/generic/check_fds.c index ff9562de08..8a3efd1b37 100644 --- a/sysdeps/generic/check_fds.c +++ b/sysdeps/generic/check_fds.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,6 +32,7 @@ #endif #include <device-nrs.h> +#include <not-cancel.h> /* Should other OSes (e.g., Hurd) have different versions which can @@ -39,6 +40,7 @@ static void check_one_fd (int fd, int mode) { + /* Note that fcntl() with this parameter is not a cancellation point. */ if (__builtin_expect (__libc_fcntl (fd, F_GETFD), 0) == -1 && errno == EBADF) { @@ -47,7 +49,7 @@ check_one_fd (int fd, int mode) /* Something is wrong with this descriptor, it's probably not opened. Open /dev/null so that the SUID program we are about to start does not accidently use this descriptor. */ - int nullfd = __libc_open (_PATH_DEVNULL, mode); + int nullfd = open_not_cancel (_PATH_DEVNULL, mode); /* We are very paranoid here. With all means we try to ensure that we are actually opening the /dev/null device and nothing else. diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h new file mode 100644 index 0000000000..b87c16034b --- /dev/null +++ b/sysdeps/generic/not-cancel.h @@ -0,0 +1,31 @@ +/* Uncancelable versions of cancelable interfaces. Generic version. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* By default we have none. Map the name to the normal functions. */ +#define open_not_cancel(name, flags, mode...) \ + __libc_open (name, flags, ##mode) +#define close_not_cancel_no_status(fd) \ + (void) __close (fd) +#define read_not_cancel(fd, buf, n) \ + __read (fd, buf, n) +#define write_not_cancel(fd, buf, n) \ + __write (fd, buf, n) +#define writev_not_cancel_no_status(fd, iov, n) \ + (void) __writev (fd, iov, n) diff --git a/sysdeps/gnu/utmpx.h b/sysdeps/gnu/utmpx.h index 1647bfe681..8622916a94 100644 --- a/sysdeps/gnu/utmpx.h +++ b/sysdeps/gnu/utmpx.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -47,41 +47,79 @@ struct utmp; __BEGIN_DECLS -/* Open user accounting database. */ -extern void setutxent (void) __THROW; +/* Open user accounting database. -/* Close user accounting database. */ -extern void endutxent (void) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setutxent (void); -/* Get the next entry from the user accounting database. */ -extern struct utmpx *getutxent (void) __THROW; +/* Close user accounting database. -/* Get the user accounting database entry corresponding to ID. */ -extern struct utmpx *getutxid (__const struct utmpx *__id) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endutxent (void); -/* Get the user accounting database entry corresponding to LINE. */ -extern struct utmpx *getutxline (__const struct utmpx *__line) __THROW; +/* Get the next entry from the user accounting database. -/* Write the entry UTMPX into the user accounting database. */ -extern struct utmpx *pututxline (__const struct utmpx *__utmpx) __THROW; + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *getutxent (void); + +/* Get the user accounting database entry corresponding to ID. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *getutxid (__const struct utmpx *__id); + +/* Get the user accounting database entry corresponding to LINE. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *getutxline (__const struct utmpx *__line); + +/* Write the entry UTMPX into the user accounting database. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *pututxline (__const struct utmpx *__utmpx); #ifdef __USE_GNU -/* Change name of the utmpx file to be examined. */ -extern int utmpxname (__const char *__file) __THROW; +/* Change name of the utmpx file to be examined. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int utmpxname (__const char *__file); + +/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. -/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. */ + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern void updwtmpx (__const char *__wtmpx_file, - __const struct utmpx *__utmpx) __THROW; + __const struct utmpx *__utmpx); -/* Copy the information in UTMPX to UTMP. */ +/* Copy the information in UTMPX to UTMP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern void getutmp (__const struct utmpx *__utmpx, - struct utmp *__utmp) __THROW; + struct utmp *__utmp); + +/* Copy the information in UTMP to UTMPX. -/* Copy the information in UTMP to UTMPX. */ + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern void getutmpx (__const struct utmp *__utmp, - struct utmpx *__utmpx) __THROW; + struct utmpx *__utmpx); #endif __END_DECLS diff --git a/sysdeps/posix/remove.c b/sysdeps/posix/remove.c index 7473ee14f4..c44af92d74 100644 --- a/sysdeps/posix/remove.c +++ b/sysdeps/posix/remove.c @@ -1,5 +1,5 @@ /* ANSI C `remove' function to delete a file or directory. POSIX.1 version. - Copyright (C) 1995,96,97,2002 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,17 +25,15 @@ int remove (file) const char *file; { - int save; + /* First try to unlink since this is more frequently the necessary action. */ + if (__unlink (file) != 0 + /* If it is indeed a directory... */ + && (errno != EISDIR + /* ...try to remove it. */ + || __rmdir (file) != 0)) + /* Cannot remove the object for whatever reason. */ + return -1; - save = errno; - if (__rmdir (file) == 0) - return 0; - else if (errno == ENOTDIR && __unlink (file) == 0) - { - __set_errno (save); - return 0; - } - - return -1; + return 0; } libc_hidden_def (remove) diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index b5b91c2059..6cae4ca0b5 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -3,6 +3,7 @@ cmsg_nxthdr.c dl-brk.c dl-sbrk.c exit-thread.S +fatal-prepare.h getdirentries.c getdirentries64.c ipc_priv.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index eaa6e2a083..dcffc97986 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -2,6 +2,11 @@ ifeq ($(subdir),csu) sysdep_routines += errno-loc endif +ifeq ($(subdir),assert) +CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>' +CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>' +endif + ifeq ($(subdir),malloc) CFLAGS-malloc.c += -DMORECORE_CLEARS=2 endif diff --git a/sysdeps/unix/sysv/linux/fatal-prepare.h b/sysdeps/unix/sysv/linux/fatal-prepare.h new file mode 100644 index 0000000000..d48ae625ee --- /dev/null +++ b/sysdeps/unix/sysv/linux/fatal-prepare.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <pthread.h> + +/* We have to completely disable cancellation. assert() must not be a + cancellation point but the implementation uses write() etc. */ +#ifdef SHARED +# include <pthread-functions.h> +# define FATAL_PREPARE \ + { \ + int (*fp) (int, int *); \ + fp = __libc_pthread_functions.ptr_pthread_setcancelstate; \ + if (fp != NULL) \ + fp (PTHREAD_CANCEL_DISABLE, NULL); \ + } +#else +# pragma weak pthread_setcancelstate +# define FATAL_PREPARE \ + { \ + if (pthread_setcancelstate != NULL) \ + pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \ + } +#endif diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c index 96a78c6da1..4b587ceab3 100644 --- a/sysdeps/unix/sysv/linux/gethostid.c +++ b/sysdeps/unix/sysv/linux/gethostid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998-2001,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,6 +21,7 @@ #include <fcntl.h> #include <unistd.h> #include <netdb.h> +#include <not-cancel.h> #define HOSTIDFILE "/etc/hostid" #define OLD_HOSTIDFILE "/etc/hostid" @@ -41,13 +42,13 @@ sethostid (id) } /* Open file for writing. Everybody is allowed to read this file. */ - fd = __open64 (HOSTIDFILE, O_CREAT|O_WRONLY|O_TRUNC, 0644); + fd = open_not_cancel (HOSTIDFILE, O_CREAT|O_WRONLY|O_TRUNC, 0644); if (fd < 0) return -1; - written = __write (fd, &id, sizeof (id)); + written = write_not_cancel (fd, &id, sizeof (id)); - __close (fd); + close_not_cancel_no_status (fd); return written != sizeof (id) ? -1 : 0; } @@ -71,14 +72,14 @@ gethostid () int fd; /* First try to get the ID from a former invocation of sethostid. */ - fd = __open64 (HOSTIDFILE, O_RDONLY); + fd = open_not_cancel (HOSTIDFILE, O_RDONLY|O_LARGEFILE); if (fd < 0) - fd = __open64 (OLD_HOSTIDFILE, O_RDONLY); + fd = open_not_cancel (OLD_HOSTIDFILE, O_RDONLY|O_LARGEFILE); if (fd >= 0) { - ssize_t n = __read (fd, &id, sizeof (id)); + ssize_t n = read_not_cancel (fd, &id, sizeof (id)); - __close (fd); + close_not_cancel_no_status (fd); if (n == sizeof (id)) return id; diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c index 5043f62880..bb4d61a836 100644 --- a/sysdeps/unix/sysv/linux/libc_fatal.c +++ b/sysdeps/unix/sysv/linux/libc_fatal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,1994,1995,1997,2000,2002 Free Software Foundation, Inc. +/* Copyright (C) 1993-1995,1997,2000,2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,13 +37,15 @@ __libc_fatal (message) while (len > 0) { - ssize_t count = INLINE_SYSCALL (write, 3, STDERR_FILENO, message, len); - if (count > 0) + INTERNAL_SYSCALL_DECL (err); + ssize_t count = INTERNAL_SYSCALL (write, err, 3, STDERR_FILENO, + message, len); + if (! INTERNAL_SYSCALL_ERROR_P (count, err)) { message += count; len -= count; } - else if (count < 0 && errno != EINTR) + else if (INTERNAL_SYSCALL_ERRNO (count, err) != EINTR) break; } diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h new file mode 100644 index 0000000000..e2cb3b24a1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -0,0 +1,54 @@ +/* Uncancelable versions of cancelable interfaces. Linux version. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +/* Uncancelable open. */ +#ifdef INLINE_SYSCALL +# define open_not_cancel(name, flags, mode...) \ + ({ int _mode = (0, ##mode); \ + INLINE_SYSCALL (open, 3, name, flags, _mode); }) +#endif + +/* Uncancelable close. */ +#ifdef INLINE_SYSCALL +# define close_not_cancel_no_status(fd) \ + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (close, err, 1, fd); }) +#endif + +/* Uncancelable read. */ +#ifdef INLINE_SYSCALL +# define read_not_cancel(fd, buf, n) \ + INLINE_SYSCALL (read, 3, fd, buf, n) +#endif + +/* Uncancelable write. */ +#ifdef INLINE_SYSCALL +# define write_not_cancel(fd, buf, n) \ + INLINE_SYSCALL (write, 3, fd, buf, n) +#endif + +/* Uncancelable writev. */ +#ifdef INLINE_SYSCALL +# define writev_not_cancel_no_status(fd, iov, n) \ + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (writev, err, 3, fd, iov, n); }) +#endif diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h index 9568baf89f..1fd64b2ac0 100644 --- a/sysvipc/sys/msg.h +++ b/sysvipc/sys/msg.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1999,2000,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -62,13 +62,19 @@ extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; /* Get messages queue. */ extern int msgget (key_t __key, int __msgflg) __THROW; -/* Receive message from message queue. */ +/* Receive message from message queue. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int msgrcv (int __msqid, void *__msgp, size_t __msgsz, - long int __msgtyp, int __msgflg) __THROW; + long int __msgtyp, int __msgflg); + +/* Send message to message queue. -/* Send message to message queue. */ + This function is a cancellation point and therefore not marked with + __THROW. */ extern int msgsnd (int __msqid, __const void *__msgp, size_t __msgsz, - int __msgflg) __THROW; + int __msgflg); __END_DECLS diff --git a/termios/termios.h b/termios/termios.h index 2c66457e2a..9698b1fbd0 100644 --- a/termios/termios.h +++ b/termios/termios.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,96,97,98,99 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,94,96,97,98,99, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -80,8 +80,11 @@ extern void cfmakeraw (struct termios *__termios_p) __THROW; /* Send zero bits on FD. */ extern int tcsendbreak (int __fd, int __duration) __THROW; -/* Wait for pending output to be written on FD. */ -extern int tcdrain (int __fd) __THROW; +/* Wait for pending output to be written on FD. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int tcdrain (int __fd); /* Flush pending data on FD. Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */ diff --git a/time/time.h b/time/time.h index febd0cb2a8..27e0d8bc36 100644 --- a/time/time.h +++ b/time/time.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991-1999,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -317,9 +317,12 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); # ifdef __USE_POSIX199309 -/* Pause execution for a number of nanoseconds. */ +/* Pause execution for a number of nanoseconds. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int nanosleep (__const struct timespec *__requested_time, - struct timespec *__remaining) __THROW; + struct timespec *__remaining); /* Get resolution of clock CLOCK_ID. */ @@ -333,10 +336,13 @@ extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp) __THROW; # ifdef __USE_XOPEN2K -/* High-resolution sleep with the specified clock. */ +/* High-resolution sleep with the specified clock. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int clock_nanosleep (clockid_t __clock_id, int __flags, __const struct timespec *__req, - struct timespec *__rem) __THROW; + struct timespec *__rem); /* Return clock ID for CPU-time clock. */ extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; @@ -382,8 +388,11 @@ extern int getdate_err; /* Parse the given string as a date specification and return a value representing the value. The templates from the file identified by the environment variable DATEMSK are used. In case of an error - `getdate_err' is set. */ -extern struct tm *getdate (__const char *__string) __THROW; + `getdate_err' is set. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern struct tm *getdate (__const char *__string); # endif # ifdef __USE_GNU @@ -391,9 +400,14 @@ extern struct tm *getdate (__const char *__string) __THROW; and the static buffer to return the result in, we provide a thread-safe variant. The functionality is the same. The result is returned in the buffer pointed to by RESBUFP and in case of an error the return - value is != 0 with the same values as given above for `getdate_err'. */ + value is != 0 with the same values as given above for `getdate_err'. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int getdate_r (__const char *__restrict __string, - struct tm *__restrict __resbufp) __THROW; + struct tm *__restrict __resbufp); # endif __END_DECLS diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index 9b2f721076..8cdd79bb70 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-99,2000,01,02 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -577,27 +577,39 @@ __BEGIN_NAMESPACE_C99 extern int fwide (__FILE *__fp, int __mode) __THROW; -/* Write formatted output to STREAM. */ +/* Write formatted output to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int fwprintf (__FILE *__restrict __stream, __const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; -/* Write formatted output to stdout. */ + /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; +/* Write formatted output to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int wprintf (__const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; + /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; /* Write formatted output of at most N characters to S. */ extern int swprintf (wchar_t *__restrict __s, size_t __n, __const wchar_t *__restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */; -/* Write formatted output to S from argument list ARG. */ +/* Write formatted output to S from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vfwprintf (__FILE *__restrict __s, __const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; -/* Write formatted output to stdout from argument list ARG. */ + /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; +/* Write formatted output to stdout from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vwprintf (__const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; + /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; /* Write formatted output of at most N character to S from argument list ARG. */ extern int vswprintf (wchar_t *__restrict __s, size_t __n, @@ -606,13 +618,19 @@ extern int vswprintf (wchar_t *__restrict __s, size_t __n, __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; -/* Read formatted input from STREAM. */ +/* Read formatted input from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int fwscanf (__FILE *__restrict __stream, __const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; -/* Read formatted input from stdin. */ + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +/* Read formatted input from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int wscanf (__const wchar_t *__restrict __format, ...) - __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; + /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; /* Read formatted input from S. */ extern int swscanf (__const wchar_t *__restrict __s, __const wchar_t *__restrict __format, ...) @@ -624,15 +642,21 @@ __END_NAMESPACE_C99 #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 -/* Read formatted input from S into argument list ARG. */ +/* Read formatted input from S into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vfwscanf (__FILE *__restrict __s, __const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; -/* Read formatted input from stdin into argument list ARG. */ + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +/* Read formatted input from stdin into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ extern int vwscanf (__const wchar_t *__restrict __format, __gnuc_va_list __arg) - __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; + /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; /* Read formatted input from S into argument list ARG. */ extern int vswscanf (__const wchar_t *__restrict __s, __const wchar_t *__restrict __format, @@ -644,62 +668,113 @@ __END_NAMESPACE_C99 __BEGIN_NAMESPACE_C99 -/* Read a character from STREAM. */ -extern wint_t fgetwc (__FILE *__stream) __THROW; -extern wint_t getwc (__FILE *__stream) __THROW; +/* Read a character from STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fgetwc (__FILE *__stream); +extern wint_t getwc (__FILE *__stream); -/* Read a character from stdin. */ -extern wint_t getwchar (void) __THROW; +/* Read a character from stdin. + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern wint_t getwchar (void); -/* Write a character to STREAM. */ -extern wint_t fputwc (wchar_t __wc, __FILE *__stream) __THROW; -extern wint_t putwc (wchar_t __wc, __FILE *__stream) __THROW; -/* Write a character to stdout. */ -extern wint_t putwchar (wchar_t __wc) __THROW; +/* Write a character to STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fputwc (wchar_t __wc, __FILE *__stream); +extern wint_t putwc (wchar_t __wc, __FILE *__stream); + +/* Write a character to stdout. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t putwchar (wchar_t __wc); /* Get a newline-terminated wide character string of finite length - from STREAM. */ + from STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); + +/* Write a string to STREAM. -/* Write a string to STREAM. */ + This function is a possible cancellation points and therefore not + marked with __THROW. */ extern int fputws (__const wchar_t *__restrict __ws, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); + +/* Push a character back onto the input buffer of STREAM. -/* Push a character back onto the input buffer of STREAM. */ -extern wint_t ungetwc (wint_t __wc, __FILE *__stream) __THROW; + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t ungetwc (wint_t __wc, __FILE *__stream); __END_NAMESPACE_C99 #ifdef __USE_GNU /* These are defined to be equivalent to the `char' functions defined - in POSIX.1:1996. */ -extern wint_t getwc_unlocked (__FILE *__stream) __THROW; -extern wint_t getwchar_unlocked (void) __THROW; + in POSIX.1:1996. -/* This is the wide character version of a GNU extension. */ -extern wint_t fgetwc_unlocked (__FILE *__stream) __THROW; + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t getwc_unlocked (__FILE *__stream); +extern wint_t getwchar_unlocked (void); -/* Faster version when locking is not necessary. */ -extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW; +/* This is the wide character version of a GNU extension. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fgetwc_unlocked (__FILE *__stream); + +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); /* These are defined to be equivalent to the `char' functions defined - in POSIX.1:1996. */ -extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW; -extern wint_t putwchar_unlocked (wchar_t __wc) __THROW; + in POSIX.1:1996. + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); +extern wint_t putwchar_unlocked (wchar_t __wc); -/* This function does the same as `fgetws' but does not lock the stream. */ + +/* This function does the same as `fgetws' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); + +/* This function does the same as `fputws' but does not lock the stream. -/* This function does the same as `fputws' but does not lock the stream. */ + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ extern int fputws_unlocked (__const wchar_t *__restrict __ws, - __FILE *__restrict __stream) __THROW; + __FILE *__restrict __stream); #endif |