home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Club Elmshorn Atari PD
/
CCE_PD.iso
/
pc
/
0400
/
CCE_0423.ZIP
/
CCE_0423.PD
/
INCLUD83.ZOO
/
fcntl.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-20
|
3KB
|
128 lines
/*
* FCNTL.H
*/
#ifndef _FCNTL_H
#define _FCNTL_H
#ifndef _COMPILER_H
#include <compiler.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#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 */
#ifdef __MINT__
# define O_SYNC 0x00 /* sync after writes (not implemented) */
#endif
/* 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 */
#ifndef __MINT__
# define O_PIPE 0x2000 /* serial pipe */
#endif
/*
* 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 */
#ifdef __MINT__
#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;
};
#endif /* __MINT__ */
#ifdef __MINT__
#define __NHANDLES 40
struct __open_file {
short status; /* whether or not it's a tty */
short flags; /* if a tty, its flags */
};
#else
#define __NHANDLES 80
struct __open_file {
unsigned short append:1; /* 1 if O_APPEND set for this file */
unsigned short nodelay:1; /* 1 if O_NDELAY set for this file */
unsigned short pipe:1; /* 1 if O_PIPE set for this file */
unsigned short eclose:1; /* 1 if close on exec is set for this file */
unsigned short status:2; /* status FH_UNKNOWN | ISATTY | ISAFILE */
char *filename; /* filename of open file */
};
#endif /* __MINT__ */
extern struct __open_file __open_stat[__NHANDLES];
/* NOTE: this array is indexed by (__OPEN_INDEX(fd)) */
/* smallest valid gemdos handle */
/* note handle is only word (16 bit) negative, not long negative,
and since Fopen etc are declared as returning long in osbind.h
the sign-extension will not happen -- thanks ers
*/
#ifdef __MSHORT__
#define __SMALLEST_VALID_HANDLE (-3)
#else
#define __SMALLEST_VALID_HANDLE (0)
#endif
#define __OPEN_INDEX(x) (((short)(x)) + 3)
#define FH_UNKNOWN 0
#define FH_ISATTY 1
#define FH_ISAFILE 2
__EXTERN int fcntl __PROTO((int f, int cmd, ...));
#ifdef __cplusplus
}
#endif
#endif /* _FCNTL_H */