[Top][All Lists]

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

Rewriting hurdselect.c: How to detect that a file descriptor has disappe

From: Svante Signell
Subject: Rewriting hurdselect.c: How to detect that a file descriptor has disappeared?
Date: Fri, 02 Nov 2012 00:31:48 +0100


I'm working on a modified hurdselect.c, the poll() part, to enable file
descriptors being bogus, as allowed by POSIX. That case is now solved,
and the revent reported is POLLNVAL. What remains to do to is to return
the POLHUP event (and POLLERR). 

Using modified code from gnulib, attached, a case to check for is: open
a pipe getting both a read and write fs, write, read, close the read
fs, and poll. This case should be detected by hurdselect. Currently it
does not. 

The construct used in hurdselect is the mach_msg() function:

__mach_msg (&msg.head, MACH_RCV_MSG | options, 0, sizeof msg, portset,

This function call only has parameters set for reading. Can a
subsequent call using MACH_SEND_MSG parameters and messages be used to
find out? (or setting both READ and RCV parameters and messages in the
same function call above) If not, how to find out that the read part of
the pipe has been closed (within hurdselect, not the application)


Attachment: test_closing.c
Description: Text Data

reply via email to

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