File Control (fcntl)
Function Prototype
int fcntl(int filedes, int cmd, .../* int arg*/);- We put the command (flag) we want to execute in
cmdsection, if the command require extra argument then we put them intoargsection
Function
Change the properties of open files
CMD
File Descriptor Duplication
F_DUPFD- similar to dup, but we can specify the lowest file descriptor number we want inarg
File Descriptor Flag
F_GETFDF_SETFD
管理 open file desc. table 的 flag
File Status Flag
Command
F_GETFLF_SETFL
管理 open file table 的 flag
Flag
These flags work with flags belong to open file table
O_APPEND- same as that inopenO_NONBLOCK- turn open file object to non-blockingO_SYNC- same as that inopenO_ASYNC- enables asynchronous I/O notification, the system will send a signal when data become available for read/write- …
Signal Ownership
F_GETOWNF_SETOWN