File locking

Michalis Kabrianis kabrianis at hellug.gr
Wed Aug 25 21:39:11 EEST 1999


On 25-Aug-99 Mavroyanopoulos Nikos wrote:
> 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. 

Eixa tin entypwsi oti i flock() den elegxei, apla efarmozei locking. Tha to
ksanakoitaksw.

> 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.

Yeap , tha tin koitaksw kai aytin.

> 
> [apo proigoumeno mail]
>> 2 Problimata:
>> a) Pws elegxw to lock prin anoiksw to arxeio.
> Den mporeis. H open() prepei na klithei. 

Gamwto :-(

>> 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).

Swsto, an kai, efoson den mporw na epiballw se olo to systima na sebetai ta
locks, mallon tha to kanw mono mesa stin efarmogi mou.

> -- 
> Nikos Mavroyanopoulos
> mailto:nmav at hellug.gr
> I'm not rude, I'm "attitudinally challenged".
> --

Michalis Kabrianis
kabrianis at hellug.gr
--
====================================================================
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