2004-11-03 13:51:07 +00:00
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\" This man page was written by Jeremy Phelps <jphelps@notreached.net>.
|
|
|
|
.\" Redistribute and modify at will.
|
|
|
|
.\"
|
2008-06-11 13:43:34 +00:00
|
|
|
.TH GETPT 3 2008-06-14 "GNU" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
getpt \- open the pseudo-terminal master (PTM)
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
2007-07-07 19:06:59 +00:00
|
|
|
.B #define _GNU_SOURCE
|
2004-11-03 13:51:07 +00:00
|
|
|
.B #include <stdlib.h>
|
|
|
|
.sp
|
2007-07-07 19:06:59 +00:00
|
|
|
.B "int getpt(void);"
|
2004-11-03 13:51:07 +00:00
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR getpt ()
|
2004-11-03 13:51:07 +00:00
|
|
|
opens a pseudo-terminal master and returns its file descriptor.
|
|
|
|
It is equivalent to
|
2007-12-22 22:47:15 +00:00
|
|
|
.nf
|
|
|
|
|
|
|
|
open(/dev/ptmx, O_RDWR | O_NOCTTY);
|
|
|
|
|
|
|
|
.fi
|
2004-11-03 13:51:07 +00:00
|
|
|
on Linux systems, though the pseudo-terminal master is located
|
|
|
|
elsewhere on some systems that use GNU Libc.
|
|
|
|
.SH "RETURN VALUE"
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR getpt ()
|
2007-04-12 22:42:49 +00:00
|
|
|
returns an open file descriptor upon successful completion.
|
|
|
|
Otherwise, it
|
2005-06-15 14:10:23 +00:00
|
|
|
returns \-1 and sets
|
2004-11-03 13:51:07 +00:00
|
|
|
.I errno
|
|
|
|
to indicate the error.
|
2008-06-03 09:31:29 +00:00
|
|
|
.SH ERRORS
|
|
|
|
.BR getpt ()
|
|
|
|
can fail with various errors described in
|
|
|
|
.BR open (2).
|
2008-06-11 13:43:34 +00:00
|
|
|
.SH VERSIONS
|
|
|
|
.BR getpt ()
|
|
|
|
is provided in glibc since version 2.1.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH CONFORMING TO
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR getpt ()
|
2008-04-26 21:15:52 +00:00
|
|
|
is glibc-specific;
|
|
|
|
use
|
|
|
|
.BR posix_openpt (3)
|
|
|
|
instead.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR grantpt (3),
|
2004-12-17 12:46:00 +00:00
|
|
|
.BR posix_openpt (3),
|
2008-07-14 15:52:21 +00:00
|
|
|
.BR ptsname (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR unlockpt (3),
|
2005-10-10 13:14:12 +00:00
|
|
|
.BR ptmx (4),
|
|
|
|
.BR pty (7)
|