File locking
Mavroyanopoulos Nikos
nmav at hellug.gr
Wed Aug 25 19:56:24 EEST 1999
On Wed, Aug 25, 1999 at 04:40:53PM +0300, Michalis Kabrianis wrote:
> alla pali den yparxei tropos na min kanw open ena idi locked arxeio.
Mixali, ta locks ginontai se file descriptors ara den mporeis na deis
an kati einai locked an den to kaneis open. Kaneis open() kai elegxeis meta
me to flock() an einai locked. Kalytera to flock na einai se non-blocking
leitourgia, opote kai blepeis amesws an itan locked, kai kaleis tin close().
Kalytera pantos na xrisimopoiiseis tin fcntl() anti gia to flock, mias kai to
flock pera tou oti den doulevei se nfs (les kai i fcntl doulevei:), den yparxei
se ola ta unix. H fcntl einai dyskoloteri stin xrisi, alla exei poly perissoteres
dynatotites (opws px na kaneis lock ena kommati mono tou arxeiou). Mporeis na
breis etoima paradeigmata sto unix-faq.
[apo proigoumeno mail]
> 2 Problimata:
> a) Pws elegxw to lock prin anoiksw to arxeio.
Den mporeis. H open() prepei na klithei.
> b) afou i open() kai i flock() einai diaforetikes functions, thewritika yparxei
> i periptwsi meta tin open() kai print tin flock() na prospelasei kapoio allo
> process to idio arxeio. Auto pws ksepernietai?
Ta locks kanonizoun to sygxronismo. Opoios prolavei na kanei lock protos,
kerdizei, o allos perimenei na teleiwsei o prwtos. Prepei vevaia oles oi
efarmoges na xrisimopoioun locks, kati pou den symbainei syxna.
Prosexe omws ta locks den einai gia na empodizoun to anoigma tou arxeiou,
alla tin prospelasi se auto (read/write/append).
> Michalis Kabrianis
--
Nikos Mavroyanopoulos
mailto:nmav at hellug.gr
I'm not rude, I'm "attitudinally challenged".
--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr/archives
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users at hellug.gr
====================================================================
More information about the Linux-greek-users
mailing list