Chinaunix首页 | 论坛 | 博客
  • 博客访问: 610186
  • 博文数量: 1958
  • 博客积分: 44693
  • 博客等级: 大将
  • 技术积分: 22125
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-29 15:19
文章分类

全部博文(1958)

文章存档

2012年(560)

2011年(1398)

分类: LINUX

2011-03-12 21:27:42

fcntl.h File
Purpose

Defines file control options.

定义文件控制选项

Description

The /usr/include/fcntl.h file defines the values that can be specified for the Command and Argument parameters of the fcntl subroutine and for the Oflag parameter of theopen subroutine. The file-status flags of an open file are described in the following information.

Flag Values for open Subroutine

The following flag values are accessible only to the open subroutine:

O_RDONLYRead-only
O_WRONLYWrite-only
O_RDWRRead and write
O_CREATOpen with file create (uses the third open argument)
O_TRUNCOpen with truncation 截断
O_DIRECTOpen for Direct I/O
O_EXCLExclusive open  可执行
Note: The O_EXCL flag is not fully supported for Network File Systems (NFS). The NFS protocol does not guarantee the designed function of the O_EXCLflag.
O_NOCTTYDo not assign a controlling terminal
O_RSHARERead shared open
O_NSHARERead shared open
File Access Mode Mask

The O_ACCMODE mask is used to determine the file access mode.

File Status flags for open and fcntl Subroutines

The following file status flags are accessible to both the open and fcntl subroutines:

O_NONBLOCKPOSIX nonblocking I/O
FNONBLOCKPOSIX nonblocking I/O
O_APPENDAn append with writes guaranteed at the end
FAPPENDAn append with writes guaranteed at the end
O_SYNCSynchronous write option
FSYNCSynchronous write option
O_DSYNCSynchronous write option (file data only).
FDATASYNCSynchronous write option (file data only).
O_RSYNCSynchronous file attributes on read.
FREADSYNCSynchronous file attributes on read.
FASYNCAsynchronous I/O
O_NDELAYNonblocking I/O
FNDELAYNonblocking I/O
O_LARGEFILEAccess to large files enabled (AIX versions 4.2 and later)
File Status Flags for open Subroutine

The following file status flags are accessible to the open subroutine:

O_DEFERDeferred update
O_DELAYOpen with delay
O_DIRECTOpen for Direct I/O
File Descriptor Flags for fcntl Subroutine

The following file descriptor flag is accessible to the fcntl subroutine:

FD_CLOEXECClose this file during an exec.

File flag values corresponding to file access modes are as follows:

FREADFile is open for read.
FWRITEFile is open for write.
Notes:
  1. The FREAD and FWRITE flags cannot be used unless the _KERNEL flag has been defined.

  2. The ldfcn.h file also assigns values to the FREAD and FWRITE options. If you use the ldfcn.h and fcntl.h files together, directly or indirectly, you should use the #undef statement on the FREAD and FWRITE options of one of the header files. If you do not, the compiler will return a warning about using duplicate definitions.
Command Values for fcntl Subroutine

The Command values for the fcntl subroutine (that is, for fcntl subroutine requests) are:

F_DUPFDDuplicate the file description.
F_GETFDGet the file description flags.
F_SETFDSet the file description flags.
F_GETFLGet the file status flags and file access modes.
F_SETFLSet the file flags.
F_GETLKReturn information about an existing file lock.
F_GETLK64Return information about an existing file lock (AIX versions 4.2 and later) .
F_SETLKSet or clear a file lock.
F_SETLK64Set or clear a file lock (AIX versions 4.2 and later) .
F_SETLKWSet or clear a file lock and wait if blocked.
F_SETLKW64Set or clear a file lock and wait if blocked (AIX versions 4.2 and later) .
F_GETOWNGet the descriptor owner.
F_SETOWNSet the descriptor owner.
阅读(1053) | 评论(0) | 转发(0) |
0

上一篇:递归斐波那契数列

下一篇:打分汇总

给主人留下些什么吧!~~