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; |