Re: kp_proc and kp_eproc

From: Julian Elischer <julian_at_elischer.org>
Date: Fri, 4 Apr 2003 16:17:14 -0800 (PST)
On Fri, 4 Apr 2003, Glenn Johnson wrote:

> On Fri, Apr 04, 2003 at 03:54:05PM -0800, Julian Elischer wrote:
> 
> > yes..
> >
> > The entire process structure and it's surrounding enviroment has been 
> > through a blender.                                                    
> >
> > What do you wnat to do?
> 
> I would like to learn what I need to do to get the software to compile
> on FreeBSD-5.  I guess the question is, what information do I need to
> provide?  The software in question is OpenPBS (http://www.openpbs.org),
> so it nothing proprietary.  There were a whole bunch of dependency
> problems that I worked through manually and finally got to the point
> of the kp_proc failure.  Here is a snippet of code that produces the
> failure:
> 
> ~~~~~~~~~~

you need to start from proc.h.
the proc structure has been exploded into 4 parts
but the kinfo_proc structure still exists. you may need to look at what
'ps' does to make sense of it..
some fields have become subfields and some may require following some
links.

> static unsigned long cput_sum(pjob)
>     job         *pjob;
> {
>         static  char            id[] = "cput_sum";
>         int                     i;
>         u_long                  cputime;
>         int                     nps = 0;
>                                                                                 
>         cputime = 0;
>         for (i=0; i<nproc; i++) {
>                 struct kinfo_proc       *pp = &proc_tbl[i];
>                                                                                 
>                 if (!injob(pjob, sess_tbl[i]))
>                         continue;
>                                                                                 
>                 nps++;
>                 cputime += tvk(pp->kp_proc.p_rtime);
>                                                                                 
>                 if (pp->kp_proc.p_ru == NULL) {
>                         struct  pstats  ps;
> 			                                                                                                                                           
>                         DBPRT(("%s: p_stats 0x%lx\n", id,
>                                 (u_long)pp->kp_proc.p_stats))
>                         if (pp->kp_proc.p_stats == NULL)
>                                 continue;
>                                                                                                                                            
>                         if (kvm_read(kd, (u_long)pp->kp_proc.p_stats, &ps,
>                                         sizeof(ps)) != sizeof(ps)) {
>                                 log_err(errno, id, "kvm_read(pstats)");
>                                 continue;
>                         }
>                         cputime += tv(ps.p_ru.ru_utime) +
>                                 tv(ps.p_ru.ru_stime) +
>                                 tv(ps.p_cru.ru_utime) +
>                                 tv(ps.p_cru.ru_stime);
>                 }
>                 else {
>                         struct  rusage  ru;
>                                                                                                                                            
>                         DBPRT(("%s: p_ru 0x%lx\n", id,
>                                 (u_long)pp->kp_proc.p_ru))
>                         if (kvm_read(kd, (u_long)pp->kp_proc.p_ru, &ru,
>                                         sizeof(ru)) != sizeof(ru)) {
>                                 log_err(errno, id, "kvm_read(session)");
>                                 continue;
>                         }
>                         cputime += tv(ru.ru_utime) + tv(ru.ru_stime);
>                 }
>                 DBPRT(("%s: ses %d pid %d cputime %d\n", id,
>                                 sess_tbl[i], pp->kp_proc.p_pid, cputime))
>         }
>                                                                                                                                            
>         if (nps == 0)
>                 pjob->ji_flags |= MOM_NO_PROC;
>                                                                                                                                            
>         return ((unsigned long)((double)cputime * cputfactor));
> }
> 
> ~~~~~~~~~~
> 
> > On Fri, 4 Apr 2003, Glenn Johnson wrote:
> >
> > > I have some software that compiled fine on FreeBSD-4 but is not
> > > compiling on FreeBSD-5.  It is looking for kp_proc and kp_eproc.
> > > The error I get is:
> > >
> > > 	structure has no member named `kp_proc'
> > > 	structure has no member named `kp_eproc'
> > > 
> > > Have those changed from FreeBSD-4?
> > > 
> > > Thanks.
> 
> -- 
> Glenn Johnson
> USDA, ARS, SRRC			 Phone: (504) 286-4252
> New Orleans, LA 70124		e-mail: gjohnson_at_srrc.ars.usda.gov
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
> 
Received on Fri Apr 04 2003 - 14:17:19 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:02 UTC