lkml.org 
[lkml]   [2001]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: PROBLEM: I/O system call never returns if file desc is closed in the


On Thu, 7 Jun 2001, Matthias Urlichs wrote:

> > > a nonblocking read/write on the file descriptor won't block. You'd
> > > get EBADF in this case, therefore causing the select to return would
> > > be a Good Thing.
> >
> > Bzzert. Wrong. It may easily block. open() from another thread might
> > grab that descriptor just fine.
> >
> Sorry, s/file descriptor/file-or-socket-or-whatever.

Then what EBADF are you talking about?

> Well, if it triggers a return from select(), which it currently doesn't
> do under Linux, then it should also trigger a return from read() (with
> either zero or -EBADF).
>
> I wonder whether any other Unixes do that..?

FreeBSD, Plan 9: same as Linux (get file by descriptor, forget about
descriptor you've used for that)
OpenBSD, NetBSD: good chance of kernel panic (the whole handling of shared
descriptor tables is broken)

the rest: entirely different threads model.

> > Operations like read, select, etc. act of files. Not on descriptors.
> >
> Right -- I sort-of implied that. My fault.

So why would closing a descriptor have any effect on them? struct file
is alive and well, held by the operation we are doing.

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

\
 
 \ /
  Last update: 2005-03-22 12:54    [from the cache]
©2003-2011 Jasper Spaans