Why fcntl(fd, F_SETFL, 0) use in serial port programming

前端 未结 2 1682
忘了有多久
忘了有多久 2021-01-13 22:53

I am starting serial port programming in Linux. After reading several examples on the web, I don\'t understand exact effect of fcntl(fd, F_SETFL, 0)? It is clea

2条回答
  •  -上瘾入骨i
    2021-01-13 23:04

    per the man page for fcntl()

    F_SETFL (int)

    Set the file status flags to the value specified by arg. File access mode (O_RDONLY, O_WRONLY, O_RDWR) and file creation flags (i.e., O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC) in arg are ignored. On Linux this command can change only the O_APPEND, O_ASYNC, O_DIRECT, O_NOATIME, and O_NONBLOCK flags. It is not possible to change the O_DSYNC and O_SYNC flags; see BUGS, below.

    This is from the man page.

提交回复
热议问题