[comp.unix.aix] getpid

hbergh@oracle.nl (Herbert van den Bergh) (10/08/90)

Hi there,

I'm using an IBM RISC System/6000 with AIX 3.1 9021 + July update.

I'm currently writing a kernel extension. This is a routine
which will be loaded into the kernel after the system is booted
and can be called like a system call from user processes.

In the manual, and in Info, a kernel service routine getpid()
is mentioned which returns the process id of the process executing
the kernel extension. However, this routine is not included in
/lib/kernex.exp.

My questions are:
Can I just add getpid to /lib/kernex.exp, so I can bind my kernel extension?
Or can I make my own .exp file with
	#! /unix
	getpid
in there?
Why was it not in /lib/kernex.exp? Is there a problem with it?
Shouldn't I be using it?

I tried accessing the u-block directly from my kernel extension,
but the binder couldn't resolve the external reference to it either.

I need an answer real soon.
Thanks in advance.

-- 
Herbert van den Bergh, ORACLE Europe	hbergh@oracle.nl, hbergh@oracle.com
Rijnzathe 6, NL-3454 PV De Meern	uunet!mcsun!orcenl!hbergh
Phone: +31-3406-94211

marc@arnor.uucp (10/09/90)

getpid is a unix system call.  as such it is defined in
/lib/syscalls.exp, rather than in kernex.exp.  All of the
entries in syscalls.exp are also available to kernel extensions.

(Take some care in this.  Those syscalls which read/write user
data, such as read, will fail if passed a supervisor buffer.
So you must think about the semantics of a system call you 
issue from a kernel extension.  This is not a problem for getpid).

marc@arnor.uucp (10/09/90)

As for the u-block - it appears that the kernel does not
export the address of the u-block.  

Right now, the ublock is at 0x2ff98000.  You can define it
with an import file (to the bind) that says

#!
u   0x2ff98000


(Unfortunately, you will have to remember to do something if
the u-block moves.  If you have someone to complain to about this
you might try complaining).

tif@doorstop.austin.ibm.com (Paul Chamberlain) (10/12/90)

In article <1011@nlsun1.oracle.nl> hbergh@oracle.nl (Herbert van den Bergh) writes:
>... getpid() is mentioned ... However, this routine is not included in
>/lib/kernex.exp.

I haven't tried but don't you find getpid() in libc.a.  Even kernel
extensions link with libc.  Is there some reason this wouldn't work?

Paul Chamberlain | I do NOT represent IBM.     tif@doorstop, sc30661 at ausvm6
512/838-7008     | ...!cs.utexas.edu!ibmaus!auschs!doorstop.austin.ibm.com!tif