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
|
2010-10-12 04:58:19 +00:00
|
|
|
grantpt \- grant access to the slave pseudoterminal
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
getresuid.2, mremap.2, poll.2, remap_file_pages.2, setresuid.2, splice.2, sync_file_range.2, syscall.2, tee.2, vmsplice.2, INFINITY.3, aio_init.3, asprintf.3, assert_perror.3, basename.3, bsd_signal.3, canonicalize_file_name.3, clog10.3, crypt.3, dl_iterate_phdr.3, dlopen.3, encrypt.3, exp10.3, fcloseall.3, fenv.3, fopencookie.3, ftw.3, getaddrinfo_a.3, getloadavg.3, getutent.3, grantpt.3, hsearch.3, lseek64.3, memmem.3, mempcpy.3, pow10.3, program_invocation_name.3, ptsname.3, putgrent.3, sched_getcpu.3, sincos.3, strchr.3, strfry.3, strnlen.3, strptime.3, strstr.3, strverscmp.3, swab.3, sysv_signal.3, tsearch.3, unlockpt.3, wcwidth.3: Add reference to feature_test_macros(7)
Some pages simply list feature test macro requirements in
the form:
#define #GNU_SOURCE
#include <someheader.h>
For these pages, add a "See feature_test_macros(7)" comment
on the "#define" line.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-31 04:31:47 +00:00
|
|
|
.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 ()
|
2010-10-12 04:58:19 +00:00
|
|
|
function changes the mode and owner of the slave pseudoterminal device
|
2010-10-12 04:55:18 +00:00
|
|
|
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"
|
2007-04-12 22:42:49 +00:00
|
|
|
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
|
2010-10-12 04:55:18 +00:00
|
|
|
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
|
2010-10-12 04:55:18 +00:00
|
|
|
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"
|
2008-07-15 13:39:17 +00:00
|
|
|
POSIX.1-2001.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
2010-10-12 04:55:18 +00:00
|
|
|
This is part of the UNIX 98 pseudoterminal support, see
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR pts (4).
|
2005-07-18 14:25:42 +00:00
|
|
|
Many systems implement this function via a set-user-ID helper binary
|
2007-06-08 11:25:04 +00:00
|
|
|
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)
|