?? fcntl.h
字號:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/fcntl.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00900 /* The <fcntl.h> header is needed by the open() and fcntl() system calls,
00901 * which have a variety of parameters and flags. They are described here.
00902 * The formats of the calls to each of these are:
00903 *
00904 * open(path, oflag [,mode]) open a file
00905 * fcntl(fd, cmd [,arg]) get or set file attributes
00906 *
00907 */
00908
00909 #ifndef _FCNTL_H
00910 #define _FCNTL_H
00911
00912 /* These values are used for cmd in fcntl(). POSIX Table 6-1. */
00913 #define F_DUPFD 0 /* duplicate file descriptor */
00914 #define F_GETFD 1 /* get file descriptor flags */
00915 #define F_SETFD 2 /* set file descriptor flags */
00916 #define F_GETFL 3 /* get file status flags */
00917 #define F_SETFL 4 /* set file status flags */
00918 #define F_GETLK 5 /* get record locking information */
00919 #define F_SETLK 6 /* set record locking information */
00920 #define F_SETLKW 7 /* set record locking info; wait if blocked */
00921
00922 /* File descriptor flags used for fcntl(). POSIX Table 6-2. */
00923 #define FD_CLOEXEC 1 /* close on exec flag for third arg of fcntl */
00924
00925 /* L_type values for record locking with fcntl(). POSIX Table 6-3. */
00926 #define F_RDLCK 1 /* shared or read lock */
00927 #define F_WRLCK 2 /* exclusive or write lock */
00928 #define F_UNLCK 3 /* unlock */
00929
00930 /* Oflag values for open(). POSIX Table 6-4. */
00931 #define O_CREAT 00100 /* creat file if it doesn't exist */
00932 #define O_EXCL 00200 /* exclusive use flag */
00933 #define O_NOCTTY 00400 /* do not assign a controlling terminal */
00934 #define O_TRUNC 01000 /* truncate flag */
00935
00936 /* File status flags for open() and fcntl(). POSIX Table 6-5. */
00937 #define O_APPEND 02000 /* set append mode */
00938 #define O_NONBLOCK 04000 /* no delay */
00939
00940 /* File access modes for open() and fcntl(). POSIX Table 6-6. */
00941 #define O_RDONLY 0 /* open(name, O_RDONLY) opens read only */
00942 #define O_WRONLY 1 /* open(name, O_WRONLY) opens write only */
00943 #define O_RDWR 2 /* open(name, O_RDWR) opens read/write */
00944
00945 /* Mask for use with file access modes. POSIX Table 6-7. */
00946 #define O_ACCMODE 03 /* mask for file access modes */
00947
00948 /* Struct used for locking. POSIX Table 6-8. */
00949 struct flock {
00950 short l_type; /* type: F_RDLCK, F_WRLCK, or F_UNLCK */
00951 short l_whence; /* flag for starting offset */
00952 off_t l_start; /* relative offset in bytes */
00953 off_t l_len; /* size; if 0, then until EOF */
00954 pid_t l_pid; /* process id of the locks' owner */
00955 };
00956
00957
00958 /* Function Prototypes. */
00959 #ifndef _ANSI_H
00960 #include <ansi.h>
00961 #endif
00962
00963 _PROTOTYPE( int creat, (const char *_path, Mode_t _mode) );
00964 _PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) );
00965 _PROTOTYPE( int open, (const char *_path, int _oflag, ...) );
00966
00967 #endif /* _FCNTL_H */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -