bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lost process output in pipe between Emacs and CVS


From: Ian Lance Taylor
Subject: Re: Lost process output in pipe between Emacs and CVS
Date: 09 Jul 2002 14:47:35 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

"Stefan Monnier" <monnier+gnu/emacs/address@hidden> writes:

> > >     CVS uses stdio, and stdio doesn't work very well with non-blocking
> > >     file descriptors.  CVS can detect the error easily enough, but at that
> > >     point stdio has already thrown away the buffer full of data, and CVS
> > >     hasn't recorded it anywhere.  While in principle CVS could switch to
> > >     not use stdio, that would be a fairly substantial change.
> 
> My Unix programming is a bit rusty, so could someone explain to me
> why SSH changing the blocking status of its file-descriptor would
> have any impact on CVS' file-descriptor ?  I understand the notion
> of duplicating/sharing file-descriptors, but I would expect the
> "blocking" status of a file-descriptor to be per-process rather than
> global to all processes sharing that file-descriptor.

You might expect that, but you would be wrong.

First, don't get confused by process boundaries.  In Unix, file
descriptors point to file structures.  The table of file descriptors
is process specific; the file structures are not.

There are flags associated with a specific file descriptor, which do
not apply to duped file descriptors; these are the ones returned by
fcntl(F_GETFD), and the only standard one is FD_CLOEXEC.

There are flags associated with a specific file structure, which do
apply to duped file descriptors; these are the ones returned by
fcntl(F_GETFL), and include O_APPEND and O_NONBLOCK.

This is all more or less so that >> works correctly in /bin/sh.

Ian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]