linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] proc.5: Correct polling of mounts via select()
@ 2016-05-08 17:04 Simon Nagl
       [not found] ` <ffc3f500-cd85-0895-6ff5-6efce2254998-CZK690njTpI@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Nagl @ 2016-05-08 17:04 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hello mkt,

I tried to poll for changes of /proc/mounts via select().

This does not work as expected. I found more inforamtion on stackoverflow.

http://stackoverflow.com/questions/5070801/monitoring-mount-point-changes-via-proc-mounts



>From 41d047b5df0dc759be621d0af1e45e5b6fba0028 Mon Sep 17 00:00:00 2001
From: Simon Nagl <simonnagl-CZK690njTpI@public.gmane.org>
Date: Sun, 8 May 2016 18:49:36 +0200
Subject: [PATCH] proc.5: Correct polling of mounts via select()

Change of mounts can be polled with select via exceptfds, not readfds.
---
 man5/proc.5 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man5/proc.5 b/man5/proc.5
index cb85b9b..a377d06 100644
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -47,6 +47,7 @@
 .\"     and /proc/[pid]/fdinfo/*.
 .\" 2008-06-19, mtk, Documented /proc/[pid]/status.
 .\" 2008-07-15, mtk, added /proc/config.gz
+.\" 2016-05-08, Simon Nagl (simonnagl-CZK690njTpI@public.gmane.org), corrected
/proc/[pid]/mounts
 .\"
 .\" FIXME . cross check against Documentation/filesystems/proc.txt
 .\" to see what information could be imported from that file
@@ -1186,7 +1187,7 @@ Since kernel version 2.6.15, this file is pollable:
 after opening the file for reading, a change in this file
 (i.e., a filesystem mount or unmount) causes
 .BR select (2)
-to mark the file descriptor as readable, and
+to mark the file descriptor as an exception, and
 .BR poll (2)
 and
 .BR epoll_wait (2)
-- 
2.8.2


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] proc.5: Correct polling of mounts via select()
       [not found] ` <ffc3f500-cd85-0895-6ff5-6efce2254998-CZK690njTpI@public.gmane.org>
@ 2016-05-18 20:36   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-05-18 20:36 UTC (permalink / raw)
  To: Simon Nagl
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Simon,

On 05/08/2016 07:04 PM, Simon Nagl wrote:
> Hello mkt,
> 
> I tried to poll for changes of /proc/mounts via select().
> 
> This does not work as expected. I found more inforamtion on stackoverflow.
> 
> http://stackoverflow.com/questions/5070801/monitoring-mount-point-changes-via-proc-mounts
>
> From 41d047b5df0dc759be621d0af1e45e5b6fba0028 Mon Sep 17 00:00:00 2001
> From: Simon Nagl <simonnagl-CZK690njTpI@public.gmane.org>
> Date: Sun, 8 May 2016 18:49:36 +0200
> Subject: [PATCH] proc.5: Correct polling of mounts via select()
> 
> Change of mounts can be polled with select via exceptfds, not readfds.
> ---
>  man5/proc.5 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/man5/proc.5 b/man5/proc.5
> index cb85b9b..a377d06 100644
> --- a/man5/proc.5
> +++ b/man5/proc.5
> @@ -47,6 +47,7 @@
>  .\"     and /proc/[pid]/fdinfo/*.
>  .\" 2008-06-19, mtk, Documented /proc/[pid]/status.
>  .\" 2008-07-15, mtk, added /proc/config.gz
> +.\" 2016-05-08, Simon Nagl (simonnagl-CZK690njTpI@public.gmane.org), corrected
> /proc/[pid]/mounts
>  .\"
>  .\" FIXME . cross check against Documentation/filesystems/proc.txt
>  .\" to see what information could be imported from that file
> @@ -1186,7 +1187,7 @@ Since kernel version 2.6.15, this file is pollable:
>  after opening the file for reading, a change in this file
>  (i.e., a filesystem mount or unmount) causes
>  .BR select (2)
> -to mark the file descriptor as readable, and
> +to mark the file descriptor as an exception, and
>  .BR poll (2)
>  and
>  .BR epoll_wait (2)

Thanks for this report. I applied a somewhat more detailed patch, as below.

Cheers,

Michael

diff --git a/man7/namespaces.7 b/man7/namespaces.7
index a736711..3de8f5f 100644
--- a/man7/namespaces.7
+++ b/man7/namespaces.7
@@ -297,11 +297,20 @@ Since kernel version 2.6.15, this file is pollable:
 after opening the file for reading, a change in this file
 (i.e., a filesystem mount or unmount) causes
 .BR select (2)
-to mark the file descriptor as readable, and
+to mark the file descriptor as having an exceptional condition, and
 .BR poll (2)
 and
 .BR epoll_wait (2)
-mark the file as having an error condition.
+mark the file as having a priority event
+.RB ( POLLPRI ).
+(Before Linux 2.6.30,
+a change in this file was indicated by the file descriptor
+being marked as readable for
+.BR select (2),
+and being marked as having an error condition for
+.BR poll (2)
+and
+.BR epoll_wait (2).)
 
 The
 .IR /proc/[pid]/mountstats



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-18 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-08 17:04 [patch] proc.5: Correct polling of mounts via select() Simon Nagl
     [not found] ` <ffc3f500-cd85-0895-6ff5-6efce2254998-CZK690njTpI@public.gmane.org>
2016-05-18 20:36   ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).