Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.os.linux.development.system Subject: Re: per process llseek offset Date: Mon, 02 May 2011 13:07:47 +0100 Lines: 11 Message-ID: <87liypjofg.fsf@sapphire.mobileactivedefense.com> References: <51ad5eed-fee6-4007-aeba-35be2d9fd80d@m13g2000yqb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net MzwXoI3NhrFsM5iZ6h4FHgWuvVKQyFalKtLuyj+4U/fevbDP8= Cancel-Lock: sha1:8JDxAHVGRLY8/J9T8/MES5faZB4= sha1:o9gScFCHZGJBJ5ol/8srolmBwlc= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Xref: x330-a1.tempe.blueboxinc.net comp.os.linux.development.system:108 "dr.oktopus" writes: > as you know offset in the file structure is shared amongst father and > child processes. How can I get a per-process specific offset so that > a child lseek is not influenced by the same operation done by the > father process? Assuming that your inherited file descriptor is stored in a variable named fd (and the type of file it refers to supports this), opening the file /proc/self/ (eg /proc/self/3 if fd == 3) results in a file descriptor referring to the same file but with a newly create file structure.