All of lore.kernel.org
 help / color / mirror / Atom feed
* libmultipath: use poll() in uevent_listen()
@ 2016-05-11 10:35 Hannes Reinecke
  2016-05-11 17:19 ` Benjamin Marzinski
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2016-05-11 10:35 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: Hannes Reinecke, dm-devel

As we're not modifying the signal mask anymore we can switch
back to normal 'poll' instead of 'ppoll'.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 libmultipath/uevent.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index fbe9c44..454b819 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -477,7 +477,6 @@ int uevent_listen(struct udev *udev)
 	int fd, fd_ep = -1, socket_flags, events;
 	int need_failback = 1;
 	int timeout = 30;
-	sigset_t mask;
 	LIST_HEAD(uevlisten_tmp);
 
 	/*
@@ -528,22 +527,20 @@ int uevent_listen(struct udev *udev)
 		goto out;
 	}
 
-	pthread_sigmask(SIG_SETMASK, NULL, &mask);
 	events = 0;
 	while (1) {
 		struct uevent *uev;
 		struct udev_device *dev;
 		struct pollfd ev_poll;
-		struct timespec poll_timeout;
+		int poll_timeout;
 		int fdcount;
 
 		memset(&ev_poll, 0, sizeof(struct pollfd));
 		ev_poll.fd = fd;
 		ev_poll.events = POLLIN;
-		memset(&poll_timeout, 0, sizeof(struct timespec));
-		poll_timeout.tv_sec = timeout;
+		poll_timeout = timeout * 1000;
 		errno = 0;
-		fdcount = ppoll(&ev_poll, 1, &poll_timeout, &mask);
+		fdcount = poll(&ev_poll, 1, poll_timeout);
 		if (fdcount && ev_poll.revents & POLLIN) {
 			timeout = 0;
 			dev = udev_monitor_receive_device(monitor);
-- 
2.6.6

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

* Re: libmultipath: use poll() in uevent_listen()
  2016-05-11 10:35 libmultipath: use poll() in uevent_listen() Hannes Reinecke
@ 2016-05-11 17:19 ` Benjamin Marzinski
  2016-05-11 17:37   ` Christophe Varoqui
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Marzinski @ 2016-05-11 17:19 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: dm-devel, Hannes Reinecke, Christophe Varoqui

On Wed, May 11, 2016 at 12:35:53PM +0200, Hannes Reinecke wrote:
> As we're not modifying the signal mask anymore we can switch
> back to normal 'poll' instead of 'ppoll'.


ACK

-Ben

> 
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  libmultipath/uevent.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
> index fbe9c44..454b819 100644
> --- a/libmultipath/uevent.c
> +++ b/libmultipath/uevent.c
> @@ -477,7 +477,6 @@ int uevent_listen(struct udev *udev)
>  	int fd, fd_ep = -1, socket_flags, events;
>  	int need_failback = 1;
>  	int timeout = 30;
> -	sigset_t mask;
>  	LIST_HEAD(uevlisten_tmp);
>  
>  	/*
> @@ -528,22 +527,20 @@ int uevent_listen(struct udev *udev)
>  		goto out;
>  	}
>  
> -	pthread_sigmask(SIG_SETMASK, NULL, &mask);
>  	events = 0;
>  	while (1) {
>  		struct uevent *uev;
>  		struct udev_device *dev;
>  		struct pollfd ev_poll;
> -		struct timespec poll_timeout;
> +		int poll_timeout;
>  		int fdcount;
>  
>  		memset(&ev_poll, 0, sizeof(struct pollfd));
>  		ev_poll.fd = fd;
>  		ev_poll.events = POLLIN;
> -		memset(&poll_timeout, 0, sizeof(struct timespec));
> -		poll_timeout.tv_sec = timeout;
> +		poll_timeout = timeout * 1000;
>  		errno = 0;
> -		fdcount = ppoll(&ev_poll, 1, &poll_timeout, &mask);
> +		fdcount = poll(&ev_poll, 1, poll_timeout);
>  		if (fdcount && ev_poll.revents & POLLIN) {
>  			timeout = 0;
>  			dev = udev_monitor_receive_device(monitor);
> -- 
> 2.6.6

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

* Re: libmultipath: use poll() in uevent_listen()
  2016-05-11 17:19 ` Benjamin Marzinski
@ 2016-05-11 17:37   ` Christophe Varoqui
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe Varoqui @ 2016-05-11 17:37 UTC (permalink / raw)
  To: Benjamin Marzinski; +Cc: device-mapper development, Hannes Reinecke


[-- Attachment #1.1: Type: text/plain, Size: 1964 bytes --]

Merged

On Wed, May 11, 2016 at 7:19 PM, Benjamin Marzinski <bmarzins@redhat.com>
wrote:

> On Wed, May 11, 2016 at 12:35:53PM +0200, Hannes Reinecke wrote:
> > As we're not modifying the signal mask anymore we can switch
> > back to normal 'poll' instead of 'ppoll'.
>
>
> ACK
>
> -Ben
>
> >
> > Signed-off-by: Hannes Reinecke <hare@suse.com>
> > ---
> >  libmultipath/uevent.c | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
> > index fbe9c44..454b819 100644
> > --- a/libmultipath/uevent.c
> > +++ b/libmultipath/uevent.c
> > @@ -477,7 +477,6 @@ int uevent_listen(struct udev *udev)
> >       int fd, fd_ep = -1, socket_flags, events;
> >       int need_failback = 1;
> >       int timeout = 30;
> > -     sigset_t mask;
> >       LIST_HEAD(uevlisten_tmp);
> >
> >       /*
> > @@ -528,22 +527,20 @@ int uevent_listen(struct udev *udev)
> >               goto out;
> >       }
> >
> > -     pthread_sigmask(SIG_SETMASK, NULL, &mask);
> >       events = 0;
> >       while (1) {
> >               struct uevent *uev;
> >               struct udev_device *dev;
> >               struct pollfd ev_poll;
> > -             struct timespec poll_timeout;
> > +             int poll_timeout;
> >               int fdcount;
> >
> >               memset(&ev_poll, 0, sizeof(struct pollfd));
> >               ev_poll.fd = fd;
> >               ev_poll.events = POLLIN;
> > -             memset(&poll_timeout, 0, sizeof(struct timespec));
> > -             poll_timeout.tv_sec = timeout;
> > +             poll_timeout = timeout * 1000;
> >               errno = 0;
> > -             fdcount = ppoll(&ev_poll, 1, &poll_timeout, &mask);
> > +             fdcount = poll(&ev_poll, 1, poll_timeout);
> >               if (fdcount && ev_poll.revents & POLLIN) {
> >                       timeout = 0;
> >                       dev = udev_monitor_receive_device(monitor);
> > --
> > 2.6.6
>

[-- Attachment #1.2: Type: text/html, Size: 2933 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2016-05-11 17:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 10:35 libmultipath: use poll() in uevent_listen() Hannes Reinecke
2016-05-11 17:19 ` Benjamin Marzinski
2016-05-11 17:37   ` Christophe Varoqui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.