diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2008-01-23 17:59:27 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2008-01-23 17:59:27 +0000 |
| commit | bf7fee82b033ebb1e64d91463e19078f4b5eca35 (patch) | |
| tree | 95fbc3e2b5fa25c4410e10e0939775fe52334437 | |
| parent | 5394cc771da8b4bfa5e0db0b640d51ba4b697743 (diff) | |
Notes
| -rw-r--r-- | lib/libc/stdlib/grantpt.c | 13 | ||||
| -rw-r--r-- | lib/libutil/pty.3 | 32 |
2 files changed, 15 insertions, 30 deletions
diff --git a/lib/libc/stdlib/grantpt.c b/lib/libc/stdlib/grantpt.c index 1d67607ec3d1..6e79935b3ade 100644 --- a/lib/libc/stdlib/grantpt.c +++ b/lib/libc/stdlib/grantpt.c @@ -58,15 +58,13 @@ __FBSDID("$FreeBSD$"); #define PTYM_PREFIX "pty" /* pty(4) master naming convention */ #define PTYS_PREFIX "tty" /* pty(4) slave naming convention */ -#define PTMXM_PREFIX "ptc/" /* pts(4) master naming convention */ #define PTMXS_PREFIX "pts/" /* pts(4) slave naming convention */ #define PTMX "ptmx" /* * The following are range values for pseudo TTY devices. Pseudo TTYs have a - * name of /dev/[pt]ty[l-sL-S][0-9a-v], yielding 256 combinations per major. + * name of /dev/[pt]ty[l-sL-S][0-9a-v]. */ -#define PTY_MAX 256 #define PTY_DEV1 "pqrsPQRSlmnoLMNO" #define PTY_DEV2 "0123456789abcdefghijklmnopqrstuv" @@ -75,15 +73,6 @@ __FBSDID("$FreeBSD$"); */ #define _PATH_PTCHOWN "/usr/libexec/pt_chown" -/* - * ISPTM(x) returns 0 for struct stat x if x is not a pty master. - * The bounds checking may be unnecessary but it does eliminate doubt. - */ -#define ISPTM(x) (S_ISCHR((x).st_mode) && \ - minor((x).st_rdev) >= 0 && \ - minor((x).st_rdev) < PTY_MAX) - - #if 0 int __use_pts(void) diff --git a/lib/libutil/pty.3 b/lib/libutil/pty.3 index 35f0b828ce2f..08a5985b6841 100644 --- a/lib/libutil/pty.3 +++ b/lib/libutil/pty.3 @@ -48,13 +48,13 @@ The function .Fn openpty attempts to obtain the next available pseudo-terminal from the system (see .Xr pty 4 ) . -If it successfully finds one, it subsequently tries to change the +If it successfully finds one, it subsequently changes the ownership of the slave device to the real UID of the current process, the group membership to the group .Dq tty (if such a group exists in the system), the access permissions for -reading and writing by the owner, and for writing by the group, and to -invalidate any current use of the line by calling +reading and writing by the owner, and for writing by the group, and +invalidates any current use of the line by calling .Xr revoke 2 . .Pp If the argument @@ -114,12 +114,19 @@ The function returns -1 on failure, 0 in the slave process, and the process ID of the slave process in the parent process. .Sh ERRORS -On failure, +The .Fn openpty -will set the global variable +function may fail and set the global variable .Dv errno -to -.Er ENOENT . +for any of the errors specified for the +.Xr grantpt 3 , +.Xr posix_openpt 3 , +.Xr ptsname 3 , +and +.Xr unlockpt 3 +functions and the +.Xr revoke 2 +system call. .Pp In addition to this, .Fn forkpty @@ -136,14 +143,3 @@ may set it to any value as described for .Xr pty 4 , .Xr termios 4 , .Xr group 5 -.Sh BUGS -The calling process must have an effective UID of super-user in order -to perform all the intended actions. -No notification will occur if -.Fn openpty -or -.Fn forkpty -failed to proceed with one of the described steps, as long as they could -at least allocate the pty at all (and create the new process in the case -of -.Fn forkpty ) . |
