Re: System processes recognition.

From: John Baldwin (jhb_at_FreeBSD.org)
Date: 03/16/05

  • Next message: John Baldwin: "Re: Time to stop buildling named (and friends) by default in 6-current?"
    To: freebsd-arch@FreeBSD.org
    Date: Wed, 16 Mar 2005 17:48:02 -0500
    
    

    On Tuesday 15 March 2005 07:51 am, 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
    > (argv == NULL || argv[0] == NULL), but this is not true:
    > char *argv[1] = { NULL };
    >
    > execve("/path/to/somewhere", argv, NULL);
    > /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:
    >
    > --- init_main.c 17 Feb 2005 10:00:09 -0000 1.255
    > +++ init_main.c 15 Mar 2005 12:48:04 -0000
    > @@ -365,7 +365,7 @@ proc0_init(void *dummy __unused)
    > session0.s_leader = p;
    >
    > p->p_sysent = &null_sysvec;
    > - p->p_flag = P_SYSTEM;
    > + p->p_flag = P_SYSTEM | P_KTHREAD;
    > p->p_sflag = PS_INMEM;
    > p->p_state = PRS_NORMAL;
    > knlist_init(&p->p_klist, &p->p_mtx);
    >
    > Opinions?

    I think this is ok. Ask bde@, he might say that P_SYSTEM should be removed
    from init. (Can't remember if he is in favor of that or not.)

    -- 
    John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
    "Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
    _______________________________________________
    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: John Baldwin: "Re: Time to stop buildling named (and friends) by default in 6-current?"

    Relevant Pages