[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netbsd-current-users
Subject:    filemon, system stability
From:       bch <brad.harder () gmail ! com>
Date:       2015-06-23 22:39:47
Message-ID: CABfrOT9u5gL6oeja4roa_KtmydHYvGz+ipC5dybT-=KzLcXnGw () mail ! gmail ! com
[Download RAW message or body]

 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;
}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic