xref: /haiku/src/system/libroot/posix/glibc/include/sys/stat.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 #ifndef _SYS_STAT_H
2 #include_next <sys/stat.h>
3 #define _SYS_STAT_H     1
4 #define _STAT_VER       0
5 #include <bits/stat.h>
6 
7 /* Now define the internal interfaces. */
8 extern int __stat (__const char *__file, struct stat *__buf);
9 extern int __fstat (int __fd, struct stat *__buf);
10 extern int __lstat (__const char *__file, struct stat *__buf);
11 extern int __chmod (__const char *__file, __mode_t __mode);
12 extern int __fchmod (int __fd, __mode_t __mode);
13 extern __mode_t __umask (__mode_t __mask);
14 extern int __mkdir (__const char *__path, __mode_t __mode);
15 extern int __mknod (__const char *__path,
16 		    __mode_t __mode, __dev_t __dev);
17 #if 0
18 #if !defined NOT_IN_libc || defined IS_IN_rtld
19 hidden_proto (__fxstat)
20 hidden_proto (__fxstat64)
21 hidden_proto (__lxstat)
22 hidden_proto (__lxstat64)
23 hidden_proto (__xstat)
24 hidden_proto (__xstat64)
25 #endif
26 extern __inline__ int __stat (__const char *__path, struct stat *__statbuf)
27 {
28   return __xstat (_STAT_VER, __path, __statbuf);
29 }
30 libc_hidden_proto (__xmknod)
31 extern __inline__ int __mknod (__const char *__path, __mode_t __mode,
32 			       __dev_t __dev)
33 {
34   return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
35 }
36 
37 
38 /* The `stat', `fstat', `lstat' functions have to be handled special since
39    even while not compiling the library with optimization calls to these
40    functions in the shared library must reference the `xstat' etc functions.
41    We have to use macros but we cannot define them in the normal headers
42    since on user level we must use real functions.  */
43 #define stat(fname, buf) __xstat (_STAT_VER, fname, buf)
44 #define lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
45 #define __lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
46 #define lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
47 #define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
48 #define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
49 #define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
50 #define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
51 #endif
52 #endif
53