home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / renice.sco / part01 next >
Internet Message Format  |  1989-02-08  |  7KB

  1. Path: lll-winken!ames!mailrus!tut.cis.ohio-state.edu!ucbvax!unisoft!uunet!allbery
  2. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. Newsgroups: comp.sources.misc
  4. Subject: v06i032: SCO Xenix 286 renice part1/2
  5. Message-ID: <48161@uunet.UU.NET>
  6. Date: 4 Feb 89 03:12:51 GMT
  7. Sender: allbery@uunet.UU.NET
  8. Reply-To: wht@tridom.UUCP (Warren Tucker)
  9. Lines: 222
  10. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  11.  
  12. Posting-number: Volume 6, Issue 32
  13. Submitted-by: wht@tridom.UUCP (Warren Tucker)
  14. Archive-name: renice.sco/part01
  15.  
  16. This renice command works nicely under SCO XENIX 286 2.2.1.
  17.  
  18. #!/bin/sh
  19. # shar:    Shell Archiver  (v1.22)
  20. #
  21. #    Run the following text with /bin/sh to create:
  22. #      README
  23. #      Makefile
  24. #      uxlst.h
  25. #      libuxlst.h
  26. #      libkmem.h
  27. #
  28. if test -f README; then echo "File README exists"; else
  29. echo "x - extracting README (Text)"
  30. sed 's/^X//' << 'SHAR_EOF' > README &&
  31. XWell, here is a renice for SCO XENIX V/286.
  32. XIt is derived from the 386 renice program written by Mike "Ford" Ditto.
  33. XI changed it in two ways:
  34. X
  35. X1.  The 'xlist' procedure is performed by a separate program (uxlst)
  36. Xand the resulting xlist structure array is stored in /xenix.uxlst.
  37. XRenice thus may obtain xlist information rapidly without xlist(3) each
  38. Xtime it is executed.  Also stored in /xenix.uxlst is a stat structure of
  39. X/xenix at the time of uxlst execution.  A unique word is stored at the
  40. Xend of the file in case /xenix.uxlst's xlist structure is expanded for
  41. Xother applications.  The renice program reads /xenix.uxlst by means
  42. Xof facilities in libuxlst.c.  If the stat structure in /xenix.uxlst
  43. Xdoes not match a dynamic stat of /xenix or if the unique word does
  44. Xnot match, the xlist information is not trusted and renice prompts
  45. Xthe user to run (or have run) the uxlst program to update /xenix.uxlst.
  46. X
  47. X2.  I changed the usage syntax to follow the Berkeley usage:
  48. X          renice <nice> pid ...
  49. Xwhere <nice> is in the range -20 to 19, inclusive.  If I had known
  50. XI was going to post the program, I probably would have retained
  51. X"Ford"'s syntax for conditional compilation.
  52. X
  53. XNOTES:
  54. X1.  uxlst must be run by root with umask 22.  
  55. X2.  making against Makefile as root will make
  56. X    a. uxlst
  57. X    b. renice
  58. X    c. run uxlst to produce /xenix.uxlst
  59. X3.  When renice is run by root, any process may be set to any nice
  60. Xvalue.  When renice is run by other than root, only processes owned
  61. Xby the user may be affected and then only to reduce the priority of
  62. Xthe process.
  63. X
  64. X4.  Sources are in 4-spaced tab format (please don't flame :-).
  65. X
  66. XWarren Tucker N4HGF
  67. X...!gatech!kd4nc!tridom!wht
  68. X
  69. SHAR_EOF
  70. chmod 0644 README || echo "restore of README fails"
  71. fi
  72. if test -f Makefile; then echo "File Makefile exists"; else
  73. echo "x - extracting Makefile (Text)"
  74. sed 's/^X//' << 'SHAR_EOF' > Makefile &&
  75. X#  CHK=0xC596
  76. X#+--------------------------------------------------------------
  77. X#  Makefile for uxlst utilities
  78. X#  must be run by root with umask 22
  79. X#---------------------------------------------------------------
  80. X#+:EDITS:*/
  81. X#:10-28-1988-14:33-wht-turn off fcrc for posting to net
  82. X#:10-27-1988-13:07-wht-creation (uxlst, renice and /xenix.uxlst)
  83. X
  84. X#handle Sys V make "feature" of using SHELL
  85. XSHELL = /bin/sh
  86. X
  87. XLFLAGS = -i -s -M2e 
  88. XCFLAGS = -c -O -K -DLINT_ARGS $(LFLAGS)
  89. X#FCRC = fcrc -u $*.c ;
  90. X
  91. X.c.o:;    $(FCRC) cc $(CFLAGS) $*.c 
  92. X
  93. XUXLST_OBJ =\
  94. X    uxlst.o
  95. X
  96. XRENICE_OBJ =\
  97. X    renice.o\
  98. X    libkmem.o\
  99. X    libuxlst.o
  100. X
  101. Xall: uxlst renice /xenix.uxlst
  102. X
  103. Xshar:
  104. X    shar -v -x README Makefile uxlst.h libuxlst.h libkmem.h > renice.shar.1
  105. X    shar -v -x libkmem.c libuxlst.c uxlst.c renice.c > renice.shar.2
  106. X
  107. Xuxlst: $(UXLST_OBJ)
  108. X    cc $(LFLAGS) $(UXLST_OBJ) -o uxlst
  109. X
  110. Xrenice: $(RENICE_OBJ)
  111. X    cc $(LFLAGS) $(RENICE_OBJ) -o renice
  112. X    chmod u+s renice
  113. X
  114. X/xenix.uxlst: uxlst /xenix
  115. X    uxlst
  116. X
  117. Xclean:
  118. X    rm -f $(RENICE_OBJ) $(UXLST_OBJ)
  119. X
  120. Xclobber: clean
  121. X    rm -f uxlst renice renice.shar.1 renice.shar.2
  122. X
  123. Xuxlst.o: uxlst.h
  124. Xlibuxlst.o: uxlst.h libuxlst.h
  125. Xlibkmem.o: libkmem.h
  126. Xrenice.o: uxlst.h libuxlst.h libkmem.h
  127. SHAR_EOF
  128. chmod 0644 Makefile || echo "restore of Makefile fails"
  129. fi
  130. if test -f uxlst.h; then echo "File uxlst.h exists"; else
  131. echo "x - extracting uxlst.h (Text)"
  132. sed 's/^X//' << 'SHAR_EOF' > uxlst.h &&
  133. X/* CHK=0x5438 */
  134. X/*+-------------------------------------------------------------------------
  135. X    uxlst.h -- utility xlist - fast access to kernel /dev/kmem offsets
  136. X
  137. XThe uxlst file contains three records:
  138. X1.  struct stat xstat - stat buffer from /xenix at file creation time
  139. X2.  struct xlist uxlst - the structure of xlist'd information
  140. X3.  long unique - a unique identifier to help ensure correct uxlst length
  141. X
  142. XNOTE: the xl_name pointers are INVALID in programs using /xenix.uxlst
  143. X--------------------------------------------------------------------------*/
  144. X/*+:EDITS:*/
  145. X/*:10-27-1988-11:07-wht-creation */
  146. X
  147. X#define XENIX_KERNEL    "/xenix"
  148. X#define XENIX_UXLST        "/xenix.uxlst"
  149. X#define UXLST_UNIQUE    0xEFBC9A78L
  150. X
  151. X#define procaddr (uxlst[0].xl_value)
  152. X#define    vaddr (uxlst[1].xl_value)
  153. X
  154. X#ifdef DEFINE_UXLST
  155. Xstruct xlist    uxlst[] =
  156. X{
  157. X    { 0,0,0,"_proc"},
  158. X    { 0,0,0,"_v"},
  159. X    { 0,0,0,(char *)0},
  160. X};
  161. X#else
  162. Xextern struct xlist uxlst[];
  163. X#endif
  164. X
  165. X/* vi: set tabstop=4 shiftwidth=4: */
  166. SHAR_EOF
  167. chmod 0644 uxlst.h || echo "restore of uxlst.h fails"
  168. fi
  169. if test -f libuxlst.h; then echo "File libuxlst.h exists"; else
  170. echo "x - extracting libuxlst.h (Text)"
  171. sed 's/^X//' << 'SHAR_EOF' > libuxlst.h &&
  172. X/* CHK=0x4BC6 */
  173. X/*+-----------------------------------------------------------------------
  174. X    libuxlst.h
  175. X------------------------------------------------------------------------*/
  176. X/*+:EDITS:*/
  177. X/*:10-28-1988-14:47-afterlint-creation */
  178. X
  179. X#ifndef BUILDING_LINT_ARGS
  180. X#ifdef LINT_ARGS
  181. X
  182. X/* libuxlst.c */
  183. Xvoid uxlst_error(int );
  184. Xvoid uxlst_read(void);
  185. X
  186. X#else        /* compiler doesn't know about prototyping */
  187. X
  188. X/* libuxlst.c */
  189. Xvoid uxlst_error();
  190. Xvoid uxlst_read();
  191. X
  192. X#endif /* LINT_ARGS */
  193. X#endif /* BUILDING_LINT_ARGS */
  194. X
  195. X/* end of libuxlst.h */
  196. SHAR_EOF
  197. chmod 0644 libuxlst.h || echo "restore of libuxlst.h fails"
  198. fi
  199. if test -f libkmem.h; then echo "File libkmem.h exists"; else
  200. echo "x - extracting libkmem.h (Text)"
  201. sed 's/^X//' << 'SHAR_EOF' > libkmem.h &&
  202. X/* CHK=0x3FE9 */
  203. X/*+-----------------------------------------------------------------------
  204. X    libkmem.h
  205. X------------------------------------------------------------------------*/
  206. X/*+:EDITS:*/
  207. X/*:10-28-1988-14:46-afterlint-creation */
  208. X
  209. X#ifndef BUILDING_LINT_ARGS
  210. X#ifdef LINT_ARGS
  211. X
  212. X/* libkmem.c */
  213. Xvoid kinit(int );
  214. Xvoid kread(char  *,long ,long );
  215. Xvoid kwrite(long ,char  *,long );
  216. X
  217. X#else        /* compiler doesn't know about prototyping */
  218. X
  219. X/* libkmem.c */
  220. Xvoid kinit();
  221. Xvoid kread();
  222. Xvoid kwrite();
  223. X
  224. X#endif /* LINT_ARGS */
  225. X#endif /* BUILDING_LINT_ARGS */
  226. X
  227. X/* end of libkmem.h */
  228. SHAR_EOF
  229. chmod 0644 libkmem.h || echo "restore of libkmem.h fails"
  230. fi
  231. exit 0
  232. ---------------------------------------------------------
  233. W. Tucker ...!gatech!{emory,kd4nc}!tridom!wht
  234.