Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000144 [1003.1(2008)/Issue 7] Base Definitions and Headers Editorial Enhancement Request 2009-09-05 17:22 2009-09-24 15:37
Reporter EdSchouten View Status public  
Assigned To ajosey
Priority normal Resolution Future Enhancement  
Status Resolved  
Name Ed Schouten
Organization
User Reference
Section Chapter 11: TTYs
Page Number n/a
Line Number n/a
Interp Status ---
Final Accepted Text
Summary 0000144: Standard lacks a (possibly XSI) interface to associate a session to a TTY; tcsetsid()
Description According to the General Terminal Interface chapter, it is implementation defined whether a session associates to a TTY when O_NOCTTY is not passed to open():

The controlling terminal for a session is allocated by the session leader in an implementation-defined manner. If a session leader has no controlling terminal, and opens a terminal device file that is not already associated with a session without using the O_NOCTTY option (see open()), it is implementation-defined whether the terminal becomes the controlling terminal of the session leader.

Unfortunately, the standard does not specify a way to associate them when the implementation does not do this by default (i.e. the BSDs). This means it's practically impossible to implement a network login service or terminal emulator only using the interfaces described in POSIX.
Desired Action Standardizing things like TIOCSCTTY wouldn't be a good way to go. Some time ago I looked at this and it seems QNX has a solution for this that seems to be quite elegant:

http://www.qnx.com/developers/docs/6.4.0/neutrino/lib_ref/t/tcsetsid.html [^]

It's basically the counterpart of the already existing tcgetsid().

I propose adding this function to the standard, marked as XSI, where a minimal implementation only has to support the situation where the `pid' argument is equal to the session ID of the current process. This would be desirable anyway.

An implementation on operating systems that have TIOCSCTTY could then look as follows:

int
tcsetsid(int fd, pid_t pid)
{

    if (pid != getsid(0)) {
        errno = EINVAL;
        return -1;
    }

    return ioctl(fd, TIOCSCTTY, NULL);
}
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0000237)
nick (manager)
2009-09-24 15:36

The rules for introducing new material into the standard are provided in austin-112r3 (http://www.opengroup.org/austin/docs/austin_112r3.txt). [^]

The material introduced must have a copyright release from the original owner.

The text needs to be fully formed ... the exact words you would propose being added to the standard.

Since you have suggested that the new interface be marked XSI, the best method for moving forward would be to lobby members of The Open Group's platform working group.

- Issue History
Date Modified Username Field Change
2009-09-05 17:22 EdSchouten New Issue
2009-09-05 17:22 EdSchouten Status New => Under Review
2009-09-05 17:22 EdSchouten Assigned To => ajosey
2009-09-05 17:22 EdSchouten Name => Ed Schouten
2009-09-05 17:22 EdSchouten Section => Chapter 11: TTYs
2009-09-05 17:22 EdSchouten Page Number => n/a
2009-09-05 17:22 EdSchouten Line Number => n/a
2009-09-24 15:36 nick Note Added: 0000237
2009-09-24 15:37 msbrown Interp Status => ---
2009-09-24 15:37 msbrown Status Under Review => Resolved
2009-09-24 15:37 msbrown Resolution Open => Future Enhancement


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