X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/59e0d9fe772464b93d835d2a2964457702469a43..3d9156a7a519a5e3aa1b92e9d9d4b991f1aed7ff:/stdlib/FreeBSD/grantpt.3?ds=sidebyside diff --git a/stdlib/FreeBSD/grantpt.3 b/stdlib/FreeBSD/grantpt.3 index 02ba39c..795f4af 100644 --- a/stdlib/FreeBSD/grantpt.3 +++ b/stdlib/FreeBSD/grantpt.3 @@ -29,7 +29,7 @@ .\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/stdlib/grantpt.3,v 1.1 2003/01/02 20:44:41 jmallett Exp $ +.\" $FreeBSD: src/lib/libc/stdlib/grantpt.3,v 1.3 2003/09/14 13:41:57 ru Exp $ .\" .Dd December 23, 2002 .Os @@ -46,7 +46,7 @@ .In stdlib.h .Ft int .Fn grantpt "int fildes" -.Ft char * +.Ft "char *" .Fn ptsname "int fildes" .Ft int .Fn unlockpt "int fildes" @@ -71,19 +71,21 @@ The function is used to establish ownership and permissions of the slave device counterpart to the master device specified with -.Va fildes . +.Fa fildes . The slave device's ownership is set to the real user ID of the calling process, and the permissions are set to user readable-writable and group writable. The group owner of the slave device is also set to the -group "tty" if it exists on the system; otherwise, it +group +.Dq Li tty +if it exists on the system; otherwise, it is left untouched. .Pp The .Fn ptsname function returns the full pathname of the slave device counterpart to the master device specified with -.Va fildes . +.Fa fildes . This value can be used to subsequently open the appropriate slave after .Fn posix_openpt @@ -95,15 +97,17 @@ The .Fn unlockpt function clears the lock held on the pseudo-terminal pair for the master device specified with -.Va fildes . +.Fa fildes . .Pp The .Fn posix_openpt function opens the first available master pseudo-terminal device and returns a descriptor to it. -.Va mode +The +.Fa mode +argument specifies the flags used for opening the device: -.Bl -tag -width O_NOCTTY +.Bl -tag -width ".Dv O_NOCTTY" .It Dv O_RDWR Open for reading and writing. .It Dv O_NOCTTY @@ -111,19 +115,14 @@ If set, do not allow the terminal to become the controlling terminal for the calling process. .El .Sh RETURN VALUES -The -.Fn grantpt -and -.Fn unlockpt -functions return 0 on success; otherwise -1 is returned and -.Va errno -is set to indicate the error. +.Rv -std grantpt unlockpt .Pp The .Fn ptsname function returns a pointer to the name -of the slave device on success; -otherwise a NULL pointer is returned and +of the slave device on success; otherwise a +.Dv NULL +pointer is returned and the global variable .Va errno is set to indicate the error. .Pp @@ -131,7 +130,7 @@ The .Fn posix_openpt function returns a file descriptor to the first available master pseudo-terminal device on success; -otherwise -1 is returned and +otherwise \-1 is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS @@ -144,8 +143,8 @@ functions may fail and set .Va errno to: .Bl -tag -width Er -.It EINVAL -.Va fildes +.It Bq Er EINVAL +.Fa fildes is not a master pseudo-terminal device. .El .Pp @@ -155,7 +154,7 @@ function may set .Va errno to: .Bl -tag -width Er -.It EACCES +.It Bq Er EACCES The slave pseudo-terminal device could not be accessed. .El .Pp @@ -165,10 +164,10 @@ function may fail and set .Va errno to: .Bl -tag -width Er -.It EINVAL -.Va mode -consists an an invalid mode bit. -.It EAGAIN +.It Bq Er EINVAL +.Fa mode +consists of an invalid mode bit. +.It Bq Er EAGAIN The system has no available pseudo-terminal devices. .El .Pp @@ -179,15 +178,17 @@ and .Fn unlockpt functions may also fail and set .Va errno -for any of the errors specified for the routine -.Xr fstat 2 . +for any of the errors specified for the +.Xr fstat 2 +system call. .Pp The .Fn posix_openpt function may also fail and set .Va errno -for any of the errors specified for the routine -.Xr open 2 . +for any of the errors specified for the +.Xr open 2 +system call. .Sh SEE ALSO .Xr open 2 , .Xr pty 4 ,