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
0001044 [1003.1(2013)/Issue7+TC1] System Interfaces Editorial Enhancement Request 2016-04-14 01:07 2020-04-16 08:52
Reporter daurnimator View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied  
Name Daurnimator
User Reference
Section posix_spawn
Page Number 0
Line Number 0
Interp Status ---
Final Accepted Text Note: 0003650
Summary 0001044: Calling setsid as part of posix_spawn
Description posix_spawn currently provides no way to create a process that is in a new session. A different session to the parent is required to give the new process a different controlling TTY.

Existing implementations:

  - QNX implements POSIX_SPAWN_SETSID [1]
  - Blackberry [2]

[1] [^]
[2] [^]
Desired Action Add POSIX_SPAWN_SETSID to the standard flags accepted by posix_spawnattr_setflags.

Editing instructions:

1. Under 'posix_spawnattr_getflags', add the flag to the list of flags

2. Under 'posix_spawn' under 'The effects of the flags that may be specified in spawn-flags are as follows:' add:

     The child process shall be the session leader of a new session. The process group ID shall be set equal to the process ID of the calling process.

3. In 'posix_spawn' in the description of 'POSIX_SPAWN_SETPGROUP' change 'If the POSIX_SPAWN_SETPGROUP flag is not set', to 'If neither the POSIX_SPAWN_SETPGROUP or POSIX_SPAWN_SETSID flags are set'
Tags issue8
Attached Files

- Relationships
related to 0001208Applied 1003.1(2016)/Issue7+TC2 calling chdir as part of posix_spawn 

-  Notes
geoffclare (manager)
2017-03-23 17:06
edited on: 2017-04-07 10:52

Proposed changes (2016 edition page and line numbers):

On page 341 line 11579 section <spawn.h>, add (unshaded):

On page 1453 line 48267 section posix_spawn(), change:
If the POSIX_SPAWN_SETPGROUP flag is not set ...
If neither the POSIX_SPAWN_SETPGROUP flag nor the POSIX_SPAWN_SETSID flag is set ...

On page 1454 line 48266 section posix_spawn(), add two new paragraphs:
If the POSIX_SPAWN_SETSID flag is set in the spawn-flags attribute of the object referenced by attrp, the child process shall be the session leader of a new session, shall be the process group leader of a new process group, and shall have no controlling terminal. The process group ID of the child process shall be set equal to the process ID of the child process. The child process shall be the only process in the new process group and the only process in the new session.

If both the POSIX_SPAWN_SETPGROUP flag and the POSIX_SPAWN_SETSID flag are set in the spawn-flags attribute of the object referenced by attrp, the behavior is unspecified.

On page 1455 line 48335 section posix_spawn(), add a new paragraph:
If POSIX_SPAWN_SETSID is set in the spawn-flags attribute of the object referenced by attrp, and posix_spawn() or posix_spawnp() fails while creating the new session, changing the child's session ID, or changing the child’s process group, an error value shall be returned as described by setsid() (or, if the error occurs after the calling process successfully returns, the child process shall exit with exit status 127).

On page 1459 line 48522 section posix_spawn(), add setsid() to the SEE ALSO section.

On page 1470 line 48847-48852 section posix_spawnattr_getflags(), add POSIX_SPAWN_SETSID (unshaded) to the list of flags and reorder the list to be in alphabetical order.

On page 3695 line 126580 section B.3.3 Examples for Spawn, after:
    #define POSIX_SPAWN_RESETIDS 0x20
    #define POSIX_SPAWN_SETSID   0x40   

On page 3696 line 126646 section B.3.3 Examples for Spawn, change:
    /* Worry about process group */
    /* Worry about creating a new session */
    if (attrp->posix_attr_flags & POSIX_SPAWN_SETSID)
        /* Create a new session */
        if (setsid() == -1)
            /* Failed */

    /* Worry about process group */

Between page 3696 line 126653 and page 3699 line 126791, change all occurrences of:

The editors may also wish to consider changing all the "Worry about ..." comments in this code example to "Handle ...".

daurnimator (reporter)
2017-04-05 02:50

I just noticed the example implementation of posix_spawn in "B.3.3 Examples for Spawn". Should we also update that?
geoffclare (manager)
2017-04-07 10:54

Note: 0003650 has been updated to include changes to XRAT B.3.3 as suggested in Note: 0003658.
daurnimator (reporter)
2017-04-07 12:23

Thanks geoffclare! Looks perfect.

- Issue History
Date Modified Username Field Change
2016-04-14 01:07 daurnimator New Issue
2016-04-14 01:07 daurnimator Name => Daurnimator
2016-04-14 01:07 daurnimator Section => posix_spawn
2016-04-14 01:07 daurnimator Page Number => 0
2016-04-14 01:07 daurnimator Line Number => 0
2016-04-14 01:43 daurnimator Issue Monitored: daurnimator
2016-08-19 08:26 Florian Weimer Issue Monitored: Florian Weimer
2017-03-23 17:06 geoffclare Note Added: 0003650
2017-03-23 17:09 geoffclare Note Edited: 0003650
2017-03-30 15:13 geoffclare Interp Status => ---
2017-03-30 15:13 geoffclare Final Accepted Text => Note: 0003650
2017-03-30 15:13 geoffclare Status New => Resolved
2017-03-30 15:13 geoffclare Resolution Open => Accepted As Marked
2017-03-30 15:13 geoffclare Tag Attached: issue8
2017-04-05 02:50 daurnimator Note Added: 0003658
2017-04-07 10:52 geoffclare Note Edited: 0003650
2017-04-07 10:54 geoffclare Note Added: 0003665
2017-04-07 12:23 daurnimator Note Added: 0003666
2018-09-07 18:39 eblake Relationship added related to 0001208
2020-04-16 08:52 geoffclare Status Resolved => Applied

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