Anonymous | Login | 2024-03-29 12:09 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0000335 | [1003.1(2008)/Issue 7] System Interfaces | Editorial | Error | 2010-10-16 17:52 | 2013-04-16 13:06 | ||
Reporter | weeks | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | ||||||
Name | Nathan Weeks | ||||||
Organization | |||||||
User Reference | |||||||
Section | semget, semop | ||||||
Page Number | 1837,1842 | ||||||
Line Number | 58680,58875 | ||||||
Interp Status | --- | ||||||
Final Accepted Text | Note: 0000594 | ||||||
Summary | 0000335: semget() and semop() examples do not initialize semval | ||||||
Description |
The examples for semget() and semop() do not initialize the semaphore value with semctl() after creating the semaphore set with the second call to semget() and before operating on it with the first call to semop(). The description for semget() contains the bullet: "The data structure associated with each semaphore in the set need not be initialized. The semctl() function with the command SETVAL or SETALL can be used to initialize each semaphore." |
||||||
Desired Action |
A couple possibilities: 1. Replace the first call to semop() with "semctl(semid, 0, SETVAL, arg)", where "arg" is of type "union semun" as described in semctl(), and arg.val = 2. 2. Before the first call to semop(), call "semctl(semid, 0, SETVAL, arg)", where arg.val = 0. By keeping the call to semop(), the sem_otime member of the semid_ds data structure associated with semid will be updated, which, while not explicitly referenced in the examples, may be referenced in applications that wish to avoid the race condition described in "Unix Network Programming Volume 2 (2nd edition)" on pages 284-285. The sentence "After creating the semaphore, the program uses a call to semop() to initialize it to the values in the sbuf array" may need to be reworded depending on the solution. |
||||||
Tags | tc1-2008 | ||||||
Attached Files | |||||||
|
Relationships | |||||||||||||||||||||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
2010-10-16 17:52 | weeks | New Issue | |
2010-10-16 17:52 | weeks | Status | New => Under Review |
2010-10-16 17:52 | weeks | Assigned To | => ajosey |
2010-10-16 17:52 | weeks | Name | => Nathan Weeks |
2010-10-16 17:52 | weeks | Section | => semget, semop |
2010-10-16 17:52 | weeks | Page Number | => 0 |
2010-10-16 17:52 | weeks | Line Number | => 0 |
2010-10-16 17:52 | weeks | Issue Monitored: weeks | |
2010-10-28 23:07 | eblake | Note Added: 0000594 | |
2010-10-28 23:41 | eblake | Relationship added | related to 0000345 |
2010-10-29 18:55 | Don Cragun | Page Number | 0 => 1837,1842 |
2010-10-29 18:55 | Don Cragun | Line Number | 0 => 58680,58875 |
2010-10-29 18:55 | Don Cragun | Interp Status | => --- |
2010-11-04 15:25 | eblake | Note Edited: 0000594 | |
2010-11-04 15:29 | eblake | Final Accepted Text | => Note: 0000594 |
2010-11-04 15:29 | eblake | Status | Under Review => Resolved |
2010-11-04 15:29 | eblake | Resolution | Open => Accepted As Marked |
2010-11-04 15:30 | eblake | Tag Attached: tc1-2008 | |
2011-02-09 07:49 | Don Cragun | Relationship added | related to 0000377 |
2011-05-13 15:34 | eblake | Relationship added | related to 0000439 |
2012-08-22 16:01 | eblake | Relationship added | related to 0000575 |
2013-04-16 13:06 | ajosey | Status | Resolved => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |