Path: utzoo!attcan!uunet!mcsun!inria!chorus!francois From: francois@chorus.fr (Francois Armand) Newsgroups: comp.unix.questions Subject: Sharing Open File Current Offset? (Looking for example of applications) Keywords: Files Message-ID: <6011@chorus.fr> Date: 20 Aug 90 13:04:07 GMT Sender: news@chorus.fr Lines: 50 I am looking for some _real_ _uses_ of current offset sharing by real applications running on any flavor of UNIX systems. To be more precise, suppose you have a program that opens(2) a file "foo" for read/write operations, and then forks(2).The parent and the child processes now share the same open file description, and in particular the current offset within the file and the flags (O_SYNC, O_APPEND, O_NDELAY...). It seems to me that if both the parent and the child want to make any sensible use of that shared access to the file, they need to synchronize themselves by some mechanism (signals, shared memory, file locks...). In addition, within the Unix file system sources which I have read, I have never seen any "synchronization" mechanism to provide a deterministic way of computing the current offset when, for example, two read(2) operations are issued in parallel by two processes sharing the same open file. Thus, I really wonder how one could deal without any synchronization between user's programs. I have never seen any program using this property! Thus, my question is: do Unix systems really need to make the current offset be shared between parent and child processes. I would like to know if somebody has ever seen or written an application using that property of the UNIX fork(2)... I am not interested in having example of applications sharing open files such as terminals, pipes or sockets (for which current offset is meaningless). Could you mail me a description of the examples you are aware of, I will summarize to the net. I would be happy to get detailed information about the use of the mechanism, ie: why is the application written that way, how processes synchronize themselves, what flags are set for the shared open files (for example, setting the O_APPEND flag, changes the behaviour of the current offset...), do the programs use lseek(2)... and any kind of information that may be relevant. Thanks in advance Francois ARMAND Francois ARMAND Chorus Systemes Tel: +33 (1) 30 57 00 22 6 Avenue Gustave Eiffel Fax: +33 (1) 30 57 00 66 78182 St-Quentin-en-Yvelines Cedex Email: francois@chorus.fr (Internet) FRANCE