Date: Sun, 6 Feb 2005 21:33:22 -0800 From: "Ashwin Chandra" <ashcs@ucla.edu> To: <freebsd-hackers@freebsd.org> Subject: Opening files in Kernel Mode: help Message-ID: <002901c50cd6$89db4330$58e243a4@ash>
next in thread | raw e-mail | index | archive | help
So this is the code I got from help from you hackers out there and = templates in the /kern library. This compiles but causes a kernel panic. = I was wondering if any of you knew why this was happening and if I am = calling all the virtual node functions correctly? =20 ***********************CODE BELOW************************ register struct proc *p; struct nameidata nd; int flags =3D FWRITE | O_CREAT; struct ucred *uc; static struct ucred *acctcred; char data[1000]; acctcred =3D crhold(curthread->td_ucred); uc =3D crhold(acctcred); NDINIT(&nd, CREATE, FOLLOW, UIO_SYSSPACE, "/home/achandra/LOG", = curthread); vn_open(&nd, &flags, 0,-1); NDFREE(&nd, NDF_ONLY_PNBUF); vref(nd.ni_vp); VOP_LEASE(nd.ni_vp, curthread, uc, LEASE_WRITE); sprintf(data, "%s", "asdsada"); vn_rdwr(UIO_WRITE, nd.ni_vp, (caddr_t)data, strlen(data), (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, uc, NOCRED, (int *)0, curthread); vrele(nd.ni_vp); crfree(uc); vn_close(nd.ni_vp, flags, curthread->td_ucred, curthread);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002901c50cd6$89db4330$58e243a4>