home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / strace / part06 < prev    next >
Encoding:
Internet Message Format  |  1994-07-09  |  61.0 KB

  1. From: jrs@world.std.com (Rick Sladkey)
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i080:  strace - system call tracer for sunos, linux, svr4, solaris2, Part06/10
  4. Date: 9 Jul 1994 15:49:26 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2vn2gm$9ct@sparky.sterling.com>
  9. X-Md4-Signature: 7f48cb205bc5c4a323faf6ec64071e33
  10.  
  11. Submitted-by: jrs@world.std.com (Rick Sladkey)
  12. Posting-number: Volume 43, Issue 80
  13. Archive-name: strace/part06
  14. Environment: sunos, linux, svr4, solaris
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  strace-3.0/config.sub strace-3.0/net.c strace-3.0/strace.1
  21. #   strace-3.0/system.c
  22. # Wrapped by kent@sparky on Sat Jul  9 15:42:56 1994
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 6 (of 10)."'
  26. if test -f 'strace-3.0/config.sub' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'strace-3.0/config.sub'\"
  28. else
  29.   echo shar: Extracting \"'strace-3.0/config.sub'\" \(14713 characters\)
  30.   sed "s/^X//" >'strace-3.0/config.sub' <<'END_OF_FILE'
  31. X#!/bin/sh
  32. X# Configuration validation subroutine script, version 1.1.
  33. X#   Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  34. X# This file is (in principle) common to ALL GNU software.
  35. X# The presence of a machine in this file suggests that SOME GNU software
  36. X# can handle that machine.  It does not imply ALL GNU software can. 
  37. X
  38. X#This file is free software; you can redistribute it and/or modify
  39. X#it under the terms of the GNU General Public License as published by
  40. X#the Free Software Foundation; either version 2 of the License, or
  41. X#(at your option) any later version.
  42. X
  43. X#This program is distributed in the hope that it will be useful,
  44. X#but WITHOUT ANY WARRANTY; without even the implied warranty of
  45. X#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  46. X#GNU General Public License for more details.
  47. X
  48. X#You should have received a copy of the GNU General Public License
  49. X#along with this program; if not, write to the Free Software
  50. X#Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  51. X
  52. X
  53. X# Configuration subroutine to validate and canonicalize a configuration type.
  54. X# Supply the specified configuration type as an argument.
  55. X# If it is invalid, we print an error message on stderr and exit with code 1.
  56. X# Otherwise, we print the canonical config type on stdout and succeed.
  57. X
  58. X# This file is supposed to be the same for all GNU packages
  59. X# and recognize all the CPU types, system types and aliases
  60. X# that are meaningful with *any* GNU software.
  61. X# Each package is responsible for reporting which valid configurations
  62. X# it does not support.  The user should be able to distinguish
  63. X# a failure to support a valid configuration from a meaningless
  64. X# configuration.
  65. X
  66. X# The goal of this file is to map all the various variations of a given
  67. X# machine specification into a single specification in the form:
  68. X#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
  69. X# It is wrong to echo any other type of specification.
  70. X
  71. X# First pass through any local machine types.
  72. Xcase $1 in
  73. X    *local*)
  74. X        echo $1
  75. X        exit 0
  76. X        ;;
  77. X    *)
  78. X    ;;
  79. Xesac
  80. X
  81. X# Separate what the user gave into CPU-COMPANY and OS (if any).
  82. Xbasic_machine=`echo $1 | sed 's/-[^-]*$//'`
  83. Xif [ $basic_machine != $1 ]
  84. Xthen os=`echo $1 | sed 's/.*-/-/'`
  85. Xelse os=; fi
  86. X
  87. X### Let's recognize common machines as not being operating systems so
  88. X### that things like config.sub decstation-3100 work.  We also
  89. X### recognize some manufacturers as not being operating systems, so we
  90. X### can provide default operating systems below.
  91. Xcase $os in
  92. X    -sun*os*)
  93. X        # Prevent following clause from handling this invalid input.
  94. X        ;;
  95. X    -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
  96. X    -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
  97. X    -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \
  98. X    -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
  99. X    -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
  100. X    -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
  101. X        os=
  102. X        basic_machine=$1
  103. X        ;;
  104. X    -hiux*)
  105. X        os==-hiuxwe2
  106. X        ;;
  107. X    -sco4)
  108. X        os=-sco3.2v4
  109. X        basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
  110. X        ;;
  111. X    -sco3.2.[4-9]*)
  112. X        os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
  113. X        basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
  114. X        ;;
  115. X    -sco3.2v[4-9]*)
  116. X        # Don't forget version if it is 3.2v4 or newer.
  117. X        basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
  118. X        ;;
  119. X    -sco*)
  120. X        os=-sco3.2v2
  121. X        basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
  122. X        ;;
  123. X    -isc)
  124. X        os=-isc2.2
  125. X        basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
  126. X        ;;
  127. X    -clix*)
  128. X        basic_machine=clipper-intergraph
  129. X        ;;
  130. X    -isc*)
  131. X        basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
  132. X        ;;
  133. X    -lynx)
  134. X        os=-lynxos
  135. X        ;;
  136. Xesac
  137. X
  138. X# Decode aliases for certain CPU-COMPANY combinations.
  139. Xcase $basic_machine in
  140. X    # Recognize the basic CPU types without company name.
  141. X    # Some are omitted here because they have special meanings below.
  142. X    tahoe | i[34]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
  143. X        | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
  144. X        | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
  145. X        | powerpc)
  146. X        basic_machine=$basic_machine-unknown
  147. X        ;;
  148. X    # Object if more than one company name word.
  149. X    *-*-*)
  150. X        echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
  151. X        exit 1
  152. X        ;;
  153. X    # Recognize the basic CPU types with company name.
  154. X    vax-* | tahoe-* | i[34]86-* | i860-* | m68k-* | m68000-* | m88k-* \
  155. X          | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
  156. X          | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
  157. X          | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
  158. X          | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
  159. X          | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
  160. X          | sh-* | powerpc-*)
  161. X        ;;
  162. X    # Recognize the various machine names and aliases which stand
  163. X    # for a CPU type and a company and sometimes even an OS.
  164. X    vaxv)
  165. X        basic_machine=vax-dec
  166. X        os=-sysv
  167. X        ;;
  168. X    vms)
  169. X        basic_machine=vax-dec
  170. X        os=-vms
  171. X        ;;
  172. X    i370-ibm* | ibm*)
  173. X        basic_machine=i370-ibm
  174. X        os=-mvs
  175. X        ;;
  176. X# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
  177. X    i[34]86v32)
  178. X        basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
  179. X        os=-sysv32
  180. X        ;;
  181. X    i[34]86v4*)
  182. X        basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
  183. X        os=-sysv4
  184. X        ;;
  185. X    i[34]86v)
  186. X        basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
  187. X        os=-sysv
  188. X        ;;
  189. X    i[34]86sol2)
  190. X        basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
  191. X        os=-solaris2
  192. X        ;;
  193. X    spur)
  194. X        basic_machine=spur-unknown
  195. X        ;;
  196. X    paragon)
  197. X        basic_machine=i860-intel
  198. X        os=-osf
  199. X        ;;
  200. X    alliant | fx80)
  201. X        basic_machine=fx80-alliant
  202. X        ;;
  203. X    convex-c1)
  204. X        basic_machine=c1-convex
  205. X        os=-bsd
  206. X        ;;
  207. X    convex-c2)
  208. X        basic_machine=c2-convex
  209. X        os=-bsd
  210. X        ;;
  211. X    convex-c32)
  212. X        basic_machine=c32-convex
  213. X        os=-bsd
  214. X        ;;
  215. X    convex-c34)
  216. X        basic_machine=c34-convex
  217. X        os=-bsd
  218. X        ;;
  219. X    convex-c38)
  220. X        basic_machine=c38-convex
  221. X        os=-bsd
  222. X        ;;
  223. X    m88k-omron*)
  224. X        basic_machine=m88k-omron
  225. X        ;;
  226. X    merlin)
  227. X        basic_machine=ns32k-utek
  228. X        os=-sysv
  229. X        ;;
  230. X    crds | unos)
  231. X        basic_machine=m68k-crds
  232. X        ;;
  233. X    elxsi)
  234. X        basic_machine=elxsi-elxsi
  235. X        os=-bsd
  236. X        ;;
  237. X    encore | umax | mmax)
  238. X        basic_machine=ns32k-encore
  239. X        ;;
  240. X    genix)
  241. X        basic_machine=ns32k-ns
  242. X        ;;
  243. X    iris | iris4d)
  244. X        basic_machine=mips-sgi
  245. X        case $os in
  246. X            -irix*)
  247. X            ;;
  248. X            *)
  249. X            os=-irix4
  250. X            ;;
  251. X        esac
  252. X        ;;
  253. X    news | news700 | news800 | news900)
  254. X        basic_machine=m68k-sony
  255. X        os=-newsos
  256. X        ;;
  257. X    3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
  258. X        basic_machine=m68000-att
  259. X        ;;
  260. X    3b*)
  261. X        basic_machine=we32k-att
  262. X        ;;
  263. X    delta | 3300 | motorola-3300 | motorola-delta \
  264. X          | 3300-motorola | delta-motorola)
  265. X        basic_machine=m68k-motorola
  266. X        ;;
  267. X    balance)
  268. X        basic_machine=ns32k-sequent
  269. X        os=-dynix
  270. X        ;;
  271. X        pc532)
  272. X        basic_machine=ns32k-pc532
  273. X        ;;
  274. X    symmetry)
  275. X        basic_machine=i386-sequent
  276. X        os=-dynix
  277. X        ;;
  278. X    sun2)
  279. X        basic_machine=m68000-sun
  280. X        ;;
  281. X    sun2os3)
  282. X        basic_machine=m68000-sun
  283. X        os=-sunos3
  284. X        ;;
  285. X    sun2os4)
  286. X        basic_machine=m68000-sun
  287. X        os=-sunos4
  288. X        ;;
  289. X    sun3os3)
  290. X        basic_machine=m68k-sun
  291. X        os=-sunos3
  292. X        ;;
  293. X    sun3os4)
  294. X        basic_machine=m68k-sun
  295. X        os=-sunos4
  296. X        ;;
  297. X    sun4os3)
  298. X        basic_machine=sparc-sun
  299. X        os=-sunos3
  300. X        ;;
  301. X    sun4os4)
  302. X        basic_machine=sparc-sun
  303. X        os=-sunos4
  304. X        ;;
  305. X    sun3)
  306. X        basic_machine=m68k-sun
  307. X        ;;
  308. X    sun4)
  309. X        basic_machine=sparc-sun
  310. X        ;;
  311. X    pbd)
  312. X        basic_machine=sparc-tti
  313. X        ;;
  314. X    pbb)
  315. X        basic_machine=m68k-tti
  316. X        ;;
  317. X    sun386 | sun386i | roadrunner)
  318. X        basic_machine=i386-sun
  319. X        ;;
  320. X    ps2)
  321. X        basic_machine=i386-ibm
  322. X        ;;
  323. X    fx2800)
  324. X        basic_machine=i860-alliant
  325. X        ;;
  326. X    next)
  327. X        basic_machine=m68k-next
  328. X        os=-bsd
  329. X        ;;
  330. X    amiga)
  331. X        basic_machine=m68k-cbm
  332. X        ;;
  333. X    amigados)
  334. X        basic_machine=m68k-cbm
  335. X        os=-amigados
  336. X        ;;
  337. X    amigaunix | amix)
  338. X        basic_machine=m68k-cbm
  339. X        os=-sysv4
  340. X        ;;
  341. X    hp9k3[2-9][0-9])
  342. X        basic_machine=m68k-hp
  343. X        ;;
  344. X    hp9k31[0-9] | hp9k2[0-9][0-9])
  345. X        basic_machine=m68000-hp
  346. X        ;;
  347. X    hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
  348. X        basic_machine=hppa1.1-hp
  349. X        ;;
  350. X    hp9k8[0-9][0-9] | hp8[0-9][0-9])
  351. X        basic_machine=hppa1.0-hp
  352. X        ;;
  353. X    h3050r* | hiux*)
  354. X        basic_machine=hppa1.1-hitachi
  355. X        os=-hiuxwe2
  356. X        ;;
  357. X    pa-hitachi)
  358. X        basic_machine=hppa1.1-hitachi
  359. X        os=-hiuxwe2
  360. X        ;;
  361. X    isi68 | isi)
  362. X        basic_machine=m68k-isi
  363. X        os=-sysv
  364. X        ;;
  365. X    apollo68)
  366. X        basic_machine=m68k-apollo
  367. X        os=-sysv
  368. X        ;;
  369. X    altos | altos3068)
  370. X        basic_machine=m68k-altos
  371. X        ;;
  372. X    miniframe)
  373. X        basic_machine=m68000-convergent
  374. X        ;;
  375. X    tower | tower-32)
  376. X        basic_machine=m68k-ncr
  377. X        ;;
  378. X    news-3600 | risc-news)
  379. X        basic_machine=mips-sony
  380. X        os=-newsos
  381. X        ;;
  382. X    decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
  383. X        basic_machine=mips-dec
  384. X        ;;
  385. X    magnum | m3230)
  386. X        basic_machine=mips-mips
  387. X        os=-sysv
  388. X        ;;
  389. X    gmicro)
  390. X        basic_machine=tron-gmicro
  391. X        os=-sysv
  392. X        ;;
  393. X    rtpc | rtpc-*)
  394. X        basic_machine=romp-ibm
  395. X        ;;
  396. X    am29k)
  397. X        basic_machine=a29k-none
  398. X        os=-bsd
  399. X        ;;
  400. X    amdahl)
  401. X        basic_machine=580-amdahl
  402. X        os=-sysv
  403. X        ;;
  404. X    cray | ymp)
  405. X        basic_machine=ymp-cray
  406. X        os=-unicos
  407. X        ;;
  408. X    cray2)
  409. X        basic_machine=cray2-cray
  410. X        os=-unicos
  411. X        ;;
  412. X    xmp)
  413. X        basic_machine=xmp-cray
  414. X        os=-unicos
  415. X        ;;
  416. X    delta88)
  417. X        basic_machine=m88k-motorola
  418. X        os=-sysv3
  419. X        ;;
  420. X    dpx2* | dpx2*-bull)
  421. X        basic_machine=m68k-bull
  422. X        os=-sysv3
  423. X        ;;
  424. X    sps7)
  425. X        basic_machine=m68k-bull
  426. X        os=-sysv2
  427. X        ;;
  428. X    ebmon29k)
  429. X        basic_machine=a29k-amd
  430. X        os=-ebmon
  431. X        ;;
  432. X    h8300hms)
  433. X        basic_machine=h8300-hitachi
  434. X        os=-hms
  435. X        ;;
  436. X    sh)
  437. X        basic_machine=sh-hitachi
  438. X        os=-hms
  439. X        ;;
  440. X    harris)
  441. X        basic_machine=m88k-harris
  442. X        os=-sysv3
  443. X        ;;
  444. X    hp300bsd)
  445. X        basic_machine=m68k-hp
  446. X        os=-bsd
  447. X        ;;
  448. X    hp300hpux)
  449. X        basic_machine=m68k-hp
  450. X        os=-hpux
  451. X        ;;
  452. X    hp9k2[0-9][0-9] | hp9k31[0-9])
  453. X        basic_machine=m68000-hp
  454. X        os=-hpux
  455. X        ;;
  456. X    hp9k3[2-9][0-9])
  457. X        basic_machine=m68k-hp
  458. X        os=-hpux
  459. X        ;;
  460. X    ncr3000)
  461. X        basic_machine=i486-ncr
  462. X        os=-sysv4
  463. X        ;;
  464. X    news1000)
  465. X        basic_machine=m68030-sony
  466. X        os=-newsos
  467. X        ;;
  468. X    nindy960)
  469. X        basic_machine=i960-intel
  470. X        os=-nindy
  471. X        ;;
  472. X    pn)
  473. X        basic_machine=pn-gould
  474. X        ;;
  475. X    np1)
  476. X        basic_machine=np1-gould
  477. X        ;;
  478. X    ultra3)
  479. X        basic_machine=a29k-nyu
  480. X        os=-sym1
  481. X        ;;
  482. X    vxworks960)
  483. X        basic_machine=i960-wrs
  484. X        os=-vxworks
  485. X        ;;
  486. X    vxworks68)
  487. X        basic_machine=m68k-wrs
  488. X        os=-vxworks
  489. X        ;;
  490. X        xps | xps100)
  491. X        basic_machine=xps100-honeywell
  492. X        ;;
  493. X    none)
  494. X        basic_machine=none-none
  495. X        os=-none
  496. X        ;;
  497. X
  498. X# Here we handle the default manufacturer of certain CPU types.  It is in
  499. X# some cases the only manufacturer, in others, it is the most popular.
  500. X    mips)
  501. X        basic_machine=mips-mips
  502. X        ;;
  503. X    romp)
  504. X        basic_machine=romp-ibm
  505. X        ;;
  506. X    rs6000)
  507. X        basic_machine=rs6000-ibm
  508. X        ;;
  509. X    vax)
  510. X        basic_machine=vax-dec
  511. X        ;;
  512. X    we32k)
  513. X        basic_machine=we32k-att
  514. X        ;;
  515. X    sparc)
  516. X        basic_machine=sparc-sun
  517. X        ;;
  518. X        cydra)
  519. X        basic_machine=cydra-cydrome
  520. X        ;;
  521. X    orion)
  522. X        basic_machine=orion-highlevel
  523. X        ;;
  524. X    orion105)
  525. X        basic_machine=clipper-highlevel
  526. X        ;;
  527. X    *)
  528. X        echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
  529. X        exit 1
  530. X        ;;
  531. Xesac
  532. X
  533. X# Here we canonicalize certain aliases for manufacturers.
  534. Xcase $basic_machine in
  535. X    *-digital*)
  536. X        basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
  537. X        ;;
  538. X    *-commodore*)
  539. X        basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
  540. X        ;;
  541. X    *)
  542. X        ;;
  543. Xesac
  544. X
  545. X# Decode manufacturer-specific aliases for certain operating systems.
  546. X
  547. Xif [ x"$os" != x"" ]
  548. Xthen
  549. Xcase $os in
  550. X    # -solaris* is a basic system type, with this one exception.
  551. X    -solaris1 | -solaris1.*)
  552. X        os=`echo $os | sed -e 's|solaris1|sunos4|'`
  553. X        ;;
  554. X    -solaris)
  555. X        os=-solaris2
  556. X        ;;
  557. X    # First accept the basic system types.
  558. X    # The portable systems comes first.
  559. X    # Each alternative must end in a *, to match a version number.
  560. X    # -sysv* is not here because it comes later, after sysvr4.
  561. X    -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
  562. X          | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]* | -hpux* \
  563. X          | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
  564. X          | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
  565. X          | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
  566. X          | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
  567. X          | -hiux* | -386bsd* | -netbsd* | -riscix* | -lynxos*)
  568. X        ;;
  569. X    -sunos5*)
  570. X        os=`echo $os | sed -e 's|sunos5|solaris2|'`
  571. X        ;;
  572. X    -sunos6*)
  573. X        os=`echo $os | sed -e 's|sunos6|solaris3|'`
  574. X        ;;
  575. X    -osfrose*)
  576. X        os=-osfrose
  577. X        ;;
  578. X    -osf*)
  579. X        os=-osf
  580. X        ;;
  581. X    -utek*)
  582. X        os=-bsd
  583. X        ;;
  584. X    -dynix*)
  585. X        os=-bsd
  586. X        ;;
  587. X    -acis*)
  588. X        os=-aos
  589. X        ;;
  590. X    -ctix* | -uts*)
  591. X        os=-sysv
  592. X        ;;
  593. X    -triton*)
  594. X        os=-sysv3
  595. X        ;;
  596. X    -oss*)
  597. X        os=-sysv3
  598. X        ;;
  599. X    -svr4)
  600. X        os=-sysv4
  601. X        ;;
  602. X    -svr3)
  603. X        os=-sysv3
  604. X        ;;
  605. X    -sysvr4)
  606. X        os=-sysv4
  607. X        ;;
  608. X    # This must come after -sysvr4.
  609. X    -sysv*)
  610. X        ;;
  611. X    -xenix)
  612. X        os=-xenix
  613. X        ;;
  614. X    -none)
  615. X        ;;
  616. X    *)
  617. X        # Get rid of the `-' at the beginning of $os.
  618. X        os=`echo $1 | sed 's/[^-]*-//'`
  619. X        echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
  620. X        exit 1
  621. X        ;;
  622. Xesac
  623. Xelse
  624. X
  625. X# Here we handle the default operating systems that come with various machines.
  626. X# The value should be what the vendor currently ships out the door with their
  627. X# machine or put another way, the most popular os provided with the machine.
  628. X
  629. X# Note that if you're going to try to match "-MANUFACTURER" here (say,
  630. X# "-sun"), then you have to tell the case statement up towards the top
  631. X# that MANUFACTURER isn't an operating system.  Otherwise, code above
  632. X# will signal an error saying that MANUFACTURER isn't an operating
  633. X# system, and we'll never get to this point.
  634. X
  635. Xcase $basic_machine in
  636. X    *-acorn)
  637. X        os=-riscix1.2
  638. X        ;;
  639. X    *-dec | vax-*)
  640. X        os=-ultrix4.2
  641. X        ;;
  642. X    i386-sun)
  643. X        os=-sunos4.0.2
  644. X        ;;
  645. X    m68000-sun)
  646. X        os=-sunos3
  647. X        # This also exists in the configure program, but was not the
  648. X        # default.
  649. X        # os=-sunos4
  650. X        ;;
  651. X    *-tti)    # must be before sparc entry or we get the wrong os.
  652. X        os=-sysv3
  653. X        ;;
  654. X    sparc-* | *-sun)
  655. X        os=-sunos4.1.1
  656. X        ;;
  657. X    *-ibm)
  658. X        os=-aix
  659. X        ;;
  660. X    *-hp)
  661. X        os=-hpux
  662. X        ;;
  663. X    *-hitachi)
  664. X        os=-hiux
  665. X        ;;
  666. X    i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
  667. X        os=-sysv
  668. X        ;;
  669. X    *-cbm)
  670. X        os=-amigados
  671. X        ;;
  672. X    *-dg)
  673. X        os=-dgux
  674. X        ;;
  675. X    *-dolphin)
  676. X        os=-sysv3
  677. X        ;;
  678. X    m88k-omron*)
  679. X        os=-luna
  680. X        ;;
  681. X    *-sequent)
  682. X        os=-bsd
  683. X        ;;
  684. X    *-crds)
  685. X        os=-unos
  686. X        ;;
  687. X    *-ns)
  688. X        os=-genix
  689. X        ;;
  690. X    i370-*)
  691. X        os=-mvs
  692. X        ;;
  693. X    *-next)
  694. X        os=-bsd
  695. X        ;;
  696. X    i[34]86-*)
  697. X        os=-sco3.2v2
  698. X        ;;
  699. X        *-gould)
  700. X        os=-sysv
  701. X        ;;
  702. X        *-highlevel)
  703. X        os=-bsd
  704. X        ;;
  705. X    *-encore)
  706. X        os=-bsd
  707. X        ;;
  708. X        *-sgi)
  709. X        os=-irix
  710. X        ;;
  711. X    *-masscomp)
  712. X        os=-rtu
  713. X        ;;
  714. X    *)
  715. X        os=-none
  716. X        ;;
  717. Xesac
  718. Xfi
  719. X
  720. X# Here we handle the case where we know the os, and the CPU type, but not the
  721. X# manufacturer.  We pick the logical manufacturer.
  722. Xvendor=unknown
  723. Xcase $basic_machine in
  724. X    *-unknown)
  725. X        case $os in
  726. X            -riscix*)
  727. X                vendor=acorn
  728. X                ;;
  729. X            -sunos*)
  730. X                vendor=sun
  731. X                ;;
  732. X            -lynxos*)
  733. X                vendor=lynx
  734. X                ;;
  735. X            -aix*)
  736. X                vendor=ibm
  737. X                ;;
  738. X            -hpux*)
  739. X                vendor=hp
  740. X                ;;
  741. X            -hiux*)
  742. X                vendor=hitachi
  743. X                ;;
  744. X            -unos*)
  745. X                vendor=crds
  746. X                ;;
  747. X            -dgux*)
  748. X                vendor=dg
  749. X                ;;
  750. X            -luna*)
  751. X                vendor=omron
  752. X                ;;
  753. X            -genix*)
  754. X                vendor=ns
  755. X                ;;
  756. X            -mvs*)
  757. X                vendor=ibm
  758. X                ;;
  759. X        esac
  760. X        basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
  761. X        ;;
  762. Xesac
  763. X
  764. Xecho $basic_machine$os
  765. END_OF_FILE
  766.   if test 14713 -ne `wc -c <'strace-3.0/config.sub'`; then
  767.     echo shar: \"'strace-3.0/config.sub'\" unpacked with wrong size!
  768.   fi
  769.   chmod +x 'strace-3.0/config.sub'
  770.   # end of 'strace-3.0/config.sub'
  771. fi
  772. if test -f 'strace-3.0/net.c' -a "${1}" != "-c" ; then 
  773.   echo shar: Will not clobber existing file \"'strace-3.0/net.c'\"
  774. else
  775.   echo shar: Extracting \"'strace-3.0/net.c'\" \(12557 characters\)
  776.   sed "s/^X//" >'strace-3.0/net.c' <<'END_OF_FILE'
  777. X/*
  778. X * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
  779. X * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
  780. X * Copyright (c) 1993, 1994 Rick Sladkey <jrs@world.std.com>
  781. X * All rights reserved.
  782. X *
  783. X * Redistribution and use in source and binary forms, with or without
  784. X * modification, are permitted provided that the following conditions
  785. X * are met:
  786. X * 1. Redistributions of source code must retain the above copyright
  787. X *    notice, this list of conditions and the following disclaimer.
  788. X * 2. Redistributions in binary form must reproduce the above copyright
  789. X *    notice, this list of conditions and the following disclaimer in the
  790. X *    documentation and/or other materials provided with the distribution.
  791. X * 3. All advertising materials mentioning features or use of this software
  792. X *    must display the following acknowledgement:
  793. X *      This product includes software developed by Paul Kranenburg,
  794. X *      Branko Lankester and Rick Sladkey.
  795. X * 4. The name of the author may not be used to endorse or promote products
  796. X *    derived from this software without specific prior written permission.
  797. X *
  798. X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  799. X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  800. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  801. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  802. X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  803. X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  804. X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  805. X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  806. X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  807. X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  808. X *
  809. X *    net.c,v 2.21 1994/03/21 05:45:31 jrs Exp
  810. X */
  811. X
  812. X#include "defs.h"
  813. X
  814. X#include <sys/stat.h>
  815. X#include <sys/socket.h>
  816. X#include <sys/un.h>
  817. X#include <netinet/in.h>
  818. X#include <arpa/inet.h>
  819. X
  820. X#ifndef PF_UNSPEC
  821. X#define PF_UNSPEC AF_UNSPEC
  822. X#endif
  823. X
  824. Xstatic struct xlat domains[] = {
  825. X    { PF_UNSPEC,    "PF_UNSPEC"    },
  826. X    { PF_UNIX,    "PF_UNIX"    },
  827. X    { PF_INET,    "PF_INET"    },
  828. X#ifdef PF_ISO
  829. X    { PF_ISO,    "PF_ISO"    },
  830. X#endif
  831. X#ifdef PF_IMPLINK
  832. X    { PF_IMPLINK,    "PF_IMPLINK"    },
  833. X#endif
  834. X    { 0,        NULL        },
  835. X};
  836. Xstatic struct xlat socktypes[] = {
  837. X    { SOCK_STREAM,    "SOCK_STREAM"    },
  838. X    { SOCK_DGRAM,    "SOCK_DGRAM"    },
  839. X#ifdef SOCK_RAW
  840. X    { SOCK_RAW,    "SOCK_RAW"    },
  841. X#endif
  842. X#ifdef SOCK_SEQPACKET
  843. X    { SOCK_SEQPACKET,"SOCK_SEQPACKET"},
  844. X#endif
  845. X#ifdef SOCK_RDM
  846. X    { SOCK_RDM,    "SOCK_RDM"    },
  847. X#endif
  848. X    { 0,        NULL        },
  849. X};
  850. Xstatic struct xlat protocols[] = {
  851. X    { IPPROTO_IP,    "IPPROTO_IP"    },
  852. X    { IPPROTO_ICMP,    "IPPROTO_ICMP"    },
  853. X    { IPPROTO_TCP,    "IPPROTO_TCP"    },
  854. X    { IPPROTO_UDP,    "IPPROTO_UDP"    },
  855. X#ifdef IPPROTO_GGP
  856. X    { IPPROTO_GGP,    "IPPROTO_GGP"    },
  857. X#endif
  858. X#ifdef IPPROTO_EGP
  859. X    { IPPROTO_EGP,    "IPPROTO_EGP"    },
  860. X#endif
  861. X#ifdef IPPROTO_PUP
  862. X    { IPPROTO_PUP,    "IPPROTO_PUP"    },
  863. X#endif
  864. X#ifdef IPPROTO_IDP
  865. X    { IPPROTO_IDP,    "IPPROTO_IDP"    },
  866. X#endif
  867. X#ifdef IPPROTO_IGMP
  868. X    { IPPROTO_IGMP,    "IPPROTO_IGMP"    },
  869. X#endif
  870. X#ifdef IPPROTO_HELLO
  871. X    { IPPROTO_HELLO,"IPPROTO_HELLO"    },
  872. X#endif
  873. X#ifdef IPPROTO_ND
  874. X    { IPPROTO_ND,    "IPPROTO_ND"    },
  875. X#endif
  876. X#ifdef IPPROTO_RAW
  877. X    { IPPROTO_RAW,    "IPPROTO_RAW"    },
  878. X#endif
  879. X#ifdef IPPROTO_MAX
  880. X    { IPPROTO_MAX,    "IPPROTO_MAX"    },
  881. X#endif
  882. X    { 0,        NULL        },
  883. X};
  884. Xstatic struct xlat msg_flags[] = {
  885. X    { MSG_OOB,    "MSG_OOB"    },
  886. X#ifdef MSG_DONTROUTE
  887. X    { MSG_DONTROUTE,"MSG_DONTROUTE"    },
  888. X#endif
  889. X#ifdef MSG_PEEK
  890. X    { MSG_PEEK,    "MSG_PEEK"    },
  891. X#endif
  892. X    { 0,        NULL        },
  893. X};
  894. X
  895. Xstatic struct xlat sockoptions[] = {
  896. X#ifdef SO_DEBUG
  897. X    { SO_DEBUG,    "SO_DEBUG"    },
  898. X#endif
  899. X#ifdef SO_REUSEADDR
  900. X    { SO_REUSEADDR,    "SO_REUSEADDR"    },
  901. X#endif
  902. X#ifdef SO_KEEPALIVE
  903. X    { SO_KEEPALIVE,    "SO_KEEPALIVE"    },
  904. X#endif
  905. X#ifdef SO_DONTROUTE
  906. X    { SO_DONTROUTE,    "SO_DONTROUTE"    },
  907. X#endif
  908. X#ifdef SO_BROADCAST
  909. X    { SO_BROADCAST,    "SO_BROADCAST"    },
  910. X#endif
  911. X#ifdef SO_LINGER
  912. X    { SO_LINGER,    "SO_LINGER"    },
  913. X#endif
  914. X#ifdef SO_OOBINLINE
  915. X    { SO_OOBINLINE,    "SO_OOBINLINE"    },
  916. X#endif
  917. X#ifdef SO_TYPE
  918. X    { SO_TYPE,    "SO_TYPE"    },
  919. X#endif
  920. X#ifdef SO_ERROR
  921. X    { SO_ERROR,    "SO_ERROR"    },
  922. X#endif
  923. X#ifdef SO_SNDBUF
  924. X    { SO_SNDBUF,    "SO_SNDBUF"    },
  925. X#endif
  926. X#ifdef SO_RCVBUF
  927. X    { SO_RCVBUF,    "SO_RCVBUF"    },
  928. X#endif
  929. X#ifdef SO_NO_CHECK
  930. X    { SO_NO_CHECK,    "SO_NO_CHECK"    },
  931. X#endif
  932. X#ifdef SO_PRIORITY
  933. X    { SO_PRIORITY,    "SO_PRIORITY"    },
  934. X#endif
  935. X#ifdef SO_ACCEPTCONN
  936. X    { SO_ACCEPTCONN,"SO_ACCEPTCONN"    },
  937. X#endif
  938. X#ifdef SO_USELOOPBACK
  939. X    { SO_USELOOPBACK,"SO_USELOOPBACK"},
  940. X#endif
  941. X#ifdef SO_SNDLOWAT
  942. X    { SO_SNDLOWAT,    "SO_SNDLOWAT"    },
  943. X#endif
  944. X#ifdef SO_RCVLOWAT
  945. X    { SO_RCVLOWAT,    "SO_RCVLOWAT"    },
  946. X#endif
  947. X#ifdef SO_SNDTIMEO
  948. X    { SO_SNDTIMEO,    "SO_SNDTIMEO"    },
  949. X#endif
  950. X#ifdef SO_RCVTIMEO
  951. X    { SO_RCVTIMEO,    "SO_RCVTIMEO"    },
  952. X#endif
  953. X    { 0,        NULL        },
  954. X};
  955. X
  956. Xvoid
  957. Xprintsock(tcp, addr)
  958. Xstruct tcb *tcp;
  959. Xint addr;
  960. X{
  961. X    struct sockaddr sa;
  962. X    struct sockaddr_in *sin = (struct sockaddr_in *) &sa;
  963. X    struct sockaddr_un sau;
  964. X
  965. X    if (addr == 0) {
  966. X        tprintf("NULL");
  967. X        return;
  968. X    }
  969. X    if (!verbose(tcp)) {
  970. X        tprintf("%#x", addr);
  971. X        return;
  972. X    }
  973. X    if (umove(tcp, addr, &sa) < 0) {
  974. X        tprintf("{...}");
  975. X        return;
  976. X    }
  977. X    switch (sa.sa_family) {
  978. X    case AF_UNIX:
  979. X        if (umove(tcp, addr, &sau) < 0)
  980. X            tprintf("{sun_family=AF_UNIX, ...}");
  981. X        else
  982. X            tprintf("{sun_family=AF_UNIX, sun_path=\"%s\"}",
  983. X                sau.sun_path);
  984. X        break;
  985. X    case AF_INET:
  986. X        tprintf("{sin_family=AF_INET, ");
  987. X        tprintf("sin_port=htons(%u), sin_addr=inet_addr(\"%s\")}",
  988. X            ntohs(sin->sin_port), inet_ntoa(sin->sin_addr));
  989. X        break;
  990. X    default:
  991. X        tprintf("{sa_family=%u, sa_data=", sa.sa_family);
  992. X        printstr(tcp, (int) &((struct sockaddr *) addr)->sa_data,
  993. X            sizeof sa.sa_data);
  994. X        tprintf("}");
  995. X        break;
  996. X    }
  997. X}
  998. X
  999. X#ifdef SUNOS4
  1000. X
  1001. Xstatic void
  1002. Xprintmsghdr(tcp, addr)
  1003. Xstruct tcb *tcp;
  1004. Xint addr;
  1005. X{
  1006. X    struct msghdr msg;
  1007. X
  1008. X    umove(tcp, addr, &msg);
  1009. X    tprintf("{msg_name=%s, msg_namelen=%u, msg_iov=%#lx, msg_iovlen=%u, ",
  1010. X        msg.msg_name, msg.msg_namelen,
  1011. X        (unsigned long) msg.msg_iov, msg.msg_iovlen);
  1012. X    tprintf("msg_accrights=%#lx, msg_accrightslen=%u}",
  1013. X        (unsigned long) msg.msg_accrights, msg.msg_accrightslen);
  1014. X}
  1015. X#endif
  1016. X
  1017. Xint
  1018. Xsys_socket(tcp)
  1019. Xstruct tcb *tcp;
  1020. X{
  1021. X    if (entering(tcp)) {
  1022. X        printxval(domains, tcp->u_arg[0], "PF_???");
  1023. X        tprintf(", ");
  1024. X        printxval(socktypes, tcp->u_arg[1], "SOCK_???");
  1025. X        tprintf(", ");
  1026. X        if (tcp->u_arg[0] == PF_INET) {
  1027. X            printxval(protocols, tcp->u_arg[2], "IPPROTO_???");
  1028. X        } else {
  1029. X            tprintf(", %u", tcp->u_arg[2]);
  1030. X        }
  1031. X    }
  1032. X    return 0;
  1033. X}
  1034. X
  1035. Xint
  1036. Xsys_bind(tcp)
  1037. Xstruct tcb *tcp;
  1038. X{
  1039. X    if (entering(tcp)) {
  1040. X        tprintf("%d, ", tcp->u_arg[0]);
  1041. X        printsock(tcp, tcp->u_arg[1]);
  1042. X        tprintf(", %u", tcp->u_arg[2]);
  1043. X    }
  1044. X    return 0;
  1045. X}
  1046. X
  1047. Xint
  1048. Xsys_connect(tcp)
  1049. Xstruct tcb *tcp;
  1050. X{
  1051. X    return sys_bind(tcp);
  1052. X}
  1053. X
  1054. Xint
  1055. Xsys_listen(tcp)
  1056. Xstruct tcb *tcp;
  1057. X{
  1058. X    if (entering(tcp)) {
  1059. X        tprintf("%d, %u", tcp->u_arg[0], tcp->u_arg[1]);
  1060. X    }
  1061. X    return 0;
  1062. X}
  1063. X
  1064. Xint
  1065. Xsys_accept(tcp)
  1066. Xstruct tcb *tcp;
  1067. X{
  1068. X    if (entering(tcp)) {
  1069. X        tprintf("%d, ", tcp->u_arg[0]);
  1070. X    } else if (!tcp->u_arg[2])
  1071. X        tprintf("%#x, NULL", tcp->u_arg[1]);
  1072. X    else {
  1073. X        if (tcp->u_arg[1] == 0 || syserror(tcp)) {
  1074. X            tprintf("%#x", tcp->u_arg[1]);
  1075. X        } else {
  1076. X            printsock(tcp, tcp->u_arg[1]);
  1077. X        }
  1078. X        tprintf(", ");
  1079. X        printnum(tcp, tcp->u_arg[2], "%u");
  1080. X    }
  1081. X    return 0;
  1082. X}
  1083. X
  1084. Xint
  1085. Xsys_send(tcp)
  1086. Xstruct tcb *tcp;
  1087. X{
  1088. X    if (entering(tcp)) {
  1089. X        tprintf("%u, ", tcp->u_arg[0]);
  1090. X        printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
  1091. X        tprintf(", %u, ", tcp->u_arg[2]);
  1092. X        /* flags */
  1093. X        if (printflags(msg_flags, tcp->u_arg[3]) == 0)
  1094. X            tprintf("0");
  1095. X    }
  1096. X    return 0;
  1097. X}
  1098. X
  1099. Xint
  1100. Xsys_sendto(tcp)
  1101. Xstruct tcb *tcp;
  1102. X{
  1103. X    if (entering(tcp)) {
  1104. X        tprintf("%u, ", tcp->u_arg[0]);
  1105. X        printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
  1106. X        tprintf(", %u, ", tcp->u_arg[2]);
  1107. X        /* flags */
  1108. X        if (printflags(msg_flags, tcp->u_arg[3]) == 0)
  1109. X            tprintf("0");
  1110. X        /* to address */
  1111. X        tprintf(", ");
  1112. X        printsock(tcp, tcp->u_arg[4]);
  1113. X        /* to length */
  1114. X        tprintf(", %u", tcp->u_arg[5]);
  1115. X    }
  1116. X    return 0;
  1117. X}
  1118. X
  1119. X#ifdef SUNOS4
  1120. X
  1121. Xint
  1122. Xsys_sendmsg(tcp)
  1123. Xstruct tcb *tcp;
  1124. X{
  1125. X    if (entering(tcp)) {
  1126. X        tprintf("%d, ", tcp->u_arg[0]);
  1127. X        printmsghdr(tcp, tcp->u_arg[1]);
  1128. X        /* flags */
  1129. X        tprintf(", ");
  1130. X        if (printflags(msg_flags, tcp->u_arg[2]) == 0)
  1131. X            tprintf("0");
  1132. X    }
  1133. X    return 0;
  1134. X}
  1135. X
  1136. X#endif /* SUNOS4 */
  1137. X
  1138. Xint
  1139. Xsys_recv(tcp)
  1140. Xstruct tcb *tcp;
  1141. X{
  1142. X    if (entering(tcp)) {
  1143. X        tprintf("%d, ", tcp->u_arg[0]);
  1144. X    } else {
  1145. X        if (syserror(tcp))
  1146. X            tprintf("%#x", tcp->u_arg[1]);
  1147. X        else
  1148. X            printstr(tcp, tcp->u_arg[1], tcp->u_rval);
  1149. X
  1150. X        tprintf(", %u, ", tcp->u_arg[2]);
  1151. X        if (printflags(msg_flags, tcp->u_arg[3]) == 0)
  1152. X            tprintf("0");
  1153. X    }
  1154. X    return 0;
  1155. X}
  1156. X
  1157. Xint
  1158. Xsys_recvfrom(tcp)
  1159. Xstruct tcb *tcp;
  1160. X{
  1161. X    int fromlen;
  1162. X    
  1163. X    if (entering(tcp)) {
  1164. X        tprintf("%u, ", tcp->u_arg[0]);
  1165. X    } else {
  1166. X        if (syserror(tcp)) {
  1167. X            tprintf("%#x, %u, %u, %#x, %#x",
  1168. X                tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3],
  1169. X                tcp->u_arg[4], tcp->u_arg[5]);
  1170. X            return 0;
  1171. X        }
  1172. X        /* buf */
  1173. X        printstr(tcp, tcp->u_arg[1], tcp->u_rval);
  1174. X        /* len */
  1175. X        tprintf(", %u, ", tcp->u_arg[2]);
  1176. X        /* flags */
  1177. X        if (printflags(msg_flags, tcp->u_arg[3]) == 0)
  1178. X            tprintf("0");
  1179. X        /* from address, len */
  1180. X        if (!tcp->u_arg[4] || !tcp->u_arg[5]) {
  1181. X            if (tcp->u_arg[4] == 0)
  1182. X                tprintf(", NULL");
  1183. X            else
  1184. X                tprintf(", %#x", tcp->u_arg[4]);
  1185. X            if (tcp->u_arg[5] == 0)
  1186. X                tprintf(", NULL");
  1187. X            else
  1188. X                tprintf(", %#x", tcp->u_arg[5]);
  1189. X            return 0;
  1190. X        }
  1191. X        if (umove(tcp, tcp->u_arg[5], &fromlen) < 0) {
  1192. X            tprintf(", {...}, [?]");
  1193. X            return 0;
  1194. X        }
  1195. X        tprintf(", ");
  1196. X        printsock(tcp, tcp->u_arg[4]);
  1197. X        /* from length */
  1198. X        tprintf(", [%u]", fromlen);
  1199. X    }
  1200. X    return 0;
  1201. X}
  1202. X
  1203. X#ifdef SUNOS4
  1204. X
  1205. Xint
  1206. Xsys_recvmsg(tcp)
  1207. Xstruct tcb *tcp;
  1208. X{
  1209. X    if (entering(tcp)) {
  1210. X        tprintf("%d, ", tcp->u_arg[0]);
  1211. X    } else {
  1212. X        if (syserror(tcp) || !verbose(tcp))
  1213. X            tprintf("%#x", tcp->u_arg[1]);
  1214. X        else
  1215. X            printmsghdr(tcp, tcp->u_arg[1]);
  1216. X        /* flags */
  1217. X        tprintf(", ");
  1218. X        if (printflags(msg_flags, tcp->u_arg[2]) == 0)
  1219. X            tprintf("0");
  1220. X    }
  1221. X    return 0;
  1222. X}
  1223. X
  1224. X#endif /* SUNOS4 */
  1225. X
  1226. Xint
  1227. Xsys_shutdown(tcp)
  1228. Xstruct tcb *tcp;
  1229. X{
  1230. X    if (entering(tcp)) {
  1231. X        tprintf("%d, %d", tcp->u_arg[0], tcp->u_arg[1]);
  1232. X        switch (tcp->u_arg[1]) {
  1233. X        case 0:
  1234. X            tprintf("%s", " /* receive */");
  1235. X            break;
  1236. X        case 1:
  1237. X            tprintf("%s", " /* send */");
  1238. X            break;
  1239. X        case 2:
  1240. X            tprintf("%s", " /* send and receive */");
  1241. X            break;
  1242. X        }
  1243. X    }
  1244. X    return 0;
  1245. X}
  1246. X
  1247. Xint
  1248. Xsys_getsockname(tcp)
  1249. Xstruct tcb *tcp;
  1250. X{
  1251. X    return sys_accept(tcp);
  1252. X}
  1253. X
  1254. Xint
  1255. Xsys_getpeername(tcp)
  1256. Xstruct tcb *tcp;
  1257. X{
  1258. X    return sys_accept(tcp);
  1259. X}
  1260. X
  1261. Xint
  1262. Xsys_pipe(tcp)
  1263. Xstruct tcb *tcp;
  1264. X{
  1265. X
  1266. X#ifdef LINUX
  1267. X    int fds[2];
  1268. X
  1269. X    if (exiting(tcp)) {
  1270. X        if (syserror(tcp)) {
  1271. X            tprintf("%#x", tcp->u_arg[0]);
  1272. X            return 0;
  1273. X        }
  1274. X        if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
  1275. X            tprintf("[...]");
  1276. X        else
  1277. X            tprintf("[%u, %u]", fds[0], fds[1]);
  1278. X    }
  1279. X#endif /* LINUX */
  1280. X
  1281. X#ifdef SUNOS4
  1282. X    if (exiting(tcp))
  1283. X        tprintf("[%u, %u]", tcp->u_rval, getrval2(tcp));
  1284. X#endif /* SUNOS4 */
  1285. X
  1286. X#ifdef SVR4
  1287. X    if (exiting(tcp))
  1288. X        tprintf("[%u, %u]", tcp->u_rval, getrval2(tcp));
  1289. X#endif /* SVR4 */
  1290. X
  1291. X    return 0;
  1292. X}
  1293. X
  1294. Xint
  1295. Xsys_socketpair(tcp)
  1296. Xstruct tcb *tcp;
  1297. X{
  1298. X#ifdef LINUX
  1299. X    int fds[2];
  1300. X#endif
  1301. X
  1302. X    if (entering(tcp)) {
  1303. X        printxval(domains, tcp->u_arg[0], "PF_???");
  1304. X        tprintf(", ");
  1305. X        printxval(socktypes, tcp->u_arg[1], "SOCK_???");
  1306. X        tprintf(", ");
  1307. X        if (tcp->u_arg[0] == PF_INET) {
  1308. X            printxval(protocols, tcp->u_arg[2], "IPPROTO_???");
  1309. X        } else {
  1310. X            tprintf(", %u", tcp->u_arg[2]);
  1311. X        }
  1312. X    } else {
  1313. X        if (syserror(tcp)) {
  1314. X            tprintf("%#x", tcp->u_arg[3]);
  1315. X            return 0;
  1316. X        }
  1317. X#ifdef LINUX
  1318. X        if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0)
  1319. X            tprintf("[...]");
  1320. X        else
  1321. X            tprintf(", [%u, %u]", fds[0], fds[1]);
  1322. X#endif /* LINUX */
  1323. X#ifdef SUNOS4
  1324. X        tprintf(", [%u, %u]", tcp->u_rval, getrval2(tcp));
  1325. X#endif /* SUNOS4 */
  1326. X#ifdef SVR4
  1327. X        tprintf(", [%u, %u]", tcp->u_rval, getrval2(tcp));
  1328. X#endif /* SVR4 */
  1329. X    }
  1330. X    return 0;
  1331. X}
  1332. X
  1333. Xint
  1334. Xsys_getsockopt(tcp)
  1335. Xstruct tcb *tcp;
  1336. X{
  1337. X    if (entering(tcp)) {
  1338. X        tprintf("%u, ", tcp->u_arg[0]);
  1339. X        if (tcp->u_arg[1] == SOL_SOCKET) {
  1340. X            tprintf("SOL_SOCKET, ");
  1341. X            printxval(sockoptions, tcp->u_arg[2], "SO_???");
  1342. X            tprintf(", ");
  1343. X        } else {
  1344. X            /* XXX - should know socket family here */
  1345. X            printxval(protocols, tcp->u_arg[1], "IPPROTO_???");
  1346. X            tprintf("%u, ", tcp->u_arg[2]);
  1347. X        }
  1348. X    } else {
  1349. X        if (syserror(tcp)) {
  1350. X            tprintf("%#x, %#x",
  1351. X                tcp->u_arg[3], tcp->u_arg[4]);
  1352. X            return 0;
  1353. X        }
  1354. X        printnum(tcp, tcp->u_arg[3], "%d");
  1355. X        tprintf(", ");
  1356. X        printnum(tcp, tcp->u_arg[4], "%d");
  1357. X    }
  1358. X    return 0;
  1359. X}
  1360. X
  1361. Xint
  1362. Xsys_setsockopt(tcp)
  1363. Xstruct tcb *tcp;
  1364. X{
  1365. X    if (entering(tcp)) {
  1366. X        tprintf("%u, ", tcp->u_arg[0]);
  1367. X        if (tcp->u_arg[1] == SOL_SOCKET) {
  1368. X            tprintf("SOL_SOCKET, ");
  1369. X            printxval(sockoptions, tcp->u_arg[2], "SO_???");
  1370. X            tprintf(", ");
  1371. X        } else {
  1372. X            /* XXX - should know socket family here */
  1373. X            printxval(protocols, tcp->u_arg[1], "IPPROTO_???");
  1374. X            tprintf("%u, ", tcp->u_arg[2]);
  1375. X        }
  1376. X        printnum(tcp, tcp->u_arg[3], "%d");
  1377. X        tprintf(", %u", tcp->u_arg[4]);
  1378. X    }
  1379. X    return 0;
  1380. X}
  1381. END_OF_FILE
  1382.   if test 12557 -ne `wc -c <'strace-3.0/net.c'`; then
  1383.     echo shar: \"'strace-3.0/net.c'\" unpacked with wrong size!
  1384.   fi
  1385.   # end of 'strace-3.0/net.c'
  1386. fi
  1387. if test -f 'strace-3.0/strace.1' -a "${1}" != "-c" ; then 
  1388.   echo shar: Will not clobber existing file \"'strace-3.0/strace.1'\"
  1389. else
  1390.   echo shar: Extracting \"'strace-3.0/strace.1'\" \(15424 characters\)
  1391.   sed "s/^X//" >'strace-3.0/strace.1' <<'END_OF_FILE'
  1392. X.\" Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
  1393. X.\" Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
  1394. X.\" Copyright (c) 1993, 1994 Rick Sladkey <jrs@world.std.com>
  1395. X.\" All rights reserved.
  1396. X.\"
  1397. X.\" Redistribution and use in source and binary forms, with or without
  1398. X.\" modification, are permitted provided that the following conditions
  1399. X.\" are met:
  1400. X.\" 1. Redistributions of source code must retain the above copyright
  1401. X.\"    notice, this list of conditions and the following disclaimer.
  1402. X.\" 2. Redistributions in binary form must reproduce the above copyright
  1403. X.\"    notice, this list of conditions and the following disclaimer in the
  1404. X.\"    documentation and/or other materials provided with the distribution.
  1405. X.\" 3. All advertising materials mentioning features or use of this software
  1406. X.\"    must display the following acknowledgement:
  1407. X.\"      This product includes software developed by Paul Kranenburg,
  1408. X.\"      Branko Lankester and Rick Sladkey.
  1409. X.\" 4. The name of the author may not be used to endorse or promote products
  1410. X.\"    derived from this software without specific prior written permission.
  1411. X.\"
  1412. X.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  1413. X.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1414. X.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  1415. X.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  1416. X.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  1417. X.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  1418. X.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  1419. X.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1420. X.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  1421. X.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1422. X.\"
  1423. X.\"    strace.1,v 2.19 1994/06/29 04:43:24 jrs Exp
  1424. X.\"
  1425. X.de CW
  1426. X.sp
  1427. X.nf
  1428. X.ft CW
  1429. X..
  1430. X.de CE
  1431. X.ft
  1432. X.fi
  1433. X.sp
  1434. X..
  1435. X.TH STRACE 1 "94/06/21"
  1436. X.SH NAME
  1437. Xstrace \- trace system calls and signals
  1438. X.SH SYNOPSIS
  1439. X.B strace
  1440. X[
  1441. X.B \-dffhiqrtttTvxx
  1442. X]
  1443. X[
  1444. X.BI \-a column
  1445. X]
  1446. X[
  1447. X.BI \-e expr
  1448. X]
  1449. X\&...
  1450. X[
  1451. X.BI \-o file
  1452. X]
  1453. X[
  1454. X.BI \-p pid
  1455. X]
  1456. X\&...
  1457. X[
  1458. X.BI \-s strsize
  1459. X]
  1460. X[
  1461. X.I command
  1462. X[
  1463. X.I arg
  1464. X\&...
  1465. X]
  1466. X]
  1467. X.sp
  1468. X.B strace
  1469. X.B \-c
  1470. X[
  1471. X.BI \-e expr
  1472. X]
  1473. X\&...
  1474. X[
  1475. X.BI \-O overhead
  1476. X]
  1477. X[
  1478. X.BI \-S sortby
  1479. X]
  1480. X[
  1481. X.I command
  1482. X[
  1483. X.I arg
  1484. X\&...
  1485. X]
  1486. X]
  1487. X.SH DESCRIPTION
  1488. X.IX "strace command" "" "\fLstrace\fR command"  
  1489. X.LP
  1490. XIn the simplest case
  1491. X.B strace
  1492. Xruns the specified
  1493. X.I command
  1494. Xuntil it exits.
  1495. XIt intercepts and records the system calls which are called
  1496. Xby a process and the signals which are received by a process.
  1497. XThe name of each system call, its arguments and its return value
  1498. Xare printed on standard error or to the file specified with the
  1499. X.B \-o
  1500. Xoption.
  1501. X.LP
  1502. X.B strace
  1503. Xis a useful diagnositic, instructional, and debugging tool.
  1504. XSystem adminstrators, diagnosticians and trouble-shooters will find
  1505. Xit invaluable for solving problems with
  1506. Xprograms for which the source is not readily available since
  1507. Xthey do not need to be recompiled in order to trace them.
  1508. XStudents, hackers and the overly-curious will find that
  1509. Xa great deal can be learned about a system and its system calls by 
  1510. Xtracing even ordinary programs.  And programmers will find that
  1511. Xsince system calls and signals are events that happen at the user/kernel
  1512. Xinterface, a close examination of this boundary is very
  1513. Xuseful for bug isolation, sanity checking and
  1514. Xattempting to capture race conditions.
  1515. X.LP
  1516. XEach line in the trace contains the system call name, followed
  1517. Xby its arguments in parentheses and its return value.
  1518. XAn example from stracing the command ``cat /dev/null'' is:
  1519. X.CW
  1520. Xopen("/dev/null", O_RDONLY) = 3
  1521. X.CE
  1522. XErrors (typically a return value of \-1) have the errno symbol
  1523. Xand error string appended.
  1524. X.CW
  1525. Xopen("/foo/bar", O_RDONLY) = -1 ENOENT (No such file or directory)
  1526. X.CE
  1527. XSignals are printed as a signal symbol and a signal string.
  1528. XAn excerpt from stracing and interrupting the command ``sleep 666'' is:
  1529. X.CW
  1530. Xsigsuspend([] <unfinished ...>
  1531. X--- SIGINT (Interrupt) ---
  1532. X+++ killed by SIGINT +++
  1533. X.CE
  1534. XArguments are printed in symbolic form with a passion.
  1535. XThis example shows the shell peforming ``>>xyzzy'' output redirection:
  1536. X.CW
  1537. Xopen("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
  1538. X.CE
  1539. XHere the three argument form of open is decoded by breaking down the
  1540. Xflag argument into its three bitwise-OR constituents and printing the
  1541. Xmode value in octal by tradition.  Where traditional or native
  1542. Xusage differs from ANSI or POSIX, the latter forms are preferred.
  1543. XIn some cases, strace output has proven to be more readable than
  1544. Xthe source.
  1545. X.LP
  1546. XStructure pointers are dereferenced and the members are displayed
  1547. Xas appropriate.  In all cases arguments are formatted in the most C-like
  1548. Xfashion possible.
  1549. XFor example, the essence of the command ``ls -l /dev/null'' is captured as:
  1550. X.CW
  1551. Xlstat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
  1552. X.CE
  1553. XNotice how the `struct stat' argument is dereferenced and how each member is
  1554. Xdisplayed symbolically.  In particular, observe how the st_mode member
  1555. Xis carefully decoded into a bitwise-OR of symbolic and numeric values.
  1556. XAlso notice in this example that the first argument to lstat is an input
  1557. Xto the system call and the second argument is an output.  Since output
  1558. Xarguments not modified if the system call fails, arguments may not
  1559. Xalways be dereferenced.  For example, retrying the ``ls -l'' example
  1560. Xwith a non-existent file produces the following line:
  1561. X.CW
  1562. Xlstat("/foo/bar", 0xb004) = -1 ENOENT (No such file or directory)
  1563. X.CE
  1564. XIn this case the porch light is on but nobody is home.
  1565. X.LP
  1566. XCharacter pointers are dereferenced and printed as C strings.
  1567. XNon-printing characters in strings are normally represented by
  1568. Xordinary C escape codes.
  1569. XOnly the first
  1570. X.I strsize
  1571. X(32 by default) bytes of strings are printed;
  1572. Xlonger strings have an ellipsis appended following the closing quote.
  1573. XHere is a line from ``ls -l'' where the getpwuid library routine is
  1574. Xreading the password file:
  1575. X.CW
  1576. Xread(3, "root::0:0:System Administrator:/"..., 1024) = 422
  1577. X.CE
  1578. XWhile structures are annotated using curly braces, simple pointers
  1579. Xand arrays are printed using square brackets with commas separating
  1580. Xelements.  Here is an example from the command ``id'' on a system with
  1581. Xsupplementary group ids:
  1582. X.CW
  1583. Xgetgroups(32, [100, 0]) = 2
  1584. X.CE
  1585. XOn the other hand, bit-sets are also shown using square brackets
  1586. Xbut set elements are separated only by a space.  Here is the shell
  1587. Xpreparing to execute an external command:
  1588. X.CW
  1589. Xsigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0
  1590. X.CE
  1591. XHere the second argument is a bit-set of two signals, SIGCHLD and SIGTTOU.
  1592. XIn some cases the bit-set is so full that printing out the unset
  1593. Xelements is more valuable.  In that case, the bit-set is prefixed by
  1594. Xa tilde like this:
  1595. X.CW
  1596. Xsigprocmask(SIG_UNBLOCK, ~[], NULL) = 0
  1597. X.CE
  1598. XHere the second argument represents the full set of all signals.
  1599. X.SH OPTIONS
  1600. X.TP 12
  1601. X.TP
  1602. X.B \-c
  1603. XCount time, calls, and errors for each system call and report a
  1604. Xsummary on program exit.
  1605. X.TP
  1606. X.B \-d
  1607. XShow some debugging output of strace itself on
  1608. X.I stderr .
  1609. X.TP
  1610. X.B \-f
  1611. XTrace child processes as they are created by currently traced
  1612. Xprocesses as a result of the fork(2) system call.  The new process is
  1613. Xattached to as soon as its pid is known (through the return value of
  1614. Xfork(2) in the parent process). This means that such children may run
  1615. Xuncontrolled for a while (especially in the case of a vfork(2)), until
  1616. Xthe parent is scheduled again to complete its (v)fork(2) call.
  1617. XIf the parent process decides to wait(2) for a child that is currently
  1618. Xbeing traced, it is suspended until an appropriate child process either
  1619. Xterminates or incurs a signal that would cause it to terminate (as
  1620. Xdetermined from the child's current signal disposition).
  1621. X.TP
  1622. X.B \-ff
  1623. XIf the
  1624. X.BI \-o filename
  1625. Xoption is in effect, each processes trace is written to
  1626. X.I filename.pid
  1627. Xwhere pid is the numeric process id of each process.
  1628. X.TP
  1629. X.B \-F
  1630. XOn SunOS 4.x, this option has the effect of attempting to follow
  1631. Xvforks by performing some dynamic linking trickery.  Otherwise,
  1632. Xvforks will not be followed even if
  1633. X.B \-f
  1634. Xhas been given.
  1635. X.TP
  1636. X.B \-h
  1637. XPrint the help summary.
  1638. X.TP
  1639. X.B \-i
  1640. XPrint the instruction pointer at the time of the system call.
  1641. X.TP
  1642. X.B \-q
  1643. XSuppress messages about attaching, detaching etc.  This happens
  1644. Xautomatically when output is redirected to a file and the command
  1645. Xis run directly instead of attaching.
  1646. X.TP
  1647. X.B \-r
  1648. XPrint a relative timestamp upon entry to each system call.  This
  1649. Xrecords the time difference between the beginning of successive
  1650. Xsystem calls.
  1651. X.TP
  1652. X.B \-t
  1653. XPrefix each line of the trace with the time of day.
  1654. X.TP
  1655. X.B \-tt
  1656. XIf given twice, the time printed will include the microseconds.
  1657. X.TP
  1658. X.B \-T
  1659. XShow the time spent in system calls. This records the time
  1660. Xdifference between the beginning and the end of each system call.
  1661. X.TP
  1662. X.B \-v
  1663. XPrint unabbreviated versions of environment, stat, termios, etc.
  1664. Xcalls.  These structures are very common in calls and so the default
  1665. Xbehavior displays a reasonable subset of structure members.  Use
  1666. Xthis option to get all of the gory details.
  1667. X.TP
  1668. X.B \-V
  1669. XPrint the version number of strace.
  1670. X.TP
  1671. X.B \-x
  1672. XPrint all non-ascii strings in hexidecimal string format.
  1673. X.TP
  1674. X.B \-xx
  1675. XPrint all strings in hexidecimal string format.
  1676. X.TP
  1677. X.BI \-a column
  1678. XAlign return values in a secific column (default column 40).
  1679. X.TP
  1680. X.BI \-e expr
  1681. XA qualifying expression which modifies which events to trace
  1682. Xor how to trace them.  The format of the expression is:
  1683. X.br
  1684. X[qualifier=][!]value1[,value2]...
  1685. X.br
  1686. Xwhere qualifier is one of trace, abbrev, verbose, raw, signal, read, or write
  1687. Xand value is a qualifier-dependent symbol or number.  The default
  1688. Xqualifier is trace.  Using an exclamation mark negates the set of values.
  1689. XFor example \-eopen means literally \-e trace=open which in turn means
  1690. Xtrace only the open system call.  By contrast, \-etrace=!open means
  1691. Xto trace every system call except open.  In addition the special values
  1692. Xall and none have the obvious meanings.
  1693. X.TP
  1694. X.BI \-etrace= set
  1695. XTrace only the specified set of system calls.  The
  1696. X.B \-c
  1697. Xoption is useful for determining which system calls might be useful
  1698. Xto trace.  For example, trace=open,close,read,write means to only
  1699. Xtrace those four system calls.  Be careful when making inferences
  1700. Xabout the user/kernel boundary if only a subset of system calls
  1701. Xare being monitored.  The default is trace=all.
  1702. X.TP
  1703. X.BI \-eabbrev= set
  1704. XAbbreviate the output from printing each member of large structures.
  1705. XThe default is abbrev=all.  The
  1706. X.B \-v
  1707. Xoption has the effect of abbrev=none.
  1708. X.TP
  1709. X.BI \-everbose= set
  1710. XDereference structures for the specified set of system calls.  The
  1711. Xdefault is verbose=all.
  1712. X.TP
  1713. X.BI \-eraw= set
  1714. XPrint raw, undecoded arguments for the specifed set of system calls.
  1715. XThis option has the effect of causing all arguments to be printed
  1716. Xin hexidecimal.  This is mostly useful if you don't trust the
  1717. Xdecoding or you need to know the actual numeric value of an
  1718. Xargument.
  1719. X.TP
  1720. X.BI \-esignal= set
  1721. XTrace only the specified subset of signals.  The default is signal=all.
  1722. XFor example signal=!SIGIO (or signal=!io) causes SIGIO signals not to
  1723. Xbe traced.
  1724. X.TP
  1725. X.BI \-eread= set
  1726. XPerform a full hexidecimal and ascii dump of all the data read from
  1727. Xfile descriptors listed in the specified set.  For example, to see
  1728. Xall input activity on file descriptors 3 and 5 use read=3,5.
  1729. X.TP
  1730. X.BI \-ewrite= set
  1731. XPerform a full hexidecimal and ascii dump of all the data written to
  1732. Xfile descriptors listed in the specified set.  For example, to see
  1733. Xall output activity on file descriptors 3 and 5 use read=3,5.
  1734. X.TP
  1735. X.BI \-o filename
  1736. XWrite the trace output to the file
  1737. X.I filename
  1738. Xrather than to stderr.
  1739. XUse
  1740. X.I filename.pid
  1741. Xif
  1742. X.B \-ff
  1743. Xis used.
  1744. X.TP
  1745. X.BI \-O overhead
  1746. XSet the overhead for tracing system calls to overhead microseconds.
  1747. XThis is useful for overriding the default heuristic for guessing
  1748. Xhow much time is spent in mere measuring when timing system calls using
  1749. Xthe
  1750. X.B \-c
  1751. Xoption.  The acuracy of the heuristic can be gauged by timing a given
  1752. Xprogram run without tracing (using time(1)) and comparing the accumulated
  1753. Xsystem call time to the total produced using
  1754. X.B \-c .
  1755. X.TP
  1756. X.BI \-p pid
  1757. XAttach to the process with the process
  1758. X.SM ID
  1759. X.I pid
  1760. Xand begin tracing.
  1761. XThe trace may be terminated
  1762. Xat any time by a keyboard interrupt signal (\c
  1763. X.SM CTRL\s0-C).
  1764. X.B strace
  1765. Xwill respond by detaching itself from the traced process(es)
  1766. Xleaving it (them) to continue running.
  1767. XMultiple -p options can be used to attach to up to MAXPROC (currently 32)
  1768. Xprocesses in addition to
  1769. X.I command
  1770. X(which is optional if at least one -p option is given).
  1771. X.TP
  1772. X.BI \-s strsize
  1773. XSpecify the maximum string size to print (the default is 32).  Note
  1774. Xthat filenames are not considered strings and are always printed in
  1775. Xfull.
  1776. X.TP
  1777. X.BI \-S sortby
  1778. XSort the output of the histogram printed by the
  1779. X.B \-c
  1780. Xoption by the specified critereon.  Legal values are
  1781. Xtime, calls, name, and nothing (default time).
  1782. X.SH "SEE ALSO"
  1783. X.BR ptrace(2) ,
  1784. X.BR time(1) ,
  1785. X.B trace(1)
  1786. X.SH NOTES
  1787. XIt is a pity that so much tracing clutter is produced by systems
  1788. Xemploying shared libraries.  It is more reminiscent of the Multics
  1789. Xoperating system than the one that was trying to ridicule it.
  1790. X.LP
  1791. XIt is instructive to think about system call inputs and outputs
  1792. Xas data-flow across the user/kernel boundary.  Because user-space
  1793. Xand kernel-space are separate and address-protected, it is
  1794. Xsometimes possible to make deductive inferences about process
  1795. Xbehavior using inputs and outputs as propositions.
  1796. X.LP
  1797. XIn some cases, a system call will differ from the documented
  1798. Xbehavior.  For example, on System V derived systems the true
  1799. Xtime(2) system call does not take an argument.
  1800. XThese discrepancies are normal but idiosyncratic
  1801. Xcharacteristics of the system call interface and are accounted for 
  1802. Xby C library system call interface functions.
  1803. X.LP
  1804. XOn some platforms a process that has a system call trace applied
  1805. Xto it with the
  1806. X.B \-p
  1807. Xoption will receive a
  1808. X.BR \s-1SIGSTOP\s0 .
  1809. XThis signal may interrupt a system call that is not restartable.
  1810. XThis may have an unpredictable effect on the process
  1811. Xif the process takes no action to restart the system call.
  1812. X.SH BUGS
  1813. XTracing a subset of calls can inhibit the ability to follow forks
  1814. Xif certain keys system calls are not traced, like fork and wait4.
  1815. X.LP
  1816. XPrograms that use the
  1817. X.I setuid
  1818. Xbit do not have
  1819. Xeffective user
  1820. X.SM ID
  1821. Xprivileges while being traced.
  1822. X.LP
  1823. XA traced process ignores
  1824. X.SM SIGSTOP\s0.
  1825. X.LP
  1826. XA traced process which tries to block SIGTRAP will be sent a SIGSTOP
  1827. Xin an attempt to force continuation of tracing.
  1828. X.LP
  1829. XA traced process runs slowly.
  1830. X.LP
  1831. XTraced processes which are descended from
  1832. X.I command
  1833. Xmay be left running after an interrupt signal (\c
  1834. X.SM CTRL\s0-C).
  1835. X.SH HISTORY
  1836. X.B strace
  1837. Xwas written by Paul Kranenburg, Branko Lankester and Rick Sladkey.
  1838. XThe original strace was written by Paul Kranenburg
  1839. Xfor SunOS and was inspired by its trace utility.
  1840. XThe SunOS version of strace was ported to Linux and enhanced
  1841. Xby Branko Lankester, who also wrote the Linux kernel support.
  1842. XEven though Paul released strace 2.5 in 1992,
  1843. XBranko's work was based on Paul's strace 1.5 release from 1991.
  1844. XIn 1993, Rick Sladkey merged strace 2.5 for SunOS and the
  1845. Xsecond release of strace for Linux, added the best features of truss
  1846. Xfrom SVR4, and produced an strace that worked on both platforms.
  1847. XIn 1994 Rick ported strace to SVR4 and Solaris and wrote the
  1848. Xautomatic configuration support.
  1849. END_OF_FILE
  1850.   if test 15424 -ne `wc -c <'strace-3.0/strace.1'`; then
  1851.     echo shar: \"'strace-3.0/strace.1'\" unpacked with wrong size!
  1852.   fi
  1853.   # end of 'strace-3.0/strace.1'
  1854. fi
  1855. if test -f 'strace-3.0/system.c' -a "${1}" != "-c" ; then 
  1856.   echo shar: Will not clobber existing file \"'strace-3.0/system.c'\"
  1857. else
  1858.   echo shar: Extracting \"'strace-3.0/system.c'\" \(14134 characters\)
  1859.   sed "s/^X//" >'strace-3.0/system.c' <<'END_OF_FILE'
  1860. X/*
  1861. X * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
  1862. X * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
  1863. X * Copyright (c) 1993, 1994 Rick Sladkey <jrs@world.std.com>
  1864. X * All rights reserved.
  1865. X *
  1866. X * Redistribution and use in source and binary forms, with or without
  1867. X * modification, are permitted provided that the following conditions
  1868. X * are met:
  1869. X * 1. Redistributions of source code must retain the above copyright
  1870. X *    notice, this list of conditions and the following disclaimer.
  1871. X * 2. Redistributions in binary form must reproduce the above copyright
  1872. X *    notice, this list of conditions and the following disclaimer in the
  1873. X *    documentation and/or other materials provided with the distribution.
  1874. X * 3. All advertising materials mentioning features or use of this software
  1875. X *    must display the following acknowledgement:
  1876. X *      This product includes software developed by Paul Kranenburg,
  1877. X *      Branko Lankester and Rick Sladkey.
  1878. X * 4. The name of the author may not be used to endorse or promote products
  1879. X *    derived from this software without specific prior written permission.
  1880. X *
  1881. X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  1882. X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1883. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  1884. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  1885. X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  1886. X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  1887. X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  1888. X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1889. X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  1890. X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1891. X *
  1892. X *    system.c,v 2.20 1994/03/21 05:45:43 jrs Exp
  1893. X */
  1894. X
  1895. X#include "defs.h"
  1896. X
  1897. X#ifdef LINUX
  1898. X
  1899. X#include <linux/fs.h>
  1900. X#include <sys/socket.h>
  1901. X#include <arpa/inet.h>
  1902. X#include <linux/nfs_mount.h>
  1903. X
  1904. Xstatic struct xlat mount_flags[] = {
  1905. X    { MS_RDONLY,    "MS_RDONLY"    },
  1906. X    { MS_NOSUID,    "MS_NOSUID"    },
  1907. X    { MS_NODEV,    "MS_NODEV"    },
  1908. X    { MS_NOEXEC,    "MS_NOEXEC"    },
  1909. X    { MS_NOSUID,    "MS_NOSUID"    },
  1910. X    { MS_SYNC,    "MS_SYNC"    },
  1911. X    { MS_REMOUNT,    "MS_REMOUNT"    },
  1912. X    { 0,        NULL        },
  1913. X};
  1914. X
  1915. Xint
  1916. Xsys_mount(tcp)
  1917. Xstruct tcb *tcp;
  1918. X{
  1919. X    if (entering(tcp)) {
  1920. X        printpath(tcp, tcp->u_arg[0]);
  1921. X        tprintf(", ");
  1922. X        printpath(tcp, tcp->u_arg[1]);
  1923. X        tprintf(", ");
  1924. X        printpath(tcp, tcp->u_arg[2]);
  1925. X        tprintf(", ");
  1926. X        printflags(mount_flags, tcp->u_arg[3]);
  1927. X        tprintf(", %#x", tcp->u_arg[4]);
  1928. X    }
  1929. X    return 0;
  1930. X}
  1931. X
  1932. X#endif /* LINUX */
  1933. X
  1934. X#ifdef SUNOS4
  1935. X
  1936. X#include <sys/reboot.h>
  1937. X#define NFSCLIENT
  1938. X#define LOFS
  1939. X#define RFS
  1940. X#define PCFS
  1941. X#include <sys/mount.h>
  1942. X#include <sys/socket.h>
  1943. X#include <nfs/export.h>
  1944. X#include <rpc/types.h>
  1945. X#include <rpc/auth.h>
  1946. X
  1947. X/*ARGSUSED*/
  1948. Xint
  1949. Xsys_sync(tcp)
  1950. Xstruct tcb *tcp;
  1951. X{
  1952. X    return 0;
  1953. X}
  1954. X
  1955. Xstatic struct xlat bootflags[] = {
  1956. X    { RB_AUTOBOOT,    "RB_AUTOBOOT"    },    /* for system auto-booting itself */
  1957. X    { RB_ASKNAME,    "RB_ASKNAME"    },    /* ask for file name to reboot from */
  1958. X    { RB_SINGLE,    "RB_SINGLE"    },    /* reboot to single user only */
  1959. X    { RB_NOSYNC,    "RB_NOSYNC"    },    /* dont sync before reboot */
  1960. X    { RB_HALT,    "RB_HALT"    },    /* don't reboot, just halt */
  1961. X    { RB_INITNAME,    "RB_INITNAME"    },    /* name given for /etc/init */
  1962. X    { RB_NOBOOTRC,    "RB_NOBOOTRC"    },    /* don't run /etc/rc.boot */
  1963. X    { RB_DEBUG,    "RB_DEBUG"    },    /* being run under debugger */
  1964. X    { RB_DUMP,    "RB_DUMP"    },    /* dump system core */
  1965. X    { RB_WRITABLE,    "RB_WRITABLE"    },    /* mount root read/write */
  1966. X    { RB_STRING,    "RB_STRING"    },    /* pass boot args to prom monitor */
  1967. X    { 0,        NULL        },
  1968. X};
  1969. X
  1970. Xint
  1971. Xsys_reboot(tcp)
  1972. Xstruct tcb *tcp;
  1973. X{
  1974. X    if (entering(tcp)) {
  1975. X        if (!printflags(bootflags, tcp->u_arg[0]))
  1976. X            tprintf("RB_???");
  1977. X        if (tcp->u_arg[0] & RB_STRING) {
  1978. X            printstr(tcp, tcp->u_arg[1], -1);
  1979. X        }
  1980. X    }
  1981. X    return 0;
  1982. X}
  1983. X
  1984. Xint
  1985. Xsys_sysacct(tcp)
  1986. Xstruct tcb *tcp;
  1987. X{
  1988. X    if (entering(tcp)) {
  1989. X        printstr(tcp, tcp->u_arg[0], -1);
  1990. X    }
  1991. X    return 0;
  1992. X}
  1993. X
  1994. Xint
  1995. Xsys_swapon(tcp)
  1996. Xstruct tcb *tcp;
  1997. X{
  1998. X    if (entering(tcp)) {
  1999. X        printstr(tcp, tcp->u_arg[0], -1);
  2000. X    }
  2001. X    return 0;
  2002. X}
  2003. X
  2004. Xint
  2005. Xsys_nfs_svc(tcp)
  2006. Xstruct tcb *tcp;
  2007. X{
  2008. X    if (entering(tcp)) {
  2009. X        printsock(tcp, tcp->u_arg[0]);
  2010. X    }
  2011. X    return 0;
  2012. X}
  2013. X
  2014. Xstatic struct xlat mountflags[] = {
  2015. X    { M_RDONLY,    "M_RDONLY"    },
  2016. X    { M_NOSUID,    "M_NOSUID"    },
  2017. X    { M_NEWTYPE,    "M_NEWTYPE"    },
  2018. X    { M_GRPID,    "M_GRPID"    },
  2019. X#ifdef    M_REMOUNT
  2020. X    { M_REMOUNT,    "M_REMOUNT"    },
  2021. X#endif
  2022. X#ifdef    M_NOSUB
  2023. X    { M_NOSUB,    "M_NOSUB"    },
  2024. X#endif
  2025. X#ifdef    M_MULTI
  2026. X    { M_MULTI,    "M_MULTI"    },
  2027. X#endif
  2028. X#ifdef    M_SYS5
  2029. X    { M_SYS5,    "M_SYS5"    },
  2030. X#endif
  2031. X    { 0,        NULL        },
  2032. X};
  2033. X
  2034. Xstatic struct xlat nfsflags[] = {
  2035. X    { NFSMNT_SOFT,        "NFSMNT_SOFT"        },
  2036. X    { NFSMNT_WSIZE,        "NFSMNT_WSIZE"        },
  2037. X    { NFSMNT_RSIZE,        "NFSMNT_RSIZE"        },
  2038. X    { NFSMNT_TIMEO,        "NFSMNT_TIMEO"        },
  2039. X    { NFSMNT_RETRANS,    "NFSMNT_RETRANS"    },
  2040. X    { NFSMNT_HOSTNAME,    "NFSMNT_HOSTNAME"    },
  2041. X    { NFSMNT_INT,        "NFSMNT_INT"        },
  2042. X    { NFSMNT_NOAC,        "NFSMNT_NOAC"        },
  2043. X    { NFSMNT_ACREGMIN,    "NFSMNT_ACREGMIN"    },
  2044. X    { NFSMNT_ACREGMAX,    "NFSMNT_ACREGMAX"    },
  2045. X    { NFSMNT_ACDIRMIN,    "NFSMNT_ACDIRMIN"    },
  2046. X    { NFSMNT_ACDIRMAX,    "NFSMNT_ACDIRMAX"    },
  2047. X#ifdef    NFSMNT_SECURE
  2048. X    { NFSMNT_SECURE,    "NFSMNT_SECURE"        },
  2049. X#endif
  2050. X#ifdef    NFSMNT_NOCTO
  2051. X    { NFSMNT_NOCTO,        "NFSMNT_NOCTO"        },
  2052. X#endif
  2053. X#ifdef    NFSMNT_POSIX
  2054. X    { NFSMNT_POSIX,        "NFSMNT_POSIX"        },
  2055. X#endif
  2056. X    { 0,            NULL            },
  2057. X};
  2058. X
  2059. Xint
  2060. Xsys_mount(tcp)
  2061. Xstruct tcb *tcp;
  2062. X{
  2063. X    char type[4];
  2064. X
  2065. X    if (entering(tcp)) {
  2066. X        if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
  2067. X                tcp->u_arg[0],  sizeof type, type) < 0) {
  2068. X            tprintf("OLDTYPE:#%x", tcp->u_arg[0]);
  2069. X        } else {
  2070. X            tprintf("\"%s\", ", type);
  2071. X        }
  2072. X        printstr(tcp, tcp->u_arg[1], -1);
  2073. X        tprintf(", ");
  2074. X        if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
  2075. X            tprintf("0");
  2076. X        tprintf(", ");
  2077. X
  2078. X        if (strcmp(type, "4.2") == 0) {
  2079. X            struct ufs_args a;
  2080. X            if (umove(tcp, tcp->u_arg[3], &a) < 0)
  2081. X                return 0;
  2082. X            printstr(tcp, (int)a.fspec, -1);
  2083. X        } else if (strcmp(type, "lo") == 0) {
  2084. X            struct lo_args a;
  2085. X            if (umove(tcp, tcp->u_arg[3], &a) < 0)
  2086. X                return 0;
  2087. X            printstr(tcp, (int)a.fsdir, -1);
  2088. X        } else if (strcmp(type, "nfs") == 0) {
  2089. X            struct nfs_args a;
  2090. X            if (umove(tcp, tcp->u_arg[3], &a) < 0)
  2091. X                return 0;
  2092. X            tprintf("[");
  2093. X            printsock(tcp, (int) a.addr);
  2094. X            tprintf(", ");
  2095. X            if (!printflags(nfsflags, a.flags))
  2096. X                tprintf("NFSMNT_???");
  2097. X            tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
  2098. X                a.wsize, a.rsize, a.timeo, a.retrans);
  2099. X            if (a.flags & NFSMNT_HOSTNAME && a.hostname)
  2100. X                printstr(tcp, (int)a.hostname, -1);
  2101. X            else
  2102. X                tprintf("%#lx", (unsigned long) a.hostname);
  2103. X            tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
  2104. X                a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
  2105. X            if ((a.flags & NFSMNT_SECURE) && a.netname)
  2106. X                printstr(tcp, (int) a.netname, -1);
  2107. X            else
  2108. X                tprintf("%#lx", (unsigned long) a.netname);
  2109. X            tprintf("]");
  2110. X        } else if (strcmp(type, "rfs") == 0) {
  2111. X            struct rfs_args a;
  2112. X            struct token t;
  2113. X            if (umove(tcp, tcp->u_arg[3], &a) < 0)
  2114. X                return 0;
  2115. X            tprintf("[");
  2116. X            printstr(tcp, (int)a.rmtfs, -1);
  2117. X            if (umove(tcp, (int)a.token, &t) < 0)
  2118. X                return 0;
  2119. X            tprintf(", %u, %s]", t.t_id, t.t_uname);
  2120. X        } else if (strcmp(type, "pcfs") == 0) {
  2121. X            struct pc_args a;
  2122. X            if (umove(tcp, tcp->u_arg[3], &a) < 0)
  2123. X                return 0;
  2124. X            printstr(tcp, (int)a.fspec, -1);
  2125. X        }
  2126. X    }
  2127. X    return 0;
  2128. X}
  2129. X
  2130. Xint
  2131. Xsys_unmount(tcp)
  2132. Xstruct tcb *tcp;
  2133. X{
  2134. X    if (entering(tcp)) {
  2135. X        printstr(tcp, tcp->u_arg[0], -1);
  2136. X    }
  2137. X    return 0;
  2138. X}
  2139. X
  2140. Xint
  2141. Xsys_umount(tcp)
  2142. Xstruct tcb *tcp;
  2143. X{
  2144. X    return sys_unmount(tcp);
  2145. X}
  2146. X
  2147. Xint
  2148. Xsys_auditsys(tcp)
  2149. Xstruct tcb *tcp;
  2150. X{
  2151. X    /* XXX - no information available */
  2152. X    return printargs(tcp);
  2153. X}
  2154. X
  2155. Xstatic struct xlat ex_auth_flags[] = {
  2156. X    { AUTH_UNIX,    "AUTH_UNIX"    },
  2157. X    { AUTH_DES,    "AUTH_DES"    },
  2158. X    { 0,        NULL        },
  2159. X};
  2160. X
  2161. Xint
  2162. Xsys_exportfs(tcp)
  2163. Xstruct tcb *tcp;
  2164. X{
  2165. X    struct export e;
  2166. X    int i;
  2167. X
  2168. X    if (entering(tcp)) {
  2169. X        printstr(tcp, tcp->u_arg[0], -1);
  2170. X        if (umove(tcp, tcp->u_arg[1], &e) < 0) {
  2171. X            tprintf("%#x", tcp->u_arg[1]);
  2172. X            return 0;
  2173. X        }
  2174. X        tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
  2175. X        printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
  2176. X        tprintf(", roots:[");
  2177. X        if (e.ex_auth == AUTH_UNIX) {
  2178. X            for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
  2179. X                printsock(tcp,
  2180. X                    (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
  2181. X            }
  2182. X            tprintf("], writers:[");
  2183. X            for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
  2184. X                printsock(tcp,
  2185. X                    (int)&e.ex_writeaddrs.addrvec[i]);
  2186. X            }
  2187. X            tprintf("]");
  2188. X        } else {
  2189. X            for (i=0; i<e.ex_u.exdes.nnames; i++) {
  2190. X                printsock(tcp,
  2191. X                    (int)&e.ex_u.exdes.rootnames[i]);
  2192. X                tprintf(", ");
  2193. X            }
  2194. X            tprintf("], window:%u", e.ex_u.exdes.window);
  2195. X        }
  2196. X        tprintf("}");
  2197. X    }
  2198. X    return 0;
  2199. X}
  2200. X
  2201. Xstatic struct xlat sysconflimits[] = {
  2202. X#ifdef    _SC_ARG_MAX
  2203. X    { _SC_ARG_MAX,    "_SC_ARG_MAX"    },    /* space for argv & envp */
  2204. X#endif
  2205. X#ifdef    _SC_CHILD_MAX
  2206. X    { _SC_CHILD_MAX,    "_SC_CHILD_MAX"    },    /* maximum children per process??? */
  2207. X#endif
  2208. X#ifdef    _SC_CLK_TCK
  2209. X    { _SC_CLK_TCK,    "_SC_CLK_TCK"    },    /* clock ticks/sec */
  2210. X#endif
  2211. X#ifdef    _SC_NGROUPS_MAX
  2212. X    { _SC_NGROUPS_MAX,    "_SC_NGROUPS_MAX"    },    /* number of groups if multple supp. */
  2213. X#endif
  2214. X#ifdef    _SC_OPEN_MAX
  2215. X    { _SC_OPEN_MAX,    "_SC_OPEN_MAX"    },    /* max open files per process */
  2216. X#endif
  2217. X#ifdef    _SC_JOB_CONTROL
  2218. X    { _SC_JOB_CONTROL,    "_SC_JOB_CONTROL"    },    /* do we have job control */
  2219. X#endif
  2220. X#ifdef    _SC_SAVED_IDS
  2221. X    { _SC_SAVED_IDS,    "_SC_SAVED_IDS"    },    /* do we have saved uid/gids */
  2222. X#endif
  2223. X#ifdef    _SC_VERSION
  2224. X    { _SC_VERSION,    "_SC_VERSION"    },    /* POSIX version supported */
  2225. X#endif
  2226. X    { 0,        NULL        },
  2227. X};
  2228. X
  2229. Xstatic struct xlat pathconflimits[] = {
  2230. X#ifdef    _PC_LINK_MAX
  2231. X    { _PC_LINK_MAX,    "_PC_LINK_MAX"    },    /* max links to file/dir */
  2232. X#endif
  2233. X#ifdef    _PC_MAX_CANON
  2234. X    { _PC_MAX_CANON,    "_PC_MAX_CANON"    },    /* max line length */
  2235. X#endif
  2236. X#ifdef    _PC_MAX_INPUT
  2237. X    { _PC_MAX_INPUT,    "_PC_MAX_INPUT"    },    /* max "packet" to a tty device */
  2238. X#endif
  2239. X#ifdef    _PC_NAME_MAX
  2240. X    { _PC_NAME_MAX,    "_PC_NAME_MAX"    },    /* max pathname component length */
  2241. X#endif
  2242. X#ifdef    _PC_PATH_MAX
  2243. X    { _PC_PATH_MAX,    "_PC_PATH_MAX"    },    /* max pathname length */
  2244. X#endif
  2245. X#ifdef    _PC_PIPE_BUF
  2246. X    { _PC_PIPE_BUF,    "_PC_PIPE_BUF"    },    /* size of a pipe */
  2247. X#endif
  2248. X#ifdef    _PC_CHOWN_RESTRICTED
  2249. X    { _PC_CHOWN_RESTRICTED,    "_PC_CHOWN_RESTRICTED"    },    /* can we give away files */
  2250. X#endif
  2251. X#ifdef    _PC_NO_TRUNC
  2252. X    { _PC_NO_TRUNC,    "_PC_NO_TRUNC"    },    /* trunc or error on >NAME_MAX */
  2253. X#endif
  2254. X#ifdef    _PC_VDISABLE
  2255. X    { _PC_VDISABLE,    "_PC_VDISABLE"    },    /* best char to shut off tty c_cc */
  2256. X#endif
  2257. X    { 0,        NULL        },
  2258. X};
  2259. X
  2260. Xint
  2261. Xsys_sysconf(tcp)
  2262. Xstruct tcb *tcp;
  2263. X{
  2264. X    if (entering(tcp)) {
  2265. X        printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
  2266. X    }
  2267. X    return 0;
  2268. X}
  2269. X
  2270. Xint
  2271. Xsys_pathconf(tcp)
  2272. Xstruct tcb *tcp;
  2273. X{
  2274. X    if (entering(tcp)) {
  2275. X        printstr(tcp, tcp->u_arg[0], -1);
  2276. X        tprintf(", ");
  2277. X        printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
  2278. X    }
  2279. X    return 0;
  2280. X}
  2281. X
  2282. Xint
  2283. Xsys_fpathconf(tcp)
  2284. Xstruct tcb *tcp;
  2285. X{
  2286. X    if (entering(tcp)) {
  2287. X        tprintf("%u, ", tcp->u_arg[0]);
  2288. X        printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
  2289. X    }
  2290. X    return 0;
  2291. X}
  2292. X
  2293. X#endif /* SUNOS4 */
  2294. X
  2295. X#ifdef SVR4
  2296. X
  2297. X#include <sys/sysconfig.h>
  2298. X#include <sys/utsname.h>
  2299. X#include <sys/systeminfo.h>
  2300. X
  2301. Xstatic struct xlat sysconfig_options[] = {
  2302. X#ifdef _CONFIG_NGROUPS
  2303. X    { _CONFIG_NGROUPS,        "_CONFIG_NGROUPS"        },
  2304. X#endif
  2305. X#ifdef _CONFIG_CHILD_MAX
  2306. X    { _CONFIG_CHILD_MAX,        "_CONFIG_CHILD_MAX"        },
  2307. X#endif
  2308. X#ifdef _CONFIG_OPEN_FILES
  2309. X    { _CONFIG_OPEN_FILES,        "_CONFIG_OPEN_FILES"        },
  2310. X#endif
  2311. X#ifdef _CONFIG_POSIX_VER
  2312. X    { _CONFIG_POSIX_VER,        "_CONFIG_POSIX_VER"        },
  2313. X#endif
  2314. X#ifdef _CONFIG_PAGESIZE
  2315. X    { _CONFIG_PAGESIZE,        "_CONFIG_PAGESIZE"        },
  2316. X#endif
  2317. X#ifdef _CONFIG_CLK_TCK
  2318. X    { _CONFIG_CLK_TCK,        "_CONFIG_CLK_TCK"        },
  2319. X#endif
  2320. X#ifdef _CONFIG_XOPEN_VER
  2321. X    { _CONFIG_XOPEN_VER,        "_CONFIG_XOPEN_VER"        },
  2322. X#endif
  2323. X#ifdef _CONFIG_PROF_TCK
  2324. X    { _CONFIG_PROF_TCK,        "_CONFIG_PROF_TCK"        },
  2325. X#endif
  2326. X#ifdef _CONFIG_NPROC_CONF
  2327. X    { _CONFIG_NPROC_CONF,        "_CONFIG_NPROC_CONF"        },
  2328. X#endif
  2329. X#ifdef _CONFIG_NPROC_ONLN
  2330. X    { _CONFIG_NPROC_ONLN,        "_CONFIG_NPROC_ONLN"        },
  2331. X#endif
  2332. X#ifdef _CONFIG_AIO_LISTIO_MAX
  2333. X    { _CONFIG_AIO_LISTIO_MAX,    "_CONFIG_AIO_LISTIO_MAX"    },
  2334. X#endif
  2335. X#ifdef _CONFIG_AIO_MAX
  2336. X    { _CONFIG_AIO_MAX,        "_CONFIG_AIO_MAX"        },
  2337. X#endif
  2338. X#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
  2339. X    { _CONFIG_AIO_PRIO_DELTA_MAX,    "_CONFIG_AIO_PRIO_DELTA_MAX"    },
  2340. X#endif
  2341. X#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
  2342. X    { _CONFIG_DELAYTIMER_MAX,    "_CONFIG_DELAYTIMER_MAX"    },
  2343. X#endif
  2344. X#ifdef _CONFIG_MQ_OPEN_MAX
  2345. X    { _CONFIG_MQ_OPEN_MAX,        "_CONFIG_MQ_OPEN_MAX"        },
  2346. X#endif
  2347. X#ifdef _CONFIG_MQ_PRIO_MAX
  2348. X    { _CONFIG_MQ_PRIO_MAX,        "_CONFIG_MQ_PRIO_MAX"        },
  2349. X#endif
  2350. X#ifdef _CONFIG_RTSIG_MAX
  2351. X    { _CONFIG_RTSIG_MAX,        "_CONFIG_RTSIG_MAX"        },
  2352. X#endif
  2353. X#ifdef _CONFIG_SEM_NSEMS_MAX
  2354. X    { _CONFIG_SEM_NSEMS_MAX,    "_CONFIG_SEM_NSEMS_MAX"        },
  2355. X#endif
  2356. X#ifdef _CONFIG_SEM_VALUE_MAX
  2357. X    { _CONFIG_SEM_VALUE_MAX,    "_CONFIG_SEM_VALUE_MAX"        },
  2358. X#endif
  2359. X#ifdef _CONFIG_SIGQUEUE_MAX
  2360. X    { _CONFIG_SIGQUEUE_MAX,        "_CONFIG_SIGQUEUE_MAX"        },
  2361. X#endif
  2362. X#ifdef _CONFIG_SIGRT_MIN
  2363. X    { _CONFIG_SIGRT_MIN,        "_CONFIG_SIGRT_MIN"        },
  2364. X#endif
  2365. X#ifdef _CONFIG_SIGRT_MAX
  2366. X    { _CONFIG_SIGRT_MAX,        "_CONFIG_SIGRT_MAX"        },
  2367. X#endif
  2368. X#ifdef _CONFIG_TIMER_MAX
  2369. X    { _CONFIG_TIMER_MAX,        "_CONFIG_TIMER_MAX"        },
  2370. X#endif
  2371. X#ifdef _CONFIG_CONFIG_PHYS_PAGES
  2372. X    { _CONFIG_PHYS_PAGES,        "_CONFIG_PHYS_PAGES"        },
  2373. X#endif
  2374. X#ifdef _CONFIG_AVPHYS_PAGES
  2375. X    { _CONFIG_AVPHYS_PAGES,        "_CONFIG_AVPHYS_PAGES"        },
  2376. X#endif
  2377. X    { 0,                NULL                },
  2378. X};
  2379. X
  2380. Xint
  2381. Xsys_sysconfig(tcp)
  2382. Xstruct tcb *tcp;
  2383. X{
  2384. X    if (entering(tcp))
  2385. X        printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
  2386. X    return 0;
  2387. X}
  2388. X
  2389. Xstatic struct xlat sysinfo_options[] = {
  2390. X    { SI_SYSNAME,        "SI_SYSNAME"        },
  2391. X    { SI_HOSTNAME,        "SI_HOSTNAME"        },
  2392. X    { SI_RELEASE,        "SI_RELEASE"        },
  2393. X    { SI_VERSION,        "SI_VERSION"        },
  2394. X    { SI_MACHINE,        "SI_MACHINE"        },
  2395. X    { SI_ARCHITECTURE,    "SI_ARCHITECTURE"    },
  2396. X    { SI_HW_SERIAL,        "SI_HW_SERIAL"        },
  2397. X    { SI_HW_PROVIDER,    "SI_HW_PROVIDER"    },
  2398. X    { SI_SRPC_DOMAIN,    "SI_SRPC_DOMAIN"    },
  2399. X#ifdef SI_SET_HOSTNAME
  2400. X    { SI_SET_HOSTNAME,    "SI_SET_HOSTNAME"    },
  2401. X#endif
  2402. X#ifdef SI_SET_SRPC_DOMAIN
  2403. X    { SI_SET_SRPC_DOMAIN,    "SI_SET_SRPC_DOMAIN"    },
  2404. X#endif
  2405. X#ifdef SI_SET_KERB_REALM
  2406. X    { SI_SET_KERB_REALM,    "SI_SET_KERB_REALM"    },
  2407. X#endif
  2408. X#ifdef     SI_KERB_REALM
  2409. X    { SI_KERB_REALM,    "SI_KERB_REALM"        },
  2410. X#endif
  2411. X    { 0,            NULL            },
  2412. X};
  2413. X
  2414. Xint
  2415. Xsys_sysinfo(tcp)
  2416. Xstruct tcb *tcp;
  2417. X{
  2418. X    if (entering(tcp)) {
  2419. X        printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
  2420. X        tprintf(", ");
  2421. X    }
  2422. X    else {
  2423. X        /* Technically some calls write values.  So what. */
  2424. X        if (syserror(tcp))
  2425. X            tprintf("%#x", tcp->u_arg[1]);
  2426. X        else
  2427. X            printpath(tcp, tcp->u_arg[1]);
  2428. X        tprintf(", %u", tcp->u_arg[2]);
  2429. X    }
  2430. X    return 0;
  2431. X}
  2432. X
  2433. X#endif /* SVR4 */
  2434. END_OF_FILE
  2435.   if test 14134 -ne `wc -c <'strace-3.0/system.c'`; then
  2436.     echo shar: \"'strace-3.0/system.c'\" unpacked with wrong size!
  2437.   fi
  2438.   # end of 'strace-3.0/system.c'
  2439. fi
  2440. echo shar: End of archive 6 \(of 10\).
  2441. cp /dev/null ark6isdone
  2442. MISSING=""
  2443. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  2444.     if test ! -f ark${I}isdone ; then
  2445.     MISSING="${MISSING} ${I}"
  2446.     fi
  2447. done
  2448. if test "${MISSING}" = "" ; then
  2449.     echo You have unpacked all 10 archives.
  2450.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2451. else
  2452.     echo You still must unpack the following archives:
  2453.     echo "        " ${MISSING}
  2454. fi
  2455. exit 0
  2456. exit 0 # Just in case...
  2457.