Path: utzoo!mnetor!uunet!tektronix!cae780!leadsv!laic!darin From: darin@laic.UUCP (Darin Johnson) Newsgroups: comp.os.vms Subject: Re: Dot H files #2 request Message-ID: <182@laic.UUCP> Date: 21 Mar 88 19:41:53 GMT References: <7521@oberon.USC.EDU> <321@wsccs.UUCP> Organization: Lockheed AI Center, Menlo Park Lines: 58 In article <321@wsccs.UUCP>, terry@wsccs.UUCP (terry) writes: > In article <7521@oberon.USC.EDU>, purdy@skat.usc.edu (Tim Purdy) writes: > > > > -- Our system does not have a times.h file in the syslib. Does any- > > one know how to extract the user-time and system-time elapsed for > > a process? Namely I need something that returns from the times > > structure tms_utime and tms_stime. > > $GETJPI. See the system services reference manual. It doesn't > return it how you want it, but at least it returns it. You may have to > go to assembly calls, as the beast is bigger than G_float, as I remember, > and is accurate to at least a billionth of a second... you'll pass them > a descriptor with a pointer to a structure, thus word-aligning you data > so that the math routines don't puke. I seem to also recall a LIB$EMUL > was necessary... This seems like overkill. With minimal rewriting, you can do: #include /* instead of times.h */ . . tbuffer_t ut; times(&ut); printf("user time = %d\n", ut.proc_user_time); See the .H file for the rest of the fields. They are most likely pretty much identical except for name changes (on my sun, the order is even the same). $GETJPI has lots more information, but times() should be just as accurate (and easier to program). This is C version 2.3... Earlier version may not have this. > > -- Is there a VMS substitute for the system() function? I need to send > > mail from a program to a user, UNIX C handles this nicely, but is > > there someway of doing it on VMS? > > Use the LIB$SPAWN function, in the System Services reference manual. Version 2.3 C has a system() function. It is just a slow and hideous as LIB$SPAWN. I wrote a system() myself once that actually kept around the process from LIB$SPAWN and kept sending commands to it through a mailbox. This alleviated the problem with 5 second spawns on a medium loaded 8600. > > -- Now for a real doozy: there are a few calls made by two programs for > > the VERY UNIX dependent library function ioctl.h. Hmmn. Seems like the person who wrote the program wasn't too concerned with portability. In general ioctl()'s for terminals/etc are pretty generic but even they vary among unix's. Ideally, these system dependent routines should have been isolated and given names such as "turn_off_echo()", etc., but then I am probably flagellating a deceased equine.... -- Darin Johnson (...ucbvax!sun!sunncal!leadsv!laic!darin) (...lll-lcc.arpa!leadsv!laic!darin) All aboard the DOOMED express!