If I run the following programm:
#include <sys/mtio.h>
#include <fcntl.h>

int
Tape_rewind(int fd) {
        struct mtop mo;

        mo.mt_op = MTREW;
        mo.mt_count = 0;
        if (ioctl(fd, MTIOCTOP, &mo) == -1) {
                return 1;
        }
        return 0;
};

int
Tape_fsf(int fd, int count) {
        struct mtop mo;

        mo.mt_op = MTFSF;
        mo.mt_count = count;
        if (ioctl(fd, MTIOCTOP, &mo) == -1) {
                return 1;
        }
        return 0;
};

int
main() {
        int fd;
        char buf[8192];

        fd = open("/dev/nsa0", O_RDWR);
        Tape_rewind(fd);
        write(fd, buf, sizeof(buf));
        Tape_rewind(fd);
        close(fd);
        fd = open("/dev/nsa0", O_RDWR);
        Tape_rewind(fd);
        read(fd, buf, sizeof(buf));
        Tape_rewind(fd);
        Tape_fsf(fd, 1);
        close(fd)
        return 0;
}

I get the following result:
[51]cicely13# ps -axl | grep tapefoo
    0   263   261   0  -8  0   972   94 cbwait D+    p0    0:00.05 /home/ticso/tapefoo

ktrace:
[...]
   263 tapefoo  RET   read 8192/0x2000
   263 tapefoo  CALL  ioctl(0x3,MTIOCTOP,0xbfbfd890)
   263 tapefoo  RET   ioctl 0
   263 tapefoo  CALL  ioctl(0x3,MTIOCTOP,0xbfbfd890)

It is the fsf that blocks.

I had a -current from march on that machine and updated to see if the
effect was already solved.

[57]cicely13# dmesg
Copyright (c) 1992-2002 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 5.0-CURRENT #0: Sat Jul  6 20:06:28 CEST 2002
    
[EMAIL PROTECTED]:/var/d7/builder/FreeBSD-2002-07-03/src/sys/i386/compile/CICELY13
Preloaded elf kernel "/boot/kernel/kernel" at 0xc0388000.
Timecounter "i8254"  frequency 1193182 Hz
Timecounter "TSC"  frequency 132873443 Hz
CPU: Pentium/P54C (132.87-MHz 586-class CPU)
  Origin = "GenuineIntel"  Id = 0x52c  Stepping = 12
  Features=0x1bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8>
real memory  = 33554432 (32768K bytes)
avail memory = 28942336 (28264K bytes)
Intel Pentium detected, installing workaround for F00F bug
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Host to PCI bridge> at pcibus 0 on motherboard
pci0: <PCI bus> on pcib0
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX3 ATA controller> port 0xf000-0xf00f at device 7.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
ahc0: <Adaptec 2940 Ultra SCSI adapter> port 0x6000-0x60ff mem 0xe4001000-0xe4001fff 
irq 9 at device 10.0 on pci0
aic7880: Ultra Wide Channel A, SCSI Id=7, 16/253 SCBs
de0: <Digital 21140A Fast Ethernet> port 0x6100-0x617f mem 0xe4000000-0xe400007f irq 
12 at device 11.0 on pci0
de0: SMC 9332BDT 21140A [10-100Mb/s] pass 2.0
de0: address 00:00:c0:1e:03:f2
pci0: <display, VGA> at device 12.0 (no driver attached)
orm0: <Option ROMs> at iomem 0xc8000-0xcc7ff,0xc0000-0xc7fff on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x64,0x60 on isa0
fdc0: <enhanced floppy controller (i82077, NE72065 or clone)> at port 
0x3f7,0x3f0-0x3f5 irq 6 drq 2 on isa0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
ppc0: <Parallel port> at port 0x3bc-0x3c3 on isa0
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
lpt0: <Printer> on ppbus0
lpt0: Polled port
ppi0: <Parallel I/O> on ppbus0
ppc1: <Parallel port> at port 0x378-0x37f on isa0
ppc1: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc1: FIFO with 16/16/15 bytes threshold
lpt1: <Printer> on ppbus1
lpt1: Polled port
ppi1: <Parallel I/O> on ppbus1
ppc2: <Parallel port> at port 0x278-0x27f on isa0
ppc2: Generic chipset (NIBBLE-only) in COMPATIBLE mode
ppbus2: IEEE1284 device found 
Probing for PnP devices on ppbus2:
ppi2: <Parallel I/O> on ppbus2
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x100>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A, console
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
sio2 at port 0x3e8-0x3ef irq 10 on isa0
sio2: type 16550A
sio3 at port 0x2e8-0x2ef irq 11 on isa0
sio3: type 16550A
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
unknown: <PNP0303> can't assign resources (port)
unknown: <PNP0501> can't assign resources (port)
unknown: <PNP0700> can't assign resources (port)
unknown: <PNP0401> can't assign resources (port)
unknown: <PNP0501> can't assign resources (port)
Timecounters tick every 10.000 msec
Waiting 2 seconds for SCSI devices to settle
de0: enabling 100baseTX port
(ahc0:A:0:0): refuses synchronous negotiation. Using asynchronous transfers
sa0 at ahc0 bus 0 target 2 lun 0
sa0: <WANGTEK 5525ES SCSI M74H 11> Removable Sequential Access SCSI-CCS device 
sa0: 3.300MB/s transfers
Mounting root from ufs:/dev/da0a
da0 at ahc0 bus 0 target 0 lun 0
da0: <IBM 0661467 G r> Fixed Direct Access SCSI-2 device 
da0: 5.000MB/s transfers (5.000MHz, offset 12)
da0: 382MB (782600 512 byte sectors: 64H 32S/T 382C)
de0: enabling 100baseTX port

-- 
B.Walter              COSMO-Project         http://www.cosmo-project.de
[EMAIL PROTECTED]         Usergroup           [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to