NetBSD-Bugs archive

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

Re: kern/44986: "screens" gets stuck during detach



The following reply was made to PR kern/44986; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: Matthias Scheler <tron%zhadum.org.uk@localhost>
Cc: NetBSD GNATS <gnats-bugs%NetBSD.org@localhost>
Subject: Re: kern/44986: "screens" gets stuck during detach
Date: Sat, 28 May 2011 10:34:20 -0400

 On May 28,  2:40pm, tron%zhadum.org.uk@localhost (Matthias Scheler) wrote:
 -- Subject: Re: kern/44986: "screens" gets stuck during detach
 
 | On Sat, May 28, 2011 at 12:15:05PM +0000, Matthias Scheler wrote:
 | >  On Fri, May 27, 2011 at 07:45:07PM +0000, Christos Zoulas wrote:
 | >  > The following reply was made to PR kern/44986; it has been noted by 
GNATS.
 | >  > 
 | >  > From: christos%zoulas.com@localhost (Christos Zoulas)
 | >  > To: yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO Takashi), 
gnats-bugs%NetBSD.org@localhost
 | >  > Cc: kern-bug-people%netbsd.org@localhost, 
gnats-admin%netbsd.org@localhost, 
 | >  >         netbsd-bugs%netbsd.org@localhost, tron%zhadum.org.uk@localhost
 | >  > Subject: Re: kern/44986: "screens" gets stuck during detach
 | >  > Date: Fri, 27 May 2011 15:44:40 -0400
 | >  > 
 | >  >  On May 27,  2:20am, yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO 
Takashi) wrote:
 | >  >  -- Subject: Re: kern/44986: "screens" gets stuck during detach
 | >  >  
 | >  >  | how does it work when select returns due to non-signal events?
 | >  >  | 
 | >  >  | YAMAMOTO Takashi
 | >  >  
 | >  >  Hmm, yes. I guess it will not restore the mask the same way. I will 
add a
 | >  >  function to do it. The question is what uses pselect or pollts?
 | >  
 | >  I've traced the calls with a non-NULL "mask" value. They are all
 | >  made by sys___pollts50() via pollcommon().
 | 
 | And I think I found out why my system makes a lot of pollts(2) calls.
 | This NetBSD system is a NIS client. And "src/lib/libc/rpc/clnt_dg.c"
 | uses pollts(2) with a non-NULL argument for the mask.
 
 Makes, sense. Which is one of the reasons we added it. This is why I don't
 see it on mine. Can you please try this:
 
 Index: kern/sys_select.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/sys_select.c,v
 retrieving revision 1.32
 diff -u -u -r1.32 sys_select.c
 --- kern/sys_select.c  18 May 2011 14:48:04 -0000      1.32
 +++ kern/sys_select.c  28 May 2011 14:33:06 -0000
 @@ -304,6 +304,9 @@
        }
        selclear();
  
 +      if (__predict_false(mask))
 +              sigsuspendteardown(l);
 +
        /* select and poll are not restarted after signals... */
        if (error == ERESTART)
                return EINTR;
 Index: kern/sys_sig.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/sys_sig.c,v
 retrieving revision 1.33
 diff -u -u -r1.33 sys_sig.c
 --- kern/sys_sig.c     18 May 2011 03:51:41 -0000      1.33
 +++ kern/sys_sig.c     28 May 2011 14:33:07 -0000
 @@ -631,6 +631,19 @@
        mutex_exit(p->p_lock);
  }
  
 +void
 +sigsuspendteardown(struct lwp *l)
 +{
 +      struct proc *p = l->l_proc;
 +
 +      mutex_enter(p->p_lock);
 +      if (l->l_sigrestore) {
 +              l->l_sigrestore = 0;
 +              l->l_sigmask = l->l_sigoldmask;
 +      }
 +      mutex_exit(p->p_lock);
 +}
 +
  int
  sigsuspend1(struct lwp *l, const sigset_t *ss)
  {
 Index: sys/signalvar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/sys/signalvar.h,v
 retrieving revision 1.80
 diff -u -u -r1.80 signalvar.h
 --- sys/signalvar.h    18 May 2011 03:51:41 -0000      1.80
 +++ sys/signalvar.h    28 May 2011 14:33:08 -0000
 @@ -149,6 +149,7 @@
  int   sigprocmask1(struct lwp *, int, const sigset_t *, sigset_t *);
  void  sigpending1(struct lwp *, sigset_t *);
  void  sigsuspendsetup(struct lwp *, const sigset_t *);
 +void  sigsuspendteardown(struct lwp *);
  int   sigsuspend1(struct lwp *, const sigset_t *);
  int   sigaltstack1(struct lwp *, const struct sigaltstack *,
            struct sigaltstack *);
 


Home | Main Index | Thread Index | Old Index