The following reply was made to PR misc/152485; it has been noted by GNATS.
From: Alexander Best <arun...@freebsd.org> To: bug-follo...@freebsd.org Cc: Subject: Re: misc/152485: null(4)/zero(4): /dev/null seek offset is not reported correctly Date: Thu, 24 Feb 2011 00:37:54 +0000 --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline does this patch solve the issue for you? cheers. alex -- a13x --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="null.c.diff" diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index 3005c19..a83be6f 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -47,11 +47,12 @@ static struct cdev *zero_dev; static d_write_t null_write; static d_ioctl_t null_ioctl; +static d_read_t null_read; static d_read_t zero_read; static struct cdevsw null_cdevsw = { .d_version = D_VERSION, - .d_read = (d_read_t *)nullop, + .d_read = null_read, .d_write = null_write, .d_ioctl = null_ioctl, .d_name = "null", @@ -71,6 +72,19 @@ static void *zbuf; static int null_write(struct cdev *dev __unused, struct uio *uio, int flags __unused) { + + uio->uio_offset += uio->uio_resid; + uio->uio_resid = 0; + + return (0); +} + +/* ARGSUSED */ +static int +null_read(struct cdev *dev __unused, struct uio *uio, int flags __unused) +{ + + uio->uio_offset += uio->uio_resid; uio->uio_resid = 0; return (0); --tThc/1wpZn/ma/RB-- _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"