From: denham@denham.zk3.dec.com (Jeffrey M. Denham)
Subject: Re: getting time and pid in kernel?
Date: 1996/02/06 [thread overview]
Message-ID: <4f7sab$n88@zk2nws.zko.dec.com> (raw)
In-Reply-To: 4eo9vc$41@nntp5.u.washington.edu
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
prev parent reply other threads:[~1996-02-06 5:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-01-31 5:00 getting time and pid in kernel? Ken Marquess
1996-02-06 5:00 ` Jeffrey M. Denham [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox