I'm trying to debug a reported problem with filemon(4), and to make things a bit easier I tried to pass STDOUT_FILENO as the place where filemon should write its output. Running this on a "console terminal" within qemu, the code in filemon_output() sets up a struct iovec and initializes a struct uio by calling uio_setup_sysspace(iovec). It then calls (*filemon->fm_fp->f_ops->fo_write) which ends up in spec_write().

For some reason, spec_write() doesn't like something, and the code at

#ifdef DIAGNOSTIC
        if (uio->uio_rw != UIO_WRITE)
                panic("spec_write mode");
        if (&uio->uio_vmspace->vm_map != kernel_map &&
            uio->uio_vmspace != curproc->p_vmspace)
                panic("spec_write proc");
#endif

ends up by calling the panic("spec_write proc").

It's not clear to me what the DIAGNOSTIC code is supposed to prevent, nor is it clear why the call to uio_setup_sysspace() doesn't set up everything needed.

The same code in filemon seems to work just fine when it is passed a file descriptor that refers to a "real" file.

Can someone enlighten me here?


+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+

Reply via email to