Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* getting time and pid in kernel?
@ 1996-01-31  5:00 Ken Marquess
  1996-02-06  5:00 ` Jeffrey M. Denham
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Marquess @ 1996-01-31  5:00 UTC (permalink / raw)


Executive summary: I'm having problems determining the process id and
time of day from a kernel process, specifically a device driver top half.
If you know how to do either, I'd like to talk to you!

Details: I'm trying to port/rewrite a driver (from AIX) for a pseudodevice. 
The pseudodevice forms a pair of devices (kind of like tty/pty pairs) that
are used to support a remote tape drive (i.e. there is a local pseudo
device that emulates a tape drive, and sends the data to/from a real    
drive on another system. In the device drivers, I write a trace table
for diagnostic purposes, which includes the time of day and pid. 

Aix supplied a getpid() that worked in kernel mode, and a global variable
called 'time' that was the current time. When I call getpid() in 
DEC OSF/Digital Unix (3.2.C if it matters) the system abends.

sys/time.h has some lines that imply there ought to be a global
variable called time, but I haven't figured out the right loader
flags or something - I never get a value other than 0.

I've looked through the kernel source a little, without finding any good
examples to copy.

If anyone can help, I'd appreciate it. The software will be available for
free when completed.


Ken Marquess, University of Washington, kenm@u.washington.edu



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: getting time and pid in kernel?
  1996-01-31  5:00 getting time and pid in kernel? Ken Marquess
@ 1996-02-06  5:00 ` Jeffrey M. Denham
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey M. Denham @ 1996-02-06  5:00 UTC (permalink / raw)



In article <4eo9vc$41@nntp5.u.washington.edu>, kenm@u.washington.edu (Ken Marquess) writes:
>Executive summary: I'm having problems determining the process id and
>time of day from a kernel process, specifically a device driver top half.
>If you know how to do either, I'd like to talk to you!
>
>Details: I'm trying to port/rewrite a driver (from AIX) for a pseudodevice. 
>The pseudodevice forms a pair of devices (kind of like tty/pty pairs) that
>are used to support a remote tape drive (i.e. there is a local pseudo
>device that emulates a tape drive, and sends the data to/from a real    
>drive on another system. In the device drivers, I write a trace table
>for diagnostic purposes, which includes the time of day and pid. 
>
>Aix supplied a getpid() that worked in kernel mode, and a global variable
>called 'time' that was the current time. When I call getpid() in 
>DEC OSF/Digital Unix (3.2.C if it matters) the system abends.
>
>sys/time.h has some lines that imply there ought to be a global
>variable called time, but I haven't figured out the right loader
>flags or something - I never get a value other than 0.

For the current pid, just use

#include <sys/user.h>

.
.
.

pid_t pid;

pid = u.u_procp->p_pid;

For the time, the approach should be:

#include <sys/time.h>

struct timeval tv;

microtime(&tv);

-- 

-----------------------------------------------------------------------------
Jeff Denham, Unix Software Group, Digital Equipment Corporation
email: denham@zk3.dec.com, voice: (603) 881-0057



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-02-06  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-01-31  5:00 getting time and pid in kernel? Ken Marquess
1996-02-06  5:00 ` Jeffrey M. Denham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox