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

SHMOP(2)

��������
shmop - �������� ��� ������������ ���������� ������

���������

        #include <sys/types.h>
        #include <sys/ipc.h>
        #include <sys/shm.h>
        
        char *shmat (shmid, shmaddr, shmflg)
        int shmid;
        char *shmaddr;
        int shmflg;
        
        int shmdt (shmaddr)
        char *shmaddr;

��������
������������� ��������
��������� ����� shmat (��. ��������) ������������ ����������� ������� ������, ��������������� � ��������������� shmid, � �������� ������ ����������� ��������. ������� �������������� �� ������, ��������� ����� �� ��������� ��������:

  1. ���� �������� ��������� shmaddr ����� ����, �� ������� �������������� �� ������, ���������� ��������.
  2. ���� �������� ��������� shmaddr �� ����� ���� � ��������� (shmflg & SHM_RND) �������, �� ������� �������������� �� ������, ������������ �� ������� (shmaddr - (shmaddr mod SHMLBA)) [��. intro(2)].
  3. ���� �������� ��������� shmaddr �� ����� ���� � ��������� (shmflg & SHM_RND) �����, �� ������� �������������� �� ������, ����������� ���������� shmaddr.

������������ ��������
��������� ����� shmdt ����������� ����������� ������� ������, ������������� �� ������ shmaddr, �� �������� ������ ����������� ��������.

���� ��������� (shmflg & SHM_RDONLY) �������, �� ������� �������������� ��� ������ {��������� ����� �� ������}, � ��������� ������ ������� �������������� ��� ������ � ������ {��������� ����� �� ������ � ������}.

��������� ����� shmat ����������� �������� � ����������� ������� �� ��������������, ���� ��������� ���� �� ���� �� ��������� �������:

[EINVAL]
�������� ��������� shmid �� �������� ���������� ��������������� ������������ ��������.
[EACCES]
� ����������� �������� ��� ���� �� ���������� �������� [��. intro(2)].
[ENOMEM]
� �������� ������ ��� ����� ��� ������������� ������������ ��������.
[EINVAL]
�������� ��������� shmaddr �� ����� ���� � �������� ��������� (shmaddr-(shmaddr mod SHMLBA)) �� �������� ���������� �������.
[EINVAL]
�������� ��������� shmaddr �� ����� ����, ��������� (shmflg & SHM_RND) ����� � �������� ��������� shmaddr �� �������� ���������� �������.
[EMFILE]
���������� ����������� ���������, �������������� � ����������� ��������, ��������� ����������� ���������� ��������.

��������� ����� shmdt ����������� �������� � ����������� ������� �� �������������, ����:

[EINVAL]
�������� ��������� shmaddr �� �������� ��������� ������� ������������ ��������.

��. �����
exec(2), exit(2), fork(2), intro(2), shmctl(2), shmget(2).

�����������
��� �������� ���������� ���������� ������ shmat ������������ ��������� ����� ��������������� ��������.

��� �������� ���������� ���������� ������ shmdt ��������� ����� 0.

� ������ ������ ������������ -1, � ���������� errno ������������� ��� ������.

����������
���������� ���� ������� ����������� ������� ������ ����� ����, ��� ��������� ��������� ������ �� ����.

��������
� ������ ���������� ��������� ���������� ������ shmat ����� ��� int, � �� char *.
Comments: [email protected]
Designed by Andrey Novikov
Copyright © CIT