????1. ????????
??????????????У????????????????????????????????????????£????????????÷?????????????????δ???????????????????????????????

????????????????????????????????????????????????????????????????????
????1. ??????ж??????
????2. ??????????????ó??????????
????3. ???????????????д??????С?
????????п?????????????????????????????????????д?????????У?????????????????????????????1002?????????????1001????????????????????Linux????flock(?????????????)??fcntl(????????????????)???????????????????????????????????????????????????????????????????????????Щ?????????????????????????????????
????2. flock()
????flock??????????
????#include <sys/file.h>
????// Returns 0 on success?? or -1 on error
????int flock (intfd?? int operation);
????fcntl()?????????ú??????????????????????е???????????flock()????е????????????Щ?????????????flock()?????????????к???????????Щ???? ??flock()??fcntl()??????????????
????flock()??????????????????м??????????????fd????????????в?????????????operation??????????????????????????????operation??????????:

?????????????£?????????????????????????????????????????????flock()????????????????????????????????????operation?????ж???Щ??OR??|??????????????£??????????????????????????????????????????flock()??????????????????-1??????errno???ó?EWOULDBLOCK??
???????????????????????????????????????????????????????????????????????????????????????????е??????д??????????????A????????????????B??????????????????

??????????????????????????????д?????д????????????????????????????????????????????????У?????operation???????????????????????????????????????????????????????????????????????????????????????????????????????????operation?????????LOCK_NB????????(LOCK_SH | LOCK_NB)??????????????????????????????????????????????????е????????????????