From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sun, 8 Feb 1998 09:48:34 -0600 From: G. David Butler gdb@dbSystems.com Subject: [9fans] create(2)/open(2) race for file creation Topicbox-Message-UUID: 71eaee48-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19980208154834.KcDL7tQ5cqcNP20UwhP5L6C5_BxyfOuf19jlYLtoFGQ@z> >From: forsyth@caldo.demon.co.uk >>>Any comments? > >it's hopeless trying to offer advice without knowing >what you're actually trying to achieve at the application level >(except that i can already say i really don't approve of the proposed >change to create). > >what's the aim? I have data coming from many sources that have a unique key associated with it. I want to be able to receive this data using the key as a file name without the data being corrupted. This data may need to be updated at times. I have serveral processes receiving this data and I don't want the data if I already have it because my copy may have already been updated. If I use the algorithm: if stat fails { create write close } I have no guarantee about the amout of time between the stat and the create for each process. What I need is a atomic test and set on each possible name. create(5) give me that, but there is no way to get to it from the available system calls. I can't use rendezvous because the processes are on different cpu servers. So if you don't want to change create(2), do we implement O_EXCL? David Butler gdb@dbsystems.com