Date: Thu, 24 Feb 2011 00:40:10 GMT From: Alexander Best <arundel@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/152485: null(4)/zero(4): /dev/null seek offset is not reported correctly Message-ID: <201102240040.p1O0eAbO001777@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/152485; it has been noted by GNATS. From: Alexander Best <arundel@freebsd.org> To: bug-followup@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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102240040.p1O0eAbO001777>