Commit Graph

30 Commits

Author SHA1 Message Date
Denys Vlasenko
1945ccc3fb Assorted trivial optimizations
text	   data	    bss	    dec	    hex	filename
 236448	    672	  19044	 256164	  3e8a4	strace.before
 236360	    672	  19044	 256076	  3e84c	strace

* file.c (sprintmode): Use smaller static buffer, eliminate strlen call.
(sprinttime): Use smaller static buffer.
(printstat_sparc64): Coalesce two printing calls into one.
(printstat_powerpc32): Likewise.
(printcompat_statfs6): Likewise.
(sys_utime): Do not fetch personality_wordsize[current_personality]
repeatedly - cache it in local variable instead.
* process.c (printargv): Likewise.
* resource.c (sprintrlim): Return const char*, not char*. This allows
to eliminate sprintf(buf, "RLIM_INFINITY"). Use smaller static buffer.
(sprintrlim64): Likewise.
* strace.c (strerror): Use smaller static buffer.
(strsignal): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-27 14:37:48 +01:00
Denys Vlasenko
72879c6a35 Alias a few more syscall printing functions
text	   data	    bss	    dec	    hex	filename
 237384	    672	  19044	 257100	  3ec4c	strace.before
 236448	    672	  19044	 256164	  3e8a4	strace

* defs.h: Declare new functions printargs_lu(), printargs_ld()
which simply print syscall all args as unsigned or signed longs.
* desc.c (sys_epoll_create): Call printargs_ld() instead of open-coding it.
* linux/syscall.h: Remove declarations of the following functions:
sys_alarm, sys_getresgid, sys_getsid, sys_nice, sys_setgid, sys_setpgid,
sys_setpgrp, sys_setregid, sys_setresgid.
* process.c (sys_setgid): Delete this function: now aliased to sys_setuid().
(sys_getresgid): Delete this function: now aliased to sys_getresuid().
(sys_setregid): Delete this function: now aliased to sys_setreuid().
(sys_setresgid): Delete this function: now aliased to sys_setresuid().
(sys_setpgrp): Delete this function: now aliased to printargs_lu().
(sys_getsid): Likewise.
(sys_setpgid): Likewise.
(sys_alarm): Likewise.
(sys_getpgrp): Delete this function: was unused - was already shadowed
by a define in linux/dummy.h.
(sys_setsid): Likewise.
(sys_getpgid): Likewise.
* resource.c (sys_nice): Delete this function: now aliased to printargs_ld().
* linux/dummy.h: Define new aliases (see above for the list).
* syscall.c (printargs_lu): New function.
(printargs_ld): New function.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-27 14:18:02 +01:00
e83e157021 Compress blank lines
Suppress repeated empty lines left after automated code removal.
This change was made by filtering every source code file through
"cat -s".
2012-02-25 15:41:21 +00:00
Denys Vlasenko
aa925db236 Remove a few more code parts which are unused on Linux
This change is abapted from Dmitry's changes to remove support for
non-Linux architectures.

* Makefile.am: Remove if LINUX/endif pairs.
* defs.h: Remove stream_ioctl() declaration.
* ioctl.c (ioctl_decode): Remove 'ifdef HAVE_SYS_STREAM_H' block.
* resource.c: Use 'defined(FOO)' instead of 'defined FOO' form.
* util.c: Likewise.
* signal.c: Remove conditional includes which are never used on Linux.
* stream.c: Likewise.
* file.c: Remove excessive empty lines.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-25 15:19:02 +01:00
Denys Vlasenko
1a3cf10c30 Build fixes after non-Linux code removal
* configure.ac: Remove calls to proc-based ptrace checks.
* proc.c: Remove, it's empty now.
* Makefile.am: Remove reference to proc.c.
* net.c: Remove trailing newlines.
* quota.c: Likewise
* resource.c: Likewise
* strace.c: Likewise
* stream.c: Likewise
* time.c: Likewise

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-25 02:54:34 +01:00
Denys Vlasenko
8470374cba Cleanup after non-Linux code removal.
Conditions such as defined(LINUX) are always true now,
defined(FREEBSD) etc are always false.
When if directive has them as subexpressions, it can be simplified.
Another trivial changes here are fixes for directive indentation.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-25 02:38:52 +01:00
Denys Vlasenko
ed720fda5d Automated removal of non-Linux code
This change is generated by running every source through the following command:

unifdef -DLINUX -Dlinux -USUNOS4 -USVR4 -UUNIXWARE -UFREEBSD
-USUNOS4_KERNEL_ARCH_KLUDGE -UHAVE_MP_PROCFS
-UHAVE_POLLABLE_PROCFS -UHAVE_PR_SYSCALL -UUSE_PROCFS file.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-25 02:24:03 +01:00
H.J. Lu
d602542f16 Define RLIM64_INFINITY only if not defined
* resource.c (RLIM64_INFINITY): Define only if it isn't defined.
2012-02-06 13:33:54 +00:00
H.J. Lu
0b315b6543 Cast to long for %l in printf
Cast a value to long for %l in printf to avoid compiler warning
on systems where it may be long long.

* count.c (call_summary_pers): Cast to long.
* ipc.c (sys_mq_open, printmqattr): Likewise.
* quota.c (decode_cmd_data): Likewise.
* resource.c (sys_sysinfo): Likewise.
* time.c (tprint_timex): Likewise.
2012-02-06 13:33:54 +00:00
Denys Vlasenko
60fe8c139c Use tprints with literal strings, it may be faster than tprintf
* bjm.c: Replace tprintf("str") with tprints("str").
* block.c: Likewise.
* desc.c: Likewise.
* file.c: Likewise.
* io.c: Likewise.
* ipc.c: Likewise.
* mem.c: Likewise.
* net.c: Likewise.
* proc.c: Likewise.
* process.c: Likewise.
* quota.c: Likewise.
* resource.c: Likewise.
* scsi.c: Likewise.
* signal.c: Likewise.
* sock.c: Likewise.
* strace.c: Likewise.
* stream.c: Likewise.
* syscall.c: Likewise.
* system.c: Likewise.
* term.c: Likewise.
* time.c: Likewise.
* util.c: Likewise.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-09-01 10:00:28 +02:00
Andreas Schwab
ee81c8a571 Handle biarch get/setrlimit
* resource.c (print_rlimit32) [POWERPC64 || X86_64]: Define.
(sys_getrlimit, sys_setrlimit) [POWERPC64 || X86_64]: Use it.
2010-07-17 17:46:28 +02:00
Denys Vlasenko
1d632468c0 * signal.c: Whitespace, comment, and style fixes, no code changes.
* file.c: Ditto.
* time.c: Ditto.
* process.c: Ditto.
* resource.c: Ditto.
2009-04-14 12:51:00 +00:00
Denys Vlasenko
59432dbb33 * process.c (printwaitn): Add comment about wait4() pid expansion.
Use #ifdef ALPHA instead of LINUX_64BIT, it was misleading
(by implying "any 64-bit platform").
* defs.h: Remove now-unused LINUX_64BIT define.
* resource.c (sys_osf_getrusage): Fix indentation.
2009-01-26 19:09:35 +00:00
ef5c3d657d 2006-10-16 Dmitry V. Levin <ldv@altlinux.org>
Implement comprehensive quotactl(2) parser for Linux.
	* Makefile.am (strace_SOURCES): Add quota.c.
	* quota.c: New file.
	* resource.c: Remove old quotactl(2) parser.
	Fixes RH#118696.
2006-10-16 00:26:47 +00:00
Roland McGrath
70d9909b9e 2005-12-01 Roland McGrath <roland@redhat.com>
* resource.c (resources): Add RLIMIT_NICE, RLIMIT_RTPRIO.
	Reported by Scott Tsai <scottt958@yahoo.com.tw>.
2005-12-02 04:08:27 +00:00
Roland McGrath
be4d9f8b98 2005-08-03 Roland McGrath <roland@redhat.com>
* configure.ac: Check for struct dqblk.dqb_curblocks field.
	* resource.c [LINUX] (OLD_CMD): New macro.
	(quotacmds): Use it to hard-wire old O_* values, don't use macros.
	(sys_quotactl): If dqb_curblocks is not there, it's called
	dqb_curspace instead.  Print dqb_* fields as unsigned long long.
2005-08-03 12:18:09 +00:00
Roland McGrath
e806ac29ee 2005-08-03 Roland McGrath <roland@redhat.com>
* resource.c [LINUX] (OLD_CMD): New macro.
	(quotacmds): Use it to hard-wire old O_* values, don't use macros.
2005-08-03 12:02:06 +00:00
Roland McGrath
566ce1fc62 2004-10-06 Roland McGrath <roland@redhat.com>
* resource.c (resources): Add RLIMIT_LOCKS, RLIMIT_SIGPENDING,
	and RLIMIT_MSGQUEUE, if defined.
	From Ulrich Drepper <drepper@redhat.com>.
	Fixes RH#133594.
2004-10-06 22:14:53 +00:00
Roland McGrath
d9f816f604 2004-09-03 Roland McGrath <roland@redhat.com>
* util.c (xlookup, printxval, addflags, printflags): Use const for
	struct xlat * argument.
	* defs.h (xlookup, printxval, addflags, printflags): Update decls.
	* bjm.c: Add const to all struct xlat defns.
	* desc.c: Likewise.
	* file.c: Likewise.
	* ipc.c: Likewise.
	* mem.c: Likewise.
	* net.c: Likewise.
	* proc.c: Likewise.
	* process.c: Likewise.
	* resource.c: Likewise.
	* signal.c: Likewise.
	* sock.c: Likewise.
	* stream.c: Likewise.
	* system.c: Likewise.
	* term.c: Likewise.
	* time.c: Likewise.
	* util.c: Likewise.
2004-09-04 03:39:20 +00:00
Roland McGrath
9f09da616a 2004-07-08 Roland McGrath <roland@redhat.com>
* resource.c (sys_quotactl): Truncate first argument to 32 bits, since
	that's what the kernel will do.
2004-07-08 19:00:04 +00:00
Roland McGrath
1a3d60e1fc 2004-03-18 Dmitry V. Levin <ldv@altlinux.org>
* resource.c (sys_quotactl) [LINUX]: Cast arithmetic shift operand
	from long to unsigned long, to fix output of the quotactl command
	parser.
2004-04-16 21:58:55 +00:00
Roland McGrath
1919161d41 2003-01-14 Roland McGrath <roland@redhat.com>
* resource.c [LINUX] (quotacmds): Grok new command encodings.
	From Nathan Scott <nathans@debian.org>.
2003-01-14 23:40:54 +00:00
Wichert Akkerman
7b3346be42 Import lots of ia64 related changes from David Mosberger 2001-10-09 23:47:38 +00:00
John Hughes
70623be853 Use configure to detect 64bit off_t and rlim_t 2001-03-08 13:59:00 +00:00
John Hughes
bdf48f55f2 Merge Harald Bhme's solaris patches 2001-03-06 15:08:09 +00:00
Wichert Akkerman
bf79f2e16b Add FreeBSD support 2000-09-01 21:03:06 +00:00
Wichert Akkerman
c792698a99 README-linux: updated to note that strace might not compile
with development kernels
bjm.c: sys_query_module: check if malloc succeeds
system.c: sys_cap[gs]et(): check if malloc succeeds, only malloc once
linux/syscallent.h: updated for 2.3.99pre3
linux/alpha/syscallent.h: updated for 2.3.99pre3, add all osf syscalls
even though Linux doesn't implement them
syscall.c: add global variables for MIPS registers as well
syscall.c: move global variables to before get_scno since that uses them
util.c: oops, misspelled defined
process.c: fix ptrace calls in change_syscall
mem.c: decode sys_madvise
Merge patch from Topi Miettinen <Topi.Miettinen@nic.fi>
+ add support for quotactl, fdatasync, mlock, mlockall, munlockall & acct
+ small fix for RLIMIT_* and RUSAGE_BOTH
+ enhace support for capget and capset
2000-04-10 22:22:31 +00:00
Wichert Akkerman
4dc8a2aec6 Bunch of stuff 1999-12-23 14:20:14 +00:00
Wichert Akkerman
f5eeabb156 Start merging linux-ip-routing fork 1999-11-18 17:09:47 +00:00
Wichert Akkerman
76baf7c9f6 Initial revision 1999-02-19 00:21:36 +00:00