View Issue Details

IDProjectCategoryView StatusLast Update
00012391003.1(2016/18)/Issue7+TC2System Interfacespublic2024-06-11 09:08
Reporterkre Assigned To 
PrioritynormalSeverityObjectionTypeError
Status ClosedResolutionAccepted As Marked 
NameRobert Elz
Organization
User Reference
Sectionshmat
Page Number1940-1, 384
Line Number62506, 62529, 13051-2
Interp Status---
Final Accepted TextSee 0001239:0004441.
Summary0001239: shmat() specifies non-portable return value
DescriptionThe standard specifies:
<blTockquote>
Otherwise, the shared memory segment shall not be attached, shmat( ) shall retur
n (void *)-1, and errno shall be set to indicate the error.

As was done with other similar operations (mmap, sem_open, ...) a new
symbol should be defined to replace the non-portable use of (void *)-1.
Desired ActionTwo possible solutions appear reasonable.




Pick one:


  1. In line 62506 in page 1940, change the words:
    shmat( ) shall return (void *)-1,

    to:
    shmat( ) shall return SHM_FAILED,

    In line 62529 in page 1941, change the word:
    None.

    to:

    Previous versions required an error return value of -1 with the type void * for
    the shmat( ) function, which is not guaranteed to be portable across implementat
    ions. The revised text provides the symbolic error code SHM_FAILED to eliminate
    the type conflict.

    In XBD section 13, in the page for the <sys/shm.h> header,
    add a new paragraph between lines 13051 and 13052:

    The <sys/shm.h> header shall define the symbolic constant SHM_FAILED which shall
     have type void *.


  2. Delete all of pages 1940 to 1947 (inclusive).


Tagsissue8

Relationships

related to 0001240 Closed shmctl(IPC_RMID) relationship with attached shared memory segments is not specified 
related to 0001237 Closed shmat() specifies use of an undefined operation 
related to 0001238 Closed shmat() used the word "it" with an ambiguous antecedent 

Activities

Don Cragun

2019-06-20 16:41

manager   bugnote:0004441

Last edited: 2019-06-20 16:42

In line 62506 in page 1940, change the words:

    
shmat() shall return (void *)-1,

to:
    
shmat() shall return SHM_FAILED,



In line 62529 in page 1941, change the word:
    
    
None.

to:
    
The symbol SHM_FAILED is used for the failure return of shmat() for consistency with MAP_FAILED for mmap(). However, SHM_FAILED is required to have the same value as ((void *)(intptr_t)-1) to provide backwards compatibility for applications written to earlier versions of this standard, where the failure return was specified as (void *)-1. This means that implementations need to ensure that shmat() cannot return ((void *)(intptr_t)-1) on a successful call.



In XBD section 13, in the page for the <sys/shm.h> header, add two new paragraphs between lines 13051 and 13052:

The <sys/shm.h> header shall define the symbolic constant SHM_FAILED which shall evaluate to the same value as ((void *)(intptr_t)-1).


The <sys/shm.h> header shall define the type intptr_t as described in <stdint.h>.


Issue History

Date Modified Username Field Change
2019-03-16 09:55 kre New Issue
2019-03-16 09:55 kre Name => Robert Elz
2019-03-16 09:55 kre Section => shmat
2019-03-16 09:55 kre Page Number => 1940-1, 384
2019-03-16 09:55 kre Line Number => 62506, 62529, 13051-2
2019-06-20 16:34 Don Cragun Tag Attached: issue8
2019-06-20 16:41 Don Cragun Note Added: 0004441
2019-06-20 16:42 Don Cragun Note Edited: 0004441
2019-06-20 16:44 Don Cragun Interp Status => ---
2019-06-20 16:44 Don Cragun Final Accepted Text => See 0001239:0004441.
2019-06-20 16:44 Don Cragun Status New => Resolved
2019-06-20 16:44 Don Cragun Resolution Open => Accepted As Marked
2019-06-24 15:38 eblake Relationship added related to 0001240
2019-06-24 15:38 eblake Relationship added related to 0001237
2019-06-24 15:39 eblake Relationship added related to 0001238
2020-04-29 15:10 geoffclare Status Resolved => Applied
2024-06-11 09:08 agadmin Status Applied => Closed