The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Pty - Perl extension to allow access to the SVR4 pseudo-tty functions

SYNOPSIS

This module may be used as follows:

   use Pty qw(ALL);
   use IO::File;
   my ($fdm) = IO::File->new("/dev/ptmx", "r+");
   grantpt($fdm);
   unlockpt($fdm);
   my ($slavename) = ptsname($fdm);
   my ($fds) = IO::File->new($slavename, "r");
   my ($mod);
   ioctl($fds, I_PUSH, $mod = "ptem");
   ioctl($fds, I_PUSH, $mod = "ldterm");

DESCRIPTION

This module allows access to the SVR4 pseudo-tty functions. grantpt() and unlockpt() follow the convention used by ioctl() for returning values, i.e. -1 is returned as undef, 0 is returned as the string "0 but true", and any other value is returned unchanged. ptsname() returns the pty name if sucessful, and undef otherwise.

constants

The following streams-related constants are available:

I_ATMARK I_CANPUT I_CKBAND I_EGETSIG I_ESETSIG I_FDINSERT I_FIND I_FLUSH I_FLUSHBAND I_GERROPT I_GETBAND I_GETCLTIME I_GETSIG I_GRDOPT I_GWROPT I_LINK I_LIST I_LOOK I_NREAD I_PEEK I_PLINK I_POP I_PUNLINK I_PUSH I_RECVFD I_SENDFD I_SERROPT I_SETCLTIME I_SETSIG I_SRDOPT I_STR I_SWROPT I_UNLINK);

grantpt()

Changes the mode and ownership of the slave pty associated with the corresponding master pty. Parameter is a filehandle.

unlockpt()

Unlocks the slave pty associated with the corresponding master pty. Parameter is a filehandle.

ptsname()

Returns the name of the slave pty associated with the corresponding master pty. Parameter is a filehandle.

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Alan Burlison, Alan.Burlison@uk.sun.com

SEE ALSO

perl(1), grantpt(), unlockpt(), ptsname() and your O/S specific documentation for ptys