Re: Finding out socket/pipe connectivity status

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

 



> 	write(stdout, request);
> 	/* reference point [A] */
> 	read(stdin, response);
> 
> So my idea had been to launch another thread that monitors stdin for
> 'breakage' and unmount the fs before a user can start an operation on
> myfs. So I've been trying to complete the idea to code. You say a
> broken socket raises the read flag, so:

Your connection can break at any point even mid-write so you must handle
it. You have no real choice.

You can try and spot it earlier by using select/poll and checking for
error. In which case I'd use poll() as it is a bit more clear about what
event you get

Then poll stdin and stdout. The kernel will give you back 

POLLERR - an error condition
POLLHUP - a hangup

if at the point you poll an error has already occurred. You can do this
with select and the socket error and related stuff buts its uglier

Alan
 

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux