From 8a1f658bd783e625d947933b6603dbcedb31f75b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 17 Sep 2004 08:44:34 +0000 Subject: Update. 2004-09-17 Ulrich Drepper * misc/sys/cdefs.h: Define __nonnull using nonnull function attribute for gcc 3.3 and higher. * io/fcntl.h: Add __nonnull where appropriate. * io/ftw.h: Likewise. * io/utime.h: Likewise. * io/sys/poll.h: Likewise. * io/sys/sendfile.h: Likewise. * io/sys/stat.h: Likewise. * io/sys/statfs.h: Likewise. * io/sys/statvfs.h: Likewise. * posix/unistd.h: Likewise. --- io/fcntl.h | 13 ++++++------ io/ftw.h | 16 ++++++++------- io/sys/sendfile.h | 6 +++--- io/sys/stat.h | 60 +++++++++++++++++++++++++++++++++---------------------- io/sys/statfs.h | 16 +++++++++------ io/sys/statvfs.h | 17 ++++++++++------ io/utime.h | 3 ++- 7 files changed, 78 insertions(+), 53 deletions(-) (limited to 'io') diff --git a/io/fcntl.h b/io/fcntl.h index b1a9f65387..ef9d5f9b81 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -69,16 +69,17 @@ extern int fcntl (int __fd, int __cmd, ...); This function is a cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern int open (__const char *__file, int __oflag, ...); +extern int open (__const char *__file, int __oflag, ...) __nonnull ((1)); #else # ifdef __REDIRECT -extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64); +extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64) + __nonnull ((1)); # else # define open open64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int open64 (__const char *__file, int __oflag, ...); +extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1)); #endif /* Create and open FILE, with mode MODE. This takes an `int' MODE @@ -87,17 +88,17 @@ extern int open64 (__const char *__file, int __oflag, ...); 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); +extern int creat (__const char *__file, __mode_t __mode) __nonnull ((1)); #else # ifdef __REDIRECT extern int __REDIRECT (creat, (__const char *__file, __mode_t __mode), - creat64); + creat64) __nonnull ((1)); # else # define creat creat64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int creat64 (__const char *__file, __mode_t __mode); +extern int creat64 (__const char *__file, __mode_t __mode) __nonnull ((1)); #endif #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ diff --git a/io/ftw.h b/io/ftw.h index 03973ccbbf..4bdff88c6f 100644 --- a/io/ftw.h +++ b/io/ftw.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,1996,1997,1998,1999,2003 Free Software Foundation, Inc. +/* Copyright (C) 1992,1996-1999,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -134,18 +134,19 @@ typedef int (*__nftw64_func_t) (__const char *__filename, 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); +extern int ftw (__const char *__dir, __ftw_func_t __func, int __descriptors) + __nonnull ((1, 2)); #else # ifdef __REDIRECT extern int __REDIRECT (ftw, (__const char *__dir, __ftw_func_t __func, - int __descriptors), ftw64); + int __descriptors), ftw64) __nonnull ((1, 2)); # else # define ftw ftw64 # endif #endif #ifdef __USE_LARGEFILE64 extern int ftw64 (__const char *__dir, __ftw64_func_t __func, - int __descriptors); + int __descriptors) __nonnull ((1, 2)); #endif #ifdef __USE_XOPEN_EXTENDED @@ -156,18 +157,19 @@ extern int ftw64 (__const char *__dir, __ftw64_func_t __func, marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int nftw (__const char *__dir, __nftw_func_t __func, int __descriptors, - int __flag); + int __flag) __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT (nftw, (__const char *__dir, __nftw_func_t __func, - int __descriptors, int __flag), nftw64); + int __descriptors, int __flag), nftw64) + __nonnull ((1, 2)); # else # define nftw nftw64 # endif # endif # ifdef __USE_LARGEFILE64 extern int nftw64 (__const char *__dir, __nftw64_func_t __func, - int __descriptors, int __flag); + int __descriptors, int __flag) __nonnull ((1, 2)); # endif #endif diff --git a/io/sys/sendfile.h b/io/sys/sendfile.h index 4c1367b6be..24256b5414 100644 --- a/io/sys/sendfile.h +++ b/io/sys/sendfile.h @@ -32,19 +32,19 @@ __BEGIN_DECLS case of error. */ #ifndef __USE_FILE_OFFSET64 extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset, - size_t __count) __THROW; + size_t __count) __THROW __nonnull ((3)); #else # ifdef __REDIRECT_NTH extern ssize_t __REDIRECT_NTH (sendfile, (int __out_fd, int __in_fd, __off64_t *__offset, - size_t __count), sendfile64); + size_t __count), sendfile64) __nonnull ((3)); # else # define sendfile sendfile64 # endif #endif #ifdef __USE_LARGEFILE64 extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset, - size_t __count) __THROW; + size_t __count) __THROW __nonnull ((3)); #endif __END_DECLS diff --git a/io/sys/stat.h b/io/sys/stat.h index abe68860cb..7075003922 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -205,16 +205,18 @@ __BEGIN_DECLS #ifndef __USE_FILE_OFFSET64 /* Get file attributes for FILE and put them in BUF. */ extern int stat (__const char *__restrict __file, - struct stat *__restrict __buf) __THROW; + struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); /* Get file attributes for the file, device, pipe, or socket that file descriptor FD is open on and put them in BUF. */ -extern int fstat (int __fd, struct stat *__buf) __THROW; +extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (stat, (__const char *__restrict __file, - struct stat *__restrict __buf), stat64); -extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64); + struct stat *__restrict __buf), stat64) + __nonnull ((1, 2)); +extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) + __nonnull ((2)); # else # define stat stat64 # define fstat fstat64 @@ -222,8 +224,8 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64); #endif #ifdef __USE_LARGEFILE64 extern int stat64 (__const char *__restrict __file, - struct stat64 *__restrict __buf) __THROW; -extern int fstat64 (int __fd, struct stat64 *__buf) __THROW; + struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); +extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED @@ -231,31 +233,35 @@ extern int fstat64 (int __fd, struct stat64 *__buf) __THROW; /* Get file attributes about FILE and put them in BUF. If FILE is a symbolic link, do not follow it. */ extern int lstat (__const char *__restrict __file, - struct stat *__restrict __buf) __THROW; + struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (lstat, (__const char *__restrict __file, - struct stat *__restrict __buf), lstat64); + struct stat *__restrict __buf), lstat64) + __nonnull ((1, 2)); # else # define lstat lstat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int lstat64 (__const char *__restrict __file, - struct stat64 *__restrict __buf) __THROW; + struct stat64 *__restrict __buf) + __THROW __nonnull ((1, 2)); # endif #endif /* Set file access permissions for FILE to MODE. If FILE is a symbolic link, this affects its target instead. */ -extern int chmod (__const char *__file, __mode_t __mode) __THROW; +extern int chmod (__const char *__file, __mode_t __mode) + __THROW __nonnull ((1)); #ifdef __USE_BSD /* Set file access permissions for FILE to MODE. If FILE is a symbolic link, this affects the link itself rather than its target. */ -extern int lchmod (__const char *__file, __mode_t __mode) __THROW; +extern int lchmod (__const char *__file, __mode_t __mode) + __THROW __nonnull ((1)); #endif /* Set file access permissions of the file FD is open on to MODE. */ @@ -275,19 +281,21 @@ extern __mode_t getumask (void) __THROW; #endif /* Create a new directory named PATH, with permission bits MODE. */ -extern int mkdir (__const char *__path, __mode_t __mode) __THROW; +extern int mkdir (__const char *__path, __mode_t __mode) + __THROW __nonnull ((1)); /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ #if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev) - __THROW; + __THROW __nonnull ((1)); #endif /* Create a new FIFO named PATH, with permission bits MODE. */ -extern int mkfifo (__const char *__path, __mode_t __mode) __THROW; +extern int mkfifo (__const char *__path, __mode_t __mode) + __THROW __nonnull ((1)); /* To allow the `struct stat' structure and the file type `mode_t' bits to vary without changing shared library major version number, @@ -313,19 +321,23 @@ extern int mkfifo (__const char *__path, __mode_t __mode) __THROW; /* Wrappers for stat and mknod system calls. */ #ifndef __USE_FILE_OFFSET64 -extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) __THROW; +extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) + __THROW __nonnull ((3)); extern int __xstat (int __ver, __const char *__filename, - struct stat *__stat_buf) __THROW; + struct stat *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat (int __ver, __const char *__filename, - struct stat *__stat_buf) __THROW; + struct stat *__stat_buf) __THROW __nonnull ((2, 3)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, - struct stat *__stat_buf), __fxstat64); + struct stat *__stat_buf), __fxstat64) + __nonnull ((3)); extern int __REDIRECT_NTH (__xstat, (int __ver, __const char *__filename, - struct stat *__stat_buf), __xstat64); + struct stat *__stat_buf), __xstat64) + __nonnull ((2, 3)); extern int __REDIRECT_NTH (__lxstat, (int __ver, __const char *__filename, - struct stat *__stat_buf), __lxstat64); + struct stat *__stat_buf), __lxstat64) + __nonnull ((2, 3)); # else # define __fxstat __fxstat64 @@ -336,14 +348,14 @@ extern int __REDIRECT_NTH (__lxstat, (int __ver, __const char *__filename, #ifdef __USE_LARGEFILE64 extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) - __THROW; + __THROW __nonnull ((3)); extern int __xstat64 (int __ver, __const char *__filename, - struct stat64 *__stat_buf) __THROW; + struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat64 (int __ver, __const char *__filename, - struct stat64 *__stat_buf) __THROW; + struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); #endif extern int __xmknod (int __ver, __const char *__path, __mode_t __mode, - __dev_t *__dev) __THROW; + __dev_t *__dev) __THROW __nonnull ((2, 4)); #if defined __GNUC__ && __GNUC__ >= 2 /* Inlined versions of the real stat and mknod functions. */ diff --git a/io/sys/statfs.h b/io/sys/statfs.h index c93d8f1d44..3b2226b41e 100644 --- a/io/sys/statfs.h +++ b/io/sys/statfs.h @@ -29,34 +29,38 @@ __BEGIN_DECLS /* Return information about the filesystem on which FILE resides. */ #ifndef __USE_FILE_OFFSET64 -extern int statfs (__const char *__file, struct statfs *__buf) __THROW; +extern int statfs (__const char *__file, struct statfs *__buf) + __THROW __nonnull ((1, 2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (statfs, (__const char *__file, struct statfs *__buf), - statfs64); + statfs64) __nonnull ((1, 2)); # else # define statfs statfs64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int statfs64 (__const char *__file, struct statfs64 *__buf) __THROW; +extern int statfs64 (__const char *__file, struct statfs64 *__buf) + __THROW __nonnull ((1, 2)); #endif /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 -extern int fstatfs (int __fildes, struct statfs *__buf) __THROW; +extern int fstatfs (int __fildes, struct statfs *__buf) + __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf), - fstatfs64); + fstatfs64) __nonnull ((2)); # else # define fstatfs fstatfs64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int fstatfs64 (int __fildes, struct statfs64 *__buf) __THROW; +extern int fstatfs64 (int __fildes, struct statfs64 *__buf) + __THROW __nonnull ((2)); #endif __END_DECLS diff --git a/io/sys/statvfs.h b/io/sys/statvfs.h index 7c6c90fae0..909662bc50 100644 --- a/io/sys/statvfs.h +++ b/io/sys/statvfs.h @@ -50,35 +50,40 @@ __BEGIN_DECLS /* Return information about the filesystem on which FILE resides. */ #ifndef __USE_FILE_OFFSET64 extern int statvfs (__const char *__restrict __file, - struct statvfs *__restrict __buf) __THROW; + struct statvfs *__restrict __buf) + __THROW __nonnull ((1, 2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (statvfs, (__const char *__restrict __file, - struct statvfs *__restrict __buf), statvfs64); + struct statvfs *__restrict __buf), statvfs64) + __nonnull ((1, 2)); # else # define statvfs statvfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int statvfs64 (__const char *__restrict __file, - struct statvfs64 *__restrict __buf) __THROW; + struct statvfs64 *__restrict __buf) + __THROW __nonnull ((1, 2)); #endif /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 -extern int fstatvfs (int __fildes, struct statvfs *__buf) __THROW; +extern int fstatvfs (int __fildes, struct statvfs *__buf) + __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatvfs, (int __fildes, struct statvfs *__buf), - fstatvfs64); + fstatvfs64) __nonnull ((2)); # else # define fstatvfs fstatvfs64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int fstatvfs64 (int __fildes, struct statvfs64 *__buf) __THROW; +extern int fstatvfs64 (int __fildes, struct statvfs64 *__buf) + __THROW __nonnull ((2)); #endif __END_DECLS diff --git a/io/utime.h b/io/utime.h index 587e628f1d..4b861451bc 100644 --- a/io/utime.h +++ b/io/utime.h @@ -44,7 +44,8 @@ struct utimbuf /* Set the access and modification times of FILE to those given in *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ extern int utime (__const char *__file, - __const struct utimbuf *__file_times) __THROW; + __const struct utimbuf *__file_times) + __THROW __nonnull ((1, 2)); __END_DECLS -- cgit v1.2.3