This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Linux Checkpoints, take 3
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: msnyder at redhat dot com, gdb-patches at sources dot redhat dot com, drow at false dot org
- Date: Mon, 26 Dec 2005 20:57:36 +0200
- Subject: Re: [RFA] Linux Checkpoints, take 3
- References: <43AC7D2E.6020609@redhat.com> <200512261533.jBQFXCwt001363@elgar.sibelius.xs4all.nl>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Mon, 26 Dec 2005 16:33:12 +0100 (CET)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
> CC: gdb-patches@sources.redhat.com, drow@false.org
>
> > + /* Now save the 'state' (file position) of all open file descriptors.
> > + Unfortunately fork does not take care of that for us... */
>
> Hmm, fork(2) clones it file descroptors but both file descriptors
> refer to the same open file description. Nasty. Wonder whether it'd
> be possible to copy the open file descriptorions too.
`fork' does the equivalent of `dup', AFAIK, so it cannot copy the
system file table entry to which those descriptors point. If it did
copy the entries, redirection would stop working.