/* Copyright (c) 1993 Xerox Corporation. All rights reserved. */ /* */ #ifndef __XR_fcntl_h #define __XR_fcntl_h #include #define XR_O_RDONLY 0 #define XR_O_WRONLY 1 #define XR_O_RDWR 2 #define XR_O_APPEND 0x0008 #define XR_O_CREAT 0x0200 #define XR_O_TRUNC 0x0400 #define XR_O_EXCL 0x0800 #define XR_O_NOCTTY 0x8000 #define XR_O_NONBLOCK 0x4000 #define XR_O_ACCMODE 0x3 /* close on exec request */ #define XR_FD_CLOEXEC 1 /* fcntl(2) requests */ #define XR_F_DUPFD 0 /* Duplicate fildes */ #define XR_F_GETFD 1 /* Get fildes flags (close on exec) */ #define XR_F_SETFD 2 /* Set fildes flags (close on exec) */ #define XR_F_GETFL 3 /* Get file flags */ #define XR_F_SETFL 4 /* Set file flags */ #define XR_F_GETOWN 5 /* Get owner - for ASYNC */ #define XR_F_SETOWN 6 /* Set owner - for ASYNC */ #define XR_F_GETLK 7 /* Get record-locking information */ #define XR_F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */ #define XR_F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */ /* fcntl(2) flags (l_type field of flock structure) */ #define XR_F_RDLCK 1 /* read lock */ #define XR_F_WRLCK 2 /* write lock */ #define XR_F_UNLCK 3 /* remove lock(s) */ struct XR_flock { short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ short l_whence; /* flag to choose starting offset */ long l_start; /* relative offset, in bytes */ long l_len; /* length, in bytes; 0 means lock to EOF */ short l_pid; /* returned with F_GETLK */ short l_xxx; /* reserved for future use */ }; #if defined(PCR_OS_SUNOS4) # include # define XR_fcntl_CmdToHost(cmd) (cmd) # define XR_fcntl_FlagToHost(flag) (flag) # define XR_fcntl_FlagFromHost(flag) (flag) # define XR_fcntl_FDToHost(fd) (fd) # define XR_fcntl_FDFromHost(fd) (fd) extern void XR_fcntl_FLockToHost(struct flock *hfl, struct XR_flock *xfl); extern void XR_fcntl_FLockFromHost(struct XR_flock *xfl, struct flock *hfl); #elif defined(PCR_OS_SUNOS5) # include extern int XR_fcntl_CmdToHost(int cmd); extern int XR_fcntl_FlagToHost(int flag); extern int XR_fcntl_FlagFromHost(int flag); extern int XR_fcntl_FDToHost(int fd); extern int XR_fcntl_FDFromHost(int fd); extern void XR_fcntl_FLockToHost(struct flock *hfl, struct XR_flock *xfl); extern void XR_fcntl_FLockFromHost(struct XR_flock *xfl, struct flock *hfl); #else # error os ? #endif #endif /* !__XR_fcntl_h */