Files
rosetta/lib/libc/include/fcntl.h
T

99 lines
3.1 KiB
C
Raw Normal View History

2026-03-21 10:42:00 +00:00
#ifndef FCNTL_H_
#define FCNTL_H_
#include <sys/types.h>
2026-03-21 10:42:00 +00:00
#define O_RDONLY 0x0000 /* open for reading only */
#define O_WRONLY 0x0001 /* open for writing only */
#define O_RDWR 0x0002 /* open for reading and writing */
#define O_ACCMODE 0x0003 /* mask for above modes */
#define O_NONBLOCK 0x00000004 /* no delay */
#define O_APPEND 0x00000008 /* set append mode */
#define O_SHLOCK 0x00000010 /* open with shared file lock */
#define O_EXLOCK 0x00000020 /* open with exclusive file lock */
#define O_ASYNC 0x00000040 /* signal pgrp when data ready */
#define O_FSYNC O_SYNC /* source compatibility: do not use */
#define O_NOFOLLOW 0x00000100 /* don't follow symlinks */
#define O_CREAT 0x00000200 /* create if nonexistant */
#define O_TRUNC 0x00000400 /* truncate to zero length */
#define O_EXCL 0x00000800 /* error if already exists */
#define O_RESOLVE_BENEATH \
0x00001000 /* only for open(2), same value as FMARK \
*/
#define O_EVTONLY \
0x00008000 /* descriptor requested for event notifications only */
#define O_NOCTTY 0x00020000 /* don't assign controlling terminal */
#define O_DIRECTORY 0x00100000
#define O_SYMLINK 0x00200000 /* allow open of a symlink */
#define O_CLOEXEC 0x01000000 /* implicitly set FD_CLOEXEC */
#define O_NOFOLLOW_ANY 0x20000000 /* no symlinks allowed in path */
#define O_EXEC 0x40000000 /* open file for execute only */
#define O_SEARCH (O_EXEC | O_DIRECTORY) /* open directory for search only */
#define AT_FDCWD -2
#define AT_EACCESS 0x0010 /* Use effective ids in access check */
#define AT_SYMLINK_NOFOLLOW \
0x0020 /* Act on the symlink itself not the target */
#define AT_SYMLINK_FOLLOW 0x0040 /* Act on target of symlink */
#define AT_REMOVEDIR 0x0080 /* Path refers to directory */
#define AT_REALDEV \
0x0200 /* Return real device inodes resides on for fstatat(2) */
#define AT_FDONLY \
0x0400 /* Use only the fd and Ignore the path for fstatat(2) */
#define AT_SYMLINK_NOFOLLOW_ANY \
0x0800 /* Path should not contain any symlinks */
#define S_IRWXU 00700
#define S_IRUSR 00400
#define S_IWUSR 00200
#define S_IXUSR 00100
#define S_IRWXG 00070
#define S_IRGRP 00040
#define S_IWGRP 00020
#define S_IXGRP 00010
#define S_IRWXO 00007
#define S_IROTH 00004
#define S_IWOTH 00002
#define S_IXOTH 00001
#define S_ISUID 0004000
#define S_ISGID 0002000
#define S_ISVTX 0001000
#define R_OK 4
#define W_OK 2
#define X_OK 1
#define F_OK 0
#define F_RDLCK 0
#define F_WRLCK 1
#define F_SETLKW 7
struct flock {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};
struct flock64 {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};
extern int fcntl(int fd, int op, ...);
2026-03-21 10:42:00 +00:00
#endif