Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000870 [1003.1(2013)/Issue7+TC1] System Interfaces Editorial Clarification Requested 2014-08-25 18:11 2019-06-10 08:54
Reporter dalias View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Rich Felker
Organization musl libc
User Reference
Section sem_close
Page Number 1827
Line Number 58866
Interp Status Approved
Final Accepted Text Note: 0002399
Summary 0000870: Can sem_close be called when there are waiters blocked?
Description The description of sem_close states "The effect of subsequent use of the semaphore indicated by sem by this process is undefined", but no mention is made of what happens when there are currently waiters. Since the state of a thread about to enter sem_wait pending being scheduled is observably indistinguishable from the state of already having entered sem_wait and blocked, I think the above text makes it acceptable for an implementation to crash or exhibit unexpected behavior if sem_close is called while there are waiters, but it would be preferable to make this explicit.
Desired Action Immediately after:

"The effect of subsequent use of the semaphore indicated by sem by this process is undefined."

add:

"If any threads are currently blocked on the semaphore, the behavior is undefined."
Tags tc2-2008
Attached Files

- Relationships

-  Notes
(0002364)
dalias (reporter)
2014-08-25 18:44

That should read "If any threads in the calling process are currently blocked on the semaphore, the behavior is undefined." Obviously it's permitted to close a semaphore for which other processes have waiters. Presumably it's also permitted to close a semaphore which the current process is still using as long as the reference count will not reach zero, but the reference-counted behavior of named semaphores is not even mentioned in the description of sem_close (only sem_open); this seems to be another error in the description.
(0002399)
geoffclare (manager)
2014-10-02 16:13

Interpretation response
------------------------

The standard does not speak to this issue, and as such no conformance
distinction can be made between alternative implementations based on
this. This is being referred to the sponsor.

Rationale:
-------------

There are current implementations which return mmap()ed memory and therefore a sem_close() in this situation on such implementations will result in undefined behavior.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------

On page 1827 line 58866 after:

    The effect of subsequent use of the semaphore indicated by sem by this process is undefined.

add:

    If any threads in the calling process are currently blocked on the semaphore, the behavior is undefined.
(0002404)
ajosey (manager)
2014-10-06 07:44

Interpretation proposed 6 October 2014
(0002445)
ajosey (manager)
2014-11-27 10:31

Interpretation approved 27 November 2014

- Issue History
Date Modified Username Field Change
2014-08-25 18:11 dalias New Issue
2014-08-25 18:11 dalias Name => Rich Felker
2014-08-25 18:11 dalias Organization => musl libc
2014-08-25 18:11 dalias Section => sem_close
2014-08-25 18:11 dalias Page Number => unknown
2014-08-25 18:11 dalias Line Number => unknown
2014-08-25 18:44 dalias Note Added: 0002364
2014-10-02 16:13 geoffclare Note Added: 0002399
2014-10-02 16:14 geoffclare Page Number unknown => 1827
2014-10-02 16:14 geoffclare Line Number unknown => 58866
2014-10-02 16:14 geoffclare Interp Status => Pending
2014-10-02 16:14 geoffclare Final Accepted Text => Note: 0002399
2014-10-02 16:14 geoffclare Status New => Interpretation Required
2014-10-02 16:14 geoffclare Resolution Open => Accepted As Marked
2014-10-02 16:14 geoffclare Tag Attached: tc2-2008
2014-10-06 07:44 ajosey Interp Status Pending => Proposed
2014-10-06 07:44 ajosey Note Added: 0002404
2014-11-27 10:31 ajosey Interp Status Proposed => Approved
2014-11-27 10:31 ajosey Note Added: 0002445
2019-06-10 08:54 agadmin Status Interpretation Required => Closed


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker