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

ACCT(4)

��������
acct - ������ ����� � ����������� � ���������

���������

#include <sys/acct.h>

��������
�����, ������� ���������� ��������� ������� acct(2), �������� ������ ��������� ���������, ������������ �� ���������� ����� <sys/acct.h>:

typedef ushort comp_t; /* "������������ �����": 13 ���
                          ��������, 3 ���� ������� */

struct acct {
  char   ac_flag;    /* ���� ������� ���������� */
  char   ac_stat;    /* ��� ���������� */
  ushort ac_uid;
  ushort ac_gid;
  dev_t  ac_tty;
  time_t ac_btime;   /* ����� ������ */
  comp_t ac_utime;   /* ���������������� ����� �� �
                        ������ ����� */
  comp_t ac_stime;   /* ��������� ����� �� � ������
                        ����� */
  comp_t ac_etime;   /* ��������������� ����� �������-
                        ��� � ������ ����� */
  comp_t ac_mem;     /* ������ ������ � �� */
  comp_t ac_io;      /* ���-�� ���������� �������� */
  comp_t ac_rw;      /* ����� ����� ����������� � ��-
                        �������� ������ */
  char   ac_comm[8]; /* ��� �������  */
};

extern struct acct  acctbuf;
extern struct inode *acctp; /* ��������� ����� �������
                               ���������� */
#define AFORK 01     /* �������� fork, �� �� exec */
#define ASU   02     /* ���������� ����������������� */
#define ACCTF 0300   /* ��� ������: 00 = acct */

� ���� ac_flag ���� AFORK ��������������� ��� ������ ������ fork(2) � ������������ ��� ������ exec(2). ���� ac_comm ����������� �� ������������� �������� � ������������ ��� exec(2). ������ ���, ����� ������� �������� �������� ����� �������, ��� ����� ��������� � ac_mem ������� ������ ��������, ����������� ���

     (������ �������� ������) +  (������  ��������  ������) / 
     (���������� ��������� � ������, ������������ ���� ������� ������)

�������� ac_mem/(ac_stime+ac_utime) ����� ������� ������� ������������ �������� ������� ��������, � ������ ���������� �������� ������.

��������� ��������� ������������ ���������� ��������� ������ � ������� �����������:

/* ����� ������� ���������� �� ��������� ������ */

struct tacct {
  uid_t          ta_uid;      /* �����. ������������ */
  char           ta_name[8];  /* ������� ��� */
  float          ta_cpu[2];   /* ������� ����� �� �
                                 ������� */
  float          ta_kcore[2]; /* ������� ��������
                                 �������������� */
  float          ta_con[2];   /* ������� ������������-
                                 ��� ����� ����������
                                 � ������� */
  float          ta_du;       /* ��������� ����������-
                                 ��� ����� */
  long           ta_pc;       /* ����� ��������� */
  unsigned short ta_sc;       /* ����� ������� ���. */
  unsigned short ta_dc;       /* ����� �������� �����-
                                 ����� */
  unsigned short ta_fee;      /* ��� ����. ����������
                                 */
};

��. �����
acct(2), exec(2), fork(2).
acctcom(1) � ����������� ������������.

��������
�������� ���� ac_mem ��� ������ ��������������� ������ ���� ���� ���������� � �������� ������� �������.
Comments: [email protected]
Designed by Andrey Novikov
Copyright © CIT