Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/man/man3c/./openpty.3c
Real path: /usr/share/man/man3c/openpty.3c
Zurück
'\" te .\" Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. .TH openpty 3C "17 Aug 2018" "Oracle Solaris 11.4" "Standard C Library Functions" .SH NAME openpty, login_tty, forkpty \- terminal utility functions .SH SYNOPSIS .LP .nf #include <termios.h> \fBint\fR \fBopenpty\fR(\fBint *\fR\fIamaster\fR, \fBint *\fR\fIaslave\fR, \fBchar *\fR\fIname\fR, \fBstruct termios *\fR\fItermp\fR, \fBstruct winsize *\fR\fIwinp\fR); \fBint\fR \fBlogin_tty\fR(\fBint\fR \fIfd\fR); \fBpid_t\fR \fBforkpty\fR(\fBint *\fR\fIamaster\fR, \fBchar *\fR\fIname\fR, \fBstruct termios *\fR\fItermp\fR, \fBstruct winsize *\fR\fIwinp\fR); .fi .SH DESCRIPTION .sp .LP The \fBopenpty()\fR, \fBlogin_tty()\fR, and \fBforkpty()\fR functions perform manipulations on \fBttys\fR and \fBpseudo-ttys\fR. .sp .LP The \fBopenpty()\fR function finds an available \fBpseudo-tty\fR and returns file descriptors for the master and slave in \fBamaster\fR and \fBaslave\fR. If \fBname\fR is non-null, the filename of the slave is returned in \fBname\fR, a string of at least 32 characters. If \fBtermp\fR is non-null, the terminal parameters of the slave will be set to the values in \fBtermp\fR. If \fBwinp\fR is non-null, the window size of the slave will be set to the values in \fBwinp\fR. The \fBopenpty()\fR function first attempts to allocate the \fBpseudo-tty\fR through the \fB/dev/ptmx\fR device using the \fBposix_openpt\fR command. It then invokes the \fBgrantpt()\fR, \fBunlockpt()\fR, and \fBptsname()\fR functions to obtain the path of the pseudo-terminal slave. It opens the pseudo-terminal slave, and attempts to set terminal attribute and window size of the \fBpty slave\fR if \fBtermp\fR and \fBwinp\fR are valid. Finally, the function returns the \fBpty master fd\fR, \fBpty slave\fR, and \fBpty slave name\fR to the caller. For more information, see \fBpty\fR, \fBptm\fR and \fBpts\fR man pages. .sp .LP The \fBlogin_tty()\fR function prepares for a login on the \fBtty fd\fR, which can either be a real \fBtty\fR device, or a slave of the \fBpseudo-tty\fR as returned by the \fBopenpty()\fR function. The function prepares for a login by creating a new session, making \fBfd\fR the controlling terminal for the current process, setting \fBfd\fR to be the standard input, output, and error streams of the current process, and closing \fBfd\fR. .sp .LP The \fBforkpty()\fR function combines the \fBopenpty()\fR, \fBfork()\fR, and \fBlogin_tty()\fR functions to create a new process attached to a \fBpseudo-tty\fR. The file descriptor of the master side of the \fBpseudo-tty\fR is returned in \fBamaster\fR, and the filename of the slave in \fBname\fR, if it is non-null. The \fBtermp\fR and \fBwinp\fR parameters, if non-null, will determine the terminal attributes and window size of the slave side of the pseudo-terminal. .SH RETURN VALUES .sp .LP If a call to the \fBopenpty()\fR, \fBlogin_tty()\fR, or \fBforkpty()\fR functions is not successful, then \fB-1\fR is returned, and \fBerrno\fR is set to indicate the error. Otherwise, the \fBopenpty()\fR, \fBlogin_tty()\fR, and the child process of the \fBforkpty()\fR functions return \fB0\fR, and the parent process of \fBforkpty()\fR returns the process ID of the child process. .SH ERRORS .sp .LP The \fBopenpty()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEMFILE\fR\fR .ad .RS 10n .rt \fBOPEN_MAX\fR file descriptors are currently open in the calling process .RE .sp .ne 2 .mk .na \fB\fBENFILE\fR\fR .ad .RS 10n .rt The maximum allowable number of files are currently open in the system .RE .sp .ne 2 .mk .na \fB\fBEAGAIN\fR\fR .ad .RS 10n .rt Out of pseudo-terminal resources .RE .sp .ne 2 .mk .na \fB\fBEACCES\fR\fR .ad .RS 10n .rt The corresponding slave pseudo-terminal device could not be accessed .RE .sp .LP The \fBlogin_tty()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 11n .rt The calling process is already a process group leader, or the process group ID of a process other than the calling process matches the process ID of the calling process .RE .sp .ne 2 .mk .na \fB\fBEBADF\fR\fR .ad .RS 11n .rt The \fBfildes\fR argument is not a valid open file descriptor .RE .sp .ne 2 .mk .na \fB\fBEMFILE\fR\fR .ad .RS 11n .rt The process has too many files open. For more information, see the \fBgetrlimit\fR man page .RE .sp .ne 2 .mk .na \fB\fBENOLINK\fR\fR .ad .RS 11n .rt The \fBfildes\fR argument is on a remote machine and the link to that machine is no longer active .RE .sp .LP The \fBforkpty()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEAGAIN\fR\fR .ad .RS 10n .rt A resource control or limit on the total number of processes, tasks, or LWPs under execution by a single user, task, project, or zone has been exceeded. This error can also occur if the total amount of system memory available is temporarily insufficient to duplicate this process .RE .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 10n .rt There is not enough swap space .RE .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 10n .rt The \fBPRIV_PROC_FORK\fR privilege is not asserted in the effective set of the calling process .RE .SH FILES .sp .ne 2 .mk .na \fB\fB/dev/ptmx\fR\fR .ad .RS 14n .rt Master clone device .RE .sp .ne 2 .mk .na \fB\fB/dev/pts/M\fR\fR .ad .RS 14n .rt Slave devices (\fBM = 0 -> N-1\fR) .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level Safe .TE .sp .SH SEE ALSO .sp .LP \fBpty\fR(4D), \fBpts\fR(4D), \fBposix_openpt\fR(3C), \fBgrantpt\fR(3C), \fBunlockpt\fR(3C), \fBptsname\fR(3C), \fBgetrlimit\fR(2)