home *** CD-ROM | disk | FTP | other *** search
- /*
- * FCNTL.H
- */
-
- #ifndef _FCNTL_H
- #define _FCNTL_H
-
- #define O_RDONLY 0x00 /* read only */
- #define O_WRONLY 0x01 /* write only */
- #define O_RDWR 0x02 /* read/write */
- #define O_ACCMODE 0x03 /* used to mask off file access mode */
-
- /* file sharing modes (not POSIX) */
- #define O_COMPAT 0x00 /* old TOS compatibility mode */
- #define O_DENYRW 0x10 /* deny both reads and writes */
- #define O_DENYW 0x20
- #define O_DENYR 0x30
- #define O_DENYNONE 0x40 /* don't deny anything */
- #define O_SHMODE 0x70 /* mask for file sharing mode */
-
- #define O_NDELAY 0x100 /* Non-blocking I/O */
- #define O_SYNC 0x00 /* sync after writes (not implemented) */
-
- /* the following flags are not passed to the OS */
- #define O_CREAT 0x200 /* create new file if needed */
- #define O_TRUNC 0x400 /* make file 0 length */
- #define O_EXCL 0x800 /* error if file exists */
- #define O_APPEND 0x1000 /* position at EOF */
-
- /*
- * defines for the access() function
- */
- #define F_OK 0
- #define X_OK 1
- #define W_OK 2
- #define R_OK 4
-
- /*
- * defines for fcntl()
- */
- #define F_DUPFD 0 /* Duplicate fildes */
- #define F_GETFD 1 /* Get fildes flags */
- #define F_SETFD 2 /* Set fildes flags */
- #define F_GETFL 3 /* Get file flags */
- #define F_SETFL 4 /* Set file flags */
- #define F_GETLK 5 /* Get file lock */
- #define F_SETLK 6 /* Set file lock */
-
- struct flock {
- short l_type;
- #define F_RDLCK O_RDONLY
- #define F_WRLCK O_WRONLY
- #define F_UNLCK 3
- short l_whence;
- long l_start;
- long l_len;
- short l_pid;
- };
-
- #ifndef _COMPILER_H
- #include <compiler.h>
- #endif
-
- __EXTERN int fcntl __PROTO((int, int, void *));
- /* maybe more later */
-
- /*
- * stuff for speeding up isatty(), and other library internal defines
- */
-
- #define __NHANDLES 40
- #ifdef __MSHORT__
- #define __SMALLEST_VALID_HANDLE (-3)
- #else
- #define __SMALLEST_VALID_HANDLE (0)
- #endif
-
- #define __OPEN_INDEX(fd) ((short)(fd) + 3)
-
- struct __open_file {
- short status; /* whether or not it's a tty */
- short flags; /* if a tty, its flags */
- };
-
- extern struct __open_file __open_stat[__NHANDLES];
-
- #define FH_UNKNOWN 0
- #define FH_ISATTY 1
- #define FH_ISAFILE 2
-
- #ifndef _COMPILER_H
- #include <compiler.h>
- #endif
-
- __EXTERN int fcntl __PROTO((int f, int cmd, void *arg));
-
- #endif /* _FCNTL_H */
-