Print this page
14249 pseudo-terminal nomenclature should reflect POSIX
Change-Id: Ib4a3cef899ff4c71b09cb0dc6878863c5e8357bc


   6 .\" are met:
   7 .\" 1. Redistributions of source code must retain the above copyright
   8 .\"    notice, this list of conditions and the following disclaimer.
   9 .\" 2. Redistributions in binary form must reproduce the above copyright
  10 .\"    notice, this list of conditions and the following disclaimer in the
  11 .\"    documentation and/or other materials provided with the distribution.
  12 .\"
  13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23 .\" SUCH DAMAGE.
  24 .\"
  25 .\"
  26 .Dd May 5, 2020
  27 .Dt UTEMPTER_ADD_RECORD 3UTEMPTER
  28 .Os
  29 .Sh NAME
  30 .Nm utempter_add_record ,
  31 .Nm utempter_remove_added_record ,
  32 .Nm utempter_remove_record ,
  33 .Nm addToUtmp ,
  34 .Nm removeFromUtmp ,
  35 .Nm removeLineFromUtmp
  36 .Nd utempter compatibility interface
  37 .Sh LIBRARY
  38 .Lb libutempter
  39 .Sh SYNOPSIS
  40 .In utempter.h
  41 .Ft int
  42 .Fn utempter_add_record "int fd" "const char *host"
  43 .Ft int
  44 .Fn utempter_remove_added_record "void"
  45 .Ft int
  46 .Fn utempter_remove_record "int fd"


  50 .Fn removeFromUtmp "void"
  51 .Ft void
  52 .Fn removeLineFromUtmp "const char *pty" "int fd"
  53 .Sh DESCRIPTION
  54 These functions provide an interface for terminal emulators such as tmux,
  55 screen, and xterm to record user sessions to
  56 .Xr utmpx 4
  57 database.
  58 Note that they are best effort and may not succeed.
  59 If consumers need to know for certain that they have successfully updated the
  60 .Xr utmpx 4
  61 database, these functions should not be used because they cannot communicate
  62 that for compatibility reasons.
  63 .Pp
  64 The
  65 .Fn utempter_add_record
  66 and
  67 .Fn addToUtmp
  68 functions add a login record to the
  69 .Xr utmpx 4
  70 database for the TTY belonging to the pseudo-terminal master file descriptor
  71 .Fa fd ,
  72 using the username corresponding with the real user ID of the calling
  73 process and the optional hostname
  74 .Fa host ,
  75 limited to 256 characters, that is the size of
  76 .Va ut_host
  77 member of
  78 .Vt struct utmpx
  79 minus terminating NUL character.
  80 .Pp
  81 The
  82 .Fn utempter_remove_record
  83 and
  84 .Fn removeLineFromUtmp
  85 functions mark the login session as being closed for the TTY belonging
  86 to the pseudo-terminal master file descriptor
  87 .Fa fd .
  88 .Pp
  89 The
  90 .Fn utempter_remove_added_record
  91 and
  92 .Fn removeFromUtmp
  93 functions have the same properties as the previously mentioned
  94 functions, except that they use an internally cached value of the file
  95 descriptor passed to
  96 .Fn utempter_add_record
  97 and
  98 .Fn addToUtmp .
  99 .Pp
 100 In this implementation, the
 101 .Fa pty
 102 arguments of
 103 .Fn addToUtmp
 104 and
 105 .Fn removeLineFromUtmp
 106 are ignored, and database entries are driven entirely by the




   6 .\" are met:
   7 .\" 1. Redistributions of source code must retain the above copyright
   8 .\"    notice, this list of conditions and the following disclaimer.
   9 .\" 2. Redistributions in binary form must reproduce the above copyright
  10 .\"    notice, this list of conditions and the following disclaimer in the
  11 .\"    documentation and/or other materials provided with the distribution.
  12 .\"
  13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23 .\" SUCH DAMAGE.
  24 .\"
  25 .\"
  26 .Dd February 5, 2022
  27 .Dt UTEMPTER_ADD_RECORD 3UTEMPTER
  28 .Os
  29 .Sh NAME
  30 .Nm utempter_add_record ,
  31 .Nm utempter_remove_added_record ,
  32 .Nm utempter_remove_record ,
  33 .Nm addToUtmp ,
  34 .Nm removeFromUtmp ,
  35 .Nm removeLineFromUtmp
  36 .Nd utempter compatibility interface
  37 .Sh LIBRARY
  38 .Lb libutempter
  39 .Sh SYNOPSIS
  40 .In utempter.h
  41 .Ft int
  42 .Fn utempter_add_record "int fd" "const char *host"
  43 .Ft int
  44 .Fn utempter_remove_added_record "void"
  45 .Ft int
  46 .Fn utempter_remove_record "int fd"


  50 .Fn removeFromUtmp "void"
  51 .Ft void
  52 .Fn removeLineFromUtmp "const char *pty" "int fd"
  53 .Sh DESCRIPTION
  54 These functions provide an interface for terminal emulators such as tmux,
  55 screen, and xterm to record user sessions to
  56 .Xr utmpx 4
  57 database.
  58 Note that they are best effort and may not succeed.
  59 If consumers need to know for certain that they have successfully updated the
  60 .Xr utmpx 4
  61 database, these functions should not be used because they cannot communicate
  62 that for compatibility reasons.
  63 .Pp
  64 The
  65 .Fn utempter_add_record
  66 and
  67 .Fn addToUtmp
  68 functions add a login record to the
  69 .Xr utmpx 4
  70 database for the TTY belonging to the pseudo-terminal manager file descriptor
  71 .Fa fd ,
  72 using the username corresponding with the real user ID of the calling
  73 process and the optional hostname
  74 .Fa host ,
  75 limited to 256 characters, that is the size of
  76 .Va ut_host
  77 member of
  78 .Vt struct utmpx
  79 minus terminating NUL character.
  80 .Pp
  81 The
  82 .Fn utempter_remove_record
  83 and
  84 .Fn removeLineFromUtmp
  85 functions mark the login session as being closed for the TTY belonging
  86 to the pseudo-terminal manager file descriptor
  87 .Fa fd .
  88 .Pp
  89 The
  90 .Fn utempter_remove_added_record
  91 and
  92 .Fn removeFromUtmp
  93 functions have the same properties as the previously mentioned
  94 functions, except that they use an internally cached value of the file
  95 descriptor passed to
  96 .Fn utempter_add_record
  97 and
  98 .Fn addToUtmp .
  99 .Pp
 100 In this implementation, the
 101 .Fa pty
 102 arguments of
 103 .Fn addToUtmp
 104 and
 105 .Fn removeLineFromUtmp
 106 are ignored, and database entries are driven entirely by the