NetBSD Problem Report #7084

Received: (qmail 5073 invoked from network); 5 Mar 1999 03:00:54 -0000
Message-Id: <199903050300.TAA00967@isaac.nas.nasa.gov>
Date: Thu, 4 Mar 1999 19:00:20 -0800 (PST)
From: "Thomas M. Proett" <proett@nas.nasa.gov>
Reply-To: proett@nas.nasa.gov
To: gnats-bugs@gnats.netbsd.org
Subject: read.2 man page
X-Send-Pr-Version: 3.95

>Number:         7084
>Category:       lib
>Synopsis:       read.2 man page needs entry for EINVAL
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 04 19:05:01 +0000 1999
>Closed-Date:    Wed May 17 10:16:46 +0000 2000
>Last-Modified:  Wed May 17 10:16:46 +0000 2000
>Originator:     Tom Proett
>Release:        <NetBSD-current source date> NetBSD 1.3J
>Organization:
proett@nas.nasa.gov
NASA Ames Research Center
>Environment:

System: NetBSD isaac.nas.nasa.gov 1.3J NetBSD 1.3J (MSS3_RAWHIDE) #3: Thu Mar 4 14:45:11 PST 1999 root@isaac.nas.nasa.gov:/usr/src/sys/arch/alpha/compile/MSS3_RAWHIDE alpha


>Description:

A program which opens a raw disk device then tries to read anything
except an even multiple of a block size gets EINVAL.  This is not
mentioned in the read.2 man page.
>How-To-Repeat:

Compile and run:

#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>

main()
{
        int     fd;
        int     cnt;
        char    buf[50];

        if ((fd = open("/dev/rsd10g", O_RDONLY)) == -1) {
                perror("open");
                exit(1);
        }
        cnt = read(fd, buf, sizeof(buf));
        printf("got %d with err %d\n", cnt, errno);
        return 0;
}

You get:

got -1 with err 22

The line of interest from /usr/include/sys/errno.h is:

#define EINVAL          22              /* Invalid argument */

>Fix:

>Release-Note:
>Audit-Trail:

From: "Erik E. Fair" <fair@clock.org>
To: proett@nas.nasa.gov
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: lib/7084: read.2 man page
Date: Fri, 5 Mar 1999 09:51:28 -0800

 The read.2 doesn't mention the myriad error messages one could get from a
 network failure while reading a socket, either. I don't think that is a
 bug, however; we need to cross reference stuff more, but while a little
 duplication of information in the man pages is OK, it increases the
 probability of documentation synchronization errors, and should be avoided
 in general.

 Perhaps a reference to intro(4) is in order. Hmmm. I can't find the doco
 that says that raw devices have to be read/written in DEV_BSIZE chunks...

 	Erik <fair@clock.org>
State-Changed-From-To: open->closed 
State-Changed-By: fair 
State-Changed-When: Wed May 17 03:15:07 PDT 2000 
State-Changed-Why:  
the basic system call man pages are not a catchall for every error that 
a descriptor operation can generate, particularly given that a descriptor 
can refer to a whole lot of different objects, each of which has its own 
characteristics (and, necessarily, error messages associated with its 
own peculiar failure modes). 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.