home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: attpc.rnc
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
66%
| dexvert
| Pro-Pack - Rob Northern Compression (archive/rnc)
| ext
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| C source text
| default
| |
99%
| file
| C source, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/rfc822
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 53 75 62 6a 65 63 74 3a | 20 20 76 31 33 69 30 37 |Subject:| v13i07|
|00000010| 30 3a 20 20 43 68 61 6e | 67 65 20 70 72 6f 63 65 |0: Chan|ge proce|
|00000020| 73 73 20 70 72 69 6f 72 | 69 74 79 20 6f 6e 20 41 |ss prior|ity on A|
|00000030| 54 54 20 50 43 0a 4e 65 | 77 73 67 72 6f 75 70 73 |TT PC.Ne|wsgroups|
|00000040| 3a 20 63 6f 6d 70 2e 73 | 6f 75 72 63 65 73 2e 75 |: comp.s|ources.u|
|00000050| 6e 69 78 0a 53 65 6e 64 | 65 72 3a 20 73 6f 75 72 |nix.Send|er: sour|
|00000060| 63 65 73 0a 41 70 70 72 | 6f 76 65 64 3a 20 72 73 |ces.Appr|oved: rs|
|00000070| 61 6c 7a 40 75 75 6e 65 | 74 2e 55 55 2e 4e 45 54 |alz@uune|t.UU.NET|
|00000080| 0a 0a 53 75 62 6d 69 74 | 74 65 64 2d 62 79 3a 20 |..Submit|ted-by: |
|00000090| 6b 65 6e 6f 62 69 21 66 | 6f 72 6b 20 28 4d 69 6b |kenobi!f|ork (Mik|
|000000a0| 65 20 44 69 74 74 6f 29 | 0a 50 6f 73 74 69 6e 67 |e Ditto)|.Posting|
|000000b0| 2d 6e 75 6d 62 65 72 3a | 20 56 6f 6c 75 6d 65 20 |-number:| Volume |
|000000c0| 31 33 2c 20 49 73 73 75 | 65 20 37 30 0a 41 72 63 |13, Issu|e 70.Arc|
|000000d0| 68 69 76 65 2d 6e 61 6d | 65 3a 20 61 74 74 70 63 |hive-nam|e: attpc|
|000000e0| 2e 72 65 6e 69 63 65 0a | 0a 48 65 72 65 20 69 73 |.renice.|.Here is|
|000000f0| 20 74 68 65 20 27 72 65 | 6e 69 63 65 27 20 63 6f | the 're|nice' co|
|00000100| 6d 6d 61 6e 64 2c 20 77 | 68 69 63 68 20 61 6c 74 |mmand, w|hich alt|
|00000110| 65 72 73 20 74 68 65 20 | 70 72 69 6f 72 69 74 79 |ers the |priority|
|00000120| 20 28 27 6e 69 63 65 27 | 20 76 61 6c 75 65 29 20 | ('nice'| value) |
|00000130| 6f 66 0a 61 20 72 75 6e | 6e 69 6e 67 20 70 72 6f |of.a run|ning pro|
|00000140| 63 65 73 73 2e 20 20 54 | 68 65 20 73 6f 75 72 63 |cess. T|he sourc|
|00000150| 65 20 61 73 20 77 72 69 | 74 74 65 6e 20 69 73 20 |e as wri|tten is |
|00000160| 66 6f 72 20 74 68 65 20 | 55 6e 69 78 20 50 43 2c |for the |Unix PC,|
|00000170| 20 62 75 74 20 69 73 20 | 66 61 69 72 6c 79 0a 70 | but is |fairly.p|
|00000180| 6f 72 74 61 62 6c 65 20 | 28 73 65 65 20 62 65 6c |ortable |(see bel|
|00000190| 6f 77 29 2e 0a 0a 54 68 | 69 73 20 70 72 6f 67 72 |ow)...Th|is progr|
|000001a0| 61 6d 20 69 73 20 63 6f | 6e 74 72 69 62 75 74 65 |am is co|ntribute|
|000001b0| 64 20 70 72 69 6d 61 72 | 69 6c 79 20 61 73 20 61 |d primar|ily as a|
|000001c0| 6e 20 65 78 61 6d 70 6c | 65 20 6f 66 20 74 68 65 |n exampl|e of the|
|000001d0| 20 6d 65 74 68 6f 64 73 | 20 75 73 65 64 20 74 6f | methods| used to|
|000001e0| 0a 77 72 69 74 65 20 74 | 6f 20 74 68 65 20 6b 65 |.write t|o the ke|
|000001f0| 72 6e 65 6c 27 73 20 69 | 6e 74 65 72 6e 61 6c 20 |rnel's i|nternal |
|00000200| 74 61 62 6c 65 73 2e 20 | 20 49 6e 20 74 68 69 73 |tables. | In this|
|00000210| 20 63 61 73 65 2c 20 61 | 20 66 69 65 6c 64 20 69 | case, a| field i|
|00000220| 6e 20 61 6e 20 65 6c 65 | 6d 65 6e 74 0a 6f 66 20 |n an ele|ment.of |
|00000230| 74 68 65 20 27 70 72 6f | 63 27 20 61 72 72 61 79 |the 'pro|c' array|
|00000240| 20 69 6e 73 69 64 65 20 | 74 68 65 20 6b 65 72 6e | inside |the kern|
|00000250| 65 6c 20 69 73 20 63 68 | 61 6e 67 65 64 2e 0a 0a |el is ch|anged...|
|00000260| 56 65 72 69 66 79 20 74 | 68 61 74 20 74 68 65 20 |Verify t|hat the |
|00000270| 6d 61 63 72 6f 73 20 69 | 6e 20 22 4d 61 6b 65 66 |macros i|n "Makef|
|00000280| 69 6c 65 22 20 61 72 65 | 20 63 6f 72 72 65 63 74 |ile" are| correct|
|00000290| 20 66 6f 72 20 79 6f 75 | 20 28 4c 42 49 4e 2c 20 | for you| (LBIN, |
|000002a0| 66 6f 72 20 65 78 61 6d | 70 6c 65 0a 73 68 6f 75 |for exam|ple.shou|
|000002b0| 6c 64 20 62 65 20 77 68 | 65 72 65 20 79 6f 75 20 |ld be wh|ere you |
|000002c0| 77 61 6e 74 20 74 68 65 | 20 70 72 6f 67 72 61 6d |want the| program|
|000002d0| 20 74 6f 20 62 65 20 69 | 6e 73 74 61 6c 6c 65 64 | to be i|nstalled|
|000002e0| 29 2c 20 61 6e 64 20 72 | 75 6e 20 27 6d 61 6b 65 |), and r|un 'make|
|000002f0| 27 20 41 53 20 52 4f 4f | 54 2e 0a 49 74 20 69 73 |' AS ROO|T..It is|
|00000300| 20 69 6d 70 6f 72 74 61 | 6e 74 20 74 6f 20 64 6f | importa|nt to do|
|00000310| 20 74 68 65 20 6d 61 6b | 65 20 61 73 20 72 6f 6f | the mak|e as roo|
|00000320| 74 20 73 6f 20 74 68 61 | 74 20 74 68 65 20 72 65 |t so tha|t the re|
|00000330| 73 75 6c 74 69 6e 67 20 | 70 72 6f 67 72 61 6d 20 |sulting |program |
|00000340| 77 69 6c 6c 0a 68 61 76 | 65 20 74 68 65 20 73 65 |will.hav|e the se|
|00000350| 74 2d 75 69 64 20 62 69 | 74 20 73 65 74 2c 20 61 |t-uid bi|t set, a|
|00000360| 6c 6c 6f 77 69 6e 67 20 | 69 74 20 74 6f 20 72 65 |llowing |it to re|
|00000370| 61 64 20 61 6e 64 20 77 | 72 69 74 65 20 74 68 65 |ad and w|rite the|
|00000380| 20 6b 65 72 6e 65 6c 27 | 73 20 6d 65 6d 6f 72 79 | kernel'|s memory|
|00000390| 2e 0a 0a 0a 53 6f 6d 65 | 20 6e 6f 74 65 73 20 74 |....Some| notes t|
|000003a0| 6f 20 61 6e 79 6f 6e 65 | 20 77 68 6f 20 77 61 6e |o anyone| who wan|
|000003b0| 74 73 20 74 6f 20 70 6f | 72 74 20 74 68 69 73 20 |ts to po|rt this |
|000003c0| 70 72 6f 67 72 61 6d 20 | 74 6f 20 73 6f 6d 65 74 |program |to somet|
|000003d0| 68 69 6e 67 20 6f 74 68 | 65 72 0a 74 68 61 6e 20 |hing oth|er.than |
|000003e0| 74 68 65 20 55 6e 69 78 | 20 50 43 3a 0a 0a 54 68 |the Unix| PC:..Th|
|000003f0| 65 20 55 6e 69 78 20 50 | 43 20 68 61 73 20 22 74 |e Unix P|C has "t|
|00000400| 75 6e 61 62 6c 65 20 6b | 65 72 6e 65 6c 20 70 61 |unable k|ernel pa|
|00000410| 72 61 6d 65 74 65 72 73 | 22 2c 20 77 68 69 63 68 |rameters|", which|
|00000420| 20 6d 65 61 6e 20 74 68 | 61 74 20 74 68 69 6e 67 | mean th|at thing|
|00000430| 73 20 74 68 61 74 0a 61 | 72 65 20 63 6f 6e 73 74 |s that.a|re const|
|00000440| 61 6e 74 73 20 6f 6e 20 | 6d 6f 73 74 20 6f 6c 64 |ants on |most old|
|00000450| 65 72 20 55 6e 69 78 20 | 73 79 73 74 65 6d 73 20 |er Unix |systems |
|00000460| 61 72 65 20 76 61 72 69 | 61 62 6c 65 2e 20 20 54 |are vari|able. T|
|00000470| 68 69 73 20 76 65 72 73 | 69 6f 6e 20 6f 66 0a 66 |his vers|ion of.f|
|00000480| 75 73 65 72 20 72 65 61 | 64 73 20 74 68 65 20 76 |user rea|ds the v|
|00000490| 61 6c 75 65 73 20 6f 66 | 20 74 68 65 73 65 20 76 |alues of| these v|
|000004a0| 61 72 69 61 62 6c 65 73 | 20 66 72 6f 6d 20 74 68 |ariables| from th|
|000004b0| 65 20 6b 65 72 6e 65 6c | 27 73 20 6d 65 6d 6f 72 |e kernel|'s memor|
|000004c0| 79 2e 20 20 49 20 68 61 | 76 65 0a 74 72 69 65 64 |y. I ha|ve.tried|
|000004d0| 20 74 6f 20 6d 61 6b 65 | 20 6d 6f 73 74 20 6f 66 | to make| most of|
|000004e0| 20 74 68 69 73 20 74 72 | 61 6e 73 70 61 72 65 6e | this tr|ansparen|
|000004f0| 74 2c 20 66 6f 72 20 65 | 61 73 65 20 6f 66 20 70 |t, for e|ase of p|
|00000500| 6f 72 74 69 6e 67 20 74 | 6f 20 61 20 6d 6f 72 65 |orting t|o a more|
|00000510| 20 70 6c 61 69 6e 2d 0a | 76 61 6e 69 6c 6c 61 20 | plain-.|vanilla |
|00000520| 55 6e 69 78 2e 20 20 46 | 6f 72 20 65 78 61 6d 70 |Unix. F|or examp|
|00000530| 6c 65 2c 20 49 20 68 61 | 76 65 20 61 6e 20 27 69 |le, I ha|ve an 'i|
|00000540| 6e 74 27 20 76 61 72 69 | 61 62 6c 65 20 63 61 6c |nt' vari|able cal|
|00000550| 6c 65 64 20 27 4e 50 52 | 4f 43 27 2c 20 77 68 69 |led 'NPR|OC', whi|
|00000560| 63 68 0a 65 6d 75 6c 61 | 74 65 73 20 74 68 65 20 |ch.emula|tes the |
|00000570| 23 64 65 66 69 6e 65 20 | 70 72 65 73 65 6e 74 20 |#define |present |
|00000580| 69 6e 20 27 73 74 61 6e | 64 61 72 64 27 20 55 6e |in 'stan|dard' Un|
|00000590| 69 78 2e 20 20 54 6f 20 | 6d 61 6b 65 20 72 65 6e |ix. To |make ren|
|000005a0| 69 63 65 20 72 75 6e 20 | 6f 6e 20 73 75 63 68 0a |ice run |on such.|
|000005b0| 73 79 73 74 65 6d 73 2c | 20 69 74 20 73 68 6f 75 |systems,| it shou|
|000005c0| 6c 64 20 62 65 20 70 6f | 73 73 69 62 6c 65 20 74 |ld be po|ssible t|
|000005d0| 6f 20 72 65 6d 6f 76 65 | 20 74 68 69 73 20 76 61 |o remove| this va|
|000005e0| 72 69 61 62 6c 65 20 61 | 6e 64 20 74 68 65 20 63 |riable a|nd the c|
|000005f0| 6f 64 65 20 74 68 61 74 | 20 73 65 74 73 0a 69 74 |ode that| sets.it|
|00000600| 2c 20 61 6e 64 20 74 68 | 65 20 70 72 6f 67 72 61 |, and th|e progra|
|00000610| 6d 20 77 69 6c 6c 20 75 | 73 65 20 74 68 65 20 23 |m will u|se the #|
|00000620| 64 65 66 69 6e 65 20 66 | 72 6f 6d 20 3c 73 79 73 |define f|rom <sys|
|00000630| 2f 2a 2e 68 3e 2e 20 20 | 41 6c 73 6f 20 67 65 74 |/*.h>. |Also get|
|00000640| 20 72 69 64 20 6f 66 20 | 74 68 65 0a 3c 73 79 73 | rid of |the.<sys|
|00000650| 2f 74 75 6e 65 2e 68 3e | 20 69 6e 63 6c 75 64 65 |/tune.h>| include|
|00000660| 20 61 6e 64 20 61 6e 79 | 74 68 69 6e 67 20 72 65 | and any|thing re|
|00000670| 66 65 72 65 6e 63 69 6e | 67 20 27 74 75 68 69 27 |ferencin|g 'tuhi'|
|00000680| 2e 0a 0a 0a 09 09 09 09 | 09 2d 3d 5d 20 46 6f 72 |........|.-=] For|
|00000690| 64 20 5b 3d 2d 0a 0a 22 | 54 68 65 72 65 27 73 20 |d [=-.."|There's |
|000006a0| 65 6e 6f 75 67 68 20 6d | 6f 6e 65 79 20 68 65 72 |enough m|oney her|
|000006b0| 65 09 09 28 49 6e 20 52 | 65 61 6c 20 4c 69 66 65 |e..(In R|eal Life|
|000006c0| 3a 20 20 4d 69 63 68 61 | 65 6c 20 44 69 74 74 6f |: Micha|el Ditto|
|000006d0| 29 0a 20 74 6f 20 62 75 | 79 20 35 30 30 30 20 63 |). to bu|y 5000 c|
|000006e0| 61 6e 73 20 6f 66 20 4e | 6f 6f 64 6c 65 2d 52 6f |ans of N|oodle-Ro|
|000006f0| 6e 69 21 22 09 66 6f 72 | 64 25 6b 65 6e 6f 62 69 |ni!".for|d%kenobi|
|00000700| 40 63 72 61 73 68 2e 43 | 54 53 2e 43 4f 4d 0a 20 |@crash.C|TS.COM. |
|00000710| 20 2d 2d 20 5a 69 70 70 | 79 20 74 68 65 20 50 69 | -- Zipp|y the Pi|
|00000720| 6e 68 65 61 64 09 09 09 | 2e 2e 2e 21 63 72 61 73 |nhead...|...!cras|
|00000730| 68 21 6b 65 6e 6f 62 69 | 21 66 6f 72 64 0a 0a 0a |h!kenobi|!ford...|
|00000740| 48 65 72 65 27 73 20 74 | 68 65 20 73 68 61 72 20 |Here's t|he shar |
|00000750| 66 69 6c 65 3a 0a 0a 23 | 21 20 2f 62 69 6e 2f 73 |file:..#|! /bin/s|
|00000760| 68 0a 23 20 54 68 69 73 | 20 69 73 20 61 20 73 68 |h.# This| is a sh|
|00000770| 65 6c 6c 20 61 72 63 68 | 69 76 65 2c 20 6d 65 61 |ell arch|ive, mea|
|00000780| 6e 69 6e 67 3a 0a 23 20 | 31 2e 20 52 65 6d 6f 76 |ning:.# |1. Remov|
|00000790| 65 20 65 76 65 72 79 74 | 68 69 6e 67 20 61 62 6f |e everyt|hing abo|
|000007a0| 76 65 20 74 68 65 20 23 | 21 20 2f 62 69 6e 2f 73 |ve the #|! /bin/s|
|000007b0| 68 20 6c 69 6e 65 2e 0a | 23 20 32 2e 20 53 61 76 |h line..|# 2. Sav|
|000007c0| 65 20 74 68 65 20 72 65 | 73 75 6c 74 69 6e 67 20 |e the re|sulting |
|000007d0| 74 65 78 74 20 69 6e 20 | 61 20 66 69 6c 65 2e 0a |text in |a file..|
|000007e0| 23 20 33 2e 20 45 78 65 | 63 75 74 65 20 74 68 65 |# 3. Exe|cute the|
|000007f0| 20 66 69 6c 65 20 77 69 | 74 68 20 2f 62 69 6e 2f | file wi|th /bin/|
|00000800| 73 68 20 28 6e 6f 74 20 | 63 73 68 29 20 74 6f 20 |sh (not |csh) to |
|00000810| 63 72 65 61 74 65 20 74 | 68 65 20 66 69 6c 65 73 |create t|he files|
|00000820| 3a 0a 23 09 72 65 6e 69 | 63 65 2e 31 0a 23 09 4d |:.#.reni|ce.1.#.M|
|00000830| 61 6b 65 66 69 6c 65 0a | 23 09 72 65 6e 69 63 65 |akefile.|#.renice|
|00000840| 2e 63 0a 65 78 70 6f 72 | 74 20 50 41 54 48 3b 20 |.c.expor|t PATH; |
|00000850| 50 41 54 48 3d 2f 62 69 | 6e 3a 24 50 41 54 48 0a |PATH=/bi|n:$PATH.|
|00000860| 65 63 68 6f 20 73 68 61 | 72 3a 20 65 78 74 72 61 |echo sha|r: extra|
|00000870| 63 74 69 6e 67 20 22 27 | 72 65 6e 69 63 65 2e 31 |cting "'|renice.1|
|00000880| 27 22 20 27 28 31 32 32 | 32 20 63 68 61 72 61 63 |'" '(122|2 charac|
|00000890| 74 65 72 73 29 27 0a 69 | 66 20 74 65 73 74 20 2d |ters)'.i|f test -|
|000008a0| 66 20 27 72 65 6e 69 63 | 65 2e 31 27 0a 74 68 65 |f 'renic|e.1'.the|
|000008b0| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 77 69 |n..echo |shar: wi|
|000008c0| 6c 6c 20 6e 6f 74 20 6f | 76 65 72 2d 77 72 69 74 |ll not o|ver-writ|
|000008d0| 65 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |e existi|ng file |
|000008e0| 22 27 72 65 6e 69 63 65 | 2e 31 27 22 0a 65 6c 73 |"'renice|.1'".els|
|000008f0| 65 0a 63 61 74 20 3c 3c | 20 5c 53 48 41 52 5f 45 |e.cat <<| \SHAR_E|
|00000900| 4f 46 20 3e 20 27 72 65 | 6e 69 63 65 2e 31 27 0a |OF > 're|nice.1'.|
|00000910| 2e 54 48 20 52 45 4e 49 | 43 45 20 31 0a 2e 53 48 |.TH RENI|CE 1..SH|
|00000920| 20 4e 41 4d 45 0a 72 65 | 6e 69 63 65 20 5c 2d 20 | NAME.re|nice \- |
|00000930| 63 68 61 6e 67 65 20 74 | 68 65 20 70 72 69 6f 72 |change t|he prior|
|00000940| 69 74 79 20 6f 66 20 61 | 20 72 75 6e 6e 69 6e 67 |ity of a| running|
|00000950| 20 70 72 6f 67 72 61 6d | 0a 2e 53 48 20 53 59 4e | program|..SH SYN|
|00000960| 4f 50 53 49 53 0a 2e 42 | 20 72 65 6e 69 63 65 0a |OPSIS..B| renice.|
|00000970| 5b 7b 2b 2d 7d 69 6e 63 | 5d 20 5b 3d 70 72 69 6f |[{+-}inc|] [=prio|
|00000980| 5d 20 70 69 64 20 2e 2e | 2e 0a 2e 53 48 20 44 45 |] pid ..|...SH DE|
|00000990| 53 43 52 49 50 54 49 4f | 4e 0a 2e 49 20 52 65 6e |SCRIPTIO|N..I Ren|
|000009a0| 69 63 65 0a 6d 6f 64 69 | 66 69 65 73 20 74 68 65 |ice.modi|fies the|
|000009b0| 20 6b 65 72 6e 65 6c 27 | 73 20 69 6e 74 65 72 6e | kernel'|s intern|
|000009c0| 61 6c 20 70 72 6f 63 65 | 73 73 20 74 61 62 6c 65 |al proce|ss table|
|000009d0| 20 74 6f 20 63 68 61 6e | 67 65 20 74 68 65 20 27 | to chan|ge the '|
|000009e0| 6e 69 63 65 27 20 76 61 | 6c 75 65 0a 6f 66 20 74 |nice' va|lue.of t|
|000009f0| 68 65 20 6c 69 73 74 65 | 64 20 70 72 6f 63 65 73 |he liste|d proces|
|00000a00| 73 20 49 44 73 2e 20 20 | 54 68 65 20 70 72 69 6f |s IDs. |The prio|
|00000a10| 72 69 74 79 20 6d 61 79 | 20 62 65 20 69 6e 63 72 |rity may| be incr|
|00000a20| 65 61 73 65 64 2c 0a 64 | 65 63 72 65 61 73 65 64 |eased,.d|ecreased|
|00000a30| 2c 20 6f 72 20 73 65 74 | 20 74 6f 20 61 6e 20 61 |, or set| to an a|
|00000a40| 62 73 6f 6c 75 74 65 20 | 6e 75 6d 62 65 72 2e 0a |bsolute |number..|
|00000a50| 2e 50 0a 4f 6e 6c 79 20 | 74 68 65 20 73 75 70 65 |.P.Only |the supe|
|00000a60| 72 2d 75 73 65 72 20 63 | 61 6e 20 69 6e 63 72 65 |r-user c|an incre|
|00000a70| 61 73 65 20 74 68 65 20 | 70 72 69 6f 72 69 74 79 |ase the |priority|
|00000a80| 20 6f 66 20 61 20 70 72 | 6f 63 65 73 73 2c 20 6f | of a pr|ocess, o|
|00000a90| 72 20 63 68 61 6e 67 65 | 20 74 68 65 0a 70 72 69 |r change| the.pri|
|00000aa0| 6f 72 69 74 79 20 6f 66 | 20 61 6e 6f 74 68 65 72 |ority of| another|
|00000ab0| 20 75 73 65 72 27 73 20 | 70 72 6f 63 65 73 73 2e | user's |process.|
|00000ac0| 0a 2e 53 48 20 4f 50 54 | 49 4f 4e 53 0a 47 69 76 |..SH OPT|IONS.Giv|
|00000ad0| 69 6e 67 0a 2e 42 20 2d | 69 6e 63 0a 63 61 75 73 |ing..B -|inc.caus|
|00000ae0| 65 73 20 74 68 65 20 70 | 72 69 6f 72 69 74 79 20 |es the p|riority |
|00000af0| 74 6f 20 64 65 63 72 65 | 61 73 65 20 62 79 20 60 |to decre|ase by `|
|00000b00| 69 6e 63 27 2e 20 20 47 | 69 76 69 6e 67 0a 2e 42 |inc'. G|iving..B|
|00000b10| 20 2b 69 6e 63 0a 63 61 | 75 73 65 73 20 74 68 65 | +inc.ca|uses the|
|00000b20| 20 70 72 69 6f 72 69 74 | 79 20 74 6f 20 69 6e 63 | priorit|y to inc|
|00000b30| 72 65 61 73 65 20 62 79 | 20 60 69 6e 63 27 2e 20 |rease by| `inc'. |
|00000b40| 20 47 69 76 69 6e 67 0a | 2e 42 20 3d 70 72 69 6f | Giving.|.B =prio|
|00000b50| 0a 63 61 75 73 65 73 20 | 74 68 65 20 70 72 69 6f |.causes |the prio|
|00000b60| 72 69 74 79 20 74 6f 20 | 62 65 20 73 65 74 20 74 |rity to |be set t|
|00000b70| 6f 20 60 70 72 69 6f 27 | 2e 20 20 0a 2e 50 0a 54 |o `prio'|. ..P.T|
|00000b80| 68 65 20 63 68 61 6e 67 | 65 73 20 74 6f 20 74 68 |he chang|es to th|
|00000b90| 65 20 70 72 69 6f 72 69 | 74 79 20 6d 61 79 20 62 |e priori|ty may b|
|00000ba0| 65 20 72 65 2d 73 70 65 | 63 69 66 69 65 64 20 62 |e re-spe|cified b|
|00000bb0| 65 74 77 65 65 6e 20 70 | 72 6f 63 65 73 73 20 49 |etween p|rocess I|
|00000bc0| 44 73 2e 20 20 54 68 65 | 0a 64 65 66 61 75 6c 74 |Ds. The|.default|
|00000bd0| 20 63 68 61 6e 67 65 20 | 69 73 20 74 6f 20 61 64 | change |is to ad|
|00000be0| 64 20 35 20 74 6f 20 74 | 68 65 20 27 6e 69 63 65 |d 5 to t|he 'nice|
|00000bf0| 6e 65 73 73 27 20 6f 66 | 20 74 68 65 20 70 72 6f |ness' of| the pro|
|00000c00| 63 65 73 73 65 73 20 28 | 64 65 63 72 65 61 73 65 |cesses (|decrease|
|00000c10| 20 69 74 73 0a 70 72 69 | 6f 72 69 74 79 20 62 79 | its.pri|ority by|
|00000c20| 20 35 29 2e 0a 2e 53 48 | 20 45 58 41 4d 50 4c 45 | 5)...SH| EXAMPLE|
|00000c30| 53 0a 24 20 6e 72 6f 66 | 66 20 2d 6d 61 6e 20 2d |S.$ nrof|f -man -|
|00000c40| 54 33 37 20 72 65 6e 69 | 63 65 2e 31 20 3e 20 2f |T37 reni|ce.1 > /|
|00000c50| 74 6d 70 2f 72 65 6e 69 | 63 65 2e 6d 61 6e 70 61 |tmp/reni|ce.manpa|
|00000c60| 67 65 20 26 0a 2e 62 72 | 0a 5b 31 5d 20 31 32 33 |ge &..br|.[1] 123|
|00000c70| 34 0a 2e 62 72 0a 72 65 | 6e 69 63 65 20 31 32 33 |4..br.re|nice 123|
|00000c80| 34 0a 2e 62 72 0a 2e 52 | 53 0a 54 68 65 73 65 20 |4..br..R|S.These |
|00000c90| 63 6f 6d 6d 61 6e 64 73 | 20 73 74 61 72 74 20 61 |commands| start a|
|00000ca0| 20 6e 72 6f 66 66 20 69 | 6e 20 74 68 65 20 62 61 | nroff i|n the ba|
|00000cb0| 63 6b 67 72 6f 75 6e 64 | 2c 20 61 6e 64 20 74 68 |ckground|, and th|
|00000cc0| 65 6e 20 63 68 61 6e 67 | 65 20 69 74 73 20 70 72 |en chang|e its pr|
|00000cd0| 69 6f 72 69 74 79 0a 73 | 6f 20 74 68 61 74 20 69 |iority.s|o that i|
|00000ce0| 74 20 77 69 6c 6c 20 6e | 6f 74 20 73 6c 6f 77 20 |t will n|ot slow |
|00000cf0| 64 6f 77 6e 20 77 6f 72 | 6b 20 64 6f 6e 65 20 69 |down wor|k done i|
|00000d00| 6e 20 74 68 65 20 66 6f | 72 65 67 72 6f 75 6e 64 |n the fo|reground|
|00000d10| 2e 20 20 54 68 65 20 73 | 61 6d 65 20 65 66 66 65 |. The s|ame effe|
|00000d20| 63 74 0a 77 6f 75 6c 64 | 20 68 61 76 65 20 72 65 |ct.would| have re|
|00000d30| 73 75 6c 74 65 64 20 66 | 72 6f 6d 20 74 79 70 69 |sulted f|rom typi|
|00000d40| 6e 67 20 27 6e 69 63 65 | 27 20 62 65 66 6f 72 65 |ng 'nice|' before|
|00000d50| 20 74 68 65 20 6e 72 6f | 66 66 20 63 6f 6d 6d 61 | the nro|ff comma|
|00000d60| 6e 64 2c 20 62 75 74 20 | 74 68 69 73 0a 65 78 61 |nd, but |this.exa|
|00000d70| 6d 70 6c 65 20 61 73 73 | 75 6d 65 73 20 74 68 61 |mple ass|umes tha|
|00000d80| 74 20 74 68 65 20 75 73 | 65 72 20 27 66 6f 72 67 |t the us|er 'forg|
|00000d90| 6f 74 27 20 74 6f 20 6c | 6f 77 65 72 20 74 68 65 |ot' to l|ower the|
|00000da0| 20 70 72 69 6f 72 69 74 | 79 20 75 6e 74 69 6c 20 | priorit|y until |
|00000db0| 74 68 65 0a 70 72 6f 67 | 72 61 6d 20 20 77 61 73 |the.prog|ram was|
|00000dc0| 20 61 6c 72 65 61 64 79 | 20 72 75 6e 6e 69 6e 67 | already| running|
|00000dd0| 2e 0a 2e 52 45 0a 53 48 | 41 52 5f 45 4f 46 0a 69 |...RE.SH|AR_EOF.i|
|00000de0| 66 20 74 65 73 74 20 31 | 32 32 32 20 2d 6e 65 20 |f test 1|222 -ne |
|00000df0| 22 60 77 63 20 2d 63 20 | 3c 20 27 72 65 6e 69 63 |"`wc -c |< 'renic|
|00000e00| 65 2e 31 27 60 22 0a 74 | 68 65 6e 0a 09 65 63 68 |e.1'`".t|hen..ech|
|00000e10| 6f 20 73 68 61 72 3a 20 | 65 72 72 6f 72 20 74 72 |o shar: |error tr|
|00000e20| 61 6e 73 6d 69 74 74 69 | 6e 67 20 22 27 72 65 6e |ansmitti|ng "'ren|
|00000e30| 69 63 65 2e 31 27 22 20 | 27 28 73 68 6f 75 6c 64 |ice.1'" |'(should|
|00000e40| 20 68 61 76 65 20 62 65 | 65 6e 20 31 32 32 32 20 | have be|en 1222 |
|00000e50| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 66 69 0a |characte|rs)'.fi.|
|00000e60| 66 69 20 23 20 65 6e 64 | 20 6f 66 20 6f 76 65 72 |fi # end| of over|
|00000e70| 77 72 69 74 69 6e 67 20 | 63 68 65 63 6b 0a 65 63 |writing |check.ec|
|00000e80| 68 6f 20 73 68 61 72 3a | 20 65 78 74 72 61 63 74 |ho shar:| extract|
|00000e90| 69 6e 67 20 22 27 4d 61 | 6b 65 66 69 6c 65 27 22 |ing "'Ma|kefile'"|
|00000ea0| 20 27 28 31 37 31 20 63 | 68 61 72 61 63 74 65 72 | '(171 c|haracter|
|00000eb0| 73 29 27 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |s)'.if t|est -f '|
|00000ec0| 4d 61 6b 65 66 69 6c 65 | 27 0a 74 68 65 6e 0a 09 |Makefile|'.then..|
|00000ed0| 65 63 68 6f 20 73 68 61 | 72 3a 20 77 69 6c 6c 20 |echo sha|r: will |
|00000ee0| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|00000ef0| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 22 27 4d |xisting |file "'M|
|00000f00| 61 6b 65 66 69 6c 65 27 | 22 0a 65 6c 73 65 0a 63 |akefile'|".else.c|
|00000f10| 61 74 20 3c 3c 20 5c 53 | 48 41 52 5f 45 4f 46 20 |at << \S|HAR_EOF |
|00000f20| 3e 20 27 4d 61 6b 65 66 | 69 6c 65 27 0a 53 48 45 |> 'Makef|ile'.SHE|
|00000f30| 4c 4c 3d 2f 62 69 6e 2f | 73 68 0a 49 4e 53 54 41 |LL=/bin/|sh.INSTA|
|00000f40| 4c 4c 3d 6c 6e 0a 4c 42 | 49 4e 3d 2f 75 73 72 2f |LL=ln.LB|IN=/usr/|
|00000f50| 6c 62 69 6e 0a 43 46 4c | 41 47 53 3d 2d 4f 0a 0a |lbin.CFL|AGS=-O..|
|00000f60| 72 65 6e 69 63 65 20 3a | 20 72 65 6e 69 63 65 2e |renice :| renice.|
|00000f70| 6f 0a 09 24 28 43 43 29 | 20 24 28 43 46 4c 41 47 |o..$(CC)| $(CFLAG|
|00000f80| 53 29 20 2d 6f 20 72 65 | 6e 69 63 65 20 72 65 6e |S) -o re|nice ren|
|00000f90| 69 63 65 2e 6f 0a 09 63 | 68 6d 6f 64 20 34 37 35 |ice.o..c|hmod 475|
|00000fa0| 35 20 72 65 6e 69 63 65 | 0a 09 63 68 6f 77 6e 20 |5 renice|..chown |
|00000fb0| 72 6f 6f 74 20 72 65 6e | 69 63 65 0a 09 24 28 49 |root ren|ice..$(I|
|00000fc0| 4e 53 54 41 4c 4c 29 20 | 72 65 6e 69 63 65 20 24 |NSTALL) |renice $|
|00000fd0| 28 4c 42 49 4e 29 0a 0a | 53 48 41 52 5f 45 4f 46 |(LBIN)..|SHAR_EOF|
|00000fe0| 0a 69 66 20 74 65 73 74 | 20 31 37 31 20 2d 6e 65 |.if test| 171 -ne|
|00000ff0| 20 22 60 77 63 20 2d 63 | 20 3c 20 27 4d 61 6b 65 | "`wc -c| < 'Make|
|00001000| 66 69 6c 65 27 60 22 0a | 74 68 65 6e 0a 09 65 63 |file'`".|then..ec|
|00001010| 68 6f 20 73 68 61 72 3a | 20 65 72 72 6f 72 20 74 |ho shar:| error t|
|00001020| 72 61 6e 73 6d 69 74 74 | 69 6e 67 20 22 27 4d 61 |ransmitt|ing "'Ma|
|00001030| 6b 65 66 69 6c 65 27 22 | 20 27 28 73 68 6f 75 6c |kefile'"| '(shoul|
|00001040| 64 20 68 61 76 65 20 62 | 65 65 6e 20 31 37 31 20 |d have b|een 171 |
|00001050| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 66 69 0a |characte|rs)'.fi.|
|00001060| 66 69 20 23 20 65 6e 64 | 20 6f 66 20 6f 76 65 72 |fi # end| of over|
|00001070| 77 72 69 74 69 6e 67 20 | 63 68 65 63 6b 0a 65 63 |writing |check.ec|
|00001080| 68 6f 20 73 68 61 72 3a | 20 65 78 74 72 61 63 74 |ho shar:| extract|
|00001090| 69 6e 67 20 22 27 72 65 | 6e 69 63 65 2e 63 27 22 |ing "'re|nice.c'"|
|000010a0| 20 27 28 34 39 31 36 20 | 63 68 61 72 61 63 74 65 | '(4916 |characte|
|000010b0| 72 73 29 27 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |rs)'.if |test -f |
|000010c0| 27 72 65 6e 69 63 65 2e | 63 27 0a 74 68 65 6e 0a |'renice.|c'.then.|
|000010d0| 09 65 63 68 6f 20 73 68 | 61 72 3a 20 77 69 6c 6c |.echo sh|ar: will|
|000010e0| 20 6e 6f 74 20 6f 76 65 | 72 2d 77 72 69 74 65 20 | not ove|r-write |
|000010f0| 65 78 69 73 74 69 6e 67 | 20 66 69 6c 65 20 22 27 |existing| file "'|
|00001100| 72 65 6e 69 63 65 2e 63 | 27 22 0a 65 6c 73 65 0a |renice.c|'".else.|
|00001110| 63 61 74 20 3c 3c 20 5c | 53 48 41 52 5f 45 4f 46 |cat << \|SHAR_EOF|
|00001120| 20 3e 20 27 72 65 6e 69 | 63 65 2e 63 27 0a 2f 2a | > 'reni|ce.c'./*|
|00001130| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001140| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001150| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001160| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 0a 20 2a 0a 20 |********|***. *. |
|00001170| 2a 20 54 68 69 73 20 70 | 72 6f 67 72 61 6d 20 77 |* This p|rogram w|
|00001180| 61 73 20 77 72 69 74 74 | 65 6e 20 62 79 20 6d 65 |as writt|en by me|
|00001190| 2c 20 4d 69 6b 65 20 22 | 46 6f 72 64 22 20 44 69 |, Mike "|Ford" Di|
|000011a0| 74 74 6f 2c 20 61 6e 64 | 0a 20 2a 20 49 20 68 65 |tto, and|. * I he|
|000011b0| 72 65 62 79 20 72 65 6c | 65 61 73 65 20 69 74 20 |reby rel|ease it |
|000011c0| 69 6e 74 6f 20 74 68 65 | 20 70 75 62 6c 69 63 20 |into the| public |
|000011d0| 64 6f 6d 61 69 6e 20 69 | 6e 20 74 68 65 20 69 6e |domain i|n the in|
|000011e0| 74 65 72 65 73 74 0a 20 | 2a 20 6f 66 20 70 72 6f |terest. |* of pro|
|000011f0| 6d 6f 74 69 6e 67 20 74 | 68 65 20 64 65 76 65 6c |moting t|he devel|
|00001200| 6f 70 6d 65 6e 74 20 6f | 66 20 66 72 65 65 2c 20 |opment o|f free, |
|00001210| 71 75 61 6c 69 74 79 20 | 73 6f 66 74 77 61 72 65 |quality |software|
|00001220| 0a 20 2a 20 66 6f 72 20 | 74 68 65 20 68 61 63 6b |. * for |the hack|
|00001230| 65 72 73 20 61 6e 64 20 | 75 73 65 72 73 20 6f 66 |ers and |users of|
|00001240| 20 74 68 65 20 77 6f 72 | 6c 64 2e 0a 20 2a 0a 20 | the wor|ld.. *. |
|00001250| 2a 20 46 65 65 6c 20 66 | 72 65 65 20 74 6f 20 75 |* Feel f|ree to u|
|00001260| 73 65 2c 20 63 6f 70 79 | 2c 20 6d 6f 64 69 66 79 |se, copy|, modify|
|00001270| 2c 20 69 6d 70 72 6f 76 | 65 2c 20 61 6e 64 20 72 |, improv|e, and r|
|00001280| 65 64 69 73 74 72 69 62 | 75 74 65 0a 20 2a 20 74 |edistrib|ute. * t|
|00001290| 68 69 73 20 70 72 6f 67 | 72 61 6d 2c 20 62 75 74 |his prog|ram, but|
|000012a0| 20 6b 65 65 70 20 69 6e | 20 6d 69 6e 64 20 74 68 | keep in| mind th|
|000012b0| 65 20 73 70 69 72 69 74 | 20 6f 66 20 74 68 69 73 |e spirit| of this|
|000012c0| 0a 20 2a 20 63 6f 6e 74 | 72 69 62 75 74 69 6f 6e |. * cont|ribution|
|000012d0| 3b 20 61 6c 77 61 79 73 | 20 70 72 6f 76 69 64 65 |; always| provide|
|000012e0| 20 73 6f 75 72 63 65 2c | 20 61 6e 64 20 61 6c 77 | source,| and alw|
|000012f0| 61 79 73 20 61 6c 6c 6f | 77 0a 20 2a 20 66 72 65 |ays allo|w. * fre|
|00001300| 65 20 72 65 64 69 73 74 | 72 69 62 75 74 69 6f 6e |e redist|ribution|
|00001310| 20 28 73 68 61 72 65 77 | 61 72 65 20 69 73 20 66 | (sharew|are is f|
|00001320| 69 6e 65 20 77 69 74 68 | 20 6d 65 29 2e 20 20 49 |ine with| me). I|
|00001330| 66 0a 20 2a 20 79 6f 75 | 20 75 73 65 20 61 20 73 |f. * you| use a s|
|00001340| 69 67 6e 69 66 69 63 61 | 6e 74 20 70 61 72 74 20 |ignifica|nt part |
|00001350| 6f 66 20 74 68 69 73 20 | 63 6f 64 65 20 69 6e 20 |of this |code in |
|00001360| 61 20 70 72 6f 67 72 61 | 6d 20 6f 66 0a 20 2a 20 |a progra|m of. * |
|00001370| 79 6f 75 72 73 2c 20 49 | 20 77 6f 75 6c 64 20 61 |yours, I| would a|
|00001380| 70 70 72 65 63 69 61 74 | 65 20 62 65 69 6e 67 20 |ppreciat|e being |
|00001390| 67 69 76 65 6e 20 74 68 | 65 20 61 70 70 72 6f 70 |given th|e approp|
|000013a0| 72 69 61 74 65 0a 20 2a | 20 61 6d 6f 75 6e 74 20 |riate. *| amount |
|000013b0| 6f 66 20 63 72 65 64 69 | 74 2e 0a 20 2a 09 09 09 |of credi|t.. *...|
|000013c0| 09 2d 3d 5d 20 46 6f 72 | 64 20 5b 3d 2d 0a 20 2a |.-=] For|d [=-. *|
|000013d0| 0a 20 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |. ******|********|
|000013e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000013f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001400| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2f 0a |********|******/.|
|00001410| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 74 64 69 6f |.#includ|e <stdio|
|00001420| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 66 63 |.h>.#inc|lude <fc|
|00001430| 6e 74 6c 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |ntl.h>.#|include |
|00001440| 3c 63 74 79 70 65 2e 68 | 3e 0a 23 69 6e 63 6c 75 |<ctype.h|>.#inclu|
|00001450| 64 65 20 3c 65 72 72 6e | 6f 2e 68 3e 0a 23 69 6e |de <errn|o.h>.#in|
|00001460| 63 6c 75 64 65 20 3c 70 | 77 64 2e 68 3e 0a 23 69 |clude <p|wd.h>.#i|
|00001470| 6e 63 6c 75 64 65 20 3c | 67 72 70 2e 68 3e 0a 23 |nclude <|grp.h>.#|
|00001480| 69 6e 63 6c 75 64 65 20 | 3c 73 79 73 2f 74 79 70 |include |<sys/typ|
|00001490| 65 73 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |es.h>.#i|nclude <|
|000014a0| 73 79 73 2f 70 61 72 61 | 6d 2e 68 3e 0a 23 69 6e |sys/para|m.h>.#in|
|000014b0| 63 6c 75 64 65 20 3c 73 | 79 73 2f 74 75 6e 65 2e |clude <s|ys/tune.|
|000014c0| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 79 73 |h>.#incl|ude <sys|
|000014d0| 2f 70 72 6f 63 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |/proc.h>|.#includ|
|000014e0| 65 20 3c 6e 6c 69 73 74 | 2e 68 3e 0a 0a 0a 65 78 |e <nlist|.h>...ex|
|000014f0| 74 65 72 6e 20 6c 6f 6e | 67 20 6c 73 65 65 6b 28 |tern lon|g lseek(|
|00001500| 29 3b 0a 65 78 74 65 72 | 6e 20 76 6f 69 64 20 70 |);.exter|n void p|
|00001510| 65 72 72 6f 72 28 29 2c | 20 65 78 69 74 28 29 3b |error(),| exit();|
|00001520| 0a 0a 0a 76 6f 69 64 20 | 6b 63 6f 70 79 28 29 2c |...void |kcopy(),|
|00001530| 20 6b 77 72 69 74 65 28 | 29 3b 0a 0a 63 68 61 72 | kwrite(|);..char|
|00001540| 20 2a 70 72 6f 67 6e 61 | 6d 65 3b 0a 0a 23 64 65 | *progna|me;..#de|
|00001550| 66 69 6e 65 20 74 75 68 | 69 61 64 64 72 20 28 6d |fine tuh|iaddr (m|
|00001560| 79 73 79 6d 73 5b 30 5d | 2e 6e 5f 76 61 6c 75 65 |ysyms[0]|.n_value|
|00001570| 29 0a 23 64 65 66 69 6e | 65 20 70 72 6f 63 61 64 |).#defin|e procad|
|00001580| 64 72 20 28 6d 79 73 79 | 6d 73 5b 31 5d 2e 6e 5f |dr (mysy|ms[1].n_|
|00001590| 76 61 6c 75 65 29 0a 0a | 73 74 72 75 63 74 20 6e |value)..|struct n|
|000015a0| 6c 69 73 74 20 6d 79 73 | 79 6d 73 5b 5d 20 3d 0a |list mys|yms[] =.|
|000015b0| 7b 0a 20 20 20 20 7b 20 | 22 74 75 68 69 22 2c 20 |{. { |"tuhi", |
|000015c0| 7d 2c 0a 20 20 20 20 7b | 20 22 70 72 6f 63 22 2c |},. {| "proc",|
|000015d0| 20 7d 2c 0a 20 20 20 20 | 7b 20 28 63 68 61 72 20 | },. |{ (char |
|000015e0| 2a 29 30 2c 20 7d 2c 0a | 7d 3b 0a 0a 63 68 61 72 |*)0, },.|};..char|
|000015f0| 20 62 75 66 5b 42 55 46 | 53 49 5a 5d 3b 0a 0a 69 | buf[BUF|SIZ];..i|
|00001600| 6e 74 20 6b 6d 65 6d 3b | 0a 69 6e 74 20 6d 79 75 |nt kmem;|.int myu|
|00001610| 69 64 3b 0a 69 6e 74 20 | 4e 50 52 4f 43 3b 0a 73 |id;.int |NPROC;.s|
|00001620| 74 61 74 69 63 20 73 74 | 72 75 63 74 20 70 72 6f |tatic st|ruct pro|
|00001630| 63 20 70 72 6f 63 3b 0a | 0a 0a 76 6f 69 64 20 75 |c proc;.|..void u|
|00001640| 73 61 67 65 28 29 0a 7b | 0a 20 20 20 20 66 70 72 |sage().{|. fpr|
|00001650| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 0a 09 20 20 |intf(std|err,.. |
|00001660| 20 20 22 75 73 61 67 65 | 3a 09 25 73 20 5b 7b 2b | "usage|:.%s [{+|
|00001670| 2d 7d 69 6e 63 5d 20 5b | 3d 70 72 69 6f 5d 20 70 |-}inc] [|=prio] p|
|00001680| 69 64 20 2e 2e 2e 5c 6e | 22 2c 20 70 72 6f 67 6e |id ...\n|", progn|
|00001690| 61 6d 65 29 3b 0a 20 20 | 20 20 65 78 69 74 28 2d |ame);. | exit(-|
|000016a0| 31 29 3b 0a 7d 0a 0a 0a | 6d 61 69 6e 28 61 72 67 |1);.}...|main(arg|
|000016b0| 63 2c 20 61 72 67 76 29 | 0a 69 6e 74 20 61 72 67 |c, argv)|.int arg|
|000016c0| 63 3b 0a 63 68 61 72 20 | 2a 61 72 67 76 5b 5d 3b |c;.char |*argv[];|
|000016d0| 0a 7b 0a 20 20 20 20 69 | 6e 74 20 73 74 61 74 75 |.{. i|nt statu|
|000016e0| 73 3d 30 3b 0a 20 20 20 | 20 69 6e 74 20 70 69 64 |s=0;. | int pid|
|000016f0| 2c 20 72 65 6c 61 74 69 | 76 65 2c 20 76 61 6c 75 |, relati|ve, valu|
|00001700| 65 3b 0a 0a 20 20 20 20 | 70 72 6f 67 6e 61 6d 65 |e;.. |progname|
|00001710| 20 3d 20 2a 61 72 67 76 | 3b 0a 0a 20 20 20 20 73 | = *argv|;.. s|
|00001720| 65 74 75 70 28 29 3b 0a | 0a 20 20 20 20 72 65 6c |etup();.|. rel|
|00001730| 61 74 69 76 65 20 3d 20 | 31 3b 0a 20 20 20 20 76 |ative = |1;. v|
|00001740| 61 6c 75 65 20 3d 20 35 | 3b 0a 0a 20 20 20 20 77 |alue = 5|;.. w|
|00001750| 68 69 6c 65 20 28 2b 2b | 61 72 67 76 2c 2d 2d 61 |hile (++|argv,--a|
|00001760| 72 67 63 29 0a 09 73 77 | 69 74 63 68 20 28 61 72 |rgc)..sw|itch (ar|
|00001770| 67 76 5b 30 5d 5b 30 5d | 29 0a 09 7b 0a 09 63 61 |gv[0][0]|)..{..ca|
|00001780| 73 65 20 27 2d 27 3a 0a | 09 20 20 20 20 69 66 20 |se '-':.|. if |
|00001790| 28 73 73 63 61 6e 66 28 | 61 72 67 76 5b 30 5d 2b |(sscanf(|argv[0]+|
|000017a0| 31 2c 20 22 25 64 22 2c | 20 26 76 61 6c 75 65 29 |1, "%d",| &value)|
|000017b0| 20 21 3d 20 31 29 0a 09 | 09 75 73 61 67 65 28 29 | != 1)..|.usage()|
|000017c0| 3b 0a 09 20 20 20 20 72 | 65 6c 61 74 69 76 65 20 |;.. r|elative |
|000017d0| 3d 20 31 3b 0a 09 20 20 | 20 20 62 72 65 61 6b 3b |= 1;.. | break;|
|000017e0| 0a 09 63 61 73 65 20 27 | 2b 27 3a 0a 09 20 20 20 |..case '|+':.. |
|000017f0| 20 69 66 20 28 73 73 63 | 61 6e 66 28 61 72 67 76 | if (ssc|anf(argv|
|00001800| 5b 30 5d 2b 31 2c 20 22 | 25 64 22 2c 20 26 76 61 |[0]+1, "|%d", &va|
|00001810| 6c 75 65 29 20 21 3d 20 | 31 29 0a 09 09 75 73 61 |lue) != |1)...usa|
|00001820| 67 65 28 29 3b 0a 09 20 | 20 20 20 76 61 6c 75 65 |ge();.. | value|
|00001830| 20 3d 20 2d 76 61 6c 75 | 65 3b 0a 09 20 20 20 20 | = -valu|e;.. |
|00001840| 72 65 6c 61 74 69 76 65 | 20 3d 20 31 3b 0a 09 20 |relative| = 1;.. |
|00001850| 20 20 20 62 72 65 61 6b | 3b 0a 09 63 61 73 65 20 | break|;..case |
|00001860| 27 3d 27 3a 0a 09 20 20 | 20 20 69 66 20 28 73 73 |'=':.. | if (ss|
|00001870| 63 61 6e 66 28 61 72 67 | 76 5b 30 5d 2b 31 2c 20 |canf(arg|v[0]+1, |
|00001880| 22 25 64 22 2c 20 26 76 | 61 6c 75 65 29 20 21 3d |"%d", &v|alue) !=|
|00001890| 20 31 29 0a 09 09 75 73 | 61 67 65 28 29 3b 0a 09 | 1)...us|age();..|
|000018a0| 20 20 20 20 72 65 6c 61 | 74 69 76 65 20 3d 20 30 | rela|tive = 0|
|000018b0| 3b 0a 09 20 20 20 20 62 | 72 65 61 6b 3b 0a 09 64 |;.. b|reak;..d|
|000018c0| 65 66 61 75 6c 74 3a 0a | 09 20 20 20 20 69 66 20 |efault:.|. if |
|000018d0| 28 73 73 63 61 6e 66 28 | 61 72 67 76 5b 30 5d 2c |(sscanf(|argv[0],|
|000018e0| 20 22 25 64 22 2c 20 26 | 70 69 64 29 20 21 3d 20 | "%d", &|pid) != |
|000018f0| 31 29 0a 09 09 75 73 61 | 67 65 28 29 3b 0a 09 20 |1)...usa|ge();.. |
|00001900| 20 20 20 73 74 61 74 75 | 73 20 2b 3d 20 72 65 6e | statu|s += ren|
|00001910| 69 63 65 28 70 69 64 2c | 20 76 61 6c 75 65 2c 20 |ice(pid,| value, |
|00001920| 72 65 6c 61 74 69 76 65 | 29 3b 0a 09 7d 0a 0a 20 |relative|);..}.. |
|00001930| 20 20 20 72 65 74 75 72 | 6e 20 73 74 61 74 75 73 | retur|n status|
|00001940| 3b 0a 7d 0a 0a 0a 2f 2a | 20 6f 6e 65 2d 74 69 6d |;.}.../*| one-tim|
|00001950| 65 20 73 65 74 75 70 20 | 6f 66 20 6d 61 69 6e 20 |e setup |of main |
|00001960| 64 61 74 61 20 73 74 72 | 75 63 74 75 72 65 73 20 |data str|uctures |
|00001970| 66 72 6f 6d 20 74 68 65 | 20 6b 65 72 6e 65 6c 20 |from the| kernel |
|00001980| 2a 2f 0a 73 65 74 75 70 | 28 29 0a 7b 0a 20 20 20 |*/.setup|().{. |
|00001990| 20 73 74 72 75 63 74 20 | 74 75 6e 61 62 6c 65 20 | struct |tunable |
|000019a0| 74 75 6e 65 3b 0a 0a 20 | 20 20 20 69 66 20 28 20 |tune;.. | if ( |
|000019b0| 28 6b 6d 65 6d 3d 6f 70 | 65 6e 28 22 2f 64 65 76 |(kmem=op|en("/dev|
|000019c0| 2f 6b 6d 65 6d 22 2c 20 | 4f 5f 52 44 57 52 29 29 |/kmem", |O_RDWR))|
|000019d0| 20 3c 20 30 20 29 0a 20 | 20 20 20 7b 0a 09 73 70 | < 0 ). | {..sp|
|000019e0| 72 69 6e 74 66 28 62 75 | 66 2c 20 22 25 73 3a 20 |rintf(bu|f, "%s: |
|000019f0| 63 61 6e 27 74 20 6f 70 | 65 6e 20 2f 64 65 76 2f |can't op|en /dev/|
|00001a00| 6b 6d 65 6d 22 2c 20 70 | 72 6f 67 6e 61 6d 65 29 |kmem", p|rogname)|
|00001a10| 3b 0a 09 70 65 72 72 6f | 72 28 62 75 66 29 3b 0a |;..perro|r(buf);.|
|00001a20| 09 65 78 69 74 28 31 29 | 3b 0a 20 20 20 20 7d 0a |.exit(1)|;. }.|
|00001a30| 0a 20 20 20 20 69 66 20 | 28 6e 6c 69 73 74 28 22 |. if |(nlist("|
|00001a40| 2f 75 6e 69 78 22 2c 20 | 6d 79 73 79 6d 73 29 29 |/unix", |mysyms))|
|00001a50| 0a 20 20 20 20 7b 0a 09 | 73 70 72 69 6e 74 66 28 |. {..|sprintf(|
|00001a60| 62 75 66 2c 20 22 25 73 | 3a 20 63 61 6e 27 74 20 |buf, "%s|: can't |
|00001a70| 6e 6c 69 73 74 20 2f 75 | 6e 69 78 22 2c 20 70 72 |nlist /u|nix", pr|
|00001a80| 6f 67 6e 61 6d 65 29 3b | 0a 09 70 65 72 72 6f 72 |ogname);|..perror|
|00001a90| 28 62 75 66 29 3b 0a 09 | 65 78 69 74 28 31 29 3b |(buf);..|exit(1);|
|00001aa0| 0a 20 20 20 20 7d 0a 0a | 20 20 20 20 6d 79 75 69 |. }..| myui|
|00001ab0| 64 20 3d 20 67 65 74 75 | 69 64 28 29 3b 0a 20 20 |d = getu|id();. |
|00001ac0| 20 20 73 65 74 75 69 64 | 28 6d 79 75 69 64 29 3b | setuid|(myuid);|
|00001ad0| 0a 0a 23 69 66 64 65 66 | 20 44 45 42 55 47 0a 20 |..#ifdef| DEBUG. |
|00001ae0| 20 20 20 66 70 72 69 6e | 74 66 28 73 74 64 65 72 | fprin|tf(stder|
|00001af0| 72 2c 20 22 74 75 68 69 | 3a 09 30 78 25 30 38 6c |r, "tuhi|:.0x%08l|
|00001b00| 78 5c 6e 22 2c 20 74 75 | 68 69 61 64 64 72 29 3b |x\n", tu|hiaddr);|
|00001b10| 0a 23 65 6e 64 69 66 20 | 44 45 42 55 47 0a 20 20 |.#endif |DEBUG. |
|00001b20| 20 20 6b 63 6f 70 79 28 | 28 63 68 61 72 20 2a 29 | kcopy(|(char *)|
|00001b30| 26 74 75 6e 65 2c 20 74 | 75 68 69 61 64 64 72 2c |&tune, t|uhiaddr,|
|00001b40| 20 28 6c 6f 6e 67 29 20 | 73 69 7a 65 6f 66 20 74 | (long) |sizeof t|
|00001b50| 75 6e 65 29 3b 0a 0a 20 | 20 20 20 2f 2a 20 64 6f |une);.. | /* do|
|00001b60| 20 69 6e 64 69 72 65 63 | 74 69 6f 6e 20 6f 6e 20 | indirec|tion on |
|00001b70| 74 68 65 20 70 72 6f 63 | 20 61 64 64 72 65 73 73 |the proc| address|
|00001b80| 2c 20 73 69 6e 63 65 20 | 69 74 20 2a 2f 0a 20 20 |, since |it */. |
|00001b90| 20 20 2f 2a 20 69 73 20 | 6a 75 73 74 20 61 20 70 | /* is |just a p|
|00001ba0| 6f 69 6e 74 65 72 20 69 | 6e 20 74 68 65 20 6b 65 |ointer i|n the ke|
|00001bb0| 72 6e 65 6c 20 2a 2f 0a | 20 20 20 20 6b 63 6f 70 |rnel */.| kcop|
|00001bc0| 79 28 28 63 68 61 72 20 | 2a 29 26 70 72 6f 63 61 |y((char |*)&proca|
|00001bd0| 64 64 72 2c 20 70 72 6f | 63 61 64 64 72 2c 20 28 |ddr, pro|caddr, (|
|00001be0| 6c 6f 6e 67 29 20 73 69 | 7a 65 6f 66 20 70 72 6f |long) si|zeof pro|
|00001bf0| 63 61 64 64 72 29 3b 0a | 0a 23 69 66 64 65 66 20 |caddr);.|.#ifdef |
|00001c00| 44 45 42 55 47 0a 20 20 | 20 20 66 70 72 69 6e 74 |DEBUG. | fprint|
|00001c10| 66 28 73 74 64 65 72 72 | 2c 20 22 70 72 6f 63 3a |f(stderr|, "proc:|
|00001c20| 09 30 78 25 30 38 6c 78 | 5c 6e 22 2c 20 70 72 6f |.0x%08lx|\n", pro|
|00001c30| 63 61 64 64 72 29 3b 0a | 23 65 6e 64 69 66 20 44 |caddr);.|#endif D|
|00001c40| 45 42 55 47 0a 0a 20 20 | 20 20 4e 50 52 4f 43 20 |EBUG.. | NPROC |
|00001c50| 3d 20 74 75 6e 65 2e 6e | 70 72 6f 63 3b 0a 0a 23 |= tune.n|proc;..#|
|00001c60| 69 66 64 65 66 20 44 45 | 42 55 47 0a 20 20 20 20 |ifdef DE|BUG. |
|00001c70| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|00001c80| 22 4e 50 52 4f 43 3a 09 | 25 64 5c 6e 22 2c 20 4e |"NPROC:.|%d\n", N|
|00001c90| 50 52 4f 43 29 3b 0a 23 | 65 6e 64 69 66 20 44 45 |PROC);.#|endif DE|
|00001ca0| 42 55 47 0a 7d 0a 0a 0a | 2f 2a 20 63 6f 70 79 20 |BUG.}...|/* copy |
|00001cb0| 62 79 74 65 73 20 66 72 | 6f 6d 20 6b 65 72 6e 65 |bytes fr|om kerne|
|00001cc0| 6c 20 61 64 64 72 65 73 | 73 20 73 70 61 63 65 20 |l addres|s space |
|00001cd0| 74 6f 20 74 68 69 73 20 | 70 72 6f 63 65 73 73 20 |to this |process |
|00001ce0| 2a 2f 0a 76 6f 69 64 20 | 6b 63 6f 70 79 28 63 61 |*/.void |kcopy(ca|
|00001cf0| 64 64 72 2c 20 6b 61 64 | 64 72 2c 20 6e 62 79 74 |ddr, kad|dr, nbyt|
|00001d00| 65 73 29 0a 63 68 61 72 | 20 2a 63 61 64 64 72 3b |es).char| *caddr;|
|00001d10| 0a 6c 6f 6e 67 20 6b 61 | 64 64 72 3b 0a 6c 6f 6e |.long ka|ddr;.lon|
|00001d20| 67 20 6e 62 79 74 65 73 | 3b 0a 7b 0a 20 20 20 20 |g nbytes|;.{. |
|00001d30| 69 66 20 28 20 6c 73 65 | 65 6b 28 6b 6d 65 6d 2c |if ( lse|ek(kmem,|
|00001d40| 20 6b 61 64 64 72 2c 20 | 30 29 3c 30 4c 20 7c 7c | kaddr, |0)<0L |||
|00001d50| 0a 09 72 65 61 64 28 6b | 6d 65 6d 2c 20 63 61 64 |..read(k|mem, cad|
|00001d60| 64 72 2c 20 28 75 6e 73 | 69 67 6e 65 64 29 6e 62 |dr, (uns|igned)nb|
|00001d70| 79 74 65 73 29 20 21 3d | 20 6e 62 79 74 65 73 20 |ytes) !=| nbytes |
|00001d80| 29 0a 20 20 20 20 7b 0a | 09 73 70 72 69 6e 74 66 |). {.|.sprintf|
|00001d90| 28 62 75 66 2c 20 22 25 | 73 3a 20 63 61 6e 27 74 |(buf, "%|s: can't|
|00001da0| 20 72 65 61 64 20 2f 64 | 65 76 2f 6b 6d 65 6d 22 | read /d|ev/kmem"|
|00001db0| 2c 20 70 72 6f 67 6e 61 | 6d 65 29 3b 0a 09 70 65 |, progna|me);..pe|
|00001dc0| 72 72 6f 72 28 62 75 66 | 29 3b 0a 09 65 78 69 74 |rror(buf|);..exit|
|00001dd0| 28 31 29 3b 0a 20 20 20 | 20 7d 0a 7d 0a 0a 0a 2f |(1);. | }.}.../|
|00001de0| 2a 20 77 72 69 74 65 20 | 62 79 74 65 73 20 66 72 |* write |bytes fr|
|00001df0| 6f 6d 20 74 68 69 73 20 | 70 72 6f 63 65 73 73 27 |om this |process'|
|00001e00| 20 61 64 64 72 65 73 73 | 20 73 70 61 63 65 20 74 | address| space t|
|00001e10| 6f 20 74 68 65 20 6b 65 | 72 6e 65 6c 27 73 20 2a |o the ke|rnel's *|
|00001e20| 2f 0a 76 6f 69 64 20 6b | 77 72 69 74 65 28 6b 61 |/.void k|write(ka|
|00001e30| 64 64 72 2c 20 63 61 64 | 64 72 2c 20 6e 62 79 74 |ddr, cad|dr, nbyt|
|00001e40| 65 73 29 0a 6c 6f 6e 67 | 20 6b 61 64 64 72 3b 0a |es).long| kaddr;.|
|00001e50| 63 68 61 72 20 2a 63 61 | 64 64 72 3b 0a 6c 6f 6e |char *ca|ddr;.lon|
|00001e60| 67 20 6e 62 79 74 65 73 | 3b 0a 7b 0a 23 69 66 64 |g nbytes|;.{.#ifd|
|00001e70| 65 66 20 44 45 42 55 47 | 0a 20 20 20 20 66 70 72 |ef DEBUG|. fpr|
|00001e80| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 57 72 |intf(std|err, "Wr|
|00001e90| 69 74 69 6e 67 20 25 6c | 64 20 62 79 74 65 73 20 |iting %l|d bytes |
|00001ea0| 74 6f 20 6b 65 72 6e 65 | 6c 20 61 64 64 72 65 73 |to kerne|l addres|
|00001eb0| 73 20 30 78 25 30 38 6c | 78 5c 6e 22 2c 0a 09 20 |s 0x%08l|x\n",.. |
|00001ec0| 20 20 20 6e 62 79 74 65 | 73 2c 20 6b 61 64 64 72 | nbyte|s, kaddr|
|00001ed0| 29 3b 0a 23 65 6e 64 69 | 66 0a 0a 20 20 20 20 69 |);.#endi|f.. i|
|00001ee0| 66 20 28 20 6c 73 65 65 | 6b 28 6b 6d 65 6d 2c 20 |f ( lsee|k(kmem, |
|00001ef0| 6b 61 64 64 72 2c 20 30 | 29 3c 30 4c 20 7c 7c 0a |kaddr, 0|)<0L ||.|
|00001f00| 09 77 72 69 74 65 28 6b | 6d 65 6d 2c 20 63 61 64 |.write(k|mem, cad|
|00001f10| 64 72 2c 20 28 75 6e 73 | 69 67 6e 65 64 29 6e 62 |dr, (uns|igned)nb|
|00001f20| 79 74 65 73 29 20 21 3d | 20 6e 62 79 74 65 73 20 |ytes) !=| nbytes |
|00001f30| 29 0a 20 20 20 20 7b 0a | 09 73 70 72 69 6e 74 66 |). {.|.sprintf|
|00001f40| 28 62 75 66 2c 20 22 25 | 73 3a 20 63 61 6e 27 74 |(buf, "%|s: can't|
|00001f50| 20 77 72 69 74 65 20 2f | 64 65 76 2f 6b 6d 65 6d | write /|dev/kmem|
|00001f60| 22 2c 20 70 72 6f 67 6e | 61 6d 65 29 3b 0a 09 70 |", progn|ame);..p|
|00001f70| 65 72 72 6f 72 28 62 75 | 66 29 3b 0a 09 65 78 69 |error(bu|f);..exi|
|00001f80| 74 28 31 29 3b 0a 20 20 | 20 20 7d 0a 7d 0a 0a 0a |t(1);. | }.}...|
|00001f90| 2f 2a 20 63 68 61 6e 67 | 65 20 74 68 65 20 6e 69 |/* chang|e the ni|
|00001fa0| 63 65 20 76 61 6c 75 65 | 20 6f 66 20 70 72 6f 63 |ce value| of proc|
|00001fb0| 65 73 73 20 60 70 69 64 | 27 20 62 61 73 65 64 20 |ess `pid|' based |
|00001fc0| 6f 6e 20 27 76 61 6c 75 | 65 27 20 61 6e 64 20 27 |on 'valu|e' and '|
|00001fd0| 72 65 6c 61 74 69 76 65 | 27 20 2a 2f 0a 72 65 6e |relative|' */.ren|
|00001fe0| 69 63 65 28 70 69 64 2c | 20 76 61 6c 75 65 2c 20 |ice(pid,| value, |
|00001ff0| 72 65 6c 61 74 69 76 65 | 29 0a 69 6e 74 20 70 69 |relative|).int pi|
|00002000| 64 2c 20 76 61 6c 75 65 | 2c 20 72 65 6c 61 74 69 |d, value|, relati|
|00002010| 76 65 3b 0a 7b 0a 20 20 | 20 20 72 65 67 69 73 74 |ve;.{. | regist|
|00002020| 65 72 20 69 3b 0a 20 20 | 20 20 69 6e 74 20 74 6d |er i;. | int tm|
|00002030| 70 6e 69 63 65 3b 0a 0a | 20 20 20 20 66 6f 72 20 |pnice;..| for |
|00002040| 28 20 69 3d 30 20 3b 20 | 69 3c 4e 50 52 4f 43 20 |( i=0 ; |i<NPROC |
|00002050| 3b 20 2b 2b 69 20 29 0a | 20 20 20 20 7b 0a 09 6b |; ++i ).| {..k|
|00002060| 63 6f 70 79 28 28 63 68 | 61 72 20 2a 29 26 70 72 |copy((ch|ar *)&pr|
|00002070| 6f 63 2c 0a 09 20 20 20 | 20 20 20 28 6c 6f 6e 67 |oc,.. | (long|
|00002080| 29 26 28 28 73 74 72 75 | 63 74 20 70 72 6f 63 20 |)&((stru|ct proc |
|00002090| 2a 29 70 72 6f 63 61 64 | 64 72 29 5b 69 5d 2c 0a |*)procad|dr)[i],.|
|000020a0| 09 20 20 20 20 20 20 28 | 6c 6f 6e 67 29 73 69 7a |. (|long)siz|
|000020b0| 65 6f 66 20 70 72 6f 63 | 29 3b 0a 09 69 66 20 28 |eof proc|);..if (|
|000020c0| 20 70 72 6f 63 2e 70 5f | 70 69 64 20 3d 3d 20 70 | proc.p_|pid == p|
|000020d0| 69 64 20 29 0a 09 7b 0a | 23 69 66 64 65 66 20 44 |id )..{.|#ifdef D|
|000020e0| 45 42 55 47 0a 09 20 20 | 20 20 66 70 72 69 6e 74 |EBUG.. | fprint|
|000020f0| 66 28 73 74 64 65 72 72 | 2c 20 22 46 6f 75 6e 64 |f(stderr|, "Found|
|00002100| 20 69 74 21 20 20 70 72 | 6f 63 5b 25 64 5d 2c 20 | it! pr|oc[%d], |
|00002110| 70 5f 75 69 64 20 69 73 | 20 25 64 5c 6e 22 2c 0a |p_uid is| %d\n",.|
|00002120| 09 09 20 20 20 69 2c 20 | 70 72 6f 63 2e 70 5f 75 |.. i, |proc.p_u|
|00002130| 69 64 29 3b 0a 0a 09 20 | 20 20 20 66 70 72 69 6e |id);... | fprin|
|00002140| 74 66 28 73 74 64 65 72 | 72 2c 20 22 4f 6c 64 20 |tf(stder|r, "Old |
|00002150| 70 5f 6e 69 63 65 20 77 | 61 73 20 25 64 5c 6e 22 |p_nice w|as %d\n"|
|00002160| 2c 20 70 72 6f 63 2e 70 | 5f 6e 69 63 65 29 3b 0a |, proc.p|_nice);.|
|00002170| 23 65 6e 64 69 66 20 44 | 45 42 55 47 0a 0a 09 20 |#endif D|EBUG... |
|00002180| 20 20 20 74 6d 70 6e 69 | 63 65 20 3d 20 70 72 6f | tmpni|ce = pro|
|00002190| 63 2e 70 5f 6e 69 63 65 | 3b 0a 0a 09 20 20 20 20 |c.p_nice|;... |
|000021a0| 69 66 20 28 72 65 6c 61 | 74 69 76 65 29 0a 09 09 |if (rela|tive)...|
|000021b0| 74 6d 70 6e 69 63 65 20 | 2b 3d 20 76 61 6c 75 65 |tmpnice |+= value|
|000021c0| 3b 0a 09 20 20 20 20 65 | 6c 73 65 0a 09 09 74 6d |;.. e|lse...tm|
|000021d0| 70 6e 69 63 65 20 3d 20 | 76 61 6c 75 65 3b 0a 0a |pnice = |value;..|
|000021e0| 09 20 20 20 20 69 66 20 | 28 74 6d 70 6e 69 63 65 |. if |(tmpnice|
|000021f0| 20 3e 3d 20 34 30 29 0a | 09 09 74 6d 70 6e 69 63 | >= 40).|..tmpnic|
|00002200| 65 20 3d 20 34 30 3b 0a | 09 20 20 20 20 69 66 20 |e = 40;.|. if |
|00002210| 28 74 6d 70 6e 69 63 65 | 20 3c 20 30 29 0a 09 09 |(tmpnice| < 0)...|
|00002220| 74 6d 70 6e 69 63 65 20 | 3d 20 30 3b 0a 0a 23 69 |tmpnice |= 0;..#i|
|00002230| 66 64 65 66 20 44 45 42 | 55 47 0a 09 20 20 20 20 |fdef DEB|UG.. |
|00002240| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|00002250| 22 4e 65 77 20 70 5f 6e | 69 63 65 20 69 73 20 25 |"New p_n|ice is %|
|00002260| 64 5c 6e 22 2c 20 74 6d | 70 6e 69 63 65 29 3b 0a |d\n", tm|pnice);.|
|00002270| 23 65 6e 64 69 66 20 44 | 45 42 55 47 0a 0a 09 20 |#endif D|EBUG... |
|00002280| 20 20 20 69 66 20 28 20 | 6d 79 75 69 64 20 26 26 | if ( |myuid &&|
|00002290| 20 28 6d 79 75 69 64 20 | 21 3d 20 70 72 6f 63 2e | (myuid |!= proc.|
|000022a0| 70 5f 75 69 64 20 7c 7c | 20 74 6d 70 6e 69 63 65 |p_uid ||| tmpnice|
|000022b0| 3c 70 72 6f 63 2e 70 5f | 6e 69 63 65 29 20 29 0a |<proc.p_|nice) ).|
|000022c0| 09 20 20 20 20 7b 0a 09 | 09 65 72 72 6e 6f 20 3d |. {..|.errno =|
|000022d0| 20 45 41 43 43 45 53 3b | 0a 09 09 73 70 72 69 6e | EACCES;|...sprin|
|000022e0| 74 66 28 62 75 66 2c 20 | 22 25 73 3a 20 63 61 6e |tf(buf, |"%s: can|
|000022f0| 27 74 20 72 65 6e 69 63 | 65 20 70 72 6f 63 65 73 |'t renic|e proces|
|00002300| 73 20 25 64 22 2c 20 70 | 72 6f 67 6e 61 6d 65 2c |s %d", p|rogname,|
|00002310| 20 70 69 64 29 3b 0a 09 | 09 70 65 72 72 6f 72 28 | pid);..|.perror(|
|00002320| 62 75 66 29 3b 0a 09 09 | 72 65 74 75 72 6e 20 31 |buf);...|return 1|
|00002330| 3b 0a 09 20 20 20 20 7d | 0a 0a 09 20 20 20 20 70 |;.. }|... p|
|00002340| 72 6f 63 2e 70 5f 6e 69 | 63 65 20 3d 20 74 6d 70 |roc.p_ni|ce = tmp|
|00002350| 6e 69 63 65 3b 0a 0a 09 | 20 20 20 20 6b 77 72 69 |nice;...| kwri|
|00002360| 74 65 28 28 6c 6f 6e 67 | 29 26 28 28 73 74 72 75 |te((long|)&((stru|
|00002370| 63 74 20 70 72 6f 63 20 | 2a 29 70 72 6f 63 61 64 |ct proc |*)procad|
|00002380| 64 72 29 5b 69 5d 0a 09 | 09 20 20 20 2b 20 28 20 |dr)[i]..|. + ( |
|00002390| 28 28 63 68 61 72 20 2a | 29 26 70 72 6f 63 2e 70 |((char *|)&proc.p|
|000023a0| 5f 6e 69 63 65 29 20 2d | 20 28 63 68 61 72 20 2a |_nice) -| (char *|
|000023b0| 29 26 70 72 6f 63 20 29 | 2c 0a 09 09 20 20 20 28 |)&proc )|,... (|
|000023c0| 63 68 61 72 20 2a 29 26 | 70 72 6f 63 2e 70 5f 6e |char *)&|proc.p_n|
|000023d0| 69 63 65 2c 0a 09 09 20 | 20 20 28 6c 6f 6e 67 29 |ice,... | (long)|
|000023e0| 73 69 7a 65 6f 66 20 70 | 72 6f 63 2e 70 5f 6e 69 |sizeof p|roc.p_ni|
|000023f0| 63 65 29 3b 0a 09 20 20 | 20 20 72 65 74 75 72 6e |ce);.. | return|
|00002400| 20 30 3b 0a 09 7d 0a 20 | 20 20 20 7d 0a 0a 20 20 | 0;..}. | }.. |
|00002410| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|00002420| 2c 20 22 25 73 3a 20 70 | 72 6f 63 65 73 73 20 25 |, "%s: p|rocess %|
|00002430| 64 20 6e 6f 74 20 66 6f | 75 6e 64 2e 5c 6e 22 2c |d not fo|und.\n",|
|00002440| 20 70 72 6f 67 6e 61 6d | 65 2c 20 70 69 64 29 3b | prognam|e, pid);|
|00002450| 0a 0a 20 20 20 20 72 65 | 74 75 72 6e 20 31 3b 0a |.. re|turn 1;.|
|00002460| 7d 0a 53 48 41 52 5f 45 | 4f 46 0a 69 66 20 74 65 |}.SHAR_E|OF.if te|
|00002470| 73 74 20 34 39 31 36 20 | 2d 6e 65 20 22 60 77 63 |st 4916 |-ne "`wc|
|00002480| 20 2d 63 20 3c 20 27 72 | 65 6e 69 63 65 2e 63 27 | -c < 'r|enice.c'|
|00002490| 60 22 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |`".then.|.echo sh|
|000024a0| 61 72 3a 20 65 72 72 6f | 72 20 74 72 61 6e 73 6d |ar: erro|r transm|
|000024b0| 69 74 74 69 6e 67 20 22 | 27 72 65 6e 69 63 65 2e |itting "|'renice.|
|000024c0| 63 27 22 20 27 28 73 68 | 6f 75 6c 64 20 68 61 76 |c'" '(sh|ould hav|
|000024d0| 65 20 62 65 65 6e 20 34 | 39 31 36 20 63 68 61 72 |e been 4|916 char|
|000024e0| 61 63 74 65 72 73 29 27 | 0a 66 69 0a 66 69 20 23 |acters)'|.fi.fi #|
|000024f0| 20 65 6e 64 20 6f 66 20 | 6f 76 65 72 77 72 69 74 | end of |overwrit|
|00002500| 69 6e 67 20 63 68 65 63 | 6b 0a 23 09 45 6e 64 20 |ing chec|k.#.End |
|00002510| 6f 66 20 73 68 65 6c 6c | 20 61 72 63 68 69 76 65 |of shell| archive|
|00002520| 0a 65 78 69 74 20 30 0a | 0a |.exit 0.|. |
+--------+-------------------------+-------------------------+--------+--------+