DragonFly kernel List (threaded) for 2003-12
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: KDE Bug? or an on-purpose?
David Rhodus <drhodus@xxxxxxxxx> writes:
Thanks! Its actually illegal to include sys/proc.h and
sys/user.h does it just fine.
This patch is very good. I will incorporate it into whatever
other patches I have for kdebase.
Then maybe we can do an override port or something.
Dave
> Here you go.
>
> -DR
>
> --- ProcessList.c.orig Wed Jul 30 00:23:10 2003
> +++ ProcessList.c Wed Jul 30 18:59:32 2003
> @@ -28,6 +28,9 @@
> #include <stdlib.h>
> #include <string.h>
> #include <sys/param.h>
> +#include <sys/proc.h>
> +#include <sys/user.h>
> +#include <sys/resourcevar.h>
> #if __FreeBSD_version > 500015
> #include <sys/priority.h>
> #endif
> @@ -108,7 +111,7 @@
> * good idea. I never thought that the stability of UNIX
> could get me
> * into trouble! ;)
> */
> - unsigned int userTime;
> + long userTime;
>
> /*
> * The number of 1/100 of a second the process has spend in
> system space.
> @@ -167,6 +170,7 @@
> struct passwd* pwent;
> int mib[4];
> struct kinfo_proc p;
> + struct rusage pru;
> size_t len;
>
> if ((ps = findProcessInList(pid)) == 0)
> @@ -209,7 +213,10 @@
> #if __FreeBSD_version >= 500015
> ps->userTime = p.ki_runtime / 10000;
> #elif __FreeBSD_version >= 300000
> - ps->userTime = p.kp_proc.p_runtime / 10000;
> + if (!getrusage(p.kp_proc.p_pid, &pru)) {
> + errx(1, "failed to get rusage info");
> + }
> + ps->userTime = pru.ru_utime.tv_usec / 10000; /*p_runtime /
> 10000;*/
> #else
> ps->userTime =
> p.kp_proc.p_rtime.tv_sec*100+p.kp_proc.p_rtime.tv_usec/100;
> #endif
> @@ -234,7 +241,7 @@
> p.kp_eproc.e_vm.vm_dsize +
> p.kp_eproc.e_vm.vm_ssize) * getpagesize();
> ps->vmRss = p.kp_eproc.e_vm.vm_rssize * getpagesize();
> - strncpy(ps->name,p.kp_proc.p_comm ? p.kp_proc.p_comm : "????",
> sizeof(ps->name));
> + strncpy(ps->name,p.kp_thread.td_comm ? p.kp_thread.td_comm :
> "????", sizeof(ps->name));
> strcpy(ps->status,(p.kp_proc.p_stat>=1)&&(p.kp_proc.p_stat<=5)?
> statuses[p.kp_proc.p_stat-1]:"????");
> #endif
>
>
> On Dec 16, 2003, at 11:01 PM, Dave Leimbach wrote:
>
> > The problem with ksysguardd and also apparently kcontrol is that
> > they expect certain fields to exist in
> >
> > struct kinfo_proc.
> >
> >
> > These are in /usr/include/user.h I think :)
> >
> > #ifndef _KERNEL
> >
> > /*
> > * stuff that *used* to be included by user.h, or is now needed. The
> > * expectation here is that the user program wants to mess with kernel
> > * structures. To be sure we get kernel structures we have to define
> > * _KERNEL_STRUCTURES. Otherwise we might get the user version.
> > *
> > * This is a really aweful hack. Fortunately nobody includes
> > sys/user.h
> > * unless they really, really, really need kinfo_proc.
> > */
> >
> >
> > KDE really really really really needs it :)
> >
> > The offending line looks for a p_comm field in this structure.
> >
> > if(proc_p.kp_eproc.e_ppid==ppid && p[num].kp_proc.p_comm &&
> > 0 == strcmp(p[num].kp_proc.p_comm, proc))
> > if(pid)
> > error=true;
> > else
> > pid=p[num].kp_proc.p_pid;
> >
> > I am unfortunately not sure what p_comm was in FreeBSD or what the
> > replacement is in DragonFly.
> >
> > The other field is p_runtime. I am also not sure what the correct
> > solution is for this.
> >
> > Dave
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]