man-pages/man3/grantpt.3

69 lines
1.6 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" Hey Emacs! This file is -*- nroff -*- source.
.\" This page is in the public domain. - aeb
.\"
2008-06-11 13:43:34 +00:00
.TH GRANTPT 3 2008-06-14 "GNU" "Linux Programmer's Manual"
2004-11-03 13:51:07 +00:00
.SH NAME
grantpt \- grant access to the slave pseudoterminal
2004-11-03 13:51:07 +00:00
.SH SYNOPSIS
.nf
.BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
2004-11-03 13:51:07 +00:00
.br
.B #include <stdlib.h>
.sp
.BI "int grantpt(int " fd ");"
.fi
.SH DESCRIPTION
The
.BR grantpt ()
function changes the mode and owner of the slave pseudoterminal device
corresponding to the master pseudoterminal referred to by
2004-11-03 13:51:07 +00:00
.IR fd .
The user ID of the slave is set to the real UID of the calling process.
2007-12-24 15:08:20 +00:00
The group ID is set to an unspecified value (e.g., \fItty\fP).
2004-11-03 13:51:07 +00:00
The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
.PP
The behavior of
.BR grantpt ()
2007-06-21 05:38:48 +00:00
is unspecified if a signal handler is installed to catch
.B SIGCHLD
signals.
2004-11-03 13:51:07 +00:00
.SH "RETURN VALUE"
When successful,
2004-11-03 13:51:07 +00:00
.BR grantpt ()
2007-06-08 03:17:37 +00:00
returns 0.
Otherwise, it returns \-1 and sets
2004-11-03 13:51:07 +00:00
.I errno
appropriately.
.SH ERRORS
.TP
.B EACCES
The corresponding slave pseudoterminal could not be accessed.
2004-11-03 13:51:07 +00:00
.TP
.B EBADF
The
.I fd
argument is not a valid open file descriptor.
.TP
.B EINVAL
The
.I fd
argument is valid but not associated with a master pseudoterminal.
2008-06-11 13:43:34 +00:00
.SH VERSIONS
.BR grantpt ()
is provided in glibc since version 2.1.
2004-11-03 13:51:07 +00:00
.SH "CONFORMING TO"
POSIX.1-2001.
2004-11-03 13:51:07 +00:00
.SH NOTES
This is part of the UNIX 98 pseudoterminal support, see
2004-11-03 13:51:07 +00:00
.BR pts (4).
Many systems implement this function via a set-user-ID helper binary
called "pt_chown".
With Linux devpts no such helper binary is required.
2004-11-03 13:51:07 +00:00
.SH "SEE ALSO"
.BR open (2),
2004-12-17 12:46:00 +00:00
.BR posix_openpt (3),
2004-11-03 13:51:07 +00:00
.BR ptsname (3),
.BR unlockpt (3),
2005-10-10 13:14:12 +00:00
.BR pts (4),
.BR pty (7)