[comp.sys.hp] setpriority

beau@over..caltech.edu (B. Thomas Adler) (09/02/90)

I'm trying to port the "top" program to HPUX, and I've gotten everything
working, except for one feature... the one to renice a process.  This
is accomplished by the setpriority(2) command in 4.3BSD, and the closest
I could find was nice(2) system call.

Unfortunately, nice(2) only allows you to modify the "niceness" of the
calling program, but I'd like to be able to nice other processes as well.
Another candidate was rtprio(2), but that only modifies the run-time
priority, and not the "niceness" value.

Any clues, hints, ideas, or solutions?

BTW, I'm running HPUX 7.0 on hp9000s300 machines.

-Bo Adler    beau@betwixt.cs.caltech.edu

--
B. Thomas Adler               <adler@csvax.caltech.edu>
<adler@citjulie.bitnet>       <...!ames!elroy!cit-vax!adler>

se@ikp.uni-koeln.de (Stefan Esser) (09/03/90)

I have written a setpriority function that works well with top 2.5
on our hp9000s835. It patches the process's niceness in the proc area.
I included all the security checks normally performed by the system call. 
Because it requires _write_-access to the kernel, top has to be installed 
setgid 'kmem' with /dev/kmem mode 660.
(But I don't see how that could break security.)

To port the setpriority code to your hp9000s300 should't be hard.

The file is named 	'/pub/misc/top_hp.2.5.tar.Z'
on 			'ftp.rrz.uni-koeln.de'.

The file '/pub/misc/top2.5.tar.Z' is the original version (without renice).
You should be able to isolate my patches with a diff of these two files.

Stefan Esser
--
 Stefan Esser, Institute of Nuclear Physics, University of Cologne, W. Germany
 se@ikp.Uni-Koeln.DE                                            [134.95.192.9]

paul@eye.com (Paul B. Booth) (09/06/90)

In article <beau.652222947@over> eye!uupsi!rpi!zaphod.mps.ohio-state.edu!usc!jarthur!nntp-server.caltech.edu!over!beau beau@over..caltech.edu (B. Thomas Adler) writes:
>
>I'm trying to port the "top" program to HPUX, and I've gotten everything
>working, except for one feature... the one to renice a process.  This
>is accomplished by the setpriority(2) command in 4.3BSD, and the closest
>I could find was nice(2) system call.
....other stuff....
>BTW, I'm running HPUX 7.0 on hp9000s300 machines.
>
If your 7.0 tapes came with the USRCONTRB fileset, you can save yourself the
effort.  This fileset has top along with other contributed goodies like
monitor and readmem.  If USRCONTRB is listed in /etc/filesets, you've got em.
If not, check w/ your system guru (s/he maybe didn't install them), or your
hp SE, who definitely should be able to get these for you.
-- 
--
Paul B. Booth  (paul@eye.com)
-------------------------------------------------------------------------------
3D/EYE, Inc., 2359 N. Triphammer Rd., Ithaca, NY  14850    voice: (607)257-1381