[comp.sys.hp] u.u_comm on HP9000/800

tml@santra.HUT.FI (Tor Lillqvist) (11/03/88)

Could somebody tell me where in the kernel to look for the name of a
program on an HP9000/840 running HP-UX 2.10?  u.u_comm seems to
contain only zeroes.  Are the include files perhaps out-of-date with
respect to the actual sources used when building the kernel?  I have
<sys/user.h> $Revision: 1.58.11.1 $ (The problem comes up when porting
the `top' program.

tsu@hpcupt1.HP.COM (Stanley Tsu) (11/06/88)

Are you sure you're locating u correctly?  If you have a HP-UX source 
license, take a look at how ps(1) does it.  There is a /usr/local
version of top available.  Send me mail if you want it and I'll see
what can be done about sending it out.

Stanley Tsu
Hewlett-Packard
tsu@hpda.HP.com
{cbogsd,decwrl,hplabs,seismo,ucbvax}!hpda!tsu

dvl@hpcupt1.HP.COM (Doug Larson) (11/08/88)

I assume you are porting from a Berkeley 4.x system.  In these systems
the u area is located at a constant location in the third quadrant.  

In HP-UX on the 800 series, this is not the case.  The u areas are in 
an array in system space.  E.g. proc[i] matches u[i].  The  tricky
part comes about for two reasons; The u areas are not sizeof(struct user)
apart, and of course the particular u area you are interested in may
not be mapped in.

In any case, to find u[i];

#define USIZ (sizeof(struct user))
/* make sure the pid array is double word aligned!! */
#define PIDSIZ ((npids * sizeof(int)+sizeof(double) -1) & ~(sizeof(double) -1))

byte address = ubase + i*(USIZ+PIDSIZ) 		(Make appropriate type casts)

gives you the byte address system virtual space.   Ubase is where the
user areas start.  Good luck!

	Doug Larson
	hplabs!hpda!dvl