Yes, for example if I want to set the serial device baud rate(TCSETS), should I open it with O_WRONLY?
On Sat, Apr 2, 2022 at 10:56 PM Gregory Nutt <[email protected]> wrote: > On 4/2/2022 7:03 AM, Xiang Xiao wrote: > > Many functionality is accessed through ioctl callback, what permission is > > needed before invoking ioctl? > > By permissions, you mean open mode? Per POSIX, O_WRONLY, O_RDONLY, or > O_RDWR is required on any success open call (or O_EXEC or O_SEARCH). > > But I did run across this non-standard Linux behavior in this man page: > https://man7.org/linux/man-pages/man2/open.2.html: > > Under Linux, the*O_NONBLOCK *flag is sometimes used in cases where > one wants to open but does not necessarily have the intention to > read or write. For example, this may be used to open a device in > order to get a file descriptor for use withioctl(2) < > https://man7.org/linux/man-pages/man2/ioctl.2.html>. > > >
