From 3fec316902712c8a7546405852fa50a0aa39d4f6 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 19 Aug 2002 18:04:25 +0000 Subject: Eliminate wrapping of struct stat and use the kernel version directly. Eliminate all the attendant baggage. Fix internal types to match kernel types more closely. -Erik --- include/sys/stat.h | 114 ----------------------------------------------------- 1 file changed, 114 deletions(-) (limited to 'include') diff --git a/include/sys/stat.h b/include/sys/stat.h index a2a669277..2b29e420f 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -275,122 +275,8 @@ extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev) __THROW; #endif - /* Create a new FIFO named PATH, with permission bits MODE. */ extern int mkfifo (__const char *__path, __mode_t __mode) __THROW; - -/* To allow the `struct stat' structure and the file type `mode_t' - bits to vary without changing shared library major version number, - the `stat' family of functions and `mknod' are in fact inline - wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', - which all take a leading version-number argument designating the - data structure and bits used. defines _STAT_VER with - the version number corresponding to `struct stat' as defined in - that file; and _MKNOD_VER with the version number corresponding to - the S_IF* macros defined therein. It is arranged that when not - inlined these function are always statically linked; that way a - dynamically-linked executable always encodes the version number - corresponding to the data structures it uses, so the `x' functions - in the shared library can adapt without needing to recompile all - callers. */ - -#ifndef _STAT_VER -# define _STAT_VER 0 -#endif -#ifndef _MKNOD_VER -# define _MKNOD_VER 0 -#endif - -/* 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 __xstat (int __ver, __const char *__filename, - struct stat *__stat_buf) __THROW; -extern int __lxstat (int __ver, __const char *__filename, - struct stat *__stat_buf) __THROW; -#else -# ifdef __REDIRECT -extern int __REDIRECT (__fxstat, (int __ver, int __fildes, - struct stat *__stat_buf) __THROW, - __fxstat64); -extern int __REDIRECT (__xstat, (int __ver, __const char *__filename, - struct stat *__stat_buf) __THROW, __xstat64); -extern int __REDIRECT (__lxstat, (int __ver, __const char *__filename, - struct stat *__stat_buf) __THROW, - __lxstat64); - -# else -# define __fxstat __fxstat64 -# define __xstat __xstat64 -# define __lxstat __lxstat64 -# endif -#endif - -#ifdef __USE_LARGEFILE64 -extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) - __THROW; -extern int __xstat64 (int __ver, __const char *__filename, - struct stat64 *__stat_buf) __THROW; -extern int __lxstat64 (int __ver, __const char *__filename, - struct stat64 *__stat_buf) __THROW; -#endif -extern int __xmknod (int __ver, __const char *__path, __mode_t __mode, - __dev_t *__dev) __THROW; - -#if defined __GNUC__ && __GNUC__ >= 2 -/* Inlined versions of the real stat and mknod functions. */ - -extern __inline__ int stat (__const char *__path, - struct stat *__statbuf) __THROW -{ - return __xstat (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -extern __inline__ int lstat (__const char *__path, - struct stat *__statbuf) __THROW -{ - return __lxstat (_STAT_VER, __path, __statbuf); -} -# endif - -extern __inline__ int fstat (int __fd, struct stat *__statbuf) __THROW -{ - return __fxstat (_STAT_VER, __fd, __statbuf); -} - -# if defined __USE_MISC || defined __USE_BSD -extern __inline__ int mknod (__const char *__path, __mode_t __mode, - __dev_t __dev) __THROW -{ - return __xmknod (_MKNOD_VER, __path, __mode, &__dev); -} -# endif - -# if defined __USE_LARGEFILE64 \ - && (! defined __USE_FILE_OFFSET64 \ - || (defined __REDIRECT && defined __OPTIMIZE__)) -extern __inline__ int stat64 (__const char *__path, - struct stat64 *__statbuf) __THROW -{ - return __xstat64 (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -extern __inline__ int lstat64 (__const char *__path, - struct stat64 *__statbuf) __THROW -{ - return __lxstat64 (_STAT_VER, __path, __statbuf); -} -# endif - -extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf) __THROW -{ - return __fxstat64 (_STAT_VER, __fd, __statbuf); -} -# endif - -#endif __END_DECLS -- cgit v1.2.3