1*11a6dbe7Smartin.\" $NetBSD: grantpt.3,v 1.4 2008/04/30 13:10:51 martin Exp $ 2892ad9caSchristos.\" 3892ad9caSchristos.\" Copyright (c) 2004 The NetBSD Foundation, Inc. 4892ad9caSchristos.\" All rights reserved. 5892ad9caSchristos.\" 6892ad9caSchristos.\" This code is derived from software contributed to The NetBSD Foundation 7892ad9caSchristos.\" by Christos Zoulas. 8892ad9caSchristos.\" 9892ad9caSchristos.\" Redistribution and use in source and binary forms, with or without 10892ad9caSchristos.\" modification, are permitted provided that the following conditions 11892ad9caSchristos.\" are met: 12892ad9caSchristos.\" 1. Redistributions of source code must retain the above copyright 13892ad9caSchristos.\" notice, this list of conditions and the following disclaimer. 14892ad9caSchristos.\" 2. Redistributions in binary form must reproduce the above copyright 15892ad9caSchristos.\" notice, this list of conditions and the following disclaimer in the 16892ad9caSchristos.\" documentation and/or other materials provided with the distribution. 17892ad9caSchristos.\" 18892ad9caSchristos.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19892ad9caSchristos.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20892ad9caSchristos.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21892ad9caSchristos.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22892ad9caSchristos.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23892ad9caSchristos.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24892ad9caSchristos.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25892ad9caSchristos.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26892ad9caSchristos.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27892ad9caSchristos.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28892ad9caSchristos.\" POSSIBILITY OF SUCH DAMAGE. 29892ad9caSchristos.\" 30892ad9caSchristos.Dd May 25, 2004 31508c6e77Swiz.Dt GRANTPT 3 32892ad9caSchristos.Os 33892ad9caSchristos.Sh NAME 34892ad9caSchristos.Nm grantpt 35892ad9caSchristos.Nd grant access to a slave pseudo-terminal device 36892ad9caSchristos.Sh LIBRARY 37892ad9caSchristos.Lb libc 38892ad9caSchristos.Sh SYNOPSIS 39892ad9caSchristos.In stdlib.h 40892ad9caSchristos.Ft int 41892ad9caSchristos.Fn grantpt "int fildes" 42892ad9caSchristos.Sh DESCRIPTION 43892ad9caSchristosThe 44892ad9caSchristos.Fn grantpt 45892ad9caSchristosfunction changes the mode and ownership of the slave pseudo-terminal device 46892ad9caSchristosthat corresponds to the master pseudo-terminal device associated with 47892ad9caSchristos.Fa fildes 48892ad9caSchristosto be owned by the real user id of the calling process, group id of 49892ad9caSchristos.Dv tty . 50892ad9caSchristosThe permissions are set to readable and writable by owner, and writable by 51892ad9caSchristosgroup. 52892ad9caSchristosIf the slave pseudo-terminal device was being accessed by other file 53892ad9caSchristosdescriptors at the time, all such access will be revoked. 54892ad9caSchristos.Sh RETURN VALUES 55892ad9caSchristosIf successful, 56892ad9caSchristos.Fn grantpt 57508c6e77Swizreturns 0; otherwise a value of \-1 is returned and 58892ad9caSchristos.Va errno 59892ad9caSchristosis set to indicate the error. 60892ad9caSchristos.Sh ERRORS 61892ad9caSchristosThe 62892ad9caSchristos.Fn grantpt 63892ad9caSchristosfunction will fail if: 64892ad9caSchristos.Bl -tag -width Er 65892ad9caSchristos.It Bq Er EACCESS 66892ad9caSchristosthe corresponding pseudo-terminal device could not be accessed. 67892ad9caSchristos.It Bq Er EBADF 68892ad9caSchristos.Fa fildes 69892ad9caSchristosis not a valid descriptor. 70892ad9caSchristos.It Bq Er EINVAL 71892ad9caSchristos.Fa fildes 72892ad9caSchristosis not associated with a master pseudo-terminal device. 73892ad9caSchristos.El 74892ad9caSchristos.Sh NOTES 75892ad9caSchristosSetting the group to 76892ad9caSchristos.Dv tty 77892ad9caSchristosand revoking accesses by other file descriptors are 78892ad9caSchristos.Nx 79892ad9caSchristosextensions. 80892ad9caSchristosCalling 81892ad9caSchristos.Fn grantpt 82892ad9caSchristosis equivalent to: 83892ad9caSchristos.Bd -literal 84892ad9caSchristos ioctl(fildes, TIOCGRANTPT, 0); 85892ad9caSchristos.Ed 86892ad9caSchristos.Sh SEE ALSO 87892ad9caSchristos.Xr ioctl 2 , 88892ad9caSchristos.Xr posix_openpt 3 , 89892ad9caSchristos.Xr ptsname 3 , 90892ad9caSchristos.Xr unlockpt 3 91892ad9caSchristos.Sh STANDARDS 92892ad9caSchristosThe 93892ad9caSchristos.Fn grantpt 94892ad9caSchristosfunction conforms to 95892ad9caSchristos.St -p1003.1-2001 . 96892ad9caSchristosIts first release was in 97892ad9caSchristos.St -xpg4.2 . 98