Subject: lib/7084: read.2 man page
To: None <gnats-bugs@gnats.netbsd.org>
From: Thomas M. Proett <proett@nas.nasa.gov>
List: netbsd-bugs
Date: 03/04/1999 19:00:20
>Number:         7084
>Category:       lib
>Synopsis:       read.2 man page needs entry for EINVAL
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar  4 19:05:01 1999
>Last-Modified:
>Originator:     Tom Proett
>Organization:
proett@nas.nasa.gov
NASA Ames Research Center
>Release:        <NetBSD-current source date> NetBSD 1.3J
>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:
	
>Audit-Trail:
>Unformatted: