123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- #ifndef _FCNTL_H
- #define _FCNTL_H 1
- #include <features.h>
- __BEGIN_DECLS
- #include <bits/fcntl.h>
- #ifdef __USE_XOPEN
- # include <sys/stat.h>
- #endif
- #ifdef __USE_MISC
- # ifndef R_OK
- # define R_OK 4
- # define W_OK 2
- # define X_OK 1
- # define F_OK 0
- # endif
- #endif
- #ifdef __USE_XOPEN
- # define SEEK_SET 0
- # define SEEK_CUR 1
- # define SEEK_END 2
- #endif
- #ifdef __USE_ATFILE
- # define AT_FDCWD -100
- # define AT_SYMLINK_NOFOLLOW 0x100
- # define AT_REMOVEDIR 0x200
- # define AT_SYMLINK_FOLLOW 0x400
- # ifdef __USE_GNU
- # define AT_NO_AUTOMOUNT 0x800
- # define AT_EMPTY_PATH 0x1000
- # define AT_STATX_SYNC_TYPE 0x6000
- # define AT_STATX_SYNC_AS_STAT 0x0000
- # define AT_STATX_FORCE_SYNC 0x2000
- # define AT_STATX_DONT_SYNC 0x4000
- # define AT_RECURSIVE 0x8000
- # endif
- # define AT_EACCESS 0x200
- #endif
- #if !defined(__USE_FILE_OFFSET64) || defined(__LP64__)
- extern int fcntl (int __fd, int __cmd, ...);
- # ifdef _LIBC
- extern int __fcntl_nocancel(int, int, long) attribute_hidden;
- libc_hidden_proto(fcntl)
- # endif
- #else
- # ifdef __REDIRECT
- extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
- # else
- # define fcntl fcntl64
- # endif
- #endif
- #if defined(__USE_LARGEFILE64) && !defined(__LP64__)
- extern int fcntl64 (int __fd, int __cmd, ...);
- # ifdef _LIBC
- extern int __fcntl64_nocancel(int, int, long) attribute_hidden;
- libc_hidden_proto(fcntl64)
- # endif
- #endif
- #ifndef __USE_FILE_OFFSET64
- extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
- libc_hidden_proto(open)
- # ifdef _LIBC
- extern int __open2_nocancel(const char *, int) __nonnull ((1)) attribute_hidden;
- extern int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden;
- # endif
- #else
- # ifdef __REDIRECT
- 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, ...) __nonnull ((1));
- libc_hidden_proto(open64)
- #endif
- #ifdef __USE_ATFILE
- # ifndef __USE_FILE_OFFSET64
- extern int openat (int __fd, const char *__file, int __oflag, ...)
- __nonnull ((2));
- libc_hidden_proto(openat)
- # else
- # ifdef __REDIRECT
- extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
- ...), openat64) __nonnull ((2));
- # else
- # define openat openat64
- # endif
- # endif
- extern int openat64 (int __fd, const char *__file, int __oflag, ...)
- __nonnull ((2));
- #endif
- #ifndef __USE_FILE_OFFSET64
- 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) __nonnull ((1));
- # else
- # define creat creat64
- # endif
- #endif
- #ifdef __USE_LARGEFILE64
- extern int creat64 (const char *__file, __mode_t __mode) __nonnull ((1));
- #endif
- #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
- && !defined __USE_POSIX))
- # define F_ULOCK 0
- # define F_LOCK 1
- # define F_TLOCK 2
- # define F_TEST 3
- # ifndef __USE_FILE_OFFSET64
- extern int lockf (int __fd, int __cmd, __off_t __len);
- libc_hidden_proto(lockf)
- # else
- # ifdef __REDIRECT
- 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);
- # endif
- #endif
- #if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
- # ifndef __USE_FILE_OFFSET64
- extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len,
- int __advise) __THROW;
- # else
- # ifdef __REDIRECT_NTH
- extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
- __off64_t __len, int __advise),
- posix_fadvise64);
- # else
- # define posix_fadvise posix_fadvise64
- # endif
- # endif
- # ifdef __USE_LARGEFILE64
- extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
- int __advise) __THROW;
- # endif
- #endif
- #if defined __UCLIBC_HAS_ADVANCED_REALTIME__
- # ifndef __USE_FILE_OFFSET64
- extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
- # else
- # ifdef __REDIRECT
- extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
- __off64_t __len),
- posix_fallocate64);
- # else
- # define posix_fallocate posix_fallocate64
- # endif
- # endif
- # ifdef __USE_LARGEFILE64
- extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
- # endif
- #endif
- #if (defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU) || defined _LIBC
- # define FALLOC_FL_KEEP_SIZE 1
- # define FALLOC_FL_PUNCH_HOLE 2
- # ifndef __USE_FILE_OFFSET64
- extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
- # else
- # ifdef __REDIRECT
- extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
- # else
- # define fallocate fallocate64
- # endif
- # endif
- # ifdef __USE_LARGEFILE64
- extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len);
- # endif
- #endif
- #if (defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU)
- struct file_handle {
- unsigned handle_bytes;
- int handle_type;
- unsigned char f_handle[];
- };
- #define MAX_HANDLE_SZ 128
- int name_to_handle_at(int dirfd, const char *pathname,
- struct file_handle *handle, int *mount_id, int flags);
- int open_by_handle_at(int mount_fd, struct file_handle *handle, int flags);
- #endif
- #ifdef __USE_GNU
- # define F_SETOWN_EX 15
- # define F_GETOWN_EX 16
- enum __pid_type
- {
- F_OWNER_TID = 0,
- F_OWNER_PID,
- F_OWNER_PGRP,
- F_OWNER_GID = F_OWNER_PGRP
- };
- struct f_owner_ex
- {
- enum __pid_type type;
- __pid_t pid;
- };
- #endif
- __END_DECLS
- #endif
|