man-pages/man3/getpt.3

50 lines
1.1 KiB
Groff
Raw Normal View History

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-03 12:25:15 +00:00
.TH GETPT 3 2008-06-03 "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
.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"
.BR getpt ()
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.
.SH ERRORS
.BR getpt ()
can fail with various errors described in
.BR open (2).
2004-11-03 13:51:07 +00:00
.SH CONFORMING TO
.BR getpt ()
is glibc-specific;
use
.BR posix_openpt (3)
instead.
2004-11-03 13:51:07 +00:00
.SH "SEE ALSO"
.BR grantpt (3),
.BR ptsname (3),
2004-12-17 12:46:00 +00:00
.BR posix_openpt (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)