Operating System - HP-UX
1752812 Members
6052 Online
108789 Solutions
New Discussion юеВ

Re: how to get current process in hpux11 dlkm

 
SOLVED
Go to solution
kaijile
Frequent Advisor

how to get current process in hpux11 dlkm

I'm developing dlkm now on HP-UX 11.11i
in my kernel module i want to get the current process ,such as linux's macro "current"
how to get current process in hpux11 dlkm?
40 REPLIES 40
Dennis Handly
Acclaimed Contributor

Re: how to get current process in hpux11 dlkm

What would be the current process if you have a N way machine? The one that is doing the I/O?

You want to supply more info on what you are trying to do.
Laurent Menase
Honored Contributor

Re: how to get current process in hpux11 dlkm

on 11.23:
thread id:
kt_tid(u.u_kthreadp);

process id
p_pid(u.uprocp);


don't forget to include sys/user.h
kaijile
Frequent Advisor

Re: how to get current process in hpux11 dlkm

I want to get the current process's struct proc and struct kthread descriptor,how to get their pointer?

how to traversing all struct proc and struct kthread descriptors in kernel ?

kt_tid is ok ,but when i used p_pid(u.uprocp);
have compile error :
cc: "test.c", line 187: error 1588: "uprocp" undefined

where is the variabe u defined?

bash-4.0# uname -a
HP-UX rp5470 B.11.11 U 9000/800 142444635 unlimited-user license

Laurent Menase
Honored Contributor
Solution

Re: how to get current process in hpux11 dlkm

u.u_procp
sorry for the typo
Laurent Menase
Honored Contributor

Re: how to get current process in hpux11 dlkm

it is in
/usr/include/machine/sys/user.h I believe.
it is a struct user defined in
/usr/include/sys/user.h
kaijile
Frequent Advisor

Re: how to get current process in hpux11 dlkm

kt_tid(u.u_kthreadp);

p_pid(u.uprocp);

I can't find these two functions in the
HP-UX 11i v1 Driver Development Guide and
HP-UX 11i v1 Driver Development Reference Guide


which Documentation has mentioned p_pid() and
kt_tid() function?

Laurent Menase
Honored Contributor

Re: how to get current process in hpux11 dlkm

they are defined in kthread_iface.h and proc_iface.h
Else I don't know. may be in 11i v2 dd ref guide
Laurent Menase
Honored Contributor

Re: how to get current process in hpux11 dlkm

but what are you trying to make exactly?

a kill calls logger?
kaijile
Frequent Advisor

Re: how to get current process in hpux11 dlkm

i want to traversing all struct proc and struct kthread descriptors in kernel,
but i can not find suitable kernel API function to do it.
in HP-UX 11i v1 Driver Development Guide and
HP-UX 11i v1 Driver Development Reference Guide
i can not find related information