Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!mcvax!kddlab!nttlab!nttspl!futagami From: futagami@nttspl.ntt.junet (Toshitsugu Futagami) Newsgroups: net.unix Subject: The problem of "read" system call Message-ID: <140@nttspl.ntt.junet> Date: Thu, 13-Mar-86 17:14:08 EST Article-I.D.: nttspl.140 Posted: Thu Mar 13 17:14:08 1986 Date-Received: Sun, 16-Mar-86 09:42:43 EST Distribution: net Organization: NTT Software Production Technology Labs., Japan Lines: 96 Dear Sirs: Our VAX-11/750 stops on the point of "read" in the following program. This process remains the status "D" of process runnability and we cannot kill the process. We find that it often stops after reading a tape mark. Is it a bug of 4.2BSD? Or our mt equipment has any troubles? If you can, please run this program and tell me the result. If you know anything, please tell me them, wouldn't you? Thank you. +--------+---------+---------+---------+---------+---------+---------+---------+ | NTT Toshitsugu Futagami NTT | | NTT ( NTT Software Production Technology Labs. JAPAN) NTT | | NTT JUNET: futagami@nttspl.ntt.junet NTT | | NTT UUCP : ..!kddlab!nttlab!nttspl!futagami NTT | | NTT PHONE: ( 0422 ) 59 - 3518 NTT | +--------+---------+---------+---------+---------+---------+---------+---------+ --------------------------------------------------------------- #include #include #include #include #include #include main() { int i,mfd; int r; int k; char buf[4100]; struct mtop mtbl; k=1; if ((mfd=open("/dev/rmt12",O_RDONLY,00777)) == -1) { printf("open err\n"); exit(); } while(1) { r = read(mfd,buf,4100); if ( r == -1) { printf("read err\n"); exit(); } if (r == 0) { printf("\n"); if (close(mfd) == -1) { printf("close err\n"); exit(); } if ((mfd=open("/dev/rmt12",O_RDONLY,00777)) == -1) { printf("open err\n"); exit(); } r = read(mfd,buf,4100); if (r == -1) { printf("read err\n"); exit(); } if (r == 0) { printf("\n"); if (close(mfd) == -1) { printf("close err\n"); exit(); } break; } for (i=0;i\n"); continue; } for (i=0;i\n"); continue; } printf("\n"); if ((mfd=open("/dev/rmt12",O_RDONLY,00777)) == -1) { printf("open err\n"); exit(); } mtbl.mt_op = MTREW; mtbl.mt_count = 1; if (ioctl(mfd, MTIOCTOP, &mtbl) == -1) { printf("ioctl error\n"); exit(); } if (close(mfd) == -1) { printf("close err\n"); exit(); } } ---------------------------------------------------------------