man-pages/man3/grantpt.3

70 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 pseudo-terminal
2004-11-03 13:51:07 +00:00
.SH SYNOPSIS
.nf
.B #define _XOPEN_SOURCE
.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 pseudo-terminal device
(pty) corresponding to the master pty referred to by
.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 pty could not be accessed.
.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 pty.
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
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/ The man pages were rather inconsistent in the use of "Unix" versus "UNIX". Let's go with the trademark usage. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
This is part of the UNIX 98 pty 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),
2007-01-28 20:00:24 +00:00
.BR feature_test_macros (7),
2005-10-10 13:14:12 +00:00
.BR pty (7)