Re: some questions about descriptors

From: Frederick Barnes (frmb2@ukc.ac.uk)
Date: Sun Jun 04 2000 - 05:53:29 EST


> > happens. In all cases, a number of processes share the same
> > file-descriptor table (via clone());
> >
> > * is reading from a descriptor in one clone, and writing to it
> > in another safe ?
>
> Yes. Remember the file offset is shared, you may find pread/pwrite more
> useful

Most of the time I'll be using sockets, wanting to read/write
in parallel from different clones.

> > * if a clone is blocked reading/writing from a descriptor, does
> > close()ing it in another clone cause an error return from the
> > blocked clone ? does the same happen if the descriptor is in
> > a select() set (and blocked), when the descriptor is close()d
> > in another clone ?
>
> It closes when all the syscalls using it return

So calling close() in one clone, won't cause the early return of,
say, read() in another; the read has to complete before the
descriptor gets closed proper. Is that right ?

-- Fred

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:18 EST