Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jan 2007 10:33:31 +0200 (EET)
From:      jau@iki.fi (Jukka A. Ukkonen)
To:        freebsd-standards@FreeBSD.ORG, bug-followup@FreeBSD.ORG
Subject:   Re: standards/107561: Missing SUS function tcgetsid()
Message-ID:  <200701100833.l0A8XWXM009467@jau.iki.fi>
In-Reply-To: <200701072004.l07K4Iko053501@lurza.secnetix.de> from "Oliver Fromme" at Jan 7, 7 09:04:18 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Oliver Fromme:
> 
> The proposed implementation looks good to me (we would
> also need an appropriate manual page, though).

	Right, find attached at the end an initial version of the
	manual page.

	If you wish to publish my name as the author in the HISTORY
	or AUTHOR sections, you are welcome to do so, but, please, do
	not include my e-mail address in there.

	I get quite a load of spam already every day. Though it makes
	perfect sense to always publish the names of authors, I would
	like it to be done in a way that does not increase my spam
	levels.


	Cheers,
		// jau
.---  ..-  -.-  -.-  .-    .-  .-.-.-    ..-  -.-  -.-  ---  -.  .  -.
  /    Jukka A. Ukkonen,                             Oxit Ltd, Finland
 /__   M.Sc. (sw-eng & cs)                    (Phone) +358-500-606-671
   /   Internet: Jukka.Ukkonen(a)Oxit.Fi        (Home) +358-9-6215-280
  /    Internet: jau(a)iki.fi
 v
        .---  .-  ..-  ...-.-  ..  -.-  ..  .-.-.-  ..-.  ..
+ + + + My opinions are mine and mine alone, not my employers. + + + +

 o
  \ /
-  X ------------------------- clip clip ------------------------------
  / \
 O

.\" Copyright (C) 1992-2007
.\"     The FreeBSD Project.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: tcgetsid.3,v 1.3 2007/01/10 06:45:53 jau Exp jau $
.\"
.Dd January 10, 2007
.Dt TCGETSID 3
.Os Standard C Library Functions
.Sh NAME
.Nm tcgetsid
.Nd get session ID for controlling terminal
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In termios.h
.Ft pid_t
.Fn tcgetsid "int fd"
.Sh DESCRIPTION
The 
.Fn tcgetsid
function obtains the session ID of the session for which the terminal
specified by fd is the controlling terminal.

.Pp
This function is a convenience function only and in practice it is
equal to calling
.Nm getsid
(
.Nm tcgetpgrp
(
.Ar "int fd"
)).

.Pp
The session ID is equal to the process group ID (and the process ID)
for the session leader for the controlling terminal.

.Sh RETURN VALUES
Upon successful completion, tcgetsid() returns the process group ID
associated with the terminal.
Otherwise, a value of (pid_t)-1 is returned and errno is set to
indicate the error.

.Sh ERRORS
The
.Fn tcgetsid
function may fail with
.Nm errno
set to the following values:
.Bl -tag -width Er
.It Bq Er EACCES
The
.Fa fd
argument is not associated with a controlling terminal.
.It Bq Er EBADF
The
.Fa fd
argument is not a valid file descriptor.
.It Bq Er ENOTTY
The file associated with
.Fa fd
is not a terminal.
.It Bq Er ESRCH
There is no process with a process ID equal to the process group ID
of the terminal.
.Pp
Note that an implementation may restrict the availability of
this function to processes within the same session ID as
the calling process.
.El

.Sh SEE ALSO
.Xr getsid 2 ,
.Xr tcgetpgrp 3

.Sh STANDARDS
The
.Fn tcgetsid
function is expected to be compliant with the
.St -p1003.1-2001

.Sh AUTHOR
Jukka A. Ukkonen, 2007

.Sh HISTORY
This manual page was adapted from
SunOS 5.9 29 Dec 1996 tcgetsid(3C).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701100833.l0A8XWXM009467>