Server for Information Technologies ������ ��������������
������� �������������� ����������
(095) 932-9212, 932-9213, 939-0783
E-mail: [email protected]
������ �������� ����(!) ������������� ���������� CIT Forum CD-ROM

UTMP(4)

��������
utmp, wtmp - ������ ��������� ������ utmp � wtmp

���������

#include <sys/types.h>
#include <utmp.h>

��������
����� utmp � wtmp �������� ���������� � ������������� � ������� ���������� ��� ����� ������, ��� who(1), write(1)login(1). �� �������� ����� ��������� ���������, ������������ �� ���������� ����� <utmp.h>:

#define UTMP_FILE  "/etc/utmp"
#define WTMP_FILE  "/etc/wtmp"
#define ut_name    ut_user

struct utmp {
  char ut_user[8];  /* ������� ��� ������������ */
  char ut_id[4];    /* �������������  ��  �����   /etc/
                       inittab (������ ����� �����) */
  char ut_line[12]; /* ���  ���������� (console, ttyxx) */
  short ut_pid;     /* ������������� �������� */
  short ut_type;    /* ��� �������� */
  struct exit_status {
    short e_termination; /* ���������  ���   ���������� �������� */
    short e_exit;        /* ���������������� ��� ���������� */
  } ut_exit;        /* ���  ����������  ��������, ����-
                       ������� ��� DEAD_PROCESS */
  time_t ut_time;   /* ����� �������� �������� */
};

����������� ��� ut_type

#define EMPTY          0
#define RUN_LVL        1
#define BOOT_TIME      2
#define OLD_TIME       3
#define NEW_TIME       4
#define INIT_PROCESS   5 /* ������� ������� �� init */
#define LOGIN_PROCESS  6 /* ������� getty */
#define USER_PROCESS   7 /* ���������������� ������� */
#define DEAD_PROCESS   8
#define ACCOUNTING     9
#define UTMAXTYPE ACCOUNTING /* ������������ ����������
                                �������� ��� ut_type */

����������� ������� �������� � ������� ���� ut_line, ����� ���������� �� ��������� � ���������. ������� �������� �� ����� ��������� ����� 11 �������� + ������� ����

#define RUNLVL_MSG  "run-level %c"
#define BOOT_MSG    "system boot"
#define OTIME_MSG   "old time"
#define NTIME_MSG   "new time"

�����

 /etc/utmp
 /etc/wtmp

��. �����
getut(3C).
login(1), who(1), write(1) � ����������� ������������.
acct(1M) � ����������� ��������������.
Comments: [email protected]
Designed by Andrey Novikov
Copyright © CIT