Path: utzoo!utgpu!watmath!att!ucbvax!ucdavis!sunny!poage From: poage@sunny.ucdavis.edu (Tom Poage) Newsgroups: comp.unix.questions Subject: SunOS 4.0.3 SCSI tape close error: EPERM Keywords: Sun 4.0.3 SCSI tape oh-my grmphh close(2) Message-ID: <419@sunny.ucdavis.edu> Date: 2 Aug 89 18:21:56 GMT Reply-To: poage@sunny.ucdavis.edu (Tom Poage) Distribution: na Organization: UCDMC Clinical Engineering, Sacto., CA Lines: 56 Has anyone running SunOS 4.0.3 observed that closing a 1/4" SCSI tape after read/write returns EPERM? This happens on a 3/150 with /dev/rst[08]. It may have happened under 4.0.1 too, but I don't specifically remember. If you're root or you own the device, no problem. If you don't write or read the tape, no error. Is this a known problem? Any fixes/work-arounds? Repeat with the following program and a scratch tape. Tom. ============================================================== /* * Write and read a dummy block on /dev/rst8 (SCSI tape). * * If you do not own the tape device (or not root) * you will get an EPERM error on calling close(). * You won't get the error unless you call read() * or write(). Sun 3/150, SunOS 4.0.3. * * Tom Poage (poage@sunny.ucdavis.edu) */ #include #include main() { int fd; char buf[512]; /* Tape read/write has to be modulo-512. */ if ((fd = open("/dev/rst8", O_WRONLY)) < 0) { perror("tape open #1"); return(1); } if (write(fd, buf, sizeof buf) < 0) { perror("write to tape"); return(1); } if (close(fd) < 0) { /* Fails here. */ perror("tape close #1"); } /* rst8 rewinds on close. */ if ((fd = open("/dev/rst8", O_RDONLY)) < 0) { perror("tape open #2"); return(1); } if (read(fd, buf, sizeof buf) != sizeof buf) { perror("read from tape"); } if (close(fd) < 0) { /* Fails here, too. */ perror("tape close #2"); } return(0); } -- Tom Poage, Clinical Engineering Universiy of California, Davis, Medical Center, Sacramento, CA poage@sunny.ucdavis.edu {...,ucbvax,uunet}!ucdavis!sunny!poage