home *** CD-ROM | disk | FTP | other *** search
- From: jrs@world.std.com (Rick Sladkey)
- Newsgroups: comp.sources.misc
- Subject: v43i080: strace - system call tracer for sunos, linux, svr4, solaris2, Part06/10
- Date: 9 Jul 1994 15:49:26 -0500
- Organization: Sterling Software
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <2vn2gm$9ct@sparky.sterling.com>
- X-Md4-Signature: 7f48cb205bc5c4a323faf6ec64071e33
-
- Submitted-by: jrs@world.std.com (Rick Sladkey)
- Posting-number: Volume 43, Issue 80
- Archive-name: strace/part06
- Environment: sunos, linux, svr4, solaris
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: strace-3.0/config.sub strace-3.0/net.c strace-3.0/strace.1
- # strace-3.0/system.c
- # Wrapped by kent@sparky on Sat Jul 9 15:42:56 1994
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 6 (of 10)."'
- if test -f 'strace-3.0/config.sub' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'strace-3.0/config.sub'\"
- else
- echo shar: Extracting \"'strace-3.0/config.sub'\" \(14713 characters\)
- sed "s/^X//" >'strace-3.0/config.sub' <<'END_OF_FILE'
- X#!/bin/sh
- X# Configuration validation subroutine script, version 1.1.
- X# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
- X# This file is (in principle) common to ALL GNU software.
- X# The presence of a machine in this file suggests that SOME GNU software
- X# can handle that machine. It does not imply ALL GNU software can.
- X
- X#This file is free software; you can redistribute it and/or modify
- X#it under the terms of the GNU General Public License as published by
- X#the Free Software Foundation; either version 2 of the License, or
- X#(at your option) any later version.
- X
- X#This program is distributed in the hope that it will be useful,
- X#but WITHOUT ANY WARRANTY; without even the implied warranty of
- X#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X#GNU General Public License for more details.
- X
- X#You should have received a copy of the GNU General Public License
- X#along with this program; if not, write to the Free Software
- X#Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X
- X
- X# Configuration subroutine to validate and canonicalize a configuration type.
- X# Supply the specified configuration type as an argument.
- X# If it is invalid, we print an error message on stderr and exit with code 1.
- X# Otherwise, we print the canonical config type on stdout and succeed.
- X
- X# This file is supposed to be the same for all GNU packages
- X# and recognize all the CPU types, system types and aliases
- X# that are meaningful with *any* GNU software.
- X# Each package is responsible for reporting which valid configurations
- X# it does not support. The user should be able to distinguish
- X# a failure to support a valid configuration from a meaningless
- X# configuration.
- X
- X# The goal of this file is to map all the various variations of a given
- X# machine specification into a single specification in the form:
- X# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
- X# It is wrong to echo any other type of specification.
- X
- X# First pass through any local machine types.
- Xcase $1 in
- X *local*)
- X echo $1
- X exit 0
- X ;;
- X *)
- X ;;
- Xesac
- X
- X# Separate what the user gave into CPU-COMPANY and OS (if any).
- Xbasic_machine=`echo $1 | sed 's/-[^-]*$//'`
- Xif [ $basic_machine != $1 ]
- Xthen os=`echo $1 | sed 's/.*-/-/'`
- Xelse os=; fi
- X
- X### Let's recognize common machines as not being operating systems so
- X### that things like config.sub decstation-3100 work. We also
- X### recognize some manufacturers as not being operating systems, so we
- X### can provide default operating systems below.
- Xcase $os in
- X -sun*os*)
- X # Prevent following clause from handling this invalid input.
- X ;;
- X -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- X -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- X -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \
- X -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- X -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- X -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
- X os=
- X basic_machine=$1
- X ;;
- X -hiux*)
- X os==-hiuxwe2
- X ;;
- X -sco4)
- X os=-sco3.2v4
- X basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
- X ;;
- X -sco3.2.[4-9]*)
- X os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- X basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
- X ;;
- X -sco3.2v[4-9]*)
- X # Don't forget version if it is 3.2v4 or newer.
- X basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
- X ;;
- X -sco*)
- X os=-sco3.2v2
- X basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
- X ;;
- X -isc)
- X os=-isc2.2
- X basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
- X ;;
- X -clix*)
- X basic_machine=clipper-intergraph
- X ;;
- X -isc*)
- X basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
- X ;;
- X -lynx)
- X os=-lynxos
- X ;;
- Xesac
- X
- X# Decode aliases for certain CPU-COMPANY combinations.
- Xcase $basic_machine in
- X # Recognize the basic CPU types without company name.
- X # Some are omitted here because they have special meanings below.
- X tahoe | i[34]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
- X | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
- X | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
- X | powerpc)
- X basic_machine=$basic_machine-unknown
- X ;;
- X # Object if more than one company name word.
- X *-*-*)
- X echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- X exit 1
- X ;;
- X # Recognize the basic CPU types with company name.
- X vax-* | tahoe-* | i[34]86-* | i860-* | m68k-* | m68000-* | m88k-* \
- X | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
- X | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- X | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
- X | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
- X | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
- X | sh-* | powerpc-*)
- X ;;
- X # Recognize the various machine names and aliases which stand
- X # for a CPU type and a company and sometimes even an OS.
- X vaxv)
- X basic_machine=vax-dec
- X os=-sysv
- X ;;
- X vms)
- X basic_machine=vax-dec
- X os=-vms
- X ;;
- X i370-ibm* | ibm*)
- X basic_machine=i370-ibm
- X os=-mvs
- X ;;
- X# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- X i[34]86v32)
- X basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
- X os=-sysv32
- X ;;
- X i[34]86v4*)
- X basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
- X os=-sysv4
- X ;;
- X i[34]86v)
- X basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
- X os=-sysv
- X ;;
- X i[34]86sol2)
- X basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
- X os=-solaris2
- X ;;
- X spur)
- X basic_machine=spur-unknown
- X ;;
- X paragon)
- X basic_machine=i860-intel
- X os=-osf
- X ;;
- X alliant | fx80)
- X basic_machine=fx80-alliant
- X ;;
- X convex-c1)
- X basic_machine=c1-convex
- X os=-bsd
- X ;;
- X convex-c2)
- X basic_machine=c2-convex
- X os=-bsd
- X ;;
- X convex-c32)
- X basic_machine=c32-convex
- X os=-bsd
- X ;;
- X convex-c34)
- X basic_machine=c34-convex
- X os=-bsd
- X ;;
- X convex-c38)
- X basic_machine=c38-convex
- X os=-bsd
- X ;;
- X m88k-omron*)
- X basic_machine=m88k-omron
- X ;;
- X merlin)
- X basic_machine=ns32k-utek
- X os=-sysv
- X ;;
- X crds | unos)
- X basic_machine=m68k-crds
- X ;;
- X elxsi)
- X basic_machine=elxsi-elxsi
- X os=-bsd
- X ;;
- X encore | umax | mmax)
- X basic_machine=ns32k-encore
- X ;;
- X genix)
- X basic_machine=ns32k-ns
- X ;;
- X iris | iris4d)
- X basic_machine=mips-sgi
- X case $os in
- X -irix*)
- X ;;
- X *)
- X os=-irix4
- X ;;
- X esac
- X ;;
- X news | news700 | news800 | news900)
- X basic_machine=m68k-sony
- X os=-newsos
- X ;;
- X 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- X basic_machine=m68000-att
- X ;;
- X 3b*)
- X basic_machine=we32k-att
- X ;;
- X delta | 3300 | motorola-3300 | motorola-delta \
- X | 3300-motorola | delta-motorola)
- X basic_machine=m68k-motorola
- X ;;
- X balance)
- X basic_machine=ns32k-sequent
- X os=-dynix
- X ;;
- X pc532)
- X basic_machine=ns32k-pc532
- X ;;
- X symmetry)
- X basic_machine=i386-sequent
- X os=-dynix
- X ;;
- X sun2)
- X basic_machine=m68000-sun
- X ;;
- X sun2os3)
- X basic_machine=m68000-sun
- X os=-sunos3
- X ;;
- X sun2os4)
- X basic_machine=m68000-sun
- X os=-sunos4
- X ;;
- X sun3os3)
- X basic_machine=m68k-sun
- X os=-sunos3
- X ;;
- X sun3os4)
- X basic_machine=m68k-sun
- X os=-sunos4
- X ;;
- X sun4os3)
- X basic_machine=sparc-sun
- X os=-sunos3
- X ;;
- X sun4os4)
- X basic_machine=sparc-sun
- X os=-sunos4
- X ;;
- X sun3)
- X basic_machine=m68k-sun
- X ;;
- X sun4)
- X basic_machine=sparc-sun
- X ;;
- X pbd)
- X basic_machine=sparc-tti
- X ;;
- X pbb)
- X basic_machine=m68k-tti
- X ;;
- X sun386 | sun386i | roadrunner)
- X basic_machine=i386-sun
- X ;;
- X ps2)
- X basic_machine=i386-ibm
- X ;;
- X fx2800)
- X basic_machine=i860-alliant
- X ;;
- X next)
- X basic_machine=m68k-next
- X os=-bsd
- X ;;
- X amiga)
- X basic_machine=m68k-cbm
- X ;;
- X amigados)
- X basic_machine=m68k-cbm
- X os=-amigados
- X ;;
- X amigaunix | amix)
- X basic_machine=m68k-cbm
- X os=-sysv4
- X ;;
- X hp9k3[2-9][0-9])
- X basic_machine=m68k-hp
- X ;;
- X hp9k31[0-9] | hp9k2[0-9][0-9])
- X basic_machine=m68000-hp
- X ;;
- X hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
- X basic_machine=hppa1.1-hp
- X ;;
- X hp9k8[0-9][0-9] | hp8[0-9][0-9])
- X basic_machine=hppa1.0-hp
- X ;;
- X h3050r* | hiux*)
- X basic_machine=hppa1.1-hitachi
- X os=-hiuxwe2
- X ;;
- X pa-hitachi)
- X basic_machine=hppa1.1-hitachi
- X os=-hiuxwe2
- X ;;
- X isi68 | isi)
- X basic_machine=m68k-isi
- X os=-sysv
- X ;;
- X apollo68)
- X basic_machine=m68k-apollo
- X os=-sysv
- X ;;
- X altos | altos3068)
- X basic_machine=m68k-altos
- X ;;
- X miniframe)
- X basic_machine=m68000-convergent
- X ;;
- X tower | tower-32)
- X basic_machine=m68k-ncr
- X ;;
- X news-3600 | risc-news)
- X basic_machine=mips-sony
- X os=-newsos
- X ;;
- X decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
- X basic_machine=mips-dec
- X ;;
- X magnum | m3230)
- X basic_machine=mips-mips
- X os=-sysv
- X ;;
- X gmicro)
- X basic_machine=tron-gmicro
- X os=-sysv
- X ;;
- X rtpc | rtpc-*)
- X basic_machine=romp-ibm
- X ;;
- X am29k)
- X basic_machine=a29k-none
- X os=-bsd
- X ;;
- X amdahl)
- X basic_machine=580-amdahl
- X os=-sysv
- X ;;
- X cray | ymp)
- X basic_machine=ymp-cray
- X os=-unicos
- X ;;
- X cray2)
- X basic_machine=cray2-cray
- X os=-unicos
- X ;;
- X xmp)
- X basic_machine=xmp-cray
- X os=-unicos
- X ;;
- X delta88)
- X basic_machine=m88k-motorola
- X os=-sysv3
- X ;;
- X dpx2* | dpx2*-bull)
- X basic_machine=m68k-bull
- X os=-sysv3
- X ;;
- X sps7)
- X basic_machine=m68k-bull
- X os=-sysv2
- X ;;
- X ebmon29k)
- X basic_machine=a29k-amd
- X os=-ebmon
- X ;;
- X h8300hms)
- X basic_machine=h8300-hitachi
- X os=-hms
- X ;;
- X sh)
- X basic_machine=sh-hitachi
- X os=-hms
- X ;;
- X harris)
- X basic_machine=m88k-harris
- X os=-sysv3
- X ;;
- X hp300bsd)
- X basic_machine=m68k-hp
- X os=-bsd
- X ;;
- X hp300hpux)
- X basic_machine=m68k-hp
- X os=-hpux
- X ;;
- X hp9k2[0-9][0-9] | hp9k31[0-9])
- X basic_machine=m68000-hp
- X os=-hpux
- X ;;
- X hp9k3[2-9][0-9])
- X basic_machine=m68k-hp
- X os=-hpux
- X ;;
- X ncr3000)
- X basic_machine=i486-ncr
- X os=-sysv4
- X ;;
- X news1000)
- X basic_machine=m68030-sony
- X os=-newsos
- X ;;
- X nindy960)
- X basic_machine=i960-intel
- X os=-nindy
- X ;;
- X pn)
- X basic_machine=pn-gould
- X ;;
- X np1)
- X basic_machine=np1-gould
- X ;;
- X ultra3)
- X basic_machine=a29k-nyu
- X os=-sym1
- X ;;
- X vxworks960)
- X basic_machine=i960-wrs
- X os=-vxworks
- X ;;
- X vxworks68)
- X basic_machine=m68k-wrs
- X os=-vxworks
- X ;;
- X xps | xps100)
- X basic_machine=xps100-honeywell
- X ;;
- X none)
- X basic_machine=none-none
- X os=-none
- X ;;
- X
- X# Here we handle the default manufacturer of certain CPU types. It is in
- X# some cases the only manufacturer, in others, it is the most popular.
- X mips)
- X basic_machine=mips-mips
- X ;;
- X romp)
- X basic_machine=romp-ibm
- X ;;
- X rs6000)
- X basic_machine=rs6000-ibm
- X ;;
- X vax)
- X basic_machine=vax-dec
- X ;;
- X we32k)
- X basic_machine=we32k-att
- X ;;
- X sparc)
- X basic_machine=sparc-sun
- X ;;
- X cydra)
- X basic_machine=cydra-cydrome
- X ;;
- X orion)
- X basic_machine=orion-highlevel
- X ;;
- X orion105)
- X basic_machine=clipper-highlevel
- X ;;
- X *)
- X echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- X exit 1
- X ;;
- Xesac
- X
- X# Here we canonicalize certain aliases for manufacturers.
- Xcase $basic_machine in
- X *-digital*)
- X basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- X ;;
- X *-commodore*)
- X basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- X ;;
- X *)
- X ;;
- Xesac
- X
- X# Decode manufacturer-specific aliases for certain operating systems.
- X
- Xif [ x"$os" != x"" ]
- Xthen
- Xcase $os in
- X # -solaris* is a basic system type, with this one exception.
- X -solaris1 | -solaris1.*)
- X os=`echo $os | sed -e 's|solaris1|sunos4|'`
- X ;;
- X -solaris)
- X os=-solaris2
- X ;;
- X # First accept the basic system types.
- X # The portable systems comes first.
- X # Each alternative must end in a *, to match a version number.
- X # -sysv* is not here because it comes later, after sysvr4.
- X -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- X | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]* | -hpux* \
- X | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- X | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
- X | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
- X | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
- X | -hiux* | -386bsd* | -netbsd* | -riscix* | -lynxos*)
- X ;;
- X -sunos5*)
- X os=`echo $os | sed -e 's|sunos5|solaris2|'`
- X ;;
- X -sunos6*)
- X os=`echo $os | sed -e 's|sunos6|solaris3|'`
- X ;;
- X -osfrose*)
- X os=-osfrose
- X ;;
- X -osf*)
- X os=-osf
- X ;;
- X -utek*)
- X os=-bsd
- X ;;
- X -dynix*)
- X os=-bsd
- X ;;
- X -acis*)
- X os=-aos
- X ;;
- X -ctix* | -uts*)
- X os=-sysv
- X ;;
- X -triton*)
- X os=-sysv3
- X ;;
- X -oss*)
- X os=-sysv3
- X ;;
- X -svr4)
- X os=-sysv4
- X ;;
- X -svr3)
- X os=-sysv3
- X ;;
- X -sysvr4)
- X os=-sysv4
- X ;;
- X # This must come after -sysvr4.
- X -sysv*)
- X ;;
- X -xenix)
- X os=-xenix
- X ;;
- X -none)
- X ;;
- X *)
- X # Get rid of the `-' at the beginning of $os.
- X os=`echo $1 | sed 's/[^-]*-//'`
- X echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- X exit 1
- X ;;
- Xesac
- Xelse
- X
- X# Here we handle the default operating systems that come with various machines.
- X# The value should be what the vendor currently ships out the door with their
- X# machine or put another way, the most popular os provided with the machine.
- X
- X# Note that if you're going to try to match "-MANUFACTURER" here (say,
- X# "-sun"), then you have to tell the case statement up towards the top
- X# that MANUFACTURER isn't an operating system. Otherwise, code above
- X# will signal an error saying that MANUFACTURER isn't an operating
- X# system, and we'll never get to this point.
- X
- Xcase $basic_machine in
- X *-acorn)
- X os=-riscix1.2
- X ;;
- X *-dec | vax-*)
- X os=-ultrix4.2
- X ;;
- X i386-sun)
- X os=-sunos4.0.2
- X ;;
- X m68000-sun)
- X os=-sunos3
- X # This also exists in the configure program, but was not the
- X # default.
- X # os=-sunos4
- X ;;
- X *-tti) # must be before sparc entry or we get the wrong os.
- X os=-sysv3
- X ;;
- X sparc-* | *-sun)
- X os=-sunos4.1.1
- X ;;
- X *-ibm)
- X os=-aix
- X ;;
- X *-hp)
- X os=-hpux
- X ;;
- X *-hitachi)
- X os=-hiux
- X ;;
- X i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- X os=-sysv
- X ;;
- X *-cbm)
- X os=-amigados
- X ;;
- X *-dg)
- X os=-dgux
- X ;;
- X *-dolphin)
- X os=-sysv3
- X ;;
- X m88k-omron*)
- X os=-luna
- X ;;
- X *-sequent)
- X os=-bsd
- X ;;
- X *-crds)
- X os=-unos
- X ;;
- X *-ns)
- X os=-genix
- X ;;
- X i370-*)
- X os=-mvs
- X ;;
- X *-next)
- X os=-bsd
- X ;;
- X i[34]86-*)
- X os=-sco3.2v2
- X ;;
- X *-gould)
- X os=-sysv
- X ;;
- X *-highlevel)
- X os=-bsd
- X ;;
- X *-encore)
- X os=-bsd
- X ;;
- X *-sgi)
- X os=-irix
- X ;;
- X *-masscomp)
- X os=-rtu
- X ;;
- X *)
- X os=-none
- X ;;
- Xesac
- Xfi
- X
- X# Here we handle the case where we know the os, and the CPU type, but not the
- X# manufacturer. We pick the logical manufacturer.
- Xvendor=unknown
- Xcase $basic_machine in
- X *-unknown)
- X case $os in
- X -riscix*)
- X vendor=acorn
- X ;;
- X -sunos*)
- X vendor=sun
- X ;;
- X -lynxos*)
- X vendor=lynx
- X ;;
- X -aix*)
- X vendor=ibm
- X ;;
- X -hpux*)
- X vendor=hp
- X ;;
- X -hiux*)
- X vendor=hitachi
- X ;;
- X -unos*)
- X vendor=crds
- X ;;
- X -dgux*)
- X vendor=dg
- X ;;
- X -luna*)
- X vendor=omron
- X ;;
- X -genix*)
- X vendor=ns
- X ;;
- X -mvs*)
- X vendor=ibm
- X ;;
- X esac
- X basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- X ;;
- Xesac
- X
- Xecho $basic_machine$os
- END_OF_FILE
- if test 14713 -ne `wc -c <'strace-3.0/config.sub'`; then
- echo shar: \"'strace-3.0/config.sub'\" unpacked with wrong size!
- fi
- chmod +x 'strace-3.0/config.sub'
- # end of 'strace-3.0/config.sub'
- fi
- if test -f 'strace-3.0/net.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'strace-3.0/net.c'\"
- else
- echo shar: Extracting \"'strace-3.0/net.c'\" \(12557 characters\)
- sed "s/^X//" >'strace-3.0/net.c' <<'END_OF_FILE'
- X/*
- X * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
- X * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
- X * Copyright (c) 1993, 1994 Rick Sladkey <jrs@world.std.com>
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by Paul Kranenburg,
- X * Branko Lankester and Rick Sladkey.
- X * 4. The name of the author may not be used to endorse or promote products
- X * derived from this software without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * net.c,v 2.21 1994/03/21 05:45:31 jrs Exp
- X */
- X
- X#include "defs.h"
- X
- X#include <sys/stat.h>
- X#include <sys/socket.h>
- X#include <sys/un.h>
- X#include <netinet/in.h>
- X#include <arpa/inet.h>
- X
- X#ifndef PF_UNSPEC
- X#define PF_UNSPEC AF_UNSPEC
- X#endif
- X
- Xstatic struct xlat domains[] = {
- X { PF_UNSPEC, "PF_UNSPEC" },
- X { PF_UNIX, "PF_UNIX" },
- X { PF_INET, "PF_INET" },
- X#ifdef PF_ISO
- X { PF_ISO, "PF_ISO" },
- X#endif
- X#ifdef PF_IMPLINK
- X { PF_IMPLINK, "PF_IMPLINK" },
- X#endif
- X { 0, NULL },
- X};
- Xstatic struct xlat socktypes[] = {
- X { SOCK_STREAM, "SOCK_STREAM" },
- X { SOCK_DGRAM, "SOCK_DGRAM" },
- X#ifdef SOCK_RAW
- X { SOCK_RAW, "SOCK_RAW" },
- X#endif
- X#ifdef SOCK_SEQPACKET
- X { SOCK_SEQPACKET,"SOCK_SEQPACKET"},
- X#endif
- X#ifdef SOCK_RDM
- X { SOCK_RDM, "SOCK_RDM" },
- X#endif
- X { 0, NULL },
- X};
- Xstatic struct xlat protocols[] = {
- X { IPPROTO_IP, "IPPROTO_IP" },
- X { IPPROTO_ICMP, "IPPROTO_ICMP" },
- X { IPPROTO_TCP, "IPPROTO_TCP" },
- X { IPPROTO_UDP, "IPPROTO_UDP" },
- X#ifdef IPPROTO_GGP
- X { IPPROTO_GGP, "IPPROTO_GGP" },
- X#endif
- X#ifdef IPPROTO_EGP
- X { IPPROTO_EGP, "IPPROTO_EGP" },
- X#endif
- X#ifdef IPPROTO_PUP
- X { IPPROTO_PUP, "IPPROTO_PUP" },
- X#endif
- X#ifdef IPPROTO_IDP
- X { IPPROTO_IDP, "IPPROTO_IDP" },
- X#endif
- X#ifdef IPPROTO_IGMP
- X { IPPROTO_IGMP, "IPPROTO_IGMP" },
- X#endif
- X#ifdef IPPROTO_HELLO
- X { IPPROTO_HELLO,"IPPROTO_HELLO" },
- X#endif
- X#ifdef IPPROTO_ND
- X { IPPROTO_ND, "IPPROTO_ND" },
- X#endif
- X#ifdef IPPROTO_RAW
- X { IPPROTO_RAW, "IPPROTO_RAW" },
- X#endif
- X#ifdef IPPROTO_MAX
- X { IPPROTO_MAX, "IPPROTO_MAX" },
- X#endif
- X { 0, NULL },
- X};
- Xstatic struct xlat msg_flags[] = {
- X { MSG_OOB, "MSG_OOB" },
- X#ifdef MSG_DONTROUTE
- X { MSG_DONTROUTE,"MSG_DONTROUTE" },
- X#endif
- X#ifdef MSG_PEEK
- X { MSG_PEEK, "MSG_PEEK" },
- X#endif
- X { 0, NULL },
- X};
- X
- Xstatic struct xlat sockoptions[] = {
- X#ifdef SO_DEBUG
- X { SO_DEBUG, "SO_DEBUG" },
- X#endif
- X#ifdef SO_REUSEADDR
- X { SO_REUSEADDR, "SO_REUSEADDR" },
- X#endif
- X#ifdef SO_KEEPALIVE
- X { SO_KEEPALIVE, "SO_KEEPALIVE" },
- X#endif
- X#ifdef SO_DONTROUTE
- X { SO_DONTROUTE, "SO_DONTROUTE" },
- X#endif
- X#ifdef SO_BROADCAST
- X { SO_BROADCAST, "SO_BROADCAST" },
- X#endif
- X#ifdef SO_LINGER
- X { SO_LINGER, "SO_LINGER" },
- X#endif
- X#ifdef SO_OOBINLINE
- X { SO_OOBINLINE, "SO_OOBINLINE" },
- X#endif
- X#ifdef SO_TYPE
- X { SO_TYPE, "SO_TYPE" },
- X#endif
- X#ifdef SO_ERROR
- X { SO_ERROR, "SO_ERROR" },
- X#endif
- X#ifdef SO_SNDBUF
- X { SO_SNDBUF, "SO_SNDBUF" },
- X#endif
- X#ifdef SO_RCVBUF
- X { SO_RCVBUF, "SO_RCVBUF" },
- X#endif
- X#ifdef SO_NO_CHECK
- X { SO_NO_CHECK, "SO_NO_CHECK" },
- X#endif
- X#ifdef SO_PRIORITY
- X { SO_PRIORITY, "SO_PRIORITY" },
- X#endif
- X#ifdef SO_ACCEPTCONN
- X { SO_ACCEPTCONN,"SO_ACCEPTCONN" },
- X#endif
- X#ifdef SO_USELOOPBACK
- X { SO_USELOOPBACK,"SO_USELOOPBACK"},
- X#endif
- X#ifdef SO_SNDLOWAT
- X { SO_SNDLOWAT, "SO_SNDLOWAT" },
- X#endif
- X#ifdef SO_RCVLOWAT
- X { SO_RCVLOWAT, "SO_RCVLOWAT" },
- X#endif
- X#ifdef SO_SNDTIMEO
- X { SO_SNDTIMEO, "SO_SNDTIMEO" },
- X#endif
- X#ifdef SO_RCVTIMEO
- X { SO_RCVTIMEO, "SO_RCVTIMEO" },
- X#endif
- X { 0, NULL },
- X};
- X
- Xvoid
- Xprintsock(tcp, addr)
- Xstruct tcb *tcp;
- Xint addr;
- X{
- X struct sockaddr sa;
- X struct sockaddr_in *sin = (struct sockaddr_in *) &sa;
- X struct sockaddr_un sau;
- X
- X if (addr == 0) {
- X tprintf("NULL");
- X return;
- X }
- X if (!verbose(tcp)) {
- X tprintf("%#x", addr);
- X return;
- X }
- X if (umove(tcp, addr, &sa) < 0) {
- X tprintf("{...}");
- X return;
- X }
- X switch (sa.sa_family) {
- X case AF_UNIX:
- X if (umove(tcp, addr, &sau) < 0)
- X tprintf("{sun_family=AF_UNIX, ...}");
- X else
- X tprintf("{sun_family=AF_UNIX, sun_path=\"%s\"}",
- X sau.sun_path);
- X break;
- X case AF_INET:
- X tprintf("{sin_family=AF_INET, ");
- X tprintf("sin_port=htons(%u), sin_addr=inet_addr(\"%s\")}",
- X ntohs(sin->sin_port), inet_ntoa(sin->sin_addr));
- X break;
- X default:
- X tprintf("{sa_family=%u, sa_data=", sa.sa_family);
- X printstr(tcp, (int) &((struct sockaddr *) addr)->sa_data,
- X sizeof sa.sa_data);
- X tprintf("}");
- X break;
- X }
- X}
- X
- X#ifdef SUNOS4
- X
- Xstatic void
- Xprintmsghdr(tcp, addr)
- Xstruct tcb *tcp;
- Xint addr;
- X{
- X struct msghdr msg;
- X
- X umove(tcp, addr, &msg);
- X tprintf("{msg_name=%s, msg_namelen=%u, msg_iov=%#lx, msg_iovlen=%u, ",
- X msg.msg_name, msg.msg_namelen,
- X (unsigned long) msg.msg_iov, msg.msg_iovlen);
- X tprintf("msg_accrights=%#lx, msg_accrightslen=%u}",
- X (unsigned long) msg.msg_accrights, msg.msg_accrightslen);
- X}
- X#endif
- X
- Xint
- Xsys_socket(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printxval(domains, tcp->u_arg[0], "PF_???");
- X tprintf(", ");
- X printxval(socktypes, tcp->u_arg[1], "SOCK_???");
- X tprintf(", ");
- X if (tcp->u_arg[0] == PF_INET) {
- X printxval(protocols, tcp->u_arg[2], "IPPROTO_???");
- X } else {
- X tprintf(", %u", tcp->u_arg[2]);
- X }
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_bind(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%d, ", tcp->u_arg[0]);
- X printsock(tcp, tcp->u_arg[1]);
- X tprintf(", %u", tcp->u_arg[2]);
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_connect(tcp)
- Xstruct tcb *tcp;
- X{
- X return sys_bind(tcp);
- X}
- X
- Xint
- Xsys_listen(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%d, %u", tcp->u_arg[0], tcp->u_arg[1]);
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_accept(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%d, ", tcp->u_arg[0]);
- X } else if (!tcp->u_arg[2])
- X tprintf("%#x, NULL", tcp->u_arg[1]);
- X else {
- X if (tcp->u_arg[1] == 0 || syserror(tcp)) {
- X tprintf("%#x", tcp->u_arg[1]);
- X } else {
- X printsock(tcp, tcp->u_arg[1]);
- X }
- X tprintf(", ");
- X printnum(tcp, tcp->u_arg[2], "%u");
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_send(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%u, ", tcp->u_arg[0]);
- X printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
- X tprintf(", %u, ", tcp->u_arg[2]);
- X /* flags */
- X if (printflags(msg_flags, tcp->u_arg[3]) == 0)
- X tprintf("0");
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_sendto(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%u, ", tcp->u_arg[0]);
- X printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
- X tprintf(", %u, ", tcp->u_arg[2]);
- X /* flags */
- X if (printflags(msg_flags, tcp->u_arg[3]) == 0)
- X tprintf("0");
- X /* to address */
- X tprintf(", ");
- X printsock(tcp, tcp->u_arg[4]);
- X /* to length */
- X tprintf(", %u", tcp->u_arg[5]);
- X }
- X return 0;
- X}
- X
- X#ifdef SUNOS4
- X
- Xint
- Xsys_sendmsg(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%d, ", tcp->u_arg[0]);
- X printmsghdr(tcp, tcp->u_arg[1]);
- X /* flags */
- X tprintf(", ");
- X if (printflags(msg_flags, tcp->u_arg[2]) == 0)
- X tprintf("0");
- X }
- X return 0;
- X}
- X
- X#endif /* SUNOS4 */
- X
- Xint
- Xsys_recv(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%d, ", tcp->u_arg[0]);
- X } else {
- X if (syserror(tcp))
- X tprintf("%#x", tcp->u_arg[1]);
- X else
- X printstr(tcp, tcp->u_arg[1], tcp->u_rval);
- X
- X tprintf(", %u, ", tcp->u_arg[2]);
- X if (printflags(msg_flags, tcp->u_arg[3]) == 0)
- X tprintf("0");
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_recvfrom(tcp)
- Xstruct tcb *tcp;
- X{
- X int fromlen;
- X
- X if (entering(tcp)) {
- X tprintf("%u, ", tcp->u_arg[0]);
- X } else {
- X if (syserror(tcp)) {
- X tprintf("%#x, %u, %u, %#x, %#x",
- X tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3],
- X tcp->u_arg[4], tcp->u_arg[5]);
- X return 0;
- X }
- X /* buf */
- X printstr(tcp, tcp->u_arg[1], tcp->u_rval);
- X /* len */
- X tprintf(", %u, ", tcp->u_arg[2]);
- X /* flags */
- X if (printflags(msg_flags, tcp->u_arg[3]) == 0)
- X tprintf("0");
- X /* from address, len */
- X if (!tcp->u_arg[4] || !tcp->u_arg[5]) {
- X if (tcp->u_arg[4] == 0)
- X tprintf(", NULL");
- X else
- X tprintf(", %#x", tcp->u_arg[4]);
- X if (tcp->u_arg[5] == 0)
- X tprintf(", NULL");
- X else
- X tprintf(", %#x", tcp->u_arg[5]);
- X return 0;
- X }
- X if (umove(tcp, tcp->u_arg[5], &fromlen) < 0) {
- X tprintf(", {...}, [?]");
- X return 0;
- X }
- X tprintf(", ");
- X printsock(tcp, tcp->u_arg[4]);
- X /* from length */
- X tprintf(", [%u]", fromlen);
- X }
- X return 0;
- X}
- X
- X#ifdef SUNOS4
- X
- Xint
- Xsys_recvmsg(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%d, ", tcp->u_arg[0]);
- X } else {
- X if (syserror(tcp) || !verbose(tcp))
- X tprintf("%#x", tcp->u_arg[1]);
- X else
- X printmsghdr(tcp, tcp->u_arg[1]);
- X /* flags */
- X tprintf(", ");
- X if (printflags(msg_flags, tcp->u_arg[2]) == 0)
- X tprintf("0");
- X }
- X return 0;
- X}
- X
- X#endif /* SUNOS4 */
- X
- Xint
- Xsys_shutdown(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%d, %d", tcp->u_arg[0], tcp->u_arg[1]);
- X switch (tcp->u_arg[1]) {
- X case 0:
- X tprintf("%s", " /* receive */");
- X break;
- X case 1:
- X tprintf("%s", " /* send */");
- X break;
- X case 2:
- X tprintf("%s", " /* send and receive */");
- X break;
- X }
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_getsockname(tcp)
- Xstruct tcb *tcp;
- X{
- X return sys_accept(tcp);
- X}
- X
- Xint
- Xsys_getpeername(tcp)
- Xstruct tcb *tcp;
- X{
- X return sys_accept(tcp);
- X}
- X
- Xint
- Xsys_pipe(tcp)
- Xstruct tcb *tcp;
- X{
- X
- X#ifdef LINUX
- X int fds[2];
- X
- X if (exiting(tcp)) {
- X if (syserror(tcp)) {
- X tprintf("%#x", tcp->u_arg[0]);
- X return 0;
- X }
- X if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
- X tprintf("[...]");
- X else
- X tprintf("[%u, %u]", fds[0], fds[1]);
- X }
- X#endif /* LINUX */
- X
- X#ifdef SUNOS4
- X if (exiting(tcp))
- X tprintf("[%u, %u]", tcp->u_rval, getrval2(tcp));
- X#endif /* SUNOS4 */
- X
- X#ifdef SVR4
- X if (exiting(tcp))
- X tprintf("[%u, %u]", tcp->u_rval, getrval2(tcp));
- X#endif /* SVR4 */
- X
- X return 0;
- X}
- X
- Xint
- Xsys_socketpair(tcp)
- Xstruct tcb *tcp;
- X{
- X#ifdef LINUX
- X int fds[2];
- X#endif
- X
- X if (entering(tcp)) {
- X printxval(domains, tcp->u_arg[0], "PF_???");
- X tprintf(", ");
- X printxval(socktypes, tcp->u_arg[1], "SOCK_???");
- X tprintf(", ");
- X if (tcp->u_arg[0] == PF_INET) {
- X printxval(protocols, tcp->u_arg[2], "IPPROTO_???");
- X } else {
- X tprintf(", %u", tcp->u_arg[2]);
- X }
- X } else {
- X if (syserror(tcp)) {
- X tprintf("%#x", tcp->u_arg[3]);
- X return 0;
- X }
- X#ifdef LINUX
- X if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0)
- X tprintf("[...]");
- X else
- X tprintf(", [%u, %u]", fds[0], fds[1]);
- X#endif /* LINUX */
- X#ifdef SUNOS4
- X tprintf(", [%u, %u]", tcp->u_rval, getrval2(tcp));
- X#endif /* SUNOS4 */
- X#ifdef SVR4
- X tprintf(", [%u, %u]", tcp->u_rval, getrval2(tcp));
- X#endif /* SVR4 */
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_getsockopt(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%u, ", tcp->u_arg[0]);
- X if (tcp->u_arg[1] == SOL_SOCKET) {
- X tprintf("SOL_SOCKET, ");
- X printxval(sockoptions, tcp->u_arg[2], "SO_???");
- X tprintf(", ");
- X } else {
- X /* XXX - should know socket family here */
- X printxval(protocols, tcp->u_arg[1], "IPPROTO_???");
- X tprintf("%u, ", tcp->u_arg[2]);
- X }
- X } else {
- X if (syserror(tcp)) {
- X tprintf("%#x, %#x",
- X tcp->u_arg[3], tcp->u_arg[4]);
- X return 0;
- X }
- X printnum(tcp, tcp->u_arg[3], "%d");
- X tprintf(", ");
- X printnum(tcp, tcp->u_arg[4], "%d");
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_setsockopt(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%u, ", tcp->u_arg[0]);
- X if (tcp->u_arg[1] == SOL_SOCKET) {
- X tprintf("SOL_SOCKET, ");
- X printxval(sockoptions, tcp->u_arg[2], "SO_???");
- X tprintf(", ");
- X } else {
- X /* XXX - should know socket family here */
- X printxval(protocols, tcp->u_arg[1], "IPPROTO_???");
- X tprintf("%u, ", tcp->u_arg[2]);
- X }
- X printnum(tcp, tcp->u_arg[3], "%d");
- X tprintf(", %u", tcp->u_arg[4]);
- X }
- X return 0;
- X}
- END_OF_FILE
- if test 12557 -ne `wc -c <'strace-3.0/net.c'`; then
- echo shar: \"'strace-3.0/net.c'\" unpacked with wrong size!
- fi
- # end of 'strace-3.0/net.c'
- fi
- if test -f 'strace-3.0/strace.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'strace-3.0/strace.1'\"
- else
- echo shar: Extracting \"'strace-3.0/strace.1'\" \(15424 characters\)
- sed "s/^X//" >'strace-3.0/strace.1' <<'END_OF_FILE'
- X.\" Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
- X.\" Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
- X.\" Copyright (c) 1993, 1994 Rick Sladkey <jrs@world.std.com>
- X.\" All rights reserved.
- X.\"
- X.\" Redistribution and use in source and binary forms, with or without
- X.\" modification, are permitted provided that the following conditions
- X.\" are met:
- X.\" 1. Redistributions of source code must retain the above copyright
- X.\" notice, this list of conditions and the following disclaimer.
- X.\" 2. Redistributions in binary form must reproduce the above copyright
- X.\" notice, this list of conditions and the following disclaimer in the
- X.\" documentation and/or other materials provided with the distribution.
- X.\" 3. All advertising materials mentioning features or use of this software
- X.\" must display the following acknowledgement:
- X.\" This product includes software developed by Paul Kranenburg,
- X.\" Branko Lankester and Rick Sladkey.
- X.\" 4. The name of the author may not be used to endorse or promote products
- X.\" derived from this software without specific prior written permission.
- X.\"
- X.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- X.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- X.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- X.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- X.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- X.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- X.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- X.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- X.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- X.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X.\"
- X.\" strace.1,v 2.19 1994/06/29 04:43:24 jrs Exp
- X.\"
- X.de CW
- X.sp
- X.nf
- X.ft CW
- X..
- X.de CE
- X.ft
- X.fi
- X.sp
- X..
- X.TH STRACE 1 "94/06/21"
- X.SH NAME
- Xstrace \- trace system calls and signals
- X.SH SYNOPSIS
- X.B strace
- X[
- X.B \-dffhiqrtttTvxx
- X]
- X[
- X.BI \-a column
- X]
- X[
- X.BI \-e expr
- X]
- X\&...
- X[
- X.BI \-o file
- X]
- X[
- X.BI \-p pid
- X]
- X\&...
- X[
- X.BI \-s strsize
- X]
- X[
- X.I command
- X[
- X.I arg
- X\&...
- X]
- X]
- X.sp
- X.B strace
- X.B \-c
- X[
- X.BI \-e expr
- X]
- X\&...
- X[
- X.BI \-O overhead
- X]
- X[
- X.BI \-S sortby
- X]
- X[
- X.I command
- X[
- X.I arg
- X\&...
- X]
- X]
- X.SH DESCRIPTION
- X.IX "strace command" "" "\fLstrace\fR command"
- X.LP
- XIn the simplest case
- X.B strace
- Xruns the specified
- X.I command
- Xuntil it exits.
- XIt intercepts and records the system calls which are called
- Xby a process and the signals which are received by a process.
- XThe name of each system call, its arguments and its return value
- Xare printed on standard error or to the file specified with the
- X.B \-o
- Xoption.
- X.LP
- X.B strace
- Xis a useful diagnositic, instructional, and debugging tool.
- XSystem adminstrators, diagnosticians and trouble-shooters will find
- Xit invaluable for solving problems with
- Xprograms for which the source is not readily available since
- Xthey do not need to be recompiled in order to trace them.
- XStudents, hackers and the overly-curious will find that
- Xa great deal can be learned about a system and its system calls by
- Xtracing even ordinary programs. And programmers will find that
- Xsince system calls and signals are events that happen at the user/kernel
- Xinterface, a close examination of this boundary is very
- Xuseful for bug isolation, sanity checking and
- Xattempting to capture race conditions.
- X.LP
- XEach line in the trace contains the system call name, followed
- Xby its arguments in parentheses and its return value.
- XAn example from stracing the command ``cat /dev/null'' is:
- X.CW
- Xopen("/dev/null", O_RDONLY) = 3
- X.CE
- XErrors (typically a return value of \-1) have the errno symbol
- Xand error string appended.
- X.CW
- Xopen("/foo/bar", O_RDONLY) = -1 ENOENT (No such file or directory)
- X.CE
- XSignals are printed as a signal symbol and a signal string.
- XAn excerpt from stracing and interrupting the command ``sleep 666'' is:
- X.CW
- Xsigsuspend([] <unfinished ...>
- X--- SIGINT (Interrupt) ---
- X+++ killed by SIGINT +++
- X.CE
- XArguments are printed in symbolic form with a passion.
- XThis example shows the shell peforming ``>>xyzzy'' output redirection:
- X.CW
- Xopen("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
- X.CE
- XHere the three argument form of open is decoded by breaking down the
- Xflag argument into its three bitwise-OR constituents and printing the
- Xmode value in octal by tradition. Where traditional or native
- Xusage differs from ANSI or POSIX, the latter forms are preferred.
- XIn some cases, strace output has proven to be more readable than
- Xthe source.
- X.LP
- XStructure pointers are dereferenced and the members are displayed
- Xas appropriate. In all cases arguments are formatted in the most C-like
- Xfashion possible.
- XFor example, the essence of the command ``ls -l /dev/null'' is captured as:
- X.CW
- Xlstat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
- X.CE
- XNotice how the `struct stat' argument is dereferenced and how each member is
- Xdisplayed symbolically. In particular, observe how the st_mode member
- Xis carefully decoded into a bitwise-OR of symbolic and numeric values.
- XAlso notice in this example that the first argument to lstat is an input
- Xto the system call and the second argument is an output. Since output
- Xarguments not modified if the system call fails, arguments may not
- Xalways be dereferenced. For example, retrying the ``ls -l'' example
- Xwith a non-existent file produces the following line:
- X.CW
- Xlstat("/foo/bar", 0xb004) = -1 ENOENT (No such file or directory)
- X.CE
- XIn this case the porch light is on but nobody is home.
- X.LP
- XCharacter pointers are dereferenced and printed as C strings.
- XNon-printing characters in strings are normally represented by
- Xordinary C escape codes.
- XOnly the first
- X.I strsize
- X(32 by default) bytes of strings are printed;
- Xlonger strings have an ellipsis appended following the closing quote.
- XHere is a line from ``ls -l'' where the getpwuid library routine is
- Xreading the password file:
- X.CW
- Xread(3, "root::0:0:System Administrator:/"..., 1024) = 422
- X.CE
- XWhile structures are annotated using curly braces, simple pointers
- Xand arrays are printed using square brackets with commas separating
- Xelements. Here is an example from the command ``id'' on a system with
- Xsupplementary group ids:
- X.CW
- Xgetgroups(32, [100, 0]) = 2
- X.CE
- XOn the other hand, bit-sets are also shown using square brackets
- Xbut set elements are separated only by a space. Here is the shell
- Xpreparing to execute an external command:
- X.CW
- Xsigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0
- X.CE
- XHere the second argument is a bit-set of two signals, SIGCHLD and SIGTTOU.
- XIn some cases the bit-set is so full that printing out the unset
- Xelements is more valuable. In that case, the bit-set is prefixed by
- Xa tilde like this:
- X.CW
- Xsigprocmask(SIG_UNBLOCK, ~[], NULL) = 0
- X.CE
- XHere the second argument represents the full set of all signals.
- X.SH OPTIONS
- X.TP 12
- X.TP
- X.B \-c
- XCount time, calls, and errors for each system call and report a
- Xsummary on program exit.
- X.TP
- X.B \-d
- XShow some debugging output of strace itself on
- X.I stderr .
- X.TP
- X.B \-f
- XTrace child processes as they are created by currently traced
- Xprocesses as a result of the fork(2) system call. The new process is
- Xattached to as soon as its pid is known (through the return value of
- Xfork(2) in the parent process). This means that such children may run
- Xuncontrolled for a while (especially in the case of a vfork(2)), until
- Xthe parent is scheduled again to complete its (v)fork(2) call.
- XIf the parent process decides to wait(2) for a child that is currently
- Xbeing traced, it is suspended until an appropriate child process either
- Xterminates or incurs a signal that would cause it to terminate (as
- Xdetermined from the child's current signal disposition).
- X.TP
- X.B \-ff
- XIf the
- X.BI \-o filename
- Xoption is in effect, each processes trace is written to
- X.I filename.pid
- Xwhere pid is the numeric process id of each process.
- X.TP
- X.B \-F
- XOn SunOS 4.x, this option has the effect of attempting to follow
- Xvforks by performing some dynamic linking trickery. Otherwise,
- Xvforks will not be followed even if
- X.B \-f
- Xhas been given.
- X.TP
- X.B \-h
- XPrint the help summary.
- X.TP
- X.B \-i
- XPrint the instruction pointer at the time of the system call.
- X.TP
- X.B \-q
- XSuppress messages about attaching, detaching etc. This happens
- Xautomatically when output is redirected to a file and the command
- Xis run directly instead of attaching.
- X.TP
- X.B \-r
- XPrint a relative timestamp upon entry to each system call. This
- Xrecords the time difference between the beginning of successive
- Xsystem calls.
- X.TP
- X.B \-t
- XPrefix each line of the trace with the time of day.
- X.TP
- X.B \-tt
- XIf given twice, the time printed will include the microseconds.
- X.TP
- X.B \-T
- XShow the time spent in system calls. This records the time
- Xdifference between the beginning and the end of each system call.
- X.TP
- X.B \-v
- XPrint unabbreviated versions of environment, stat, termios, etc.
- Xcalls. These structures are very common in calls and so the default
- Xbehavior displays a reasonable subset of structure members. Use
- Xthis option to get all of the gory details.
- X.TP
- X.B \-V
- XPrint the version number of strace.
- X.TP
- X.B \-x
- XPrint all non-ascii strings in hexidecimal string format.
- X.TP
- X.B \-xx
- XPrint all strings in hexidecimal string format.
- X.TP
- X.BI \-a column
- XAlign return values in a secific column (default column 40).
- X.TP
- X.BI \-e expr
- XA qualifying expression which modifies which events to trace
- Xor how to trace them. The format of the expression is:
- X.br
- X[qualifier=][!]value1[,value2]...
- X.br
- Xwhere qualifier is one of trace, abbrev, verbose, raw, signal, read, or write
- Xand value is a qualifier-dependent symbol or number. The default
- Xqualifier is trace. Using an exclamation mark negates the set of values.
- XFor example \-eopen means literally \-e trace=open which in turn means
- Xtrace only the open system call. By contrast, \-etrace=!open means
- Xto trace every system call except open. In addition the special values
- Xall and none have the obvious meanings.
- X.TP
- X.BI \-etrace= set
- XTrace only the specified set of system calls. The
- X.B \-c
- Xoption is useful for determining which system calls might be useful
- Xto trace. For example, trace=open,close,read,write means to only
- Xtrace those four system calls. Be careful when making inferences
- Xabout the user/kernel boundary if only a subset of system calls
- Xare being monitored. The default is trace=all.
- X.TP
- X.BI \-eabbrev= set
- XAbbreviate the output from printing each member of large structures.
- XThe default is abbrev=all. The
- X.B \-v
- Xoption has the effect of abbrev=none.
- X.TP
- X.BI \-everbose= set
- XDereference structures for the specified set of system calls. The
- Xdefault is verbose=all.
- X.TP
- X.BI \-eraw= set
- XPrint raw, undecoded arguments for the specifed set of system calls.
- XThis option has the effect of causing all arguments to be printed
- Xin hexidecimal. This is mostly useful if you don't trust the
- Xdecoding or you need to know the actual numeric value of an
- Xargument.
- X.TP
- X.BI \-esignal= set
- XTrace only the specified subset of signals. The default is signal=all.
- XFor example signal=!SIGIO (or signal=!io) causes SIGIO signals not to
- Xbe traced.
- X.TP
- X.BI \-eread= set
- XPerform a full hexidecimal and ascii dump of all the data read from
- Xfile descriptors listed in the specified set. For example, to see
- Xall input activity on file descriptors 3 and 5 use read=3,5.
- X.TP
- X.BI \-ewrite= set
- XPerform a full hexidecimal and ascii dump of all the data written to
- Xfile descriptors listed in the specified set. For example, to see
- Xall output activity on file descriptors 3 and 5 use read=3,5.
- X.TP
- X.BI \-o filename
- XWrite the trace output to the file
- X.I filename
- Xrather than to stderr.
- XUse
- X.I filename.pid
- Xif
- X.B \-ff
- Xis used.
- X.TP
- X.BI \-O overhead
- XSet the overhead for tracing system calls to overhead microseconds.
- XThis is useful for overriding the default heuristic for guessing
- Xhow much time is spent in mere measuring when timing system calls using
- Xthe
- X.B \-c
- Xoption. The acuracy of the heuristic can be gauged by timing a given
- Xprogram run without tracing (using time(1)) and comparing the accumulated
- Xsystem call time to the total produced using
- X.B \-c .
- X.TP
- X.BI \-p pid
- XAttach to the process with the process
- X.SM ID
- X.I pid
- Xand begin tracing.
- XThe trace may be terminated
- Xat any time by a keyboard interrupt signal (\c
- X.SM CTRL\s0-C).
- X.B strace
- Xwill respond by detaching itself from the traced process(es)
- Xleaving it (them) to continue running.
- XMultiple -p options can be used to attach to up to MAXPROC (currently 32)
- Xprocesses in addition to
- X.I command
- X(which is optional if at least one -p option is given).
- X.TP
- X.BI \-s strsize
- XSpecify the maximum string size to print (the default is 32). Note
- Xthat filenames are not considered strings and are always printed in
- Xfull.
- X.TP
- X.BI \-S sortby
- XSort the output of the histogram printed by the
- X.B \-c
- Xoption by the specified critereon. Legal values are
- Xtime, calls, name, and nothing (default time).
- X.SH "SEE ALSO"
- X.BR ptrace(2) ,
- X.BR time(1) ,
- X.B trace(1)
- X.SH NOTES
- XIt is a pity that so much tracing clutter is produced by systems
- Xemploying shared libraries. It is more reminiscent of the Multics
- Xoperating system than the one that was trying to ridicule it.
- X.LP
- XIt is instructive to think about system call inputs and outputs
- Xas data-flow across the user/kernel boundary. Because user-space
- Xand kernel-space are separate and address-protected, it is
- Xsometimes possible to make deductive inferences about process
- Xbehavior using inputs and outputs as propositions.
- X.LP
- XIn some cases, a system call will differ from the documented
- Xbehavior. For example, on System V derived systems the true
- Xtime(2) system call does not take an argument.
- XThese discrepancies are normal but idiosyncratic
- Xcharacteristics of the system call interface and are accounted for
- Xby C library system call interface functions.
- X.LP
- XOn some platforms a process that has a system call trace applied
- Xto it with the
- X.B \-p
- Xoption will receive a
- X.BR \s-1SIGSTOP\s0 .
- XThis signal may interrupt a system call that is not restartable.
- XThis may have an unpredictable effect on the process
- Xif the process takes no action to restart the system call.
- X.SH BUGS
- XTracing a subset of calls can inhibit the ability to follow forks
- Xif certain keys system calls are not traced, like fork and wait4.
- X.LP
- XPrograms that use the
- X.I setuid
- Xbit do not have
- Xeffective user
- X.SM ID
- Xprivileges while being traced.
- X.LP
- XA traced process ignores
- X.SM SIGSTOP\s0.
- X.LP
- XA traced process which tries to block SIGTRAP will be sent a SIGSTOP
- Xin an attempt to force continuation of tracing.
- X.LP
- XA traced process runs slowly.
- X.LP
- XTraced processes which are descended from
- X.I command
- Xmay be left running after an interrupt signal (\c
- X.SM CTRL\s0-C).
- X.SH HISTORY
- X.B strace
- Xwas written by Paul Kranenburg, Branko Lankester and Rick Sladkey.
- XThe original strace was written by Paul Kranenburg
- Xfor SunOS and was inspired by its trace utility.
- XThe SunOS version of strace was ported to Linux and enhanced
- Xby Branko Lankester, who also wrote the Linux kernel support.
- XEven though Paul released strace 2.5 in 1992,
- XBranko's work was based on Paul's strace 1.5 release from 1991.
- XIn 1993, Rick Sladkey merged strace 2.5 for SunOS and the
- Xsecond release of strace for Linux, added the best features of truss
- Xfrom SVR4, and produced an strace that worked on both platforms.
- XIn 1994 Rick ported strace to SVR4 and Solaris and wrote the
- Xautomatic configuration support.
- END_OF_FILE
- if test 15424 -ne `wc -c <'strace-3.0/strace.1'`; then
- echo shar: \"'strace-3.0/strace.1'\" unpacked with wrong size!
- fi
- # end of 'strace-3.0/strace.1'
- fi
- if test -f 'strace-3.0/system.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'strace-3.0/system.c'\"
- else
- echo shar: Extracting \"'strace-3.0/system.c'\" \(14134 characters\)
- sed "s/^X//" >'strace-3.0/system.c' <<'END_OF_FILE'
- X/*
- X * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
- X * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
- X * Copyright (c) 1993, 1994 Rick Sladkey <jrs@world.std.com>
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by Paul Kranenburg,
- X * Branko Lankester and Rick Sladkey.
- X * 4. The name of the author may not be used to endorse or promote products
- X * derived from this software without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * system.c,v 2.20 1994/03/21 05:45:43 jrs Exp
- X */
- X
- X#include "defs.h"
- X
- X#ifdef LINUX
- X
- X#include <linux/fs.h>
- X#include <sys/socket.h>
- X#include <arpa/inet.h>
- X#include <linux/nfs_mount.h>
- X
- Xstatic struct xlat mount_flags[] = {
- X { MS_RDONLY, "MS_RDONLY" },
- X { MS_NOSUID, "MS_NOSUID" },
- X { MS_NODEV, "MS_NODEV" },
- X { MS_NOEXEC, "MS_NOEXEC" },
- X { MS_NOSUID, "MS_NOSUID" },
- X { MS_SYNC, "MS_SYNC" },
- X { MS_REMOUNT, "MS_REMOUNT" },
- X { 0, NULL },
- X};
- X
- Xint
- Xsys_mount(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printpath(tcp, tcp->u_arg[0]);
- X tprintf(", ");
- X printpath(tcp, tcp->u_arg[1]);
- X tprintf(", ");
- X printpath(tcp, tcp->u_arg[2]);
- X tprintf(", ");
- X printflags(mount_flags, tcp->u_arg[3]);
- X tprintf(", %#x", tcp->u_arg[4]);
- X }
- X return 0;
- X}
- X
- X#endif /* LINUX */
- X
- X#ifdef SUNOS4
- X
- X#include <sys/reboot.h>
- X#define NFSCLIENT
- X#define LOFS
- X#define RFS
- X#define PCFS
- X#include <sys/mount.h>
- X#include <sys/socket.h>
- X#include <nfs/export.h>
- X#include <rpc/types.h>
- X#include <rpc/auth.h>
- X
- X/*ARGSUSED*/
- Xint
- Xsys_sync(tcp)
- Xstruct tcb *tcp;
- X{
- X return 0;
- X}
- X
- Xstatic struct xlat bootflags[] = {
- X { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
- X { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
- X { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
- X { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
- X { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
- X { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
- X { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
- X { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
- X { RB_DUMP, "RB_DUMP" }, /* dump system core */
- X { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
- X { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
- X { 0, NULL },
- X};
- X
- Xint
- Xsys_reboot(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X if (!printflags(bootflags, tcp->u_arg[0]))
- X tprintf("RB_???");
- X if (tcp->u_arg[0] & RB_STRING) {
- X printstr(tcp, tcp->u_arg[1], -1);
- X }
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_sysacct(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printstr(tcp, tcp->u_arg[0], -1);
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_swapon(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printstr(tcp, tcp->u_arg[0], -1);
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_nfs_svc(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printsock(tcp, tcp->u_arg[0]);
- X }
- X return 0;
- X}
- X
- Xstatic struct xlat mountflags[] = {
- X { M_RDONLY, "M_RDONLY" },
- X { M_NOSUID, "M_NOSUID" },
- X { M_NEWTYPE, "M_NEWTYPE" },
- X { M_GRPID, "M_GRPID" },
- X#ifdef M_REMOUNT
- X { M_REMOUNT, "M_REMOUNT" },
- X#endif
- X#ifdef M_NOSUB
- X { M_NOSUB, "M_NOSUB" },
- X#endif
- X#ifdef M_MULTI
- X { M_MULTI, "M_MULTI" },
- X#endif
- X#ifdef M_SYS5
- X { M_SYS5, "M_SYS5" },
- X#endif
- X { 0, NULL },
- X};
- X
- Xstatic struct xlat nfsflags[] = {
- X { NFSMNT_SOFT, "NFSMNT_SOFT" },
- X { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
- X { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
- X { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
- X { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
- X { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
- X { NFSMNT_INT, "NFSMNT_INT" },
- X { NFSMNT_NOAC, "NFSMNT_NOAC" },
- X { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
- X { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
- X { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
- X { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
- X#ifdef NFSMNT_SECURE
- X { NFSMNT_SECURE, "NFSMNT_SECURE" },
- X#endif
- X#ifdef NFSMNT_NOCTO
- X { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
- X#endif
- X#ifdef NFSMNT_POSIX
- X { NFSMNT_POSIX, "NFSMNT_POSIX" },
- X#endif
- X { 0, NULL },
- X};
- X
- Xint
- Xsys_mount(tcp)
- Xstruct tcb *tcp;
- X{
- X char type[4];
- X
- X if (entering(tcp)) {
- X if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
- X tcp->u_arg[0], sizeof type, type) < 0) {
- X tprintf("OLDTYPE:#%x", tcp->u_arg[0]);
- X } else {
- X tprintf("\"%s\", ", type);
- X }
- X printstr(tcp, tcp->u_arg[1], -1);
- X tprintf(", ");
- X if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
- X tprintf("0");
- X tprintf(", ");
- X
- X if (strcmp(type, "4.2") == 0) {
- X struct ufs_args a;
- X if (umove(tcp, tcp->u_arg[3], &a) < 0)
- X return 0;
- X printstr(tcp, (int)a.fspec, -1);
- X } else if (strcmp(type, "lo") == 0) {
- X struct lo_args a;
- X if (umove(tcp, tcp->u_arg[3], &a) < 0)
- X return 0;
- X printstr(tcp, (int)a.fsdir, -1);
- X } else if (strcmp(type, "nfs") == 0) {
- X struct nfs_args a;
- X if (umove(tcp, tcp->u_arg[3], &a) < 0)
- X return 0;
- X tprintf("[");
- X printsock(tcp, (int) a.addr);
- X tprintf(", ");
- X if (!printflags(nfsflags, a.flags))
- X tprintf("NFSMNT_???");
- X tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
- X a.wsize, a.rsize, a.timeo, a.retrans);
- X if (a.flags & NFSMNT_HOSTNAME && a.hostname)
- X printstr(tcp, (int)a.hostname, -1);
- X else
- X tprintf("%#lx", (unsigned long) a.hostname);
- X tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
- X a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
- X if ((a.flags & NFSMNT_SECURE) && a.netname)
- X printstr(tcp, (int) a.netname, -1);
- X else
- X tprintf("%#lx", (unsigned long) a.netname);
- X tprintf("]");
- X } else if (strcmp(type, "rfs") == 0) {
- X struct rfs_args a;
- X struct token t;
- X if (umove(tcp, tcp->u_arg[3], &a) < 0)
- X return 0;
- X tprintf("[");
- X printstr(tcp, (int)a.rmtfs, -1);
- X if (umove(tcp, (int)a.token, &t) < 0)
- X return 0;
- X tprintf(", %u, %s]", t.t_id, t.t_uname);
- X } else if (strcmp(type, "pcfs") == 0) {
- X struct pc_args a;
- X if (umove(tcp, tcp->u_arg[3], &a) < 0)
- X return 0;
- X printstr(tcp, (int)a.fspec, -1);
- X }
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_unmount(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printstr(tcp, tcp->u_arg[0], -1);
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_umount(tcp)
- Xstruct tcb *tcp;
- X{
- X return sys_unmount(tcp);
- X}
- X
- Xint
- Xsys_auditsys(tcp)
- Xstruct tcb *tcp;
- X{
- X /* XXX - no information available */
- X return printargs(tcp);
- X}
- X
- Xstatic struct xlat ex_auth_flags[] = {
- X { AUTH_UNIX, "AUTH_UNIX" },
- X { AUTH_DES, "AUTH_DES" },
- X { 0, NULL },
- X};
- X
- Xint
- Xsys_exportfs(tcp)
- Xstruct tcb *tcp;
- X{
- X struct export e;
- X int i;
- X
- X if (entering(tcp)) {
- X printstr(tcp, tcp->u_arg[0], -1);
- X if (umove(tcp, tcp->u_arg[1], &e) < 0) {
- X tprintf("%#x", tcp->u_arg[1]);
- X return 0;
- X }
- X tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
- X printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
- X tprintf(", roots:[");
- X if (e.ex_auth == AUTH_UNIX) {
- X for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
- X printsock(tcp,
- X (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
- X }
- X tprintf("], writers:[");
- X for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
- X printsock(tcp,
- X (int)&e.ex_writeaddrs.addrvec[i]);
- X }
- X tprintf("]");
- X } else {
- X for (i=0; i<e.ex_u.exdes.nnames; i++) {
- X printsock(tcp,
- X (int)&e.ex_u.exdes.rootnames[i]);
- X tprintf(", ");
- X }
- X tprintf("], window:%u", e.ex_u.exdes.window);
- X }
- X tprintf("}");
- X }
- X return 0;
- X}
- X
- Xstatic struct xlat sysconflimits[] = {
- X#ifdef _SC_ARG_MAX
- X { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
- X#endif
- X#ifdef _SC_CHILD_MAX
- X { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
- X#endif
- X#ifdef _SC_CLK_TCK
- X { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
- X#endif
- X#ifdef _SC_NGROUPS_MAX
- X { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
- X#endif
- X#ifdef _SC_OPEN_MAX
- X { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
- X#endif
- X#ifdef _SC_JOB_CONTROL
- X { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
- X#endif
- X#ifdef _SC_SAVED_IDS
- X { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
- X#endif
- X#ifdef _SC_VERSION
- X { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
- X#endif
- X { 0, NULL },
- X};
- X
- Xstatic struct xlat pathconflimits[] = {
- X#ifdef _PC_LINK_MAX
- X { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
- X#endif
- X#ifdef _PC_MAX_CANON
- X { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
- X#endif
- X#ifdef _PC_MAX_INPUT
- X { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
- X#endif
- X#ifdef _PC_NAME_MAX
- X { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
- X#endif
- X#ifdef _PC_PATH_MAX
- X { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
- X#endif
- X#ifdef _PC_PIPE_BUF
- X { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
- X#endif
- X#ifdef _PC_CHOWN_RESTRICTED
- X { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
- X#endif
- X#ifdef _PC_NO_TRUNC
- X { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
- X#endif
- X#ifdef _PC_VDISABLE
- X { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
- X#endif
- X { 0, NULL },
- X};
- X
- Xint
- Xsys_sysconf(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_pathconf(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printstr(tcp, tcp->u_arg[0], -1);
- X tprintf(", ");
- X printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
- X }
- X return 0;
- X}
- X
- Xint
- Xsys_fpathconf(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X tprintf("%u, ", tcp->u_arg[0]);
- X printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
- X }
- X return 0;
- X}
- X
- X#endif /* SUNOS4 */
- X
- X#ifdef SVR4
- X
- X#include <sys/sysconfig.h>
- X#include <sys/utsname.h>
- X#include <sys/systeminfo.h>
- X
- Xstatic struct xlat sysconfig_options[] = {
- X#ifdef _CONFIG_NGROUPS
- X { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
- X#endif
- X#ifdef _CONFIG_CHILD_MAX
- X { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
- X#endif
- X#ifdef _CONFIG_OPEN_FILES
- X { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
- X#endif
- X#ifdef _CONFIG_POSIX_VER
- X { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
- X#endif
- X#ifdef _CONFIG_PAGESIZE
- X { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
- X#endif
- X#ifdef _CONFIG_CLK_TCK
- X { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
- X#endif
- X#ifdef _CONFIG_XOPEN_VER
- X { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
- X#endif
- X#ifdef _CONFIG_PROF_TCK
- X { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
- X#endif
- X#ifdef _CONFIG_NPROC_CONF
- X { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
- X#endif
- X#ifdef _CONFIG_NPROC_ONLN
- X { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
- X#endif
- X#ifdef _CONFIG_AIO_LISTIO_MAX
- X { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
- X#endif
- X#ifdef _CONFIG_AIO_MAX
- X { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
- X#endif
- X#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
- X { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
- X#endif
- X#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
- X { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
- X#endif
- X#ifdef _CONFIG_MQ_OPEN_MAX
- X { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
- X#endif
- X#ifdef _CONFIG_MQ_PRIO_MAX
- X { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
- X#endif
- X#ifdef _CONFIG_RTSIG_MAX
- X { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
- X#endif
- X#ifdef _CONFIG_SEM_NSEMS_MAX
- X { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
- X#endif
- X#ifdef _CONFIG_SEM_VALUE_MAX
- X { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
- X#endif
- X#ifdef _CONFIG_SIGQUEUE_MAX
- X { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
- X#endif
- X#ifdef _CONFIG_SIGRT_MIN
- X { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
- X#endif
- X#ifdef _CONFIG_SIGRT_MAX
- X { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
- X#endif
- X#ifdef _CONFIG_TIMER_MAX
- X { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
- X#endif
- X#ifdef _CONFIG_CONFIG_PHYS_PAGES
- X { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
- X#endif
- X#ifdef _CONFIG_AVPHYS_PAGES
- X { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
- X#endif
- X { 0, NULL },
- X};
- X
- Xint
- Xsys_sysconfig(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp))
- X printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
- X return 0;
- X}
- X
- Xstatic struct xlat sysinfo_options[] = {
- X { SI_SYSNAME, "SI_SYSNAME" },
- X { SI_HOSTNAME, "SI_HOSTNAME" },
- X { SI_RELEASE, "SI_RELEASE" },
- X { SI_VERSION, "SI_VERSION" },
- X { SI_MACHINE, "SI_MACHINE" },
- X { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
- X { SI_HW_SERIAL, "SI_HW_SERIAL" },
- X { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
- X { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
- X#ifdef SI_SET_HOSTNAME
- X { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
- X#endif
- X#ifdef SI_SET_SRPC_DOMAIN
- X { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
- X#endif
- X#ifdef SI_SET_KERB_REALM
- X { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
- X#endif
- X#ifdef SI_KERB_REALM
- X { SI_KERB_REALM, "SI_KERB_REALM" },
- X#endif
- X { 0, NULL },
- X};
- X
- Xint
- Xsys_sysinfo(tcp)
- Xstruct tcb *tcp;
- X{
- X if (entering(tcp)) {
- X printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
- X tprintf(", ");
- X }
- X else {
- X /* Technically some calls write values. So what. */
- X if (syserror(tcp))
- X tprintf("%#x", tcp->u_arg[1]);
- X else
- X printpath(tcp, tcp->u_arg[1]);
- X tprintf(", %u", tcp->u_arg[2]);
- X }
- X return 0;
- X}
- X
- X#endif /* SVR4 */
- END_OF_FILE
- if test 14134 -ne `wc -c <'strace-3.0/system.c'`; then
- echo shar: \"'strace-3.0/system.c'\" unpacked with wrong size!
- fi
- # end of 'strace-3.0/system.c'
- fi
- echo shar: End of archive 6 \(of 10\).
- cp /dev/null ark6isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 10 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-