Re: System processes recognition (Adding P_KTHREAD to swapper)

From: Garance A Drosihn (drosih_at_rpi.edu)
Date: 03/15/05

  • Next message: Jeff Roberson: "Re: Freeing vnodes."
    Date: Tue, 15 Mar 2005 17:07:00 -0500
    To: Pawel Jakub Dawidek <pjd@freebsd.org>, freebsd-arch@freebsd.org
    
    

    At 1:51 PM +0100 3/15/05, Pawel Jakub Dawidek wrote:
    >Hi.
    >
    >I found, that there is no way to know if the given process is a system
    >(kernel) process or not:
    >
    >- P_SYSTEM flag is used also for userland processes (init),
    >- P_KTHREAD flag is not used for swapper,
    >- ps(1) thinks, that it found system process when there are
    > no arguments, checking: (argv == NULL || argv[0] == NULL)
    > but this is not true:
    >
    > char *argv[1] = { NULL };
    > execve("/path/to/somewhere", argv, NULL);
    >
    > The /path/to/somewhere process will be recognized by ps(1)
    > as a system process.
    >
    >The easiest way to fix it, is to add P_KTHREAD flag to the
    >swapper, I think:

    Something like this would be helpful, but I don't know enough
    kernel-stuff to know if there would be any side-effects by
    setting that bit. If that doesn't work, then we could have
    pkill/pgrep/ps check for 'pid == 0 && uid == 0', and assume
    any process that matches is also a "kernel thread process".

    But obviously it would be cleaner if we could just set that
    bit on the swapper process... I suppose I could just try that
    on a test system, and see if the system goes haywire :-)

    -- 
    Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
    Senior Systems Programmer           or  gad@freebsd.org
    Rensselaer Polytechnic Institute    or  drosih@rpi.edu
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Jeff Roberson: "Re: Freeing vnodes."

    Relevant Pages