lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0708122328070.28963@fbirervta.pbzchgretzou.qr>
Date:	Sun, 12 Aug 2007 23:33:03 +0200 (CEST)
From:	Jan Engelhardt <jengelh@...putergmbh.de>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	linux-fsdevel@...r.kernel.org
Subject: Re: Finding out socket/pipe connectivity status


On Aug 12 2007 19:42, Alan Cox wrote:
>> 	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.

Yes, of course. I was just saying that when the filesystem is in an operation,

	`df` -> sys_statvfs() -> [fuse magic] -> my_fuse_fs_statfs()

I cannot cancel that operation in a way such that df (or /proc/mounts if you
like) does not show the mount anymore when the peer is dead. I have to return
something. I am fine with that.

>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

poll() alone seems to do just what I want, thank you very much.

When the socket breaks, poll raises POLLIN, POLLHUP and POLLRDHUP, but not
POLLERR. What exactly is the difference between HUP and RDHUP? The manpage is
not too verbose on that. (A guess would be that RDHUP is only for sockets,
not pipes.)


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ