Unix Man ( )


LOCKING(3)


LOCKING(3)
XENIX System V (21 1987)


locking - opye paopye yaco aa e ac

#include <sys/types.h>

#include <sys/locking.h>

int locking (fildes, mode, size) int fildes, mode; long size;


locking ooe poeccy ypa aa aa ae. pye poecc, eae a ca yaco aa, coepa opoae a, yy a o ex op, oa yaco e paopyec acoc o pea ycaoeo opo.

o oo o ycao opoy o e, a oe op e e/ac. o oo o ycao opoy o ac, a oe op ac e/ac. p eoe oo x yco opoa e cac opyec oa EINVAL.

poecc, ea a ca yaco, paee opoa o e ac py poecco (coy pe LK_LOCK LK_NBLCK), ye a ocooe yaca opoa eo poecco.

poecc, ea ca yaco aa, o aopoa o ac py poecco (coy pe LK_RLCK LK_NBRLCK), ye a ocooe yaca opoa eo poecco, a poecc, ea a o yaco, coe o ee.

poecc, ea opoa yaco, coepoe oopoo ye opoao py poecco, ye a, ec pe opo LK_LOCK LK_RLCK, ye opaa ypaee c oo EACCES, ec pe opo LK_NBLCK LK_NBRLCK.

fildes ec oepo opoo aa, opaae oa creat, open, dup pipe.

mode yaae pe opo yaca. Coece coe ae oo apyea ao:

LK_UNLCK 0 LK_LOCK 1 LK_NBLCK 2 LK_RLCK 3 LK_NBRLCK 4
Paopye yaco. Tey poecc ocooae yaco, oop o paee opoa.
opye yaco. Tey poecc ye a ocooe yaca, ec aa-o eo ac opoaa py poecco. B oeo oe yaco opyec ey poecco pye poecc e oy eep a ca o yaco (opoa o e ac).
opye yaco. Ec aa-o ac yaca opoaa py poecco, opaaec oa EACCES e oa ocooe opoaoo yaca (opoa e oa).
Aaoo LK_LOCK a cee oo, o opoa yaco oe ac py poecca (opoa o ac).
Aaoo LK_NBLCK a cee oo, o opoa yaco oe ac py poecca (opoa o ac e oa).