[RTEMS Project] #4877: sptests/spsysinit01 sem_open call only has 3 parameters with O_CREAT flag

RTEMS trac trac at rtems.org
Mon Mar 13 13:31:05 UTC 2023


#4877: sptests/spsysinit01 sem_open call only has 3 parameters with O_CREAT flag
----------------------------------+----------------------
 Reporter:  Lucian-Raul Silistru  |       Owner:  joel@…
     Type:  defect                |      Status:  closed
 Priority:  normal                |   Milestone:
Component:  test                  |     Version:  5
 Severity:  normal                |  Resolution:  invalid
 Keywords:                        |  Blocked By:
 Blocking:                        |
----------------------------------+----------------------
Changes (by Joel Sherrill):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 This is an error on the caller's part. Per
 https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html,
 the fourth argument is required if you include O_CREAT. Since you did not
 explicitly pass a value, the result is undefined.

 {{{
 O_CREAT
 This flag is used to create a semaphore if it does not already exist. If
 O_CREAT is set and the semaphore already exists, then O_CREAT has no
 effect, except as noted under O_EXCL. Otherwise, sem_open() creates a
 named semaphore. The O_CREAT flag requires a third and a fourth argument:
 mode, which is of type mode_t, and value, which is of type unsigned. The
 semaphore is created with an initial value of value. Valid initial values
 for semaphores are less than or equal to {SEM_VALUE_MAX}.
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/4877#comment:1>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list