NetBSD-Bugs archive

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

Re: lib/53003: Problem with rust library using kqueue



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

From: Mickael Viey <m.viey%wanadoo.fr@localhost>
To: gnats-bugs%NetBSD.org@localhost, lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/53003: Problem with rust library using kqueue
Date: Sat, 17 Feb 2018 21:03:40 +0100

 This is a multi-part message in MIME format.
 --------------D862FF91F5BE7956B1E84E94
 Content-Type: text/plain; charset=utf-8; format=flowed
 Content-Transfer-Encoding: 8bit
 
 Hello,
 
 
 Finally I build a new kernel from netbsd-7 branch where you patch was 
 been backported.
 
 and code given in example work on this new kernel.
 
 
 Thx for your help.
 
 
 Best,
 
 
 Mickaël
 
 
 Le 11/02/2018 à 17:10, Christos Zoulas a écrit :
 > The following reply was made to PR lib/53003; it has been noted by GNATS.
 >
 > From: christos%zoulas.com@localhost (Christos Zoulas)
 > To: Mickael Viey <m.viey%wanadoo.fr@localhost>, gnats-bugs%NetBSD.org@localhost,
 > 	lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
 > 	netbsd-bugs%netbsd.org@localhost
 > Cc:
 > Subject: Re: lib/53003: Problem with rust library using kqueue
 > Date: Sun, 11 Feb 2018 11:08:19 -0500
 >
 >   On Feb 11, 10:23am, m.viey%wanadoo.fr@localhost (Mickael Viey) wrote:
 >   -- Subject: Re: lib/53003: Problem with rust library using kqueue
 >   
 >   | Ok, the NetBSD in that I tried this code is my usual working machine,
 >   | but I will try on a VM ASAP.
 >   |
 >   | Do you know why this code fails on the stable version? (a link to a PR
 >   | by example)
 >   |
 >   | Thanks for your reply(, and sorry for the typing error on uname.)
 >   
 >   I am not sure. One thing to try is to apply the diff from
 >   of kern_event.c HEAD to the netbsd-7 branch and change f_kqueue -> f_data
 >   so that it compiles. The other thing you can do is to ktrace the binary
 >   to see where it fails. My guess is that if fails because of the following.
 >   Try it, and if it works I will ask for a pullup.
 >   
 >   christos
 >   
 >   revision 1.198
 >   date: 2017-07-01 16:07:00 -0400;  author: christos;  state: Exp;  lines: +33 -2;
 >   Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
 >   Makes go unit tests pass.
 >   
 >   
 >   Index: genfs_vnops.c
 >   ===================================================================
 >   RCS file: /cvsroot/src/sys/miscfs/genfs/genfs_vnops.c,v
 >   retrieving revision 1.197
 >   retrieving revision 1.198
 >   diff -u -r1.197 -r1.198
 >   --- genfs_vnops.c	4 Jun 2017 08:02:26 -0000	1.197
 >   +++ genfs_vnops.c	1 Jul 2017 20:07:00 -0000	1.198
 >   @@ -1,4 +1,4 @@
 >   -/*	$NetBSD: genfs_vnops.c,v 1.197 2017/06/04 08:02:26 hannken Exp $	*/
 >   +/*	$NetBSD: genfs_vnops.c,v 1.198 2017/07/01 20:07:00 christos Exp $	*/
 >    
 >    /*-
 >     * Copyright (c) 2008 The NetBSD Foundation, Inc.
 >   @@ -57,7 +57,7 @@
 >     */
 >    
 >    #include <sys/cdefs.h>
 >   -__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.197 2017/06/04 08:02:26 hannken Exp $");
 >   +__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.198 2017/07/01 20:07:00 christos Exp $");
 >    
 >    #include <sys/param.h>
 >    #include <sys/systm.h>
 >   @@ -500,6 +500,32 @@
 >    }
 >    
 >    static int
 >   +filt_genfswrite(struct knote *kn, long hint)
 >   +{
 >   +	struct vnode *vp = (struct vnode *)kn->kn_hook;
 >   +
 >   +	/*
 >   +	 * filesystem is gone, so set the EOF flag and schedule
 >   +	 * the knote for deletion.
 >   +	 */
 >   +	switch (hint) {
 >   +	case NOTE_REVOKE:
 >   +		KASSERT(mutex_owned(vp->v_interlock));
 >   +		kn->kn_flags |= (EV_EOF | EV_ONESHOT);
 >   +		return (1);
 >   +	case 0:
 >   +		mutex_enter(vp->v_interlock);
 >   +		kn->kn_data = 0;
 >   +		mutex_exit(vp->v_interlock);
 >   +		return 1;
 >   +	default:
 >   +		KASSERT(mutex_owned(vp->v_interlock));
 >   +		kn->kn_data = 0;
 >   +		return 1;
 >   +	}
 >   +}
 >   +
 >   +static int
 >    filt_genfsvnode(struct knote *kn, long hint)
 >    {
 >    	struct vnode *vp = (struct vnode *)kn->kn_hook;
 >   @@ -530,6 +556,8 @@
 >    
 >    static const struct filterops genfsread_filtops =
 >    	{ 1, NULL, filt_genfsdetach, filt_genfsread };
 >   +static const struct filterops genfswrite_filtops =
 >   +	{ 1, NULL, filt_genfsdetach, filt_genfswrite };
 >    static const struct filterops genfsvnode_filtops =
 >    	{ 1, NULL, filt_genfsdetach, filt_genfsvnode };
 >    
 >   @@ -549,6 +577,9 @@
 >    	case EVFILT_READ:
 >    		kn->kn_fop = &genfsread_filtops;
 >    		break;
 >   +	case EVFILT_WRITE:
 >   +		kn->kn_fop = &genfswrite_filtops;
 >   +		break;
 >    	case EVFILT_VNODE:
 >    		kn->kn_fop = &genfsvnode_filtops;
 >    		break;
 >   
 
 
 --------------D862FF91F5BE7956B1E84E94
 Content-Type: text/html; charset=utf-8
 Content-Transfer-Encoding: 8bit
 
 <html>
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   </head>
   <body text="#333333" bgcolor="#CCCCCC">
     <p>Hello,</p>
     <p><br>
     </p>
     <p>Finally I build a new kernel from netbsd-7 branch where you patch
       was been backported.</p>
     <p>and code given in example work on this new kernel.</p>
     <p><br>
     </p>
     <p>Thx for your help.</p>
     <p><br>
     </p>
     <p>Best,</p>
     <p><br>
     </p>
     <p>Mickaël<br>
     </p>
     <br>
     <div class="moz-cite-prefix">Le 11/02/2018 à 17:10, Christos Zoulas
       a écrit :<br>
     </div>
     <blockquote type="cite"
       cite="mid:20180211161001.3037C7A264%mollari.NetBSD.org@localhost">
       <pre wrap="">The following reply was made to PR lib/53003; it has been noted by GNATS.
 
 From: <a class="moz-txt-link-abbreviated" href="mailto:christos%zoulas.com@localhost";>christos%zoulas.com@localhost</a> (Christos Zoulas)
 To: Mickael Viey <a class="moz-txt-link-rfc2396E" href="mailto:m.viey%wanadoo.fr@localhost";>&lt;m.viey%wanadoo.fr@localhost&gt;</a>, <a class="moz-txt-link-abbreviated" href="mailto:gnats-bugs%NetBSD.org@localhost";>gnats-bugs%NetBSD.org@localhost</a>, 
 	<a class="moz-txt-link-abbreviated" href="mailto:lib-bug-people%netbsd.org@localhost";>lib-bug-people%netbsd.org@localhost</a>, <a class="moz-txt-link-abbreviated" href="mailto:gnats-admin%netbsd.org@localhost";>gnats-admin%netbsd.org@localhost</a>, 
 	<a class="moz-txt-link-abbreviated" href="mailto:netbsd-bugs%netbsd.org@localhost";>netbsd-bugs%netbsd.org@localhost</a>
 Cc: 
 Subject: Re: lib/53003: Problem with rust library using kqueue
 Date: Sun, 11 Feb 2018 11:08:19 -0500
 
  On Feb 11, 10:23am, <a class="moz-txt-link-abbreviated" href="mailto:m.viey%wanadoo.fr@localhost";>m.viey%wanadoo.fr@localhost</a> (Mickael Viey) wrote:
  -- Subject: Re: lib/53003: Problem with rust library using kqueue
  
  | Ok, the NetBSD in that I tried this code is my usual working machine, 
  | but I will try on a VM ASAP.
  | 
  | Do you know why this code fails on the stable version? (a link to a PR 
  | by example)
  | 
  | Thanks for your reply(, and sorry for the typing error on uname.)
  
  I am not sure. One thing to try is to apply the diff from
  of kern_event.c HEAD to the netbsd-7 branch and change f_kqueue -&gt; f_data
  so that it compiles. The other thing you can do is to ktrace the binary
  to see where it fails. My guess is that if fails because of the following.
  Try it, and if it works I will ask for a pullup.
  
  christos
  
  revision 1.198
  date: 2017-07-01 16:07:00 -0400;  author: christos;  state: Exp;  lines: +33 -2;
  Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
  Makes go unit tests pass.
  
  
  Index: genfs_vnops.c
  ===================================================================
  RCS file: /cvsroot/src/sys/miscfs/genfs/genfs_vnops.c,v
  retrieving revision 1.197
  retrieving revision 1.198
  diff -u -r1.197 -r1.198
  --- genfs_vnops.c	4 Jun 2017 08:02:26 -0000	1.197
  +++ genfs_vnops.c	1 Jul 2017 20:07:00 -0000	1.198
  @@ -1,4 +1,4 @@
  -/*	$NetBSD: genfs_vnops.c,v 1.197 2017/06/04 08:02:26 hannken Exp $	*/
  +/*	$NetBSD: genfs_vnops.c,v 1.198 2017/07/01 20:07:00 christos Exp $	*/
   
   /*-
    * Copyright (c) 2008 The NetBSD Foundation, Inc.
  @@ -57,7 +57,7 @@
    */
   
   #include &lt;sys/cdefs.h&gt;
  -__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.197 2017/06/04 08:02:26 hannken Exp $");
  +__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.198 2017/07/01 20:07:00 christos Exp $");
   
   #include &lt;sys/param.h&gt;
   #include &lt;sys/systm.h&gt;
  @@ -500,6 +500,32 @@
   }
   
   static int
  +filt_genfswrite(struct knote *kn, long hint)
  +{
  +	struct vnode *vp = (struct vnode *)kn-&gt;kn_hook;
  +
  +	/*
  +	 * filesystem is gone, so set the EOF flag and schedule
  +	 * the knote for deletion.
  +	 */
  +	switch (hint) {
  +	case NOTE_REVOKE:
  +		KASSERT(mutex_owned(vp-&gt;v_interlock));
  +		kn-&gt;kn_flags |= (EV_EOF | EV_ONESHOT);
  +		return (1);
  +	case 0:
  +		mutex_enter(vp-&gt;v_interlock);
  +		kn-&gt;kn_data = 0;
  +		mutex_exit(vp-&gt;v_interlock);
  +		return 1;
  +	default:
  +		KASSERT(mutex_owned(vp-&gt;v_interlock));
  +		kn-&gt;kn_data = 0;
  +		return 1;
  +	}
  +}
  +
  +static int
   filt_genfsvnode(struct knote *kn, long hint)
   {
   	struct vnode *vp = (struct vnode *)kn-&gt;kn_hook;
  @@ -530,6 +556,8 @@
   
   static const struct filterops genfsread_filtops =
   	{ 1, NULL, filt_genfsdetach, filt_genfsread };
  +static const struct filterops genfswrite_filtops =
  +	{ 1, NULL, filt_genfsdetach, filt_genfswrite };
   static const struct filterops genfsvnode_filtops =
   	{ 1, NULL, filt_genfsdetach, filt_genfsvnode };
   
  @@ -549,6 +577,9 @@
   	case EVFILT_READ:
   		kn-&gt;kn_fop = &amp;genfsread_filtops;
   		break;
  +	case EVFILT_WRITE:
  +		kn-&gt;kn_fop = &amp;genfswrite_filtops;
  +		break;
   	case EVFILT_VNODE:
   		kn-&gt;kn_fop = &amp;genfsvnode_filtops;
   		break;
  
 </pre>
     </blockquote>
     <br>
   </body>
 </html>
 
 --------------D862FF91F5BE7956B1E84E94--
 



Home | Main Index | Thread Index | Old Index