This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ut_id questions


On Tue, Apr 27, 1999 at 11:36:05PM -0400, Zack Weinberg wrote:
> The /dev/pts interface comes from SVR4 by way of Solaris. It
> consistently uses everything after /dev/ - pts/0, ttyp0, tty1, ttyS0.
> I think this is the Right Thing.  Are the consistency problems inside
> libc, or is it just user apps?
> 
> >Also, utmp(5) claims that the ut_id should be 'p' followed by the
> >number - which seems like a really bad idea, since ttyp0 and pts/0
> >would then have the same ut_id.
> 
> The Solaris docs describe ut_id as containing the "inittab id, if any"
> which strikes me as useless.  Did you mean ut_line?


For the first part, you are right, but you're referring to ut_line. 
ut_id seems to be a timesaver cache value - a four-character, less
human-readable identifier.  It's used to do utent compares quickly. 
And it is completely defeated if applications can't agree on what to
put there.

Libc never sets ut_id at all that I can see, so there are no internal
problems, but I figured libc should probably at least document the
standard.  The ut_id entries in the info pages have that same useless
comment.

The Unix98 standard has only two things to say:

About struct utmp:

  char       ut_id[]    unspecified initialisation process identifier
  char       ut_line[]  device name

and about getutxid():

If the ut_type value is INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or
DEAD_PROCESS, then it stops when it finds an entry whose type is one of
these four and whose ut_id member matches the ut_id member of the utmpx
structure pointed to by id. If the end of the database is reached
without a match, getutxid( ) fails.

So it can be searched by, and glibc uses it to compare whether two
entries are for the same terminal.  Its value, however, is unspecified,
and applications have widely varied opinions of what it should be.

Even if there is no "right answer" currently, I believe that there
should somewhere be a standard, especially if it is ever to function
for Unix98 PTYs.

Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|     CMU, CS class of 2002      |
|   Debian GNU/Linux Developer    __   Part-Time Systems Programmer  |
|         dan@debian.org         |  |        drow@cs.cmu.edu         |
\--------------------------------/  \--------------------------------/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]