man-pages/man3/getpt.3

53 lines
1.2 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.
.\"
.TH GETPT 3 2010-09-10 "GNU" "Linux Programmer's Manual"
2004-11-03 13:51:07 +00:00
.SH NAME
getpt \- open the psuedoterminal master (PTM)
2004-11-03 13:51:07 +00:00
.SH SYNOPSIS
.nf
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
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 ()
opens a psuedoterminal master and returns its file descriptor.
2004-11-03 13:51:07 +00:00
It is equivalent to
2007-12-22 22:47:15 +00:00
.nf
open(/dev/ptmx, O_RDWR | O_NOCTTY);
.fi
on Linux systems, though the psuedoterminal master is located
2004-11-03 13:51:07 +00:00
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).
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
.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),
2004-12-17 12:46:00 +00:00
.BR posix_openpt (3),
.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)