Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

filemon, system stability



 I don't have a *great* code example, but here's a start (see
end-of-msg) -- Try kernels before and after the most recent work in
sys/dev/filemon/ (*not* the NULL ptr deref I reported 21 May -- more
recent than that...


Run the below code in one window, and in another, do something simple like:

$ env ls

and you'll see something like: env: unknown error

I think this is a recent phenomenon.

-bch



#include <dev/filemon/filemon.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>

int
main(int argc, char *argv[])
{
        int             filemon_fd;
        int             pid;
        int             fout = 1;

        if (2 != argc) {
                fprintf(stderr, "Usage: %s <pid>\n", argv[0]);
                return -1;
        }
        pid = atoi(argv[1]);
        if (-1 == (filemon_fd = open(_PATH_FILEMON, O_RDWR | O_CLOEXEC))) {
                fprintf(stderr, "Error opening filemon(4) device.\n");
                return -1;
        }
        ioctl(filemon_fd, FILEMON_SET_PID, &pid);
        ioctl(filemon_fd, FILEMON_SET_FD, (int *) &fout);

        return 0;
}


Home | Main Index | Thread Index | Old Index