The login() function shall update the user accounting databases. The ut parameter shall reference a utmp structure for all fields except the following:
ut_type field shall be set to
ut_pid field shall be set to the process identifier
for the current process.
ut_line field shall be set to the name of the
controlling terminal device.
The name shall be found by examining the device associated with the
standard input, output and error streams in sequence, until one associated with
a terminal device is found.
If none of these streams refers to a terminal device, the
ut_line field shall be set to
If the terminal device is in the /dev directory
ut_line field shall not contain the leading
"/dev/", otherwise it shall be set to the final component
of the pathname of the device.
If the user
accounting database imposes a limit on the size of the
ut_line field, it shall
truncate the name, but any such limit shall not be smaller than
(including a terminating null character).