From owner-freebsd-bugs@FreeBSD.ORG Thu Feb 24 00:40:10 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 480BA106566C for ; Thu, 24 Feb 2011 00:40:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 36B718FC17 for ; Thu, 24 Feb 2011 00:40:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1O0eAPf001778 for ; Thu, 24 Feb 2011 00:40:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1O0eAbO001777; Thu, 24 Feb 2011 00:40:10 GMT (envelope-from gnats) Date: Thu, 24 Feb 2011 00:40:10 GMT Message-Id: <201102240040.p1O0eAbO001777@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Alexander Best Cc: Subject: Re: misc/152485: null(4)/zero(4): /dev/null seek offset is not reported correctly X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alexander Best List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Feb 2011 00:40:10 -0000 The following reply was made to PR misc/152485; it has been noted by GNATS. From: Alexander Best 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--