[Bug 243177] Enhancement request: O_CREATFIFO flag for open(2)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jan 8 07:56:06 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243177

            Bug ID: 243177
           Summary: Enhancement request:  O_CREATFIFO flag for open(2)
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: rfg-freebsd at tristatelogic.com

The open(2) system call supports a number of optional flags which may be used
to control the exact semantics of the open() operation.  Among these is O_CREAT
which can be used to atomically create the specified file while effectively,
from the userland point of view, simultaneously and uninterruptably creating
the file.

The addition of the O_CREAT optional flag to the set of optional flags
supported by open(2) was made decades ago in recognition of the fact that
certain very troublesome race conditions could arise in userland programs in
cases where the creation of a file and the opening of that same file might be
performed non-atomically.

The exact same problem exists in the case where the file to be opened and
created happens to be a POSIX FIFO file (POSIX 1003.1b-1993, Section 5.4.2.2.)
however in this case it is currently necessary to make two separate, and
therefore interruptable system calls (to mkfifo() and open()) in order to
effect the creation and opening of a POSIX FIFO file, thus permitting
troublesome race conditions of the kind that the O_CREAT flag for open(2) was
created and implemented to eliminate.

The obvious solution is the addition a new option flag for the open(2) system
call, analogous to the already existing O_CREAT flag, which will have the
effect of both creating AND opening a POSIX FIFO file in a manner that is
atomic and uninterruptable from the point of view of userland processes.  I
would suggest the name O_CREATFIFO for this new flag, but any reasonable
symbolic name will do, provided that the semantics implied are the atomic
creation and opening of a FIFO file.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list