home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / unix_c / sysadmin / forktest.tar < prev    next >
Tape Archive  |  1989-03-04  |  16.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: Tape Archive (archive/tar).

You can browse this item here: forktest.tar

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file tar archive default
99% file tar archive (V7), file forktest/, mode 755 , uid 243 , gid 12 , size 0 , seconds 4404054543 default
98% file data default
100% siegfried x-fmt/265 Tape Archive Format default
100% lsar Tar default
100% gt2 TAR Archiv gefunden (Auflistung ist deaktiviert) default
100% disktype Pre-POSIX tar archive default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 66 6f 72 6b 74 65 73 74 | 2f 00 00 00 00 00 00 00 |forktest|/.......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 37 | 35 35 20 00 20 20 20 32 |.... 7|55 . 2|
|00000070| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000080| 20 20 20 20 20 20 30 20 | 20 34 34 30 34 30 35 34 | 0 | 4404054|
|00000090| 35 34 33 20 20 20 35 36 | 35 37 00 20 00 00 00 00 |543 56|57. ....|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 66 6f 72 6b 74 65 73 74 | 2f 53 68 61 72 46 69 6c |forktest|/SharFil|
|00000210| 65 2e 48 65 61 64 65 72 | 73 00 00 00 00 00 00 00 |e.Header|s.......|
|00000220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00000270| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000280| 20 20 20 33 30 32 37 20 | 20 34 34 30 34 30 35 34 | 3027 | 4404054|
|00000290| 35 34 34 20 20 31 30 37 | 34 31 00 20 00 00 00 00 |544 107|41. ....|
|000002a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 3d 3d 3d 20 66 6f 72 6b | 74 65 73 74 2e 73 68 61 |=== fork|test.sha|
|00000410| 72 20 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |r ======|========|
|00000420| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 0a 41 72 74 69 |========|===.Arti|
|00000430| 63 6c 65 20 33 37 33 20 | 6f 66 20 6d 6f 64 2e 73 |cle 373 |of mod.s|
|00000440| 6f 75 72 63 65 73 3a 0a | 50 61 74 68 3a 20 62 72 |ources:.|Path: br|
|00000450| 6c 2d 73 6d 6f 6b 65 21 | 62 72 6c 2d 61 64 6d 21 |l-smoke!|brl-adm!|
|00000460| 73 65 69 73 6d 6f 21 72 | 75 74 67 65 72 73 21 6d |seismo!r|utgers!m|
|00000470| 69 74 2d 65 64 64 69 65 | 21 6d 69 72 72 6f 72 21 |it-eddie|!mirror!|
|00000480| 73 6f 75 72 63 65 73 2d | 72 65 71 75 65 73 74 0a |sources-|request.|
|00000490| 46 72 6f 6d 3a 20 73 6f | 75 72 63 65 73 2d 72 65 |From: so|urces-re|
|000004a0| 71 75 65 73 74 40 6d 69 | 72 72 6f 72 2e 54 4d 43 |quest@mi|rror.TMC|
|000004b0| 2e 43 4f 4d 0a 4e 65 77 | 73 67 72 6f 75 70 73 3a |.COM.New|sgroups:|
|000004c0| 20 6d 6f 64 2e 73 6f 75 | 72 63 65 73 0a 53 75 62 | mod.sou|rces.Sub|
|000004d0| 6a 65 63 74 3a 20 76 30 | 37 69 30 39 30 3a 20 20 |ject: v0|7i090: |
|000004e0| 46 69 6e 64 20 73 65 63 | 75 72 69 74 79 20 68 6f |Find sec|urity ho|
|000004f0| 6c 65 73 20 69 6e 20 73 | 68 65 6c 6c 2d 65 73 63 |les in s|hell-esc|
|00000500| 61 70 65 73 0a 44 61 74 | 65 3a 20 31 30 20 44 65 |apes.Dat|e: 10 De|
|00000510| 63 20 38 36 20 31 38 3a | 34 36 3a 31 36 20 47 4d |c 86 18:|46:16 GM|
|00000520| 54 0a 41 70 70 72 6f 76 | 65 64 3a 20 6d 69 72 72 |T.Approv|ed: mirr|
|00000530| 6f 72 21 72 73 0a 0a 53 | 75 62 6d 69 74 74 65 64 |or!rs..S|ubmitted|
|00000540| 20 62 79 3a 20 69 68 6e | 70 34 21 75 74 7a 6f 6f | by: ihn|p4!utzoo|
|00000550| 21 68 63 72 21 68 63 72 | 76 78 31 21 68 75 67 68 |!hcr!hcr|vx1!hugh|
|00000560| 0a 4d 6f 64 2e 73 6f 75 | 72 63 65 73 3a 20 56 6f |.Mod.sou|rces: Vo|
|00000570| 6c 75 6d 65 20 37 2c 20 | 49 73 73 75 65 20 39 30 |lume 7, |Issue 90|
|00000580| 0a 41 72 63 68 69 76 65 | 2d 6e 61 6d 65 3a 20 66 |.Archive|-name: f|
|00000590| 6f 72 6b 74 65 73 74 0a | 0a 49 20 77 6f 75 6c 64 |orktest.|.I would|
|000005a0| 20 6c 69 6b 65 20 74 6f | 20 73 75 62 6d 69 74 20 | like to| submit |
|000005b0| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 70 72 |the foll|owing pr|
|000005c0| 6f 67 72 61 6d 20 74 6f | 20 6d 6f 64 2e 73 6f 75 |ogram to| mod.sou|
|000005d0| 72 63 65 73 2e 20 20 49 | 20 68 6f 70 65 0a 74 68 |rces. I| hope.th|
|000005e0| 61 74 20 74 68 65 20 63 | 6f 6d 6d 65 6e 74 73 20 |at the c|omments |
|000005f0| 61 72 65 20 73 75 66 66 | 69 63 69 65 6e 74 20 65 |are suff|icient e|
|00000600| 78 70 6c 61 6e 61 74 69 | 6f 6e 2e 20 20 49 20 64 |xplanati|on. I d|
|00000610| 6f 6e 27 74 20 73 65 65 | 20 74 68 61 74 20 61 0a |on't see| that a.|
|00000620| 6d 61 6e 75 61 6c 20 69 | 73 20 77 6f 72 74 68 77 |manual i|s worthw|
|00000630| 68 69 6c 65 2e 0a 0a 49 | 20 68 61 76 65 20 72 75 |hile...I| have ru|
|00000640| 6e 20 74 68 69 73 20 70 | 72 6f 67 72 61 6d 20 75 |n this p|rogram u|
|00000650| 6e 64 65 72 20 53 79 73 | 74 65 6d 20 56 20 61 6e |nder Sys|tem V an|
|00000660| 64 20 56 65 72 73 69 6f | 6e 20 37 2e 20 20 49 20 |d Versio|n 7. I |
|00000670| 68 61 76 65 20 6e 6f 74 | 0a 74 65 73 74 65 64 20 |have not|.tested |
|00000680| 69 74 20 75 6e 64 65 72 | 20 42 53 44 2c 20 62 75 |it under| BSD, bu|
|00000690| 74 20 49 20 6b 6e 6f 77 | 20 6f 66 20 6e 6f 20 69 |t I know| of no i|
|000006a0| 6d 70 65 64 69 6d 65 6e | 74 2e 0a 0a 57 69 74 68 |mpedimen|t...With|
|000006b0| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 2c 20 49 | this pr|ogram, I|
|000006c0| 20 68 61 76 65 20 66 6f | 75 6e 64 20 62 75 67 73 | have fo|und bugs|
|000006d0| 20 69 6e 20 61 20 6e 75 | 6d 62 65 72 20 6f 66 20 | in a nu|mber of |
|000006e0| 55 4e 49 58 20 53 79 73 | 74 65 6d 20 56 0a 75 74 |UNIX Sys|tem V.ut|
|000006f0| 69 6c 69 74 69 65 73 2e | 20 20 49 20 61 6d 20 73 |ilities.| I am s|
|00000700| 75 72 65 20 74 68 61 74 | 20 42 53 44 20 70 72 6f |ure that| BSD pro|
|00000710| 67 72 61 6d 73 20 77 6f | 75 6c 64 20 62 65 20 6a |grams wo|uld be j|
|00000720| 75 73 74 20 61 73 20 62 | 75 67 67 79 2c 20 62 75 |ust as b|uggy, bu|
|00000730| 74 0a 49 20 68 61 76 65 | 6e 27 74 20 74 65 73 74 |t.I have|n't test|
|00000740| 65 64 20 74 68 65 6d 2e | 20 20 48 65 72 65 20 61 |ed them.| Here a|
|00000750| 72 65 20 73 6f 6d 65 20 | 65 78 61 6d 70 6c 65 73 |re some |examples|
|00000760| 3a 0a 0a 50 72 6f 67 72 | 61 6d 73 20 74 68 61 74 |:..Progr|ams that|
|00000770| 20 6c 65 61 76 65 20 65 | 78 74 72 61 20 66 69 6c | leave e|xtra fil|
|00000780| 65 20 64 65 73 63 72 69 | 70 74 6f 72 73 20 6f 70 |e descri|ptors op|
|00000790| 65 6e 3a 0a 20 20 20 20 | 20 73 64 62 20 21 20 63 |en:. | sdb ! c|
|000007a0| 6f 6d 6d 61 6e 64 0a 20 | 20 20 20 20 6d 61 69 6c |ommand. | mail|
|000007b0| 78 20 7e 21 20 63 6f 6d | 6d 61 6e 64 20 64 75 72 |x ~! com|mand dur|
|000007c0| 69 6e 67 20 6d 65 73 73 | 61 67 65 20 63 6f 6d 70 |ing mess|age comp|
|000007d0| 6f 73 69 74 69 6f 6e 2c | 20 61 6e 64 20 21 20 63 |osition,| and ! c|
|000007e0| 6f 6d 6d 61 6e 64 20 28 | 74 77 6f 20 65 78 74 72 |ommand (|two extr|
|000007f0| 61 29 0a 20 20 20 20 20 | 6d 61 69 6c 20 21 20 63 |a). |mail ! c|
|00000800| 6f 6d 6d 61 6e 64 0a 20 | 20 20 20 20 72 6e 20 21 |ommand. | rn !|
|00000810| 20 6f 72 20 7c 20 63 6f | 6d 6d 61 6e 64 20 28 35 | or | co|mmand (5|
|00000820| 20 65 78 74 72 61 21 29 | 0a 20 20 20 20 20 63 75 | extra!)|. cu|
|00000830| 20 7e 21 20 63 6f 6d 6d | 61 6e 64 20 28 6f 6e 65 | ~! comm|and (one|
|00000840| 20 65 78 74 72 61 3a 20 | 6e 75 6d 62 65 72 20 35 | extra: |number 5|
|00000850| 29 0a 0a 50 72 6f 67 72 | 61 6d 73 20 74 68 61 74 |)..Progr|ams that|
|00000860| 20 6c 65 61 76 65 20 73 | 69 67 6e 61 6c 73 20 69 | leave s|ignals i|
|00000870| 67 6e 6f 72 65 64 3a 0a | 20 20 20 20 20 6d 61 69 |gnored:.| mai|
|00000880| 6c 78 20 7e 21 20 63 6f | 6d 6d 61 6e 64 20 28 53 |lx ~! co|mmand (S|
|00000890| 49 47 49 4e 54 21 29 0a | 20 20 20 20 20 72 6e 20 |IGINT!).| rn |
|000008a0| 21 20 61 6e 64 20 7c 20 | 63 6f 6d 6d 61 6e 64 73 |! and | |commands|
|000008b0| 20 28 53 49 47 45 4d 54 | 21 3f 29 0a 0a 49 20 74 | (SIGEMT|!?)..I t|
|000008c0| 68 69 6e 6b 20 74 68 61 | 74 20 74 68 69 73 20 6c |hink tha|t this l|
|000008d0| 69 73 74 20 73 68 6f 77 | 73 20 74 68 61 74 20 69 |ist show|s that i|
|000008e0| 74 20 69 73 20 65 61 73 | 79 20 74 6f 20 67 65 74 |t is eas|y to get|
|000008f0| 20 66 6f 72 6b 28 32 29 | 20 77 72 6f 6e 67 2e 0a | fork(2)| wrong..|
|00000900| 49 20 68 6f 70 65 20 70 | 72 6f 67 72 61 6d 6d 65 |I hope p|rogramme|
|00000910| 72 73 20 77 69 6c 6c 20 | 75 73 65 20 46 6f 72 6b |rs will |use Fork|
|00000920| 54 65 73 74 20 74 6f 20 | 63 61 74 63 68 20 74 68 |Test to |catch th|
|00000930| 69 73 20 74 79 70 65 20 | 6f 66 20 62 75 67 0a 65 |is type |of bug.e|
|00000940| 61 72 6c 79 2e 20 20 45 | 78 65 72 63 69 73 65 20 |arly. E|xercise |
|00000950| 66 6f 72 20 74 68 65 20 | 72 65 61 64 65 72 3a 20 |for the |reader: |
|00000960| 77 68 61 74 20 63 61 6e | 20 79 6f 75 20 73 63 72 |what can| you scr|
|00000970| 69 62 62 6c 65 20 6f 6e | 20 77 69 74 68 20 74 68 |ibble on| with th|
|00000980| 6f 73 65 0a 65 78 74 72 | 61 20 66 69 6c 65 20 64 |ose.extr|a file d|
|00000990| 65 73 63 72 69 70 74 6f | 72 73 3f 0a 0a 48 75 67 |escripto|rs?..Hug|
|000009a0| 68 20 52 65 64 65 6c 6d | 65 69 65 72 20 28 34 31 |h Redelm|eier (41|
|000009b0| 36 29 20 39 32 32 2d 31 | 39 33 37 0a 75 74 7a 6f |6) 922-1|937.utzo|
|000009c0| 6f 21 68 63 72 21 68 75 | 67 68 0a 0a 5b 20 20 49 |o!hcr!hu|gh..[ I|
|000009d0| 20 77 72 6f 74 65 20 74 | 68 65 20 4d 61 6b 65 66 | wrote t|he Makef|
|000009e0| 69 6c 65 20 61 6e 64 20 | 52 45 41 44 4d 45 2e 20 |ile and |README. |
|000009f0| 20 2d 2d 72 24 20 20 5d | 0a 2d 2d 2d 2d 2d 2d 2d | --r$ ]|.-------|
|00000a00| 2d 2d 2d 43 55 54 20 48 | 45 52 45 2d 2d 2d 2d 2d |---CUT H|ERE-----|
|00000a10| 2d 2d 2d 2d 2d 0a 0a 00 | 00 00 00 00 00 00 00 00 |-----...|........|
|00000a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c00| 66 6f 72 6b 74 65 73 74 | 2f 4d 61 6b 65 66 69 6c |forktest|/Makefil|
|00000c10| 65 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |e.......|........|
|00000c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00000c70| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000c80| 20 20 20 20 20 36 34 20 | 20 34 34 30 34 30 35 34 | 64 | 4404054|
|00000c90| 35 34 30 20 20 20 37 33 | 34 31 00 20 00 00 00 00 |540 73|41. ....|
|00000ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e00| 0a 66 6f 72 6b 74 65 73 | 74 3a 09 66 6f 72 6b 74 |.forktes|t:.forkt|
|00000e10| 65 73 74 2e 63 0a 09 24 | 28 43 43 29 20 24 28 43 |est.c..$|(CC) $(C|
|00000e20| 46 4c 41 47 53 29 20 2d | 6f 20 66 6f 72 6b 74 65 |FLAGS) -|o forkte|
|00000e30| 73 74 0a 0a 1b 90 01 00 | 14 00 08 00 4d 61 6b 65 |st......|....Make|
|00000e40| 66 69 6c 65 00 00 00 00 | 1c 90 01 00 10 00 06 00 |file....|........|
|00000e50| 52 45 41 44 4d 45 00 00 | 1d 90 01 00 a8 01 0a 00 |README..|........|
|00000e60| 66 6f 72 6b 74 65 73 74 | 2e 63 00 00 00 00 00 00 |forktest|.c......|
|00000e70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001000| 66 6f 72 6b 74 65 73 74 | 2f 52 45 41 44 4d 45 00 |forktest|/README.|
|00001010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001060| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00001070| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00001080| 20 20 20 20 33 37 35 20 | 20 34 34 30 34 30 35 34 | 375 | 4404054|
|00001090| 35 34 31 20 20 20 36 36 | 30 37 00 20 00 00 00 00 |541 66|07. ....|
|000010a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001200| 0a 5b 20 20 54 68 69 73 | 20 70 72 6f 67 72 61 6d |.[ This| program|
|00001210| 20 69 73 20 64 65 73 69 | 67 6e 65 64 20 74 6f 20 | is desi|gned to |
|00001220| 62 65 20 63 61 6c 6c 65 | 64 20 62 79 20 70 72 6f |be calle|d by pro|
|00001230| 67 72 61 6d 73 20 74 68 | 61 74 20 61 6c 6c 6f 77 |grams th|at allow|
|00001240| 0a 20 20 20 73 68 65 6c | 6c 20 65 73 63 61 70 65 |. shel|l escape|
|00001250| 73 2e 20 20 49 74 20 70 | 72 69 6e 74 73 20 6f 75 |s. It p|rints ou|
|00001260| 74 20 74 68 65 20 61 72 | 67 63 2c 61 72 67 76 20 |t the ar|gc,argv |
|00001270| 70 61 72 61 6d 65 74 65 | 72 73 2c 20 61 6e 64 0a |paramete|rs, and.|
|00001280| 20 20 20 6c 69 73 74 73 | 20 74 68 65 20 64 69 73 | lists| the dis|
|00001290| 70 6f 73 69 74 69 6f 6e | 20 6f 66 20 73 69 67 6e |position| of sign|
|000012a0| 61 6c 73 2c 20 61 6c 61 | 72 6d 20 63 61 6c 6c 73 |als, ala|rm calls|
|000012b0| 2c 20 65 74 63 2e 20 20 | 54 68 65 20 66 75 6e 0a |, etc. |The fun.|
|000012c0| 20 20 20 70 61 72 74 20 | 69 73 20 77 68 65 6e 20 | part |is when |
|000012d0| 69 74 20 6c 69 73 74 73 | 20 74 68 65 20 6f 70 65 |it lists| the ope|
|000012e0| 6e 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |n file d|escripto|
|000012f0| 72 73 2e 2e 2e 20 20 2d | 72 24 20 5d 0a 00 00 00 |rs... -|r$ ]....|
|00001300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001400| 66 6f 72 6b 74 65 73 74 | 2f 66 6f 72 6b 74 65 73 |forktest|/forktes|
|00001410| 74 2e 63 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |t.c.....|........|
|00001420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001460| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00001470| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00001480| 20 20 20 35 37 36 33 20 | 20 34 34 30 34 30 35 34 | 5763 | 4404054|
|00001490| 35 34 34 20 20 20 37 37 | 36 35 00 20 00 00 00 00 |544 77|65. ....|
|000014a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001600| 2f 2a 20 46 6f 72 6b 20 | 54 65 73 74 3a 20 64 69 |/* Fork |Test: di|
|00001610| 73 70 6c 61 79 20 61 72 | 67 73 2c 20 6f 70 65 6e |splay ar|gs, open|
|00001620| 20 66 69 6c 65 73 2c 20 | 73 69 67 6e 61 6c 73 2c | files, |signals,|
|00001630| 20 65 74 63 2e 0a 20 2a | 0a 20 2a 20 53 69 6d 70 | etc.. *|. * Simp|
|00001640| 6c 65 20 61 73 20 74 68 | 69 73 20 70 72 6f 67 72 |le as th|is progr|
|00001650| 61 6d 20 69 73 2c 20 69 | 74 20 68 61 73 20 66 6f |am is, i|t has fo|
|00001660| 75 6e 64 20 62 75 67 73 | 20 69 6e 20 74 68 65 0a |und bugs| in the.|
|00001670| 20 2a 20 77 61 79 20 61 | 20 6e 75 6d 62 65 72 20 | * way a| number |
|00001680| 6f 66 20 70 72 6f 67 72 | 61 6d 73 20 66 6f 72 6b |of progr|ams fork|
|00001690| 20 6f 66 66 20 63 68 69 | 6c 64 72 65 6e 2e 20 20 | off chi|ldren. |
|000016a0| 54 6f 20 74 65 73 74 0a | 20 2a 20 68 6f 77 20 61 |To test.| * how a|
|000016b0| 20 70 72 6f 67 72 61 6d | 20 69 73 20 69 6e 76 6f | program| is invo|
|000016c0| 6b 69 6e 67 20 69 74 73 | 20 63 68 69 6c 64 72 65 |king its| childre|
|000016d0| 6e 2c 20 72 75 6e 20 74 | 68 69 73 0a 20 2a 20 70 |n, run t|his. * p|
|000016e0| 72 6f 67 72 61 6d 20 61 | 73 20 61 20 63 68 69 6c |rogram a|s a chil|
|000016f0| 64 2e 0a 20 2a 0a 20 2a | 20 47 65 6e 65 72 61 6c |d.. *. *| General|
|00001700| 6c 79 2c 20 70 72 6f 63 | 65 73 73 65 73 20 73 68 |ly, proc|esses sh|
|00001710| 6f 75 6c 64 20 62 65 20 | 63 72 65 61 74 65 64 20 |ould be |created |
|00001720| 77 69 74 68 3a 0a 20 2a | 0a 20 2a 20 2d 20 61 20 |with:. *|. * - a |
|00001730| 72 65 61 73 6f 6e 61 62 | 6c 65 20 61 72 67 20 63 |reasonab|le arg c|
|00001740| 6f 75 6e 74 20 26 20 6c | 69 73 74 0a 20 2a 20 2d |ount & l|ist. * -|
|00001750| 20 61 72 67 20 30 20 73 | 68 6f 75 6c 64 20 6c 6f | arg 0 s|hould lo|
|00001760| 6f 6b 20 6c 69 6b 65 20 | 74 68 65 20 6e 61 6d 65 |ok like |the name|
|00001770| 20 6f 66 20 74 68 65 20 | 63 6f 6d 6d 61 6e 64 0a | of the |command.|
|00001780| 20 2a 0a 20 2a 20 2d 20 | 72 65 61 6c 20 61 6e 64 | *. * - |real and|
|00001790| 20 65 66 66 65 63 74 69 | 76 65 20 55 49 44 73 20 | effecti|ve UIDs |
|000017a0| 61 6e 64 20 47 49 44 73 | 20 73 68 6f 75 6c 64 20 |and GIDs| should |
|000017b0| 62 65 20 72 65 61 73 6f | 6e 61 62 6c 65 2e 0a 20 |be reaso|nable.. |
|000017c0| 2a 20 20 20 42 65 77 61 | 72 65 20 73 65 74 75 69 |* Bewa|re setui|
|000017d0| 64 20 70 72 6f 67 72 61 | 6d 73 20 74 68 61 74 20 |d progra|ms that |
|000017e0| 66 6f 72 6b 20 63 68 69 | 6c 64 72 65 6e 21 0a 20 |fork chi|ldren!. |
|000017f0| 2a 0a 20 2a 20 2d 20 6e | 6f 20 70 65 6e 64 69 6e |*. * - n|o pendin|
|00001800| 67 20 61 6c 61 72 6d 2e | 20 20 56 65 72 73 69 6f |g alarm.| Versio|
|00001810| 6e 20 37 20 61 70 70 61 | 72 65 6e 74 6c 79 20 64 |n 7 appa|rently d|
|00001820| 6f 65 73 20 6e 6f 74 0a | 20 2a 20 20 20 72 65 73 |oes not.| * res|
|00001830| 65 74 20 61 6c 61 72 6d | 73 20 75 70 6f 6e 20 61 |et alarm|s upon a|
|00001840| 6e 20 65 78 65 63 21 0a | 20 2a 0a 20 2a 20 2d 20 |n exec!.| *. * - |
|00001850| 66 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 73 |file des|criptors|
|00001860| 20 30 20 28 53 54 44 49 | 4e 29 2c 20 31 20 28 53 | 0 (STDI|N), 1 (S|
|00001870| 54 44 4f 55 54 29 2c 20 | 61 6e 64 20 32 20 28 53 |TDOUT), |and 2 (S|
|00001880| 54 44 45 52 52 29 0a 20 | 2a 20 20 20 6f 70 65 6e |TDERR). |* open|
|00001890| 65 64 20 72 65 61 73 6f | 6e 61 62 6c 79 0a 20 2a |ed reaso|nably. *|
|000018a0| 20 2d 20 61 6c 6c 20 6f | 74 68 65 72 20 66 69 6c | - all o|ther fil|
|000018b0| 65 20 64 65 73 63 72 69 | 70 74 6f 72 73 20 63 6c |e descri|ptors cl|
|000018c0| 6f 73 65 64 20 28 74 68 | 69 73 20 70 72 6f 67 72 |osed (th|is progr|
|000018d0| 61 6d 20 77 69 6c 6c 0a | 20 2a 20 20 20 64 65 73 |am will.| * des|
|000018e0| 63 72 69 62 65 20 61 6c | 6c 20 6f 70 65 6e 20 63 |cribe al|l open c|
|000018f0| 68 61 6e 6e 65 6c 73 29 | 0a 20 2a 0a 20 2a 20 2d |hannels)|. *. * -|
|00001900| 20 61 6c 6c 20 73 69 67 | 6e 61 6c 73 20 28 65 78 | all sig|nals (ex|
|00001910| 63 65 70 74 20 53 49 47 | 4b 49 4c 4c 29 20 73 65 |cept SIG|KILL) se|
|00001920| 74 20 74 6f 20 53 49 47 | 5f 44 46 4c 20 28 74 68 |t to SIG|_DFL (th|
|00001930| 69 73 0a 20 2a 20 20 20 | 70 72 6f 67 72 61 6d 20 |is. * |program |
|00001940| 77 69 6c 6c 20 70 72 69 | 6e 74 20 61 6c 6c 20 73 |will pri|nt all s|
|00001950| 69 67 6e 61 6c 73 20 73 | 65 74 20 6f 74 68 65 72 |ignals s|et other|
|00001960| 77 69 73 65 29 0a 20 2a | 0a 20 2a 20 54 68 65 20 |wise). *|. * The |
|00001970| 6f 75 74 70 75 74 20 69 | 73 20 66 61 69 72 6c 79 |output i|s fairly|
|00001980| 20 73 69 6d 70 6c 65 20 | 74 6f 20 75 6e 64 65 72 | simple |to under|
|00001990| 73 74 61 6e 64 2e 20 20 | 57 68 65 6e 20 69 6e 0a |stand. |When in.|
|000019a0| 20 2a 20 64 6f 75 62 74 | 2c 20 72 65 61 64 20 74 | * doubt|, read t|
|000019b0| 68 65 20 63 6f 64 65 20 | 28 61 6e 64 20 61 20 55 |he code |(and a U|
|000019c0| 4e 49 58 20 6d 61 6e 75 | 61 6c 3a 20 65 78 65 63 |NIX manu|al: exec|
|000019d0| 28 32 29 2c 0a 20 2a 20 | 67 65 74 75 69 64 28 32 |(2),. * |getuid(2|
|000019e0| 29 2c 20 61 6c 61 72 6d | 28 32 29 2c 20 73 69 67 |), alarm|(2), sig|
|000019f0| 6e 61 6c 28 32 29 2c 20 | 73 74 61 74 28 32 29 29 |nal(2), |stat(2))|
|00001a00| 2e 0a 20 2a 0a 20 2a 20 | 52 6f 6f 6d 20 66 6f 72 |.. *. * |Room for|
|00001a10| 20 49 6d 70 72 6f 76 65 | 6d 65 6e 74 3a 0a 20 2a | Improve|ment:. *|
|00001a20| 0a 20 2a 20 2d 20 73 74 | 72 69 6e 67 73 20 73 68 |. * - st|rings sh|
|00001a30| 6f 75 6c 64 20 62 65 20 | 70 72 69 6e 74 65 64 20 |ould be |printed |
|00001a40| 69 6e 20 61 20 77 61 79 | 20 74 68 61 74 20 73 68 |in a way| that sh|
|00001a50| 6f 77 73 20 66 75 6e 6e | 79 20 63 68 61 72 61 63 |ows funn|y charac|
|00001a60| 74 65 72 73 2e 0a 20 2a | 20 2d 20 73 68 6f 77 20 |ters.. *| - show |
|00001a70| 6d 69 73 63 2e 20 6f 74 | 68 65 72 20 62 69 74 73 |misc. ot|her bits|
|00001a80| 20 6f 66 20 73 74 61 74 | 65 0a 20 2a 09 2d 20 50 | of stat|e. *.- P|
|00001a90| 49 44 20 28 77 68 6f 20 | 63 61 72 65 73 3f 29 0a |ID (who |cares?).|
|00001aa0| 20 2a 09 2d 20 75 6d 61 | 73 6b 0a 20 2a 09 2d 20 | *.- uma|sk. *.- |
|00001ab0| 75 6c 69 6d 69 74 20 28 | 53 79 73 74 65 6d 20 56 |ulimit (|System V|
|00001ac0| 29 0a 20 2a 09 2d 20 73 | 74 74 79 20 73 65 74 74 |). *.- s|tty sett|
|00001ad0| 69 6e 67 73 20 6f 66 20 | 6f 70 65 6e 20 54 54 59 |ings of |open TTY|
|00001ae0| 73 0a 20 2a 0a 20 2a 20 | 43 6f 70 79 72 69 67 68 |s. *. * |Copyrigh|
|00001af0| 74 20 28 63 29 20 31 39 | 38 36 20 4d 61 72 63 68 |t (c) 19|86 March|
|00001b00| 20 31 31 20 20 44 2e 20 | 48 75 67 68 20 52 65 64 | 11 D. |Hugh Red|
|00001b10| 65 6c 6d 65 69 65 72 0a | 20 2a 0a 20 2a 20 54 68 |elmeier.| *. * Th|
|00001b20| 69 73 20 70 72 6f 67 72 | 61 6d 20 6d 61 79 20 62 |is progr|am may b|
|00001b30| 65 20 64 69 73 74 72 69 | 62 75 74 65 64 20 61 6e |e distri|buted an|
|00001b40| 64 20 75 73 65 64 20 77 | 69 74 68 6f 75 74 20 72 |d used w|ithout r|
|00001b50| 65 73 74 72 69 63 74 69 | 6f 6e 2e 0a 20 2a 2f 0a |estricti|on.. */.|
|00001b60| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 74 64 69 6f |.#includ|e <stdio|
|00001b70| 2e 68 3e 0a 0a 65 78 74 | 65 72 6e 20 75 6e 73 69 |.h>..ext|ern unsi|
|00001b80| 67 6e 65 64 20 61 6c 61 | 72 6d 28 29 3b 09 2f 2a |gned ala|rm();./*|
|00001b90| 20 73 68 6f 75 6c 64 20 | 62 65 20 75 6e 73 69 67 | should |be unsig|
|00001ba0| 6e 65 64 2c 20 62 75 74 | 20 6d 61 79 20 62 65 20 |ned, but| may be |
|00001bb0| 69 6e 74 20 2a 2f 0a 0a | 23 69 6e 63 6c 75 64 65 |int */..|#include|
|00001bc0| 20 3c 73 79 73 2f 74 79 | 70 65 73 2e 68 3e 0a 23 | <sys/ty|pes.h>.#|
|00001bd0| 69 6e 63 6c 75 64 65 20 | 3c 73 79 73 2f 73 74 61 |include |<sys/sta|
|00001be0| 74 2e 68 3e 0a 0a 73 74 | 72 75 63 74 20 73 74 61 |t.h>..st|ruct sta|
|00001bf0| 74 20 73 62 3b 0a 0a 23 | 69 6e 63 6c 75 64 65 20 |t sb;..#|include |
|00001c00| 3c 65 72 72 6e 6f 2e 68 | 3e 0a 65 78 74 65 72 6e |<errno.h|>.extern|
|00001c10| 20 69 6e 74 20 65 72 72 | 6e 6f 3b 0a 65 78 74 65 | int err|no;.exte|
|00001c20| 72 6e 20 63 68 61 72 20 | 2a 73 79 73 5f 65 72 72 |rn char |*sys_err|
|00001c30| 6c 69 73 74 5b 5d 3b 0a | 0a 23 69 6e 63 6c 75 64 |list[];.|.#includ|
|00001c40| 65 20 3c 73 69 67 6e 61 | 6c 2e 68 3e 0a 0a 69 6e |e <signa|l.h>..in|
|00001c50| 74 20 28 2a 73 69 67 6e | 61 6c 28 29 29 28 29 3b |t (*sign|al())();|
|00001c60| 0a 0a 6d 61 69 6e 28 61 | 72 67 63 2c 20 61 72 67 |..main(a|rgc, arg|
|00001c70| 76 2c 20 65 6e 76 70 29 | 0a 69 6e 74 20 61 72 67 |v, envp)|.int arg|
|00001c80| 63 3b 0a 63 68 61 72 20 | 2a 2a 61 72 67 76 2c 20 |c;.char |**argv, |
|00001c90| 2a 2a 65 6e 76 70 3b 0a | 7b 0a 09 72 65 67 69 73 |**envp;.|{..regis|
|00001ca0| 74 65 72 20 69 6e 74 20 | 69 3b 0a 09 75 6e 73 69 |ter int |i;..unsi|
|00001cb0| 67 6e 65 64 20 61 6c 20 | 3d 20 61 6c 61 72 6d 28 |gned al |= alarm(|
|00001cc0| 30 29 3b 09 2f 2a 20 67 | 65 74 20 69 74 20 77 68 |0);./* g|et it wh|
|00001cd0| 69 6c 65 20 69 74 20 69 | 73 20 68 6f 74 20 2a 2f |ile it i|s hot */|
|00001ce0| 0a 0a 09 70 72 69 6e 74 | 66 28 22 25 64 20 61 72 |...print|f("%d ar|
|00001cf0| 67 28 73 29 3a 22 2c 20 | 61 72 67 63 29 3b 0a 09 |g(s):", |argc);..|
|00001d00| 66 6f 72 20 28 69 3d 30 | 3b 20 69 3c 61 72 67 63 |for (i=0|; i<argc|
|00001d10| 3b 20 69 2b 2b 29 0a 09 | 09 69 66 20 28 61 72 67 |; i++)..|.if (arg|
|00001d20| 76 5b 69 5d 20 3d 3d 20 | 4e 55 4c 4c 29 0a 09 09 |v[i] == |NULL)...|
|00001d30| 09 70 72 69 6e 74 66 28 | 22 20 4e 55 4c 4c 21 22 |.printf(|" NULL!"|
|00001d40| 29 3b 0a 09 09 65 6c 73 | 65 0a 09 09 09 70 72 69 |);...els|e....pri|
|00001d50| 6e 74 66 28 22 20 5c 22 | 25 73 5c 22 22 2c 20 61 |ntf(" \"|%s\"", a|
|00001d60| 72 67 76 5b 69 5d 29 3b | 0a 09 70 72 69 6e 74 66 |rgv[i]);|..printf|
|00001d70| 28 22 5c 6e 22 29 3b 0a | 09 69 66 20 28 61 72 67 |("\n");.|.if (arg|
|00001d80| 76 5b 61 72 67 63 5d 20 | 21 3d 20 4e 55 4c 4c 29 |v[argc] |!= NULL)|
|00001d90| 0a 09 09 70 72 69 6e 74 | 66 28 22 41 72 67 20 6c |...print|f("Arg l|
|00001da0| 69 73 74 20 69 73 20 6e | 6f 74 20 65 6e 64 65 64 |ist is n|ot ended|
|00001db0| 20 77 69 74 68 20 61 20 | 4e 55 4c 4c 21 5c 6e 22 | with a |NULL!\n"|
|00001dc0| 29 3b 0a 0a 09 70 72 69 | 6e 74 66 28 22 52 65 61 |);...pri|ntf("Rea|
|00001dd0| 6c 20 55 49 44 20 3d 20 | 25 64 2c 20 47 49 44 20 |l UID = |%d, GID |
|00001de0| 3d 20 25 64 3b 20 45 66 | 66 65 63 74 69 76 65 20 |= %d; Ef|fective |
|00001df0| 55 49 44 20 3d 20 25 64 | 2c 20 47 49 44 20 3d 20 |UID = %d|, GID = |
|00001e00| 25 64 2e 5c 6e 22 2c 0a | 09 09 67 65 74 75 69 64 |%d.\n",.|..getuid|
|00001e10| 28 29 2c 20 67 65 74 67 | 69 64 28 29 2c 20 67 65 |(), getg|id(), ge|
|00001e20| 74 65 75 69 64 28 29 2c | 20 67 65 74 65 67 69 64 |teuid(),| getegid|
|00001e30| 28 29 29 3b 0a 0a 09 69 | 66 20 28 61 6c 29 0a 09 |());...i|f (al)..|
|00001e40| 09 70 72 69 6e 74 66 28 | 22 41 6c 61 72 6d 20 73 |.printf(|"Alarm s|
|00001e50| 65 74 20 74 6f 20 67 6f | 20 6f 66 66 20 69 6e 20 |et to go| off in |
|00001e60| 25 75 20 73 65 63 6f 6e | 64 73 2e 5c 6e 22 2c 20 |%u secon|ds.\n", |
|00001e70| 61 6c 29 3b 0a 0a 09 70 | 72 69 6e 74 66 28 22 46 |al);...p|rintf("F|
|00001e80| 69 6c 65 20 44 65 73 63 | 72 69 70 74 6f 72 73 3a |ile Desc|riptors:|
|00001e90| 5c 6e 22 29 3b 0a 09 66 | 6f 72 20 28 69 3d 30 3b |\n");..f|or (i=0;|
|00001ea0| 20 69 21 3d 34 30 3b 20 | 69 2b 2b 29 09 2f 2a 20 | i!=40; |i++)./* |
|00001eb0| 49 20 68 6f 70 65 20 34 | 30 20 69 73 20 65 6e 6f |I hope 4|0 is eno|
|00001ec0| 75 67 68 2e 20 2a 2f 0a | 09 09 69 66 20 28 66 73 |ugh. */.|..if (fs|
|00001ed0| 74 61 74 28 69 2c 20 26 | 73 62 29 20 3d 3d 20 2d |tat(i, &|sb) == -|
|00001ee0| 31 29 20 7b 0a 09 09 09 | 69 66 20 28 65 72 72 6e |1) {....|if (errn|
|00001ef0| 6f 20 21 3d 20 45 42 41 | 44 46 29 0a 09 09 09 09 |o != EBA|DF).....|
|00001f00| 70 72 69 6e 74 66 28 22 | 5c 74 25 64 20 65 72 72 |printf("|\t%d err|
|00001f10| 6f 72 3a 20 25 73 5c 6e | 22 2c 20 69 2c 20 73 79 |or: %s\n|", i, sy|
|00001f20| 73 5f 65 72 72 6c 69 73 | 74 5b 65 72 72 6e 6f 5d |s_errlis|t[errno]|
|00001f30| 29 3b 0a 09 09 7d 20 65 | 6c 73 65 20 7b 0a 09 09 |);...} e|lse {...|
|00001f40| 09 70 72 69 6e 74 66 28 | 22 5c 74 25 64 3a 20 64 |.printf(|"\t%d: d|
|00001f50| 65 76 3d 25 64 2c 20 69 | 6e 6f 3d 25 64 2c 20 70 |ev=%d, i|no=%d, p|
|00001f60| 65 72 6d 3d 30 25 30 34 | 6f 2c 20 22 2c 0a 09 09 |erm=0%04|o, ",...|
|00001f70| 09 09 69 2c 20 73 62 2e | 73 74 5f 64 65 76 2c 20 |..i, sb.|st_dev, |
|00001f80| 73 62 2e 73 74 5f 69 6e | 6f 2c 20 73 62 2e 73 74 |sb.st_in|o, sb.st|
|00001f90| 5f 6d 6f 64 65 26 30 37 | 37 37 37 29 3b 0a 09 09 |_mode&07|777);...|
|00001fa0| 09 73 77 69 74 63 68 20 | 28 73 62 2e 73 74 5f 6d |.switch |(sb.st_m|
|00001fb0| 6f 64 65 20 26 20 53 5f | 49 46 4d 54 29 20 7b 0a |ode & S_|IFMT) {.|
|00001fc0| 09 09 09 63 61 73 65 20 | 53 5f 49 46 52 45 47 3a |...case |S_IFREG:|
|00001fd0| 0a 09 09 09 09 70 72 69 | 6e 74 66 28 22 70 69 70 |.....pri|ntf("pip|
|00001fe0| 65 20 6f 72 20 72 65 67 | 75 6c 61 72 20 66 69 6c |e or reg|ular fil|
|00001ff0| 65 5c 6e 22 29 3b 0a 09 | 09 09 09 62 72 65 61 6b |e\n");..|...break|
|00002000| 3b 0a 09 09 09 2f 2a 20 | 65 78 74 65 6e 64 20 61 |;..../* |extend a|
|00002010| 73 20 64 65 73 69 72 65 | 64 20 2a 2f 0a 09 09 09 |s desire|d */....|
|00002020| 64 65 66 61 75 6c 74 3a | 0a 09 09 09 09 70 72 69 |default:|.....pri|
|00002030| 6e 74 66 28 22 49 46 4d | 54 3d 30 25 6f 5c 6e 22 |ntf("IFM|T=0%o\n"|
|00002040| 2c 20 73 62 2e 73 74 5f | 6d 6f 64 65 3e 3e 31 32 |, sb.st_|mode>>12|
|00002050| 29 3b 0a 09 09 09 09 62 | 72 65 61 6b 3b 0a 09 09 |);.....b|reak;...|
|00002060| 09 7d 0a 09 09 7d 0a 0a | 09 70 72 69 6e 74 66 28 |.}...}..|.printf(|
|00002070| 22 53 69 67 6e 61 6c 73 | 3a 5c 6e 22 29 3b 0a 09 |"Signals|:\n");..|
|00002080| 66 6f 72 20 28 69 3d 31 | 3b 20 69 21 3d 34 30 3b |for (i=1|; i!=40;|
|00002090| 20 69 2b 2b 29 20 7b 09 | 2f 2a 20 49 20 68 6f 70 | i++) {.|/* I hop|
|000020a0| 65 20 34 30 20 69 73 20 | 65 6e 6f 75 67 68 2e 20 |e 40 is |enough. |
|000020b0| 2a 2f 0a 09 09 72 65 67 | 69 73 74 65 72 20 69 6e |*/...reg|ister in|
|000020c0| 74 20 6e 20 3d 20 28 69 | 6e 74 29 20 73 69 67 6e |t n = (i|nt) sign|
|000020d0| 61 6c 28 69 2c 20 53 49 | 47 5f 49 47 4e 29 3b 0a |al(i, SI|G_IGN);.|
|000020e0| 09 09 73 77 69 74 63 68 | 20 28 6e 29 20 7b 0a 09 |..switch| (n) {..|
|000020f0| 09 63 61 73 65 20 2d 31 | 3a 0a 09 09 63 61 73 65 |.case -1|:...case|
|00002100| 20 53 49 47 5f 44 46 4c | 3a 0a 09 09 09 62 72 65 | SIG_DFL|:....bre|
|00002110| 61 6b 3b 0a 09 09 63 61 | 73 65 20 53 49 47 5f 49 |ak;...ca|se SIG_I|
|00002120| 47 4e 3a 0a 09 09 09 70 | 72 69 6e 74 66 28 22 5c |GN:....p|rintf("\|
|00002130| 74 25 64 3a 20 53 49 47 | 5f 49 47 4e 5c 6e 22 2c |t%d: SIG|_IGN\n",|
|00002140| 20 69 29 3b 0a 09 09 09 | 62 72 65 61 6b 3b 0a 09 | i);....|break;..|
|00002150| 09 64 65 66 61 75 6c 74 | 3a 0a 09 09 09 70 72 69 |.default|:....pri|
|00002160| 6e 74 66 28 22 5c 74 25 | 64 3a 20 25 64 5c 6e 22 |ntf("\t%|d: %d\n"|
|00002170| 2c 20 69 2c 20 6e 29 3b | 0a 09 09 09 62 72 65 61 |, i, n);|....brea|
|00002180| 6b 3b 0a 09 09 7d 0a 09 | 7d 0a 0a 09 70 72 69 6e |k;...}..|}...prin|
|00002190| 74 66 28 22 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3a |tf("Envi|ronment:|
|000021a0| 5c 6e 22 29 3b 0a 09 66 | 6f 72 20 28 69 3d 30 3b |\n");..f|or (i=0;|
|000021b0| 20 65 6e 76 70 5b 69 5d | 21 3d 4e 55 4c 4c 3b 20 | envp[i]|!=NULL; |
|000021c0| 69 2b 2b 29 0a 09 09 70 | 72 69 6e 74 66 28 22 5c |i++)...p|rintf("\|
|000021d0| 74 5c 22 25 73 5c 22 5c | 6e 22 2c 20 65 6e 76 70 |t\"%s\"\|n", envp|
|000021e0| 5b 69 5d 29 3b 0a 0a 09 | 65 78 69 74 28 30 29 3b |[i]);...|exit(0);|
|000021f0| 0a 7d 0a 2a 20 2d 20 6e | 6f 20 70 65 6e 64 69 6e |.}.* - n|o pendin|
|00002200| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002210| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002270| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002280| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002290| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000022f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000023a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000023b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000023c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000023d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000023e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000023f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002400| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002410| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002470| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002480| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002490| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002600| 78 70 6c 61 6e 61 74 69 | 6f 6e 2e 20 20 49 20 64 |xplanati|on. I d|
|00002610| 6f 6e 27 74 20 73 65 65 | 20 74 68 61 74 20 61 0a |on't see| that a.|
|00002620| 6d 61 6e 75 61 6c 20 69 | 73 20 77 6f 72 74 68 77 |manual i|s worthw|
|00002630| 68 69 6c 65 2e 0a 0a 49 | 20 68 61 76 65 20 72 75 |hile...I| have ru|
|00002640| 6e 20 74 68 69 73 20 70 | 72 6f 67 72 61 6d 20 75 |n this p|rogram u|
|00002650| 6e 64 65 72 20 53 79 73 | 74 65 6d 20 56 20 61 6e |nder Sys|tem V an|
|00002660| 64 20 56 65 72 73 69 6f | 6e 20 37 2e 20 20 49 20 |d Versio|n 7. I |
|00002670| 68 61 76 65 20 6e 6f 74 | 0a 74 65 73 74 65 64 20 |have not|.tested |
|00002680| 69 74 20 75 6e 64 65 72 | 20 42 53 44 2c 20 62 75 |it under| BSD, bu|
|00002690| 74 20 49 20 6b 6e 6f 77 | 20 6f 66 20 6e 6f 20 69 |t I know| of no i|
|000026a0| 6d 70 65 64 69 6d 65 6e | 74 2e 0a 0a 57 69 74 68 |mpedimen|t...With|
|000026b0| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 2c 20 49 | this pr|ogram, I|
|000026c0| 20 68 61 76 65 20 66 6f | 75 6e 64 20 62 75 67 73 | have fo|und bugs|
|000026d0| 20 69 6e 20 61 20 6e 75 | 6d 62 65 72 20 6f 66 20 | in a nu|mber of |
|000026e0| 55 4e 49 58 20 53 79 73 | 74 65 6d 20 56 0a 75 74 |UNIX Sys|tem V.ut|
|000026f0| 69 6c 69 74 69 65 73 2e | 20 20 49 20 61 6d 20 73 |ilities.| I am s|
|00002700| 75 72 65 20 74 68 61 74 | 20 42 53 44 20 70 72 6f |ure that| BSD pro|
|00002710| 67 72 61 6d 73 20 77 6f | 75 6c 64 20 62 65 20 6a |grams wo|uld be j|
|00002720| 75 73 74 20 61 73 20 62 | 75 67 67 79 2c 20 62 75 |ust as b|uggy, bu|
|00002730| 74 0a 49 20 68 61 76 65 | 6e 27 74 20 74 65 73 74 |t.I have|n't test|
|00002740| 65 64 20 74 68 65 6d 2e | 20 20 48 65 72 65 20 61 |ed them.| Here a|
|00002750| 72 65 20 73 6f 6d 65 20 | 65 78 61 6d 70 6c 65 73 |re some |examples|
|00002760| 3a 0a 0a 50 72 6f 67 72 | 61 6d 73 20 74 68 61 74 |:..Progr|ams that|
|00002770| 20 6c 65 61 76 65 20 65 | 78 74 72 61 20 66 69 6c | leave e|xtra fil|
|00002780| 65 20 64 65 73 63 72 69 | 70 74 6f 72 73 20 6f 70 |e descri|ptors op|
|00002790| 65 6e 3a 0a 20 20 20 20 | 20 73 64 62 20 21 20 63 |en:. | sdb ! c|
|000027a0| 6f 6d 6d 61 6e 64 0a 20 | 20 20 20 20 6d 61 69 6c |ommand. | mail|
|000027b0| 78 20 7e 21 20 63 6f 6d | 6d 61 6e 64 20 64 75 72 |x ~! com|mand dur|
|000027c0| 69 6e 67 20 6d 65 73 73 | 61 67 65 20 63 6f 6d 70 |ing mess|age comp|
|000027d0| 6f 73 69 74 69 6f 6e 2c | 20 61 6e 64 20 21 20 63 |osition,| and ! c|
|000027e0| 6f 6d 6d 61 6e 64 20 28 | 74 77 6f 20 65 78 74 72 |ommand (|two extr|
|000027f0| 61 29 0a 20 20 20 20 20 | 6d 61 69 6c 20 21 20 63 |a). |mail ! c|
|00002800| 6f 6d 6d 61 6e 64 0a 20 | 20 20 20 20 72 6e 20 21 |ommand. | rn !|
|00002810| 20 6f 72 20 7c 20 63 6f | 6d 6d 61 6e 64 20 28 35 | or | co|mmand (5|
|00002820| 20 65 78 74 72 61 21 29 | 0a 20 20 20 20 20 63 75 | extra!)|. cu|
|00002830| 20 7e 21 20 63 6f 6d 6d | 61 6e 64 20 28 6f 6e 65 | ~! comm|and (one|
|00002840| 20 65 78 74 72 61 3a 20 | 6e 75 6d 62 65 72 20 35 | extra: |number 5|
|00002850| 29 0a 0a 50 72 6f 67 72 | 61 6d 73 20 74 68 61 74 |)..Progr|ams that|
|00002860| 20 6c 65 61 76 65 20 73 | 69 67 6e 61 6c 73 20 69 | leave s|ignals i|
|00002870| 67 6e 6f 72 65 64 3a 0a | 20 20 20 20 20 6d 61 69 |gnored:.| mai|
|00002880| 6c 78 20 7e 21 20 63 6f | 6d 6d 61 6e 64 20 28 53 |lx ~! co|mmand (S|
|00002890| 49 47 49 4e 54 21 29 0a | 20 20 20 20 20 72 6e 20 |IGINT!).| rn |
|000028a0| 21 20 61 6e 64 20 7c 20 | 63 6f 6d 6d 61 6e 64 73 |! and | |commands|
|000028b0| 20 28 53 49 47 45 4d 54 | 21 3f 29 0a 0a 49 20 74 | (SIGEMT|!?)..I t|
|000028c0| 68 69 6e 6b 20 74 68 61 | 74 20 74 68 69 73 20 6c |hink tha|t this l|
|000028d0| 69 73 74 20 73 68 6f 77 | 73 20 74 68 61 74 20 69 |ist show|s that i|
|000028e0| 74 20 69 73 20 65 61 73 | 79 20 74 6f 20 67 65 74 |t is eas|y to get|
|000028f0| 20 66 6f 72 6b 28 32 29 | 20 77 72 6f 6e 67 2e 0a | fork(2)| wrong..|
|00002900| 49 20 68 6f 70 65 20 70 | 72 6f 67 72 61 6d 6d 65 |I hope p|rogramme|
|00002910| 72 73 20 77 69 6c 6c 20 | 75 73 65 20 46 6f 72 6b |rs will |use Fork|
|00002920| 54 65 73 74 20 74 6f 20 | 63 61 74 63 68 20 74 68 |Test to |catch th|
|00002930| 69 73 20 74 79 70 65 20 | 6f 66 20 62 75 67 0a 65 |is type |of bug.e|
|00002940| 61 72 6c 79 2e 20 20 45 | 78 65 72 63 69 73 65 20 |arly. E|xercise |
|00002950| 66 6f 72 20 74 68 65 20 | 72 65 61 64 65 72 3a 20 |for the |reader: |
|00002960| 77 68 61 74 20 63 61 6e | 20 79 6f 75 20 73 63 72 |what can| you scr|
|00002970| 69 62 62 6c 65 20 6f 6e | 20 77 69 74 68 20 74 68 |ibble on| with th|
|00002980| 6f 73 65 0a 65 78 74 72 | 61 20 66 69 6c 65 20 64 |ose.extr|a file d|
|00002990| 65 73 63 72 69 70 74 6f | 72 73 3f 0a 0a 48 75 67 |escripto|rs?..Hug|
|000029a0| 68 20 52 65 64 65 6c 6d | 65 69 65 72 20 28 34 31 |h Redelm|eier (41|
|000029b0| 36 29 20 39 32 32 2d 31 | 39 33 37 0a 75 74 7a 6f |6) 922-1|937.utzo|
|000029c0| 6f 21 68 63 72 21 68 75 | 67 68 0a 0a 5b 20 20 49 |o!hcr!hu|gh..[ I|
|000029d0| 20 77 72 6f 74 65 20 74 | 68 65 20 4d 61 6b 65 66 | wrote t|he Makef|
|000029e0| 69 6c 65 20 61 6e 64 20 | 52 45 41 44 4d 45 2e 20 |ile and |README. |
|000029f0| 20 2d 2d 72 24 20 20 5d | 0a 2d 2d 2d 2d 2d 2d 2d | --r$ ]|.-------|
|00002a00| 2d 2d 2d 43 55 54 20 48 | 45 52 45 2d 2d 2d 2d 2d |---CUT H|ERE-----|
|00002a10| 2d 2d 2d 2d 2d 0a 0a 00 | 00 00 00 00 00 00 00 00 |-----...|........|
|00002a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c00| 66 6f 72 6b 74 65 73 74 | 2f 4d 61 6b 65 66 69 6c |forktest|/Makefil|
|00002c10| 65 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |e.......|........|
|00002c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00002c70| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00002c80| 20 20 20 20 20 36 34 20 | 20 34 34 30 34 30 35 34 | 64 | 4404054|
|00002c90| 35 34 30 20 20 20 37 33 | 34 31 00 20 00 00 00 00 |540 73|41. ....|
|00002ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e00| 0a 66 6f 72 6b 74 65 73 | 74 3a 09 66 6f 72 6b 74 |.forktes|t:.forkt|
|00002e10| 65 73 74 2e 63 0a 09 24 | 28 43 43 29 20 24 28 43 |est.c..$|(CC) $(C|
|00002e20| 46 4c 41 47 53 29 20 2d | 6f 20 66 6f 72 6b 74 65 |FLAGS) -|o forkte|
|00002e30| 73 74 0a 0a 1b 90 01 00 | 14 00 08 00 4d 61 6b 65 |st......|....Make|
|00002e40| 66 69 6c 65 00 00 00 00 | 1c 90 01 00 10 00 06 00 |file....|........|
|00002e50| 52 45 41 44 4d 45 00 00 | 1d 90 01 00 a8 01 0a 00 |README..|........|
|00002e60| 66 6f 72 6b 74 65 73 74 | 2e 63 00 00 00 00 00 00 |forktest|.c......|
|00002e70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003000| 66 6f 72 6b 74 65 73 74 | 2f 52 45 41 44 4d 45 00 |forktest|/README.|
|00003010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003060| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00003070| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00003080| 20 20 20 20 33 37 35 20 | 20 34 34 30 34 30 35 34 | 375 | 4404054|
|00003090| 35 34 31 20 20 20 36 36 | 30 37 00 20 00 00 00 00 |541 66|07. ....|
|000030a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000030f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003200| 0a 5b 20 20 54 68 69 73 | 20 70 72 6f 67 72 61 6d |.[ This| program|
|00003210| 20 69 73 20 64 65 73 69 | 67 6e 65 64 20 74 6f 20 | is desi|gned to |
|00003220| 62 65 20 63 61 6c 6c 65 | 64 20 62 79 20 70 72 6f |be calle|d by pro|
|00003230| 67 72 61 6d 73 20 74 68 | 61 74 20 61 6c 6c 6f 77 |grams th|at allow|
|00003240| 0a 20 20 20 73 68 65 6c | 6c 20 65 73 63 61 70 65 |. shel|l escape|
|00003250| 73 2e 20 20 49 74 20 70 | 72 69 6e 74 73 20 6f 75 |s. It p|rints ou|
|00003260| 74 20 74 68 65 20 61 72 | 67 63 2c 61 72 67 76 20 |t the ar|gc,argv |
|00003270| 70 61 72 61 6d 65 74 65 | 72 73 2c 20 61 6e 64 0a |paramete|rs, and.|
|00003280| 20 20 20 6c 69 73 74 73 | 20 74 68 65 20 64 69 73 | lists| the dis|
|00003290| 70 6f 73 69 74 69 6f 6e | 20 6f 66 20 73 69 67 6e |position| of sign|
|000032a0| 61 6c 73 2c 20 61 6c 61 | 72 6d 20 63 61 6c 6c 73 |als, ala|rm calls|
|000032b0| 2c 20 65 74 63 2e 20 20 | 54 68 65 20 66 75 6e 0a |, etc. |The fun.|
|000032c0| 20 20 20 70 61 72 74 20 | 69 73 20 77 68 65 6e 20 | part |is when |
|000032d0| 69 74 20 6c 69 73 74 73 | 20 74 68 65 20 6f 70 65 |it lists| the ope|
|000032e0| 6e 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |n file d|escripto|
|000032f0| 72 73 2e 2e 2e 20 20 2d | 72 24 20 5d 0a 00 00 00 |rs... -|r$ ]....|
|00003300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003400| 66 6f 72 6b 74 65 73 74 | 2f 66 6f 72 6b 74 65 73 |forktest|/forktes|
|00003410| 74 2e 63 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |t.c.....|........|
|00003420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003460| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00003470| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00003480| 20 20 20 35 37 36 33 20 | 20 34 34 30 34 30 35 34 | 5763 | 4404054|
|00003490| 35 34 34 20 20 20 37 37 | 36 35 00 20 00 00 00 00 |544 77|65. ....|
|000034a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003600| 2f 2a 20 46 6f 72 6b 20 | 54 65 73 74 3a 20 64 69 |/* Fork |Test: di|
|00003610| 73 70 6c 61 79 20 61 72 | 67 73 2c 20 6f 70 65 6e |splay ar|gs, open|
|00003620| 20 66 69 6c 65 73 2c 20 | 73 69 67 6e 61 6c 73 2c | files, |signals,|
|00003630| 20 65 74 63 2e 0a 20 2a | 0a 20 2a 20 53 69 6d 70 | etc.. *|. * Simp|
|00003640| 6c 65 20 61 73 20 74 68 | 69 73 20 70 72 6f 67 72 |le as th|is progr|
|00003650| 61 6d 20 69 73 2c 20 69 | 74 20 68 61 73 20 66 6f |am is, i|t has fo|
|00003660| 75 6e 64 20 62 75 67 73 | 20 69 6e 20 74 68 65 0a |und bugs| in the.|
|00003670| 20 2a 20 77 61 79 20 61 | 20 6e 75 6d 62 65 72 20 | * way a| number |
|00003680| 6f 66 20 70 72 6f 67 72 | 61 6d 73 20 66 6f 72 6b |of progr|ams fork|
|00003690| 20 6f 66 66 20 63 68 69 | 6c 64 72 65 6e 2e 20 20 | off chi|ldren. |
|000036a0| 54 6f 20 74 65 73 74 0a | 20 2a 20 68 6f 77 20 61 |To test.| * how a|
|000036b0| 20 70 72 6f 67 72 61 6d | 20 69 73 20 69 6e 76 6f | program| is invo|
|000036c0| 6b 69 6e 67 20 69 74 73 | 20 63 68 69 6c 64 72 65 |king its| childre|
|000036d0| 6e 2c 20 72 75 6e 20 74 | 68 69 73 0a 20 2a 20 70 |n, run t|his. * p|
|000036e0| 72 6f 67 72 61 6d 20 61 | 73 20 61 20 63 68 69 6c |rogram a|s a chil|
|000036f0| 64 2e 0a 20 2a 0a 20 2a | 20 47 65 6e 65 72 61 6c |d.. *. *| General|
|00003700| 6c 79 2c 20 70 72 6f 63 | 65 73 73 65 73 20 73 68 |ly, proc|esses sh|
|00003710| 6f 75 6c 64 20 62 65 20 | 63 72 65 61 74 65 64 20 |ould be |created |
|00003720| 77 69 74 68 3a 0a 20 2a | 0a 20 2a 20 2d 20 61 20 |with:. *|. * - a |
|00003730| 72 65 61 73 6f 6e 61 62 | 6c 65 20 61 72 67 20 63 |reasonab|le arg c|
|00003740| 6f 75 6e 74 20 26 20 6c | 69 73 74 0a 20 2a 20 2d |ount & l|ist. * -|
|00003750| 20 61 72 67 20 30 20 73 | 68 6f 75 6c 64 20 6c 6f | arg 0 s|hould lo|
|00003760| 6f 6b 20 6c 69 6b 65 20 | 74 68 65 20 6e 61 6d 65 |ok like |the name|
|00003770| 20 6f 66 20 74 68 65 20 | 63 6f 6d 6d 61 6e 64 0a | of the |command.|
|00003780| 20 2a 0a 20 2a 20 2d 20 | 72 65 61 6c 20 61 6e 64 | *. * - |real and|
|00003790| 20 65 66 66 65 63 74 69 | 76 65 20 55 49 44 73 20 | effecti|ve UIDs |
|000037a0| 61 6e 64 20 47 49 44 73 | 20 73 68 6f 75 6c 64 20 |and GIDs| should |
|000037b0| 62 65 20 72 65 61 73 6f | 6e 61 62 6c 65 2e 0a 20 |be reaso|nable.. |
|000037c0| 2a 20 20 20 42 65 77 61 | 72 65 20 73 65 74 75 69 |* Bewa|re setui|
|000037d0| 64 20 70 72 6f 67 72 61 | 6d 73 20 74 68 61 74 20 |d progra|ms that |
|000037e0| 66 6f 72 6b 20 63 68 69 | 6c 64 72 65 6e 21 0a 20 |fork chi|ldren!. |
|000037f0| 2a 0a 20 2a 20 2d 20 6e | 6f 20 70 65 6e 64 69 6e |*. * - n|o pendin|
|00003800| 67 20 61 6c 61 72 6d 2e | 20 20 56 65 72 73 69 6f |g alarm.| Versio|
|00003810| 6e 20 37 20 61 70 70 61 | 72 65 6e 74 6c 79 20 64 |n 7 appa|rently d|
|00003820| 6f 65 73 20 6e 6f 74 0a | 20 2a 20 20 20 72 65 73 |oes not.| * res|
|00003830| 65 74 20 61 6c 61 72 6d | 73 20 75 70 6f 6e 20 61 |et alarm|s upon a|
|00003840| 6e 20 65 78 65 63 21 0a | 20 2a 0a 20 2a 20 2d 20 |n exec!.| *. * - |
|00003850| 66 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 73 |file des|criptors|
|00003860| 20 30 20 28 53 54 44 49 | 4e 29 2c 20 31 20 28 53 | 0 (STDI|N), 1 (S|
|00003870| 54 44 4f 55 54 29 2c 20 | 61 6e 64 20 32 20 28 53 |TDOUT), |and 2 (S|
|00003880| 54 44 45 52 52 29 0a 20 | 2a 20 20 20 6f 70 65 6e |TDERR). |* open|
|00003890| 65 64 20 72 65 61 73 6f | 6e 61 62 6c 79 0a 20 2a |ed reaso|nably. *|
|000038a0| 20 2d 20 61 6c 6c 20 6f | 74 68 65 72 20 66 69 6c | - all o|ther fil|
|000038b0| 65 20 64 65 73 63 72 69 | 70 74 6f 72 73 20 63 6c |e descri|ptors cl|
|000038c0| 6f 73 65 64 20 28 74 68 | 69 73 20 70 72 6f 67 72 |osed (th|is progr|
|000038d0| 61 6d 20 77 69 6c 6c 0a | 20 2a 20 20 20 64 65 73 |am will.| * des|
|000038e0| 63 72 69 62 65 20 61 6c | 6c 20 6f 70 65 6e 20 63 |cribe al|l open c|
|000038f0| 68 61 6e 6e 65 6c 73 29 | 0a 20 2a 0a 20 2a 20 2d |hannels)|. *. * -|
|00003900| 20 61 6c 6c 20 73 69 67 | 6e 61 6c 73 20 28 65 78 | all sig|nals (ex|
|00003910| 63 65 70 74 20 53 49 47 | 4b 49 4c 4c 29 20 73 65 |cept SIG|KILL) se|
|00003920| 74 20 74 6f 20 53 49 47 | 5f 44 46 4c 20 28 74 68 |t to SIG|_DFL (th|
|00003930| 69 73 0a 20 2a 20 20 20 | 70 72 6f 67 72 61 6d 20 |is. * |program |
|00003940| 77 69 6c 6c 20 70 72 69 | 6e 74 20 61 6c 6c 20 73 |will pri|nt all s|
|00003950| 69 67 6e 61 6c 73 20 73 | 65 74 20 6f 74 68 65 72 |ignals s|et other|
|00003960| 77 69 73 65 29 0a 20 2a | 0a 20 2a 20 54 68 65 20 |wise). *|. * The |
|00003970| 6f 75 74 70 75 74 20 69 | 73 20 66 61 69 72 6c 79 |output i|s fairly|
|00003980| 20 73 69 6d 70 6c 65 20 | 74 6f 20 75 6e 64 65 72 | simple |to under|
|00003990| 73 74 61 6e 64 2e 20 20 | 57 68 65 6e 20 69 6e 0a |stand. |When in.|
|000039a0| 20 2a 20 64 6f 75 62 74 | 2c 20 72 65 61 64 20 74 | * doubt|, read t|
|000039b0| 68 65 20 63 6f 64 65 20 | 28 61 6e 64 20 61 20 55 |he code |(and a U|
|000039c0| 4e 49 58 20 6d 61 6e 75 | 61 6c 3a 20 65 78 65 63 |NIX manu|al: exec|
|000039d0| 28 32 29 2c 0a 20 2a 20 | 67 65 74 75 69 64 28 32 |(2),. * |getuid(2|
|000039e0| 29 2c 20 61 6c 61 72 6d | 28 32 29 2c 20 73 69 67 |), alarm|(2), sig|
|000039f0| 6e 61 6c 28 32 29 2c 20 | 73 74 61 74 28 32 29 29 |nal(2), |stat(2))|
|00003a00| 2e 0a 20 2a 0a 20 2a 20 | 52 6f 6f 6d 20 66 6f 72 |.. *. * |Room for|
|00003a10| 20 49 6d 70 72 6f 76 65 | 6d 65 6e 74 3a 0a 20 2a | Improve|ment:. *|
|00003a20| 0a 20 2a 20 2d 20 73 74 | 72 69 6e 67 73 20 73 68 |. * - st|rings sh|
|00003a30| 6f 75 6c 64 20 62 65 20 | 70 72 69 6e 74 65 64 20 |ould be |printed |
|00003a40| 69 6e 20 61 20 77 61 79 | 20 74 68 61 74 20 73 68 |in a way| that sh|
|00003a50| 6f 77 73 20 66 75 6e 6e | 79 20 63 68 61 72 61 63 |ows funn|y charac|
|00003a60| 74 65 72 73 2e 0a 20 2a | 20 2d 20 73 68 6f 77 20 |ters.. *| - show |
|00003a70| 6d 69 73 63 2e 20 6f 74 | 68 65 72 20 62 69 74 73 |misc. ot|her bits|
|00003a80| 20 6f 66 20 73 74 61 74 | 65 0a 20 2a 09 2d 20 50 | of stat|e. *.- P|
|00003a90| 49 44 20 28 77 68 6f 20 | 63 61 72 65 73 3f 29 0a |ID (who |cares?).|
|00003aa0| 20 2a 09 2d 20 75 6d 61 | 73 6b 0a 20 2a 09 2d 20 | *.- uma|sk. *.- |
|00003ab0| 75 6c 69 6d 69 74 20 28 | 53 79 73 74 65 6d 20 56 |ulimit (|System V|
|00003ac0| 29 0a 20 2a 09 2d 20 73 | 74 74 79 20 73 65 74 74 |). *.- s|tty sett|
|00003ad0| 69 6e 67 73 20 6f 66 20 | 6f 70 65 6e 20 54 54 59 |ings of |open TTY|
|00003ae0| 73 0a 20 2a 0a 20 2a 20 | 43 6f 70 79 72 69 67 68 |s. *. * |Copyrigh|
|00003af0| 74 20 28 63 29 20 31 39 | 38 36 20 4d 61 72 63 68 |t (c) 19|86 March|
|00003b00| 20 31 31 20 20 44 2e 20 | 48 75 67 68 20 52 65 64 | 11 D. |Hugh Red|
|00003b10| 65 6c 6d 65 69 65 72 0a | 20 2a 0a 20 2a 20 54 68 |elmeier.| *. * Th|
|00003b20| 69 73 20 70 72 6f 67 72 | 61 6d 20 6d 61 79 20 62 |is progr|am may b|
|00003b30| 65 20 64 69 73 74 72 69 | 62 75 74 65 64 20 61 6e |e distri|buted an|
|00003b40| 64 20 75 73 65 64 20 77 | 69 74 68 6f 75 74 20 72 |d used w|ithout r|
|00003b50| 65 73 74 72 69 63 74 69 | 6f 6e 2e 0a 20 2a 2f 0a |estricti|on.. */.|
|00003b60| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 74 64 69 6f |.#includ|e <stdio|
|00003b70| 2e 68 3e 0a 0a 65 78 74 | 65 72 6e 20 75 6e 73 69 |.h>..ext|ern unsi|
|00003b80| 67 6e 65 64 20 61 6c 61 | 72 6d 28 29 3b 09 2f 2a |gned ala|rm();./*|
|00003b90| 20 73 68 6f 75 6c 64 20 | 62 65 20 75 6e 73 69 67 | should |be unsig|
|00003ba0| 6e 65 64 2c 20 62 75 74 | 20 6d 61 79 20 62 65 20 |ned, but| may be |
|00003bb0| 69 6e 74 20 2a 2f 0a 0a | 23 69 6e 63 6c 75 64 65 |int */..|#include|
|00003bc0| 20 3c 73 79 73 2f 74 79 | 70 65 73 2e 68 3e 0a 23 | <sys/ty|pes.h>.#|
|00003bd0| 69 6e 63 6c 75 64 65 20 | 3c 73 79 73 2f 73 74 61 |include |<sys/sta|
|00003be0| 74 2e 68 3e 0a 0a 73 74 | 72 75 63 74 20 73 74 61 |t.h>..st|ruct sta|
|00003bf0| 74 20 73 62 3b 0a 0a 23 | 69 6e 63 6c 75 64 65 20 |t sb;..#|include |
|00003c00| 3c 65 72 72 6e 6f 2e 68 | 3e 0a 65 78 74 65 72 6e |<errno.h|>.extern|
|00003c10| 20 69 6e 74 20 65 72 72 | 6e 6f 3b 0a 65 78 74 65 | int err|no;.exte|
|00003c20| 72 6e 20 63 68 61 72 20 | 2a 73 79 73 5f 65 72 72 |rn char |*sys_err|
|00003c30| 6c 69 73 74 5b 5d 3b 0a | 0a 23 69 6e 63 6c 75 64 |list[];.|.#includ|
|00003c40| 65 20 3c 73 69 67 6e 61 | 6c 2e 68 3e 0a 0a 69 6e |e <signa|l.h>..in|
|00003c50| 74 20 28 2a 73 69 67 6e | 61 6c 28 29 29 28 29 3b |t (*sign|al())();|
|00003c60| 0a 0a 6d 61 69 6e 28 61 | 72 67 63 2c 20 61 72 67 |..main(a|rgc, arg|
|00003c70| 76 2c 20 65 6e 76 70 29 | 0a 69 6e 74 20 61 72 67 |v, envp)|.int arg|
|00003c80| 63 3b 0a 63 68 61 72 20 | 2a 2a 61 72 67 76 2c 20 |c;.char |**argv, |
|00003c90| 2a 2a 65 6e 76 70 3b 0a | 7b 0a 09 72 65 67 69 73 |**envp;.|{..regis|
|00003ca0| 74 65 72 20 69 6e 74 20 | 69 3b 0a 09 75 6e 73 69 |ter int |i;..unsi|
|00003cb0| 67 6e 65 64 20 61 6c 20 | 3d 20 61 6c 61 72 6d 28 |gned al |= alarm(|
|00003cc0| 30 29 3b 09 2f 2a 20 67 | 65 74 20 69 74 20 77 68 |0);./* g|et it wh|
|00003cd0| 69 6c 65 20 69 74 20 69 | 73 20 68 6f 74 20 2a 2f |ile it i|s hot */|
|00003ce0| 0a 0a 09 70 72 69 6e 74 | 66 28 22 25 64 20 61 72 |...print|f("%d ar|
|00003cf0| 67 28 73 29 3a 22 2c 20 | 61 72 67 63 29 3b 0a 09 |g(s):", |argc);..|
|00003d00| 66 6f 72 20 28 69 3d 30 | 3b 20 69 3c 61 72 67 63 |for (i=0|; i<argc|
|00003d10| 3b 20 69 2b 2b 29 0a 09 | 09 69 66 20 28 61 72 67 |; i++)..|.if (arg|
|00003d20| 76 5b 69 5d 20 3d 3d 20 | 4e 55 4c 4c 29 0a 09 09 |v[i] == |NULL)...|
|00003d30| 09 70 72 69 6e 74 66 28 | 22 20 4e 55 4c 4c 21 22 |.printf(|" NULL!"|
|00003d40| 29 3b 0a 09 09 65 6c 73 | 65 0a 09 09 09 70 72 69 |);...els|e....pri|
|00003d50| 6e 74 66 28 22 20 5c 22 | 25 73 5c 22 22 2c 20 61 |ntf(" \"|%s\"", a|
|00003d60| 72 67 76 5b 69 5d 29 3b | 0a 09 70 72 69 6e 74 66 |rgv[i]);|..printf|
|00003d70| 28 22 5c 6e 22 29 3b 0a | 09 69 66 20 28 61 72 67 |("\n");.|.if (arg|
|00003d80| 76 5b 61 72 67 63 5d 20 | 21 3d 20 4e 55 4c 4c 29 |v[argc] |!= NULL)|
|00003d90| 0a 09 09 70 72 69 6e 74 | 66 28 22 41 72 67 20 6c |...print|f("Arg l|
|00003da0| 69 73 74 20 69 73 20 6e | 6f 74 20 65 6e 64 65 64 |ist is n|ot ended|
|00003db0| 20 77 69 74 68 20 61 20 | 4e 55 4c 4c 21 5c 6e 22 | with a |NULL!\n"|
|00003dc0| 29 3b 0a 0a 09 70 72 69 | 6e 74 66 28 22 52 65 61 |);...pri|ntf("Rea|
|00003dd0| 6c 20 55 49 44 20 3d 20 | 25 64 2c 20 47 49 44 20 |l UID = |%d, GID |
|00003de0| 3d 20 25 64 3b 20 45 66 | 66 65 63 74 69 76 65 20 |= %d; Ef|fective |
|00003df0| 55 49 44 20 3d 20 25 64 | 2c 20 47 49 44 20 3d 20 |UID = %d|, GID = |
|00003e00| 25 64 2e 5c 6e 22 2c 0a | 09 09 67 65 74 75 69 64 |%d.\n",.|..getuid|
|00003e10| 28 29 2c 20 67 65 74 67 | 69 64 28 29 2c 20 67 65 |(), getg|id(), ge|
|00003e20| 74 65 75 69 64 28 29 2c | 20 67 65 74 65 67 69 64 |teuid(),| getegid|
|00003e30| 28 29 29 3b 0a 0a 09 69 | 66 20 28 61 6c 29 0a 09 |());...i|f (al)..|
|00003e40| 09 70 72 69 6e 74 66 28 | 22 41 6c 61 72 6d 20 73 |.printf(|"Alarm s|
|00003e50| 65 74 20 74 6f 20 67 6f | 20 6f 66 66 20 69 6e 20 |et to go| off in |
|00003e60| 25 75 20 73 65 63 6f 6e | 64 73 2e 5c 6e 22 2c 20 |%u secon|ds.\n", |
|00003e70| 61 6c 29 3b 0a 0a 09 70 | 72 69 6e 74 66 28 22 46 |al);...p|rintf("F|
|00003e80| 69 6c 65 20 44 65 73 63 | 72 69 70 74 6f 72 73 3a |ile Desc|riptors:|
|00003e90| 5c 6e 22 29 3b 0a 09 66 | 6f 72 20 28 69 3d 30 3b |\n");..f|or (i=0;|
|00003ea0| 20 69 21 3d 34 30 3b 20 | 69 2b 2b 29 09 2f 2a 20 | i!=40; |i++)./* |
|00003eb0| 49 20 68 6f 70 65 20 34 | 30 20 69 73 20 65 6e 6f |I hope 4|0 is eno|
|00003ec0| 75 67 68 2e 20 2a 2f 0a | 09 09 69 66 20 28 66 73 |ugh. */.|..if (fs|
|00003ed0| 74 61 74 28 69 2c 20 26 | 73 62 29 20 3d 3d 20 2d |tat(i, &|sb) == -|
|00003ee0| 31 29 20 7b 0a 09 09 09 | 69 66 20 28 65 72 72 6e |1) {....|if (errn|
|00003ef0| 6f 20 21 3d 20 45 42 41 | 44 46 29 0a 09 09 09 09 |o != EBA|DF).....|
|00003f00| 70 72 69 6e 74 66 28 22 | 5c 74 25 64 20 65 72 72 |printf("|\t%d err|
|00003f10| 6f 72 3a 20 25 73 5c 6e | 22 2c 20 69 2c 20 73 79 |or: %s\n|", i, sy|
|00003f20| 73 5f 65 72 72 6c 69 73 | 74 5b 65 72 72 6e 6f 5d |s_errlis|t[errno]|
|00003f30| 29 3b 0a 09 09 7d 20 65 | 6c 73 65 20 7b 0a 09 09 |);...} e|lse {...|
|00003f40| 09 70 72 69 6e 74 66 28 | 22 5c 74 25 64 3a 20 64 |.printf(|"\t%d: d|
|00003f50| 65 76 3d 25 64 2c 20 69 | 6e 6f 3d 25 64 2c 20 70 |ev=%d, i|no=%d, p|
|00003f60| 65 72 6d 3d 30 25 30 34 | 6f 2c 20 22 2c 0a 09 09 |erm=0%04|o, ",...|
|00003f70| 09 09 69 2c 20 73 62 2e | 73 74 5f 64 65 76 2c 20 |..i, sb.|st_dev, |
|00003f80| 73 62 2e 73 74 5f 69 6e | 6f 2c 20 73 62 2e 73 74 |sb.st_in|o, sb.st|
|00003f90| 5f 6d 6f 64 65 26 30 37 | 37 37 37 29 3b 0a 09 09 |_mode&07|777);...|
|00003fa0| 09 73 77 69 74 63 68 20 | 28 73 62 2e 73 74 5f 6d |.switch |(sb.st_m|
|00003fb0| 6f 64 65 20 26 20 53 5f | 49 46 4d 54 29 20 7b 0a |ode & S_|IFMT) {.|
|00003fc0| 09 09 09 63 61 73 65 20 | 53 5f 49 46 52 45 47 3a |...case |S_IFREG:|
|00003fd0| 0a 09 09 09 09 70 72 69 | 6e 74 66 28 22 70 69 70 |.....pri|ntf("pip|
|00003fe0| 65 20 6f 72 20 72 65 67 | 75 6c 61 72 20 66 69 6c |e or reg|ular fil|
|00003ff0| 65 5c 6e 22 29 3b 0a 09 | 09 09 09 62 72 65 61 6b |e\n");..|...break|
+--------+-------------------------+-------------------------+--------+--------+