standards/107561: Missing SUS function tcgetsid()

Jukka Ukkonen jau at
Fri Jan 5 03:10:10 PST 2007

>Number:         107561
>Category:       standards
>Synopsis:       Missing SUS function tcgetsid()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 05 11:10:09 GMT 2007
>Originator:     Jukka Ukkonen
>Release:        FreeBSD 6.2-PRERELEASE
private individual, not representing any organization
FreeBSD mjolnir 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #1: Fri Jan  5 09:43:02 EET 2007     root at mjolnir:/usr/obj/usr/src/sys/Mjolnir  i386
The SUS function tcgetsid() seems to be missing in FreeBSD.

This is SUS compatibility only.
This was not strictly required by POSIX at the time it was implemented
for SUS, but since SUS clearly is a major driver in the POSIX activities,
tcgetsid() might be an obvious future extension to POSIX anyhow.
And furthermore there is no sane reason for sticking to POSIX only,
if the extension needed to become better compatible with other major
specifications happens to be this easy.

No actual problem.
The function tcgetsid() is a convenience function and
it can always be replaced by ...
getsid (tcgetpgrp (fd))


#include <sys/types.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <termios.h>

tcgetsid (fd)
    int     fd;
    int     pgrp;

    if (ioctl (fd, TIOCGPGRP, &pgrp) < 0)
        return ((pid_t) -1);

    return (getsid((pid_t) pgrp));


More information about the freebsd-standards mailing list