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

STATFS(2)

��������
statfs, fstatfs - ��������� ���������� � �������� �������

���������

        #include <sys/types.h>
        #include <sys/statfs.h>
        
        int statfs (path, buf, len, fstyp)
        char *path;
        struct statfs *buf;
        int len, fstyp;
        
        int fstatfs (fildes, buf, len, fstyp)
        int fildes;
        struct statfs *buf;
        int len, fstyp;

��������
��������� ����� statfs ���������� "������� ���������", ����������� �������� �������. ����� ����� �������������� ��� ������� ���������� ��� � ��������������, ��� � � ���������������� �������� �������; ������������� ������ ��������� ����������� � ���� ���� �������. � ����� ������� �������� buf �������� ���������� �� ��������� (����������� ����), ���� ������� ����������� � ���������� ���������� ���������� ������, � �������� len ������ ���������� ���� ����������, ������� ������� ������ ��������� � ���������. �������� len �� ������ ��������� ������ ���������: sizeof (struct statfs) � ������ len �������� ������ ���� ������; ���� �������� len �������� ������� ��������, �� ������� �������� � ��������� ����� �������� ���������� ����, ��� ���� ����������� � ����� ������� ������� ��������� � ��������� statfs ����� ���� ��� �������������� ������ ��������.

���� ����������� �������� ������� � ������� ������ ������������, �� ���������� ��� path ������ ���� ������ �����, ������� ������������� � ������ �������� �������. � ���� ������ ��� �������� ������� �������� ��, � �������� fstyp ������ ���� �������. ��� ���������������� �������� ������� ���������� ��� path ������ ���� ������ ������������ �������� �����, ����������� ��, � �������� fstyp ������ ��������� (���������) ��� �������� �������. � ����� ������� ����� ������� �� ������, ������ ��� ���������� ���������� ����� �� ���������, �� ��� ��������, ������������� � ���������� �����, ������ ���� �������� �� �����.

��������� statfs, �� ������� ��������� �������� buf, ������� �� ��������� �����:

	short f_fstyp;     /* ��� �������� ������� */
	short f_bsize;     /* ������ ����� */
	short f_frsize;    /* ������ �������� */
	long  f_blocks;    /* ����� ���������� ������ */
	long  f_bfree;     /* ������� ��������� ������ */
	long  f_files;     /* ����� ���-�� ���������� ������ */
	long  f_ffree;     /* ������� ������. ������. ������ */
	char  f_fname [6]; /* ��� ���� */
	char  f_fpack [6]; /* ��� ������ */

��������� ����� fstatfs ���������� �� statfs ������ ���, ��� ���� ���������������� �� ���������� ������, � ������������ ��������� ����� fildes, �������������� � ���������� ��������� ���������� ��������� ��������� �������: open(2), creat(2), dup(2), fcntl(2) ��� pipe(2).

��������� ����� statfs �������� ����� ������� ��������� ���������� ������ ustat(2) � � ����� ���������� ������������ ������� �������� statfs.

��������� ������ statfs � fstatfs ����������� ��������, ���� ��������� ���� �� ���� �� ��������� �������:

[ENOTDIR]
��������� �������� �� �������� ���������.
[ENOENT]
�������� ���� �� ����������.
[EACCES]
��� ����� �� ����� ��� ���������� ��������.
[EFAULT]
��������� buf ��� path ��������� �� ������� ����������� �������� ��������� ������������.
[EBADF]
�������� fildes �� �������� ���������� ������������ ��������� �����.
[EINVAL]
�������� fstyp �������� ������������ ��� �������� �������; path ������ �� ����������� ������� ���� � �������� fstyp �� ����� 0; �������� len ����������� ��� ��������� sizeof (struct statfs).
[ENOLINK]
���������� ��� path ��������� �� ��������� ���������, ����� � ������� � ������ ������ ���.
[EMULTIHOP] ���������� path ������� ������������� ��������� � ��������� �����������.

��. �����
chmod(2), chown(2), creat(2), link(2), mknod(2), pipe(2), read(2), time(2), unlink(2), utime(2), ustat(2), write(2), fs(4).

�����������
��� �������� ���������� ��������� ����� 0; � ������ ������ ������������ -1, � ���������� errno ������������� ��� ������.
Comments: [email protected]
Designed by Andrey Novikov
Copyright © CIT