PTY Handling Questions - BSD

This is a discussion on PTY Handling Questions - BSD ; Are the following functions listed in the Single UNIX Specification likely to be implemented in OpenBSD? grantpt Change permissions of slave PTY device posix_openpt Open a master PTY device ptsname Return name of slave PTY device unlockpt Allow slave PTY ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: PTY Handling Questions

  1. PTY Handling Questions

    Are the following functions listed in the Single UNIX Specification
    likely to be implemented in OpenBSD?

    grantpt Change permissions of slave PTY device
    posix_openpt Open a master PTY device
    ptsname Return name of slave PTY device
    unlockpt Allow slave PTY device to be opened

    How is the functionality of the above 4 functions currently implemented
    in OpenBSD?

    (These functions are discussed in chapter 19 of _Advanced Programming
    in the UNIX Environment_, 2nd Ed, by W Richard Stevens. While the book
    covers several UNIX operating systems, there is little coverage of BSDs
    in general and of OpenBSD in particular.)

    Thanks,
    Dave Feustel
    --
    Using ( X | KDE ) with OpenBSD?
    See Dave's OpenBSD | X | KDE corner at
    http://dfeustel.home.mindspring.com !!!

  2. Re: PTY Handling Questions

    In article , wrote:
    >Are the following functions listed in the Single UNIX Specification
    >likely to be implemented in OpenBSD?



    No.

    >grantpt Change permissions of slave PTY device
    >posix_openpt Open a master PTY device
    >ptsname Return name of slave PTY device
    >unlockpt Allow slave PTY device to be opened
    >
    >How is the functionality of the above 4 functions currently implemented
    >in OpenBSD?



    see openpty.

  3. Re: PTY Handling Questions

    Marc Espie wrote:
    > In article , wrote:
    >>Are the following functions listed in the Single UNIX Specification
    >>likely to be implemented in OpenBSD?

    >
    > No.
    >
    >>grantpt Change permissions of slave PTY device
    >>posix_openpt Open a master PTY device
    >>ptsname Return name of slave PTY device
    >>unlockpt Allow slave PTY device to be opened
    >>
    >>How is the functionality of the above 4 functions currently implemented
    >>in OpenBSD?

    >
    > see openpty.


    Doing that now. Thanks.

    Dave Feustel
    --
    Using ( X | KDE ) with OpenBSD?
    See Dave's OpenBSD | X | KDE corner at
    http://dfeustel.home.mindspring.com !!!

  4. Re: PTY Handling Questions

    I now have a pty program taken from _Advanced Programming in the Unix
    Environment_ (section 19.5, p 694. Unmodified source code available
    at http://www.apuebook.com) in which I have replaced the 2 pty_fork
    calls with OpenBSD forkpty calls. Pty runs a program via the pty
    interface. The program appears to work, but I am puzzled by the
    permissions of the pty pair allocated by forkpty. I expected that
    the permissions of ptyp0 would be daf:tty crw--w----, ie the same as
    for ttyp0.

    crw-rw-rw- 1 root wheel 6, 0 May 30 06:54 /dev/ptyp0
    crw--w---- 1 daf tty 5, 0 May 30 06:54 /dev/ttyp0

    Are the permissions on ptyp0 correct?
    (I am running the ptyp program as user daf).

    Thanks.
    --
    Using ( X | KDE ) with OpenBSD?
    See Dave's OpenBSD | X | KDE corner at
    http://dfeustel.home.mindspring.com !!!

  5. Re: PTY Handling Questions

    dfeustel@mindspring.com wrote:
    > I now have a pty program taken from _Advanced Programming in the Unix
    > Environment_ (section 19.5, p 694. Unmodified source code available
    > at http://www.apuebook.com) in which I have replaced the 2 pty_fork
    > calls with OpenBSD forkpty calls. Pty runs a program via the pty
    > interface. The program appears to work, but I am puzzled by the
    > permissions of the pty pair allocated by forkpty. I expected that
    > the permissions of ptyp0 would be daf:tty crw--w----, ie the same as
    > for ttyp0.
    >
    > crw-rw-rw- 1 root wheel 6, 0 May 30 06:54 /dev/ptyp0
    > crw--w---- 1 daf tty 5, 0 May 30 06:54 /dev/ttyp0
    >
    > Are the permissions on ptyp0 correct?
    > (I am running the ptyp program as user daf).
    >
    > Thanks.


    Also, the ownership and permissions for ttyp0 are not reset when the
    pty program terminates or after user daf logs out. The ownership and
    permissions of ttyp0 *are* reset after a reboot. Is this the expected
    behavior of pty pairs?

    --
    Using ( X | KDE ) with OpenBSD?
    See Dave's OpenBSD | X | KDE corner at
    http://dfeustel.home.mindspring.com !!!

  6. Re: PTY Handling Questions

    In article , wrote:
    >Also, the ownership and permissions for ttyp0 are not reset when the
    >pty program terminates or after user daf logs out. The ownership and
    >permissions of ttyp0 *are* reset after a reboot. Is this the expected
    >behavior of pty pairs?
    >


    Yes. I suggest you have a look at script(1) for more advanced examples of
    pty usage (still relatively self-contained compared to e.g., login-class
    examples).

  7. Re: PTY Handling Questions

    Marc Espie wrote:
    > In article , wrote:
    >>Also, the ownership and permissions for ttyp0 are not reset when the
    >>pty program terminates or after user daf logs out. The ownership and
    >>permissions of ttyp0 *are* reset after a reboot. Is this the expected
    >>behavior of pty pairs?
    >>

    >
    > Yes. I suggest you have a look at script(1) for more advanced examples of
    > pty usage (still relatively self-contained compared to e.g., login-class
    > examples).


    Thanks. I'll do that.
    --
    Using ( X | KDE ) with OpenBSD?
    See Dave's OpenBSD | X | KDE corner at
    http://dfeustel.home.mindspring.com !!!

+ Reply to Thread