fcntl.mh
来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 240 行
MH
240 行
/*
* fcntl.h File control options used by open
*
:include crwatqnx.sp
*/
#ifndef _FCNTL_H_INCLUDED
#define _FCNTL_H_INCLUDED
:include readonly.sp
:include cpluspro.sp
#ifndef _COMDEF_H_INCLUDED
#include <_comdef.h>
#endif
:segment LINUX
:include lnxkpack.sp
:include wchar_t.sp
#ifndef __TYPES_H_INCLUDED
#include <sys/types.h>
#endif
:include incdir.sp
#include _ARCH_INCLUDE(fcntl.h)
/* For now Linux has synchronicity options for data and read operations.
* We define the symbols here but let them do the same as O_SYNC since
* this is a superset.
*/
:include ext.sp
#define O_DSYNC O_SYNC /* Synchronize data. */
#define O_RSYNC O_SYNC /* Synchronize read operations. */
#endif
#define O_TEMP 000000 /* Temporary file, don't put to disk (QNX thing) */
#define O_TEXT 000000 /* Text file (DOS thing) */
#define O_BINARY 000000 /* Binary file (DOS thing) */
:elsesegment QNX
:include pshpackl.sp
:include wchar_t.sp
#ifndef __TYPES_H_INCLUDED
#include <sys/types.h>
#endif
/*
* Flag values accessible to both open() and fcntl()
* (The first three can only be set by open)
*/
/*
* File access modes.
*/
#define O_RDONLY 000000 /* Read-only mode */
#define O_WRONLY 000001 /* Write-only mode */
#define O_RDWR 000002 /* Read-Write mode */
/*
* Mask for file access modes.
*/
#define O_ACCMODE 000003
/*
* File status flags used for open() and fcntl().
*/
#define O_NONBLOCK 000200 /* Non-blocking I/O */
#define O_APPEND 000010 /* Append (writes guaranteed at the end) */
/*
* The synchronous I/O status flags are taken from POSIX.4 (draft).
* This implementation doesn't fully support sync I/O (yet)
* (no function RTFSYNCH),
* but it does support the status flags for READ and WRITE.
*/
:include ext.sp
#define O_DSYNC 000020 /* Data integrity synch */
#define O_SYNC 000040 /* File integrity synch */
#endif
#define O_PRIV 010000
/*
* oflag values for open()
*/
#define O_CREAT 000400 /* Opens with file create */
#define O_TRUNC 001000 /* Open with truncation */
#define O_EXCL 002000 /* Exclusive open */
#define O_NOCTTY 004000 /* Don't assign a controlling terminal */
:include ext.sp
#define O_TEMP 010000 /* Temporary file, don't put to disk */
#define O_CACHE 020000 /* Cache sequential files too */
#define O_TEXT 000000 /* Text file (DOS thing) */
#define O_BINARY 000000 /* Binary file (DOS thing) */
#endif
/*
* fcntl() requests
*/
#define F_DUPFD 0 /* Duplicate file descriptor */
#define F_GETFD 1 /* Get file descriptor flags */
#define F_SETFD 2 /* Set file descriptor flags */
#define F_GETFL 3 /* Get file status flags */
#define F_SETFL 4 /* Set file status flags */
#define F_SETLK 6 /* Set record locking info */
#define F_SETLKW 7 /* Set record locking info; */
#define F_CHKFL 8 /* */
#define F_ALLOCSP 10 /* */
#define F_FREESP 11 /* */
#define F_ISSTREAM 13 /* */
#define F_GETLK 14 /* Get record locking info */
#define F_PRIV 15 /* */
#define F_NPRIV 16 /* */
#define F_QUOTACTL 17 /* */
#define F_BLOCKS 18 /* */
#define F_BLKSIZE 19 /* */
#define F_RSETLK 20 /* */
#define F_RGETLK 21 /* */
#define F_RSETLKW 22 /* */
/*
* File descriptor flags used for fcntl()
*/
#define FD_CLOEXEC 0x01 /* Close on exec */
/*
* l_type values for record locking with fcntl()
*/
#define F_RDLCK 1 /* Shared or read lock */
#define F_WRLCK 2 /* Exclusive or write lock */
#define F_UNLCK 3 /* Unlock */
/*
* flock structure.
*/
typedef struct flock {
short int l_type;
short int l_whence;
off_t l_start;
off_t l_len;
long l_sysid;
pid_t l_pid;
#if defined(M_I86)
short int l_pid_pad;
#endif
short int zero[3];
} flock_t;
:elsesegment DOS
:include pshpackl.sp
:include wchar_t.sp
#define O_RDONLY 0x0000 /* open for read only */
#define _O_RDONLY 0x0000 /* open for read only */
#define O_WRONLY 0x0001 /* open for write only */
#define _O_WRONLY 0x0001 /* open for write only */
#define O_RDWR 0x0002 /* open for read and write */
#define _O_RDWR 0x0002 /* open for read and write */
#define O_APPEND 0x0010 /* writes done at end of file */
#define _O_APPEND 0x0010 /* writes done at end of file */
#define O_CREAT 0x0020 /* create new file */
#define _O_CREAT 0x0020 /* create new file */
#define O_TRUNC 0x0040 /* truncate existing file */
#define _O_TRUNC 0x0040 /* truncate existing file */
#define O_NOINHERIT 0x0080 /* file is not inherited by child process */
#define _O_NOINHERIT 0x0080 /* file is not inherited by child process */
#define O_TEXT 0x0100 /* text file */
#define _O_TEXT 0x0100 /* text file */
#define O_BINARY 0x0200 /* binary file */
#define _O_BINARY 0x0200 /* binary file */
#define O_EXCL 0x0400 /* exclusive open */
#define _O_EXCL 0x0400 /* exclusive open */
:elsesegment SNAP | SNAPDRV
:include pshpackl.sp
#ifndef __OS_IMPORTS_H
#include <os/imports.h>
#endif
/* Flags are defined based on the flags in <os/imports.h> */
#define O_RDONLY ___O_RDONLY
#define O_WRONLY ___O_WRONLY
#define O_RDWR ___O_RDWR
#define O_BINARY ___O_BINARY
#define O_TEXT ___O_TEXT
#define O_CREAT ___O_CREAT
#define O_EXCL ___O_EXCL
#define O_TRUNC ___O_TRUNC
#define O_APPEND ___O_APPEND
:endsegment
/*
* POSIX 1003.1 Prototypes.
*/
_WCRTLINK extern int open( const char *__path, int __oflag, ... );
_WCRTLINK extern int sopen( const char *__path, int __oflag, int __share, ... );
:segment QNX | LINUX
_WCRTLINK extern int creat( const char *__path, mode_t __mode );
:endsegment
:segment !NO_WIDECHAR
_WCRTLINK extern int _wopen( const wchar_t *, int, ... );
_WCRTLINK extern int _wsopen( const wchar_t *, int, int, ... );
_WCRTLINK extern int _wcreat( const wchar_t *, int );
:endsegment
:segment QNX | LINUX
_WCRTLINK extern int fcntl( int __fildes, int __cmd, ... );
:segment QNX
struct _io_open; /* for C++ */
_WCRTLINK extern int __fcntl_slib( int, int, int, struct flock * );
_WCRTLINK extern int __open_slib( const char *__path, int __oflag,
mode_t __mode );
_WCRTLINK extern int __sopen_slib( const char *__path, int __oflag, int __share,
mode_t __mode );
_WCRTLINK extern int __resolve_net( unsigned, int, struct _io_open *,
const char *, unsigned, char * );
:endsegment
:endsegment
:include poppack.sp
:include cplusepi.sp
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?