*BSD News Article 10638


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA409 ; Sun, 31 Jan 93 14:06:42 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!yarra-glen.aaii.oz.au!msi.umn.edu!umn.edu!spool.mu.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!sh.wide!wnoc-tyo-news!news.u-tokyo.ac.jp!yayoi!tansei1!mhiroshi
From: mhiroshi@tansei.cc.u-tokyo.ac.jp (H. Murakami)
Newsgroups: comp.unix.bsd,fj.os.386bsd
Subject: Problem with the low level I/O.
Message-ID: <4025@tansei1.tansei.cc.u-tokyo.ac.jp>
Date: 1 Feb 93 14:38:10 GMT
Sender: news@tansei.cc.u-tokyo.ac.jp
Followup-To: comp.unix.bsd
Organization: Hokkaido Univ. However I am subject to tansei for JUNET.
Lines: 113


I found, that the 386bsd0.1 
The I/O function read()
cannot work with the large buffer size
for the raw device.

Instead it just returns the size it actually read,
The console message appeares saying that

        "Out of range, cannot happen? Device not configured"

I have Sony workstation, it can read or write
to the disks or tapes with very large buffer 
size I/O operation.
For example, 
        % tar cvfb /dev/rmt0  10000

I wonder, if this ("Device not configured" etc.)
is a bug or specification of POSIX.


Script started on Sun Jan 24 13:05:16 1993
%
% gcc -DNSECT=100 b.c
% a.out
Success.
%
% gcc -DNSECT=110 b.c
% a.out
Success.
%
% gcc -DNSECT=120 b.c
% a.out
Success.
%
% gcc -DNSECT=125 b.c
% a.out
Success.
%
% gcc -DNSECT=126 b.c
% a.out
Out of range, cannot happen? Device not configured
%
% gcc -DNSECT=127 b.c
% a.out
Out of range, cannot happen? Device not configured
%
% gcc -DNSECT=130 b.c
% a.out
Out of range, cannot happen? Device not configured
%
% cat b.c

/* Start of sample program. */ 

#define DEVICE "/dev/ras0c"  /* SCSI Raw device to be tested. */

#include <stdio.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/times.h>

#define MAXSECT 500
#define NB (512*MAXSECT)

static char     buf[NB];

main()
{
        int     d;
        int     rtn;
        int     size;

        if ((d=open(DEVICE, O_RDONLY, 0444))<=0) {
                fprintf(stderr, "Device open error.\n");
                exit(1);  }

        size = 512 * NSECT;
        if (size > NB) {
                fprintf(stderr, "NSECT too large. size > NB.\n");
                exit(2);  }

        rtn = read(d, buf, size);
        if(rtn <=0) {
                extern int errno;
                perror("");
                exit(3);
        }
        fprintf(stderr, "Success.\n");
        close(d);
}
/* THE END. */
% exit
% exit

Script done on Sun Jan 24 13:06:21 1993


PS.
       If I changed the #define DEVICE to the raw IDE drive like /dev/rwd0a,
the limit of NSECT with success goes up was observed, however,
if it is raised somevalue between 200 and 300, the system hangs up anyway.


Wmmm.... this trouble may be related to the hang up 
when mallocing by many processes.
Does this bug relates to the limitation of the kernel must reside 
below a mega bytes?

                Hiroshi Murakami
                mhiroshi@tansei.cc.u-tokyo.ac.jp
                hiroshi@teine.chem2.hokudai.ac.jp