Commit Graph

213 Commits

Author SHA1 Message Date
Denys Vlasenko
1201426dd4 "Modernize" all old-style function parameter declarations
* bjm.c: Convert all remaining old-style C function definitions
to a "modern" form. This does not change any actual code.
* io.c: Likewise
* ioctl.c: Likewise
* net.c: Likewise
* proc.c: Likewise
* process.c: Likewise
* signal.c: Likewise
* sock.c: Likewise
* strace.c: Likewise
* stream.c: Likewise
* syscall.c: Likewise
* system.c: Likewise
* time.c: Likewise
* util.c: Likewise

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-05-30 14:00:14 +02:00
Denys Vlasenko
f8bc0655a0 Don't perform TCB_WAITEXECVE wait if not needed.
* defs.h (ptrace_setoptions_for_all): Expose this variable.
* strace.c (ptrace_setoptions_for_all): Remove "static".
* process.c (internal_exec): Don't set TCB_WAITEXECVE bit
if we know that post-execve SIGTRAP is not going to happen.
2011-05-24 20:30:24 +02:00
Denys Vlasenko
3454e4b463 Properly handle real SIGTRAPs.
* defs.h (ptrace_setoptions): Variable renamed to ptrace_setoptions_followfork.
* process.c (internal_fork): Ditto.
* strace.c (ptrace_setoptions_for_all): New variable.
(SYSCALLTRAP): New variable.
(error_msg_and_die): New function.
(test_ptrace_setoptions_for_all): New function.
(main): Call test_ptrace_setoptions_for_all() at init.
(handle_ptrace_event): Handle PTRACE_EVENT_EXEC (by ignoring it).
(trace): Check events and set ptrace options without -f too.
Check WSTOPSIG(status) not for SIGTRAP, but for SYSCALLTRAP.
2011-05-23 21:29:03 +02:00
bb668a57b4 Update PTRACE_* constants
* process.c (ptrace_cmds): Add PTRACE_GETREGSET and PTRACE_SETREGSET.
2011-03-14 21:58:59 +00:00
d9a4b0ab00 Fix compilation warning reported by gcc -Wunused-but-set-variable
* process.c (printwaitn) [!SUNOS4]: Do not define "exited" variable.
2011-02-23 00:27:12 +00:00
fde119c792 * process.c (internal_exit) [IA64]: Remove redundant check. 2011-02-18 23:16:20 +00:00
50a218d4ac Fix decoding of get[ug]id, gete[ug]id and setfs[ug]id return values
* defs.h (SYSCALL_NEVER_FAILS): New syscall flag.
* linux/dummy.h: Change redirection for sys_get[ug]id, sys_gete[ug]id
and setfs[ug]id.
* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag for get[ug]id,
gete[ug]id and setfs[ug]id syscalls.
* process.c [LINUX] (sys_getuid, sys_setfsuid): New functions.
* syscall.c (NF): New shorthand macro for use in syscallent.h files.
(get_error): Check SYSCALL_NEVER_FAILS flag.
Reported by Марк Коренберг <socketpair@gmail.com>.
2011-01-19 00:52:15 +00:00
e3d4b68a7b Recognize more clone flags
* process.c (CLONE_*): Define more flags from linux v2.6.25.
(clone_flags): Add entries for them.
Proposed by <zhangyanfei@cn.fujitsu.com>.
2010-12-03 17:27:59 +00:00
Wang Chao
ca8ab8d295 Handle followfork using ptrace_setoptions if available
If PTRACE_O_TRACECLONE et al options are supported by kernel,
use them to do followfork rather than the original setbpt
method that changes registers ourselves.

* defs.h [LINUX] (handle_new_child): New function prototype.
* process.c [LINUX] (handle_new_child): New function based on the
code from internal_fork(), with a trivial change: do reparent only
for sys_clone.
[LINUX] (internal_fork): Use handle_new_child().  Do nothing if
ptrace_setoptions is in effect.
* strace.c [LINUX] (handle_ptrace_event): New function.
[LINUX] (trace): If ptrace_setoptions is in effect, then
call the new function to handle PTRACE_EVENT_* status, and
set PTRACE_SETOPTIONS when we see the initial stop of tracee.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
2010-11-30 17:19:09 +00:00
Wang Chao
e636c85165 Do not trace children cloned with CLONE_UNTRACED flag
If clone is called with flag CLONE_UNTRACED, to be consistent with
option PTRACE_O_TRACECLONE, we should not set CLONE_PTRACE flag on
its arguments.

* process.c [LINUX] (internal_fork): Check the syscall and arguments.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
2010-09-17 16:54:52 +00:00
3eb9491673 * process.c (sys_waitid): Remove unused variable. 2010-09-09 23:20:10 +00:00
30145dda9d Fix const-correctness issues uncovered by gcc -Wwrite-strings
* defs.h (struct xlat): Add const qualifier to the field of
type "char *".
(set_sortby, qualify, printnum, printnum_int): Add const qualifier to
arguments of type "char *".
* count.c (set_sortby): Add const qualifier to the argument and
automatic variable of type "char *".
* desc.c (decode_select): Add const qualifier to automatic variables of
type "char *".
* ioctlsort.c (struct ioctlent): Add const qualifier to fields of
type "char *".
(main):  Add const qualifier to argv.
* process.c (printargv): Add const qualifier to the argument and
automatic variable of type "char *".
(printargc) Add const qualifier to argument of type "char *".
* signal.c (sprintsigmask, parse_sigset_t): Add const qualifier to
arguments of type "char *".
* strace.c (progname): Add const qualifier.
(detach): Add const qualifier to automatic variable of type "char *".
* stream.c (struct strbuf): Add const qualifier to the field of
type "char *".
* syscall.c (struct qual_options): Add const qualifier to fields of
type "char *".
(qual_syscall, qual_fault, qual_desc, lookup_class): Add const qualifier
to arguments of type "char *".
(qual_signal): Add const qualifier to the argument of type "char *",
avoid modification of constant argument.
(qualify): Likewise.
* util.c (printflags): Add const qualifier to automatic variable of
type "char *".
(printnum, printnum_int): Add const qualifier to arguments of
type "char *".
2010-09-07 00:59:18 +00:00
Wang Chao
cbdd1900a1 Fix printing clone flags
When we trace clone() syscall with only exit signal as clone
flags, strace would print an unnecessary OR operator.

* process.c (sys_clone): Fix this.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
2010-09-04 11:05:45 +00:00
Wang Chao
21b8db4eb9 Drop nclone_detached and related flags
Remove nclone_detached since CLONE_DETACHED flag was no-op for a very
long time in kernel.

* defs.h (struct tcb): Remove nclone_detached field.
Remove TCB_CLONE_DETACHED flag.
* process.c: Remove CLONE_DETACHED flag.
(clone_flags): Remove CLONE_DETACHED entry.
(internal_fork, internal_wait): Remove code dealing with CLONE_DETACHED
flag and nclone_detached.
* strace.c (startup_attach, alloc_tcb, droptcb, handle_group_exit):
Likewise.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
2010-08-28 22:36:54 +00:00
Wang Chao
5a22b31a60 Handle CLONE_PARENT flag
* process.c (internal_fork): The parent of new cloned process is the
same of the calling process when CLONE_PARENT is set.
2010-08-09 21:29:00 +00:00
Wang Chao
304ea5f067 Fix error when judging if process has children
* process.c (internal_wait): Processes counted in tcp->nclone_threads
are tcp's threads, rather than tcp's children.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
2010-08-09 21:29:00 +00:00
Edgar E. Iglesias
939caba68e Add support for the MicroBlaze architecture
* configure.ac: Recognize MicroBlaze.
* linux/microblaze/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add linux/microblaze/syscallent.h
* process.c (change_syscall, struct_user_offsets): Add MicroBlaze
support.
* signal.c (sys_sigreturn): Likewise.
* syscall.c (internal_syscall, get_scno, syscall_fixup, get_error,
syscall_enter): Likewise.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
2010-08-05 20:04:50 +00:00
Andreas Schwab
102e69a3ea Remove extern declaration at file scope
* defs.h (force_result): Declare.
* process.c (internal_wait): Don't declare force_result.
2010-07-06 19:40:25 +02:00
Chris Metcalf
c8c6698ef7 Add support for the TILE architecture
* configure.ac: Add TILE to the list of supported architectures.
* defs.h: Define TCB_WAITEXECVE for TILE.
* linux/tile/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add linux/tile/syscallent.h
* process.c (change_syscall, struct_user_offsets): Add TILE support.
* syscall.c (get_scno, get_error, syscall_enter): Likewise.
* mem.c (mmap_flags, print_mmap): Add MAP_CACHE_xxx TILE extensions
support.
* signal.c (sigact_flags): Add SA_NOPTRACE.
(sys_sigreturn): Add TILE support.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
2010-02-05 22:09:30 +00:00
e5e6085806 Remove dead code
* defs.h (tv_tv): Remove.
* net.c (sys_xsetsockaddr): Remove commented out dead code.
* process.c (setarg, sys_execv, sys_execve, struct_user_offsets):
Likewise.
* signal.c (sys_sigsuspend): Likewise.
* strace.c (reaper, trace): Likewise.
* stream.c (internal_stream_ioctl): Likewise.
* syscall.c (trace_syscall): Likewise.
* term.c (term_ioctl): Likewise.
* util.c (tv_tv, umoven, uload, getpc, fixvfork, setbpt, clearbpt):
Likewise.
2010-02-04 22:40:57 +00:00
257e15737d Merge Linux internal_clone() into internal_fork()
* defs.h (internal_clone): Remove.
* process.c (internal_clone): Merge into internal_fork().
(internal_fork) [!LINUX]: Remove dead code.
* syscall.c (internal_syscall): Replace internal_clone() with
internal_fork().
2010-02-04 22:40:57 +00:00
62e0596dbd Check umove() return code
* bjm.c (sys_query_module): Print input parameters when entering
syscall.  Fix handling of syscall error.  Handle unlikely umove()
failures.
* ipc.c (tprint_msgrcv): New function.  Move part of msgrcv parser code
here, add check umove() return code.
(sys_msgsnd): Print msqid parameter as int instead of long.
(sys_msgrcv): Likewise.  Use tprint_msgrcv().
* process.c (print_affinitylist): Check umove() return code.
* sock.c (sock_ioctl): Handle unlikely umove() failure in the
SIOCGIFCONF parser.
2009-11-06 17:27:46 +00:00
Mike Frysinger
8566c50025 sparc/linux: Rewrite to use asm/ptrace.h
The current sparc/linux code uses asm/reg.h, but recent Linux kernels
dropped that header completely.  So switch over to the ptrace headers
as those should stick around indefinitely as part of the ABI.

* defs.h [LINUXSPARC] (U_REG_G1, U_REG_O0, U_REG_O1): Define.
* process.c: Drop asm/regs.h include.
[SPARC || SPARC64] (change_syscall): Change struct regs to struct pt_regs.
* signal.c: Drop asm/regs.h include.
(m_siginfo_t): Unify [SPARC || SPARC64] and [MIPS].
[SPARC || SPARC64] (sys_sigreturn): Change struct regs to struct pt_regs.
* syscall.c: Drop asm/regs.h include.
[SPARC || SPARC64] (internal_syscall, get_scno, get_error, force_result,
syscall_enter): Change struct regs to struct pt_regs.
* util.c: Drop asm/regs.h include.
(_hack_syscall5, _ptrace): Delete.
[SPARC || SPARC64] (getpc, printcall, arg_setup_state): Change
struct regs to struct pt_regs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-12 19:54:21 +00:00
7674006eed Fix follow fork/vfork on Linux ARM OABI
__NR_SYSCALL_BASE eis 0 for EABI and is 0x900000 for OABI.
* process (change_syscall) [LINUX && ARM]: Mask off the high order bits
when changing syscall.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name>
2009-09-18 12:18:03 +00:00
Andreas Schwab
99c85693a5 Zero-extend 32-bit addresses when printing argv array.
(printargv): Zero-extend 32-bit addresses.
Fixes RH#519480 "64-bit strace is lazy on execve of 32-bit
process".
2009-08-28 19:36:20 +02:00
Andreas Schwab
85f583229f Add more futex decoding.
* process.c (FUTEX_WAIT_REQUEUE_PI, FUTEX_CMP_REQUEUE_PI)
(FUTEX_PRIVATE_FLAG, FUTEX_CLOCK_REALTIME): Define.
(futexops): Add entries for them.
(sys_futex): Decode FUTEX_CMP_REQUEUE_PI and
FUTEX_WAIT_REQUEUE_PI.
2009-08-12 09:56:16 +02:00
Roland McGrath
eb9e2e8904 Revert unapproved commits. 2009-06-02 16:49:22 -07:00
4bcd5ef922 * bjm.c (sys_query_module): Fix format warning reported by
gcc -Wformat-security.
* file.c (tprint_open_modes): Likewise.
* process.c (printargv): Likewise.
* signal.c (printsignal): Likewise.
2009-06-01 10:32:27 +00:00
Denys Vlasenko
e740fd31d2 * file.c (print_dirfd): Use int for file descriptor, not a long.
* process.c (printwaitn): Use int for PID, not a long.
2009-04-16 12:06:16 +00: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
5ae2b7c601 AVR32 support by Hans-Christian Egtvedt
(hans-christian.egtvedt AT atmel.com).
* configure.ac: Make it recognize avr32.
* defs.h: Define LINUX_AVR32.
* linux/avr32/syscallent.h: New file.
* Makefile.am: Reference linux/avr32/syscallent.h.
* proc.c (change_syscall, setarg): Add support for avr32.
(struct xlat struct_user_offsets[]): Ditto.
* syscall.c (get_scno): Ditto.
(get_error, force_result, syscall_enter): Ditto.
* util.c (getpc, printcall): Ditto.
2009-02-27 20:32:52 +00:00
Denys Vlasenko
ea0e6e8026 CRIS support by Hinko Kocevar (hinko.kocevar AT cetrtapot.si)
* configure.ac: Make it recognize cris.
* process.c: Define ARG_xxx constants for cris.
(change_syscall): Add support for cris.
(struct_user_offsets): Add cris-specific data.
* signal.c (sys_sigreturn): Add support for cris.
* syscall.c (get_scno): Add support for cris.
(syscall_fixup): Add support for cris.
(get_error): Add support for cris.
(syscall_enter): Add support for cris.
(force_result): While at it, fix cpp directives indentation.
* util.c (printcall): Add support for cris.
2009-02-25 17:08:40 +00:00
Denys Vlasenko
4dedd561d6 Replace many more bare ptrace calls with calls to wrappers
which do proper error-checking and set tcp->ptrace_errno.
In some cases, missing error checking is added.
Error handling for trace_syscall() failures and other cases
where tcp->ptrace_errno is nonzero is cleaned up a bit
and made more verbose if we see error other than ESRC.
Some comments are added or expanded.
* defs.h: Declare ptrace_cmds[]. Modify do_ptrace
declaration (last parameter is long, not void *).
* process.c: Make ptrace_cmds[] non-static.
(change_syscall): Use do_ptrace() instead of bare ptrace().
* signal.c: Use do_ptrace() instead of bare ptrace().
* strace.c: Update trace_syscall() failure handling.
* syscall.c: Use do_ptrace() instead of bare ptrace().
* util.c: Use do_ptrace() instead of bare ptrace().
Update do_ptrace() wrapper.
(str_PTRACE_xxx): New function - helper returning "PTRACE_xxx".
(do_ptrace_peekdata): New function - wrapper for PTRACE_PEEKDATA
(do_ptrace5): New function - wrapper for 5-argument ptrace calls.
2009-02-24 15:17:53 +00:00
Denys Vlasenko
c7e837154d * process.c: Indent preprocessor directives so that nesting
can be figured out. Add PTRACE_SET_SYSCALL to ptrace_cmds[].
2009-02-24 12:59:47 +00:00
Denys Vlasenko
84e20af5a6 Cleanup after tcb table expansion simplification.
There was code which was trying to continue tracing
even if table expansion fails. Now we treat it as fatal
failure, so this code is removed by this change.
* defs.h: Delete TCB_FOLLOWFORK constant.
* process.c: Delete fork_tcb() and all calls of it.
* strace.c (startup_attach): Remove usage of TCB_FOLLOWFORK.
* syscall.c: Indent preprocessor directives.
2009-02-10 16:03:20 +00:00
Denys Vlasenko
7e0615f3ae * process.c (internal_clone): Check and complain if pid value
looks insane.
* strace.c (alloc_tcb): Clear *all* fields in reused tcb.
(main): Query and remember uname() info on startup.
(handle_stopped_tcbs): Do not use PTRACE_SETOPTIONS on Linux < 2.6.29.
(printleader): Correct printing of "<unavailable>" markers.
2009-01-28 19:00:54 +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
Denys Vlasenko
db78f76e96 fix fallout from recent tcb table expansion error handling change 2009-01-26 12:55:40 +00:00
Denys Vlasenko
418d66a847 Two cleanups: tcb table expansion failure is not really a survivable
event, we do not have any viable way to continue. No wonder most
places where that is detected have FIXMEs.
It's way simpler to treat as fatal failure, and handle it inside
tcb table expansion finctions.
Second cleanup: tidy up haphazard locations of a few externs.

* defs.h: Change return type of expand_tcbtab() to void.
Declare change_syscall().
* process.c: Change all callsites of alloctcb(), alloc_tcb() and
fork_tcb(), removing now-redundant error checks.
(fork_tcb): Change return type to void - it can't fail now.
* strace.c: Move extern declarations out of function bodies.
Change all callsites of alloctcb(), alloc_tcb() and
fork_tcb(), removing now-redundant error checks.
(expand_tcbtab): Change return type to void - it can't fail now.
On failure to expand, print a message, clean up, and exit.
(alloc_tcb): On failure to expand, print a message, clean up, and exit.
* util.c (setbpt): Remove extern declaration from function body.
2009-01-17 01:52:54 +00:00
Denys Vlasenko
f9a7e63a1a * process.c: Add a comment. No code changes.
* strace.c (collect_stopped_tcbs): Stop reversing list of stopped
tcp's. I'm not totally convinced it is crucial, but this is surely
fits the concept of "least surprise".
Do not collect TCB_SUSPENDED tcp's (this is closer to how
it was before).
(handle_stopped_tcbs): Remove the code to reject TCB_SUSPENDED tcp's,
it's done earlier now. In an unobvious way, this was causing
SIGSTOPs from freshly attached children to be misinterpreted.
2009-01-17 00:21:31 +00:00
Denys Vlasenko
f535b54bc4 Fixes for ptrace() argument parsing.
* process.c: Add parsing of PTRACE_SETOPTIONS, PTRACE_GETEVENTMSG,
PTRACE_GETSIGINFO, PTRACE_SETSIGINFO.
* strace.c (handle_stopped_tcbs): Make PTRACE_SETOPTIONS
define check more robust.
* defs.h: Declare several "extern const struct xlat" arrays here.
* desc.c: Remove open_mode_flags[] and open_access_modes[]
extern declarations.
* net.c: Remove open_mode_flags[] extern declaration.
* sock.c: Remove addrfams[] extern declaration.
* util.c: Remove struct_user_offsets[] extern declaration.
* signal.c: Remove open_mode_flags[] extern declaration.
2009-01-13 18:30:55 +00:00
Denys Vlasenko
ef2fbf856c Output format fixes, improving the situation after recent
change which added better handling of processes suddenly
disappearing. Now we often do not finish last line
before exiting in those cases.
The only change affecting something other than output
is change in umovestr where we were calling
abort() on ptrace error.

* strace.c (trace): If trace_syscall() failed with ESRCH,
finish current output line with " <unfinished ...>".
(mp_ioctl): While we are at it, fix gross style mismatch
in this function definition. No code chages.
* syscall.c (trace_syscall): If decode fails on syscall exit,
finish current output line with "= ? <unavailable>".
* util.c (umoven): Do not complain if error is ESRCH.
(umovestr): Do not complain and do not abort() if error is ESRCH.
* defs.h: Remove unused tcp parameter from printtrailer().
* process.c: Adjust printtrailer() calls accordingly.
* strace.c: Adjust printtrailer() calls accordingly.
* syscall.c: Adjust printtrailer() calls accordingly.
2009-01-06 21:45:06 +00:00
Denys Vlasenko
adedb51019 Fixing many instances of broken indentation with spaces instead of tabs.
No code changes.
2008-12-30 18:47:55 +00:00
Denys Vlasenko
732d1bf4d4 Make strace somewhat resilient against process disappearing
under its claws. Prime example is sudden SIGKILL.
Fixes RH#472053
2008-12-17 19:21:59 +00:00
Denys Vlasenko
932fc7d4fc This patch does not change any logic.
It merely passes tcp pointer to upeek instead of pid.
This is needed if one wants to check or change
some tcp fields.

I have patches which require this. I can imagine someone else
eventually needing to look at tcp for completely orthogonal reasons.
2008-12-16 18:18:40 +00:00
8dd31ddfcc 2008-11-09 Dmitry V. Levin <ldv@altlinux.org>
* process.c (prctl_options): Update constants from linux 2.6.27.
2008-11-11 00:25:22 +00:00
87ea1f4fe6 2008-10-23 Mike Frysinger <vapier@gentoo.org>
Port strace to the Blackfin architecture.
	* configure.ac: Add bfin to supported architectures.
	* process.c: Skip u_fpvalid/u_fpstate for Blackfin architecture.
	(change_syscall): Support Blackfin architecture.
	* syscall.c: Declare r0 for Blackfin architecture.
	(get_scno): Decode Blackfin syscall number.
	(syscall_fixup): Extract Blackfin return value.
	(get_error): Decode Blackfin return value.
	(force_result): Poke Blackfin return value.
	(syscall_enter): Extract Blackfin syscall arguments.
	* defs.h: Define TCB_WAITEXECVE for Blackfin architecture.
	* linux/syscall.h (sys_sram_alloc): Declare for Blackfin
	architecture.
	* system.c (sys_sram_alloc): Decode Blackfin sram_alloc() syscall.
	* util.c (getpc): Handle PC on Blackfin architecture.
	(printcall): Likewise.
	* linux/bfin/ioctlent.h, linux/bfin/syscallent.h: New Blackfin
	headers.
	* Makefile.am (EXTRA_DIST): Add linux/bfin/ioctlent.h and
	linux/bfin/syscallent.h.
2008-11-10 22:21:41 +00:00
21a7534745 2008-04-19 Dmitry V. Levin <ldv@altlinux.org>
* desc.c (sys_fcntl): Do not initialize auxstr for failed syscall.
	* process.c (sys_fork, sys_rfork) [USE_PROCFS]: Likewise.
	* signal.c (sys_signal): Likewise.
	* stream.c (internal_stream_ioctl): Likewise.
	* time.c (sys_adjtimex): Likewise.
	* syscall.c (trace_syscall): If RVAL_STR is set, then
	print auxstr for failed syscall as well.
2008-09-03 01:22:18 +00:00
50f6013c15 2008-04-19 Dmitry V. Levin <ldv@altlinux.org>
* process.c (sys_prctl): Decode PR_SET_PDEATHSIG, PR_GET_PDEATHSIG,
	PR_SET_DUMPABLE, PR_GET_DUMPABLE, PR_SET_KEEPCAPS, PR_GET_KEEPCAPS.
	Fix PR_GET_UNALIGN decoder.
2008-09-03 00:56:52 +00:00
f02cf214d9 2008-04-19 Dmitry V. Levin <ldv@altlinux.org>
* process.c (prctl_options): Add more constants.
2008-09-03 00:54:40 +00:00
Roland McGrath
5b63d963ac 2008-07-17 Roland McGrath <roland@redhat.com>
* process.c (printwaitn): When current personality's wordsize is
	smaller than native, sign-extend the PID argument from 32 bits.
2008-07-18 02:16:47 +00:00
Roland McGrath
1aeaf74640 2008-07-17 Roland McGrath <roland@redhat.com>
* process.c (futexops): Update table.
	(sys_futex): Handle FUTEX_WAIT_BITSET correctly.
	From Ulrich Drepper <drepper@redhat.com>.
	Fixes RH#448628.
2008-07-18 01:27:39 +00:00
Roland McGrath
41c48227a8 2008-07-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Trace even VFORK on -f on all the platforms.
	* strace.1 <-f>: Describe Linux catches new children immediately.
	<-F>: Make the option obsolete.  Move the SunOS VFORK comment to the
	`-f' option description.
	* defs.h (followvfork): Declaration removed.
	* strace.c (followvfork): Variable removed.
	(main) <-F>: Merge with the `-f' option.
	(trace): Make !FOLLOWVFORK unconditional.
	* process.c (internal_fork): Make !FOLLOWVFORK unconditional.
2008-07-18 00:25:10 +00:00
Roland McGrath
542c2c6fe2 2007-08-26 Daniel Jacobowitz <dan@codesourcery.com>
* defs.h [MIPS]: Include <sgidefs.h>.
	(MAX_QUALS): Update for MIPS.
	(LINUX_MIPSO32, LINUX_MIPSN32, LINUX_MIPSN64, LINUX_MIPS64): Define.
	(struct tcb): Add ext_arg for MIPS N32.
	(TCB_WAITEXECVE): Define for MIPS.
	(ALIGN64): Use LINUX_MIPSO32.
	* file.c (sys_lseek): Use ext_arg for MIPS N32.
	(sys_readahead, sys_fadvise64_64): Likewise.
	* io.c (sys_pread64, sys_pwrite64): Likewise.
	* mem.c (print_mmap): Take OFFSET argument.
	(sys_old_mmap): Update call to print_mmap.
	(sys_mmap): Use ext_arg for MIPS N32.
	* process.c (struct_user_offsets): Add MIPS registers.
	* signal.c (sys_sigreturn): Handle MIPS N32 and MIPS N64.  Correct
	MIPS O32 call to sprintsigmask.
	* syscall.c (internal_syscall): Handle MIPS N32.  Check for
	TCB_WAITEXECVE on MIPS.
	(force_result): Add a comment about MIPS N32.
	(syscall_enter): Handle MIPS N32 and MIPS N64.
	* linux/syscall.h (sys_pread64, sys_pwrite64): Declare.
	* linux/mips/syscallent.h: Include "dummy.h".  Handle alternate
	MIPS ABIs.
2008-05-20 01:11:56 +00:00
Roland McGrath
1e868064d1 2007-11-19 Andreas Schwab <schwab@suse.de>
* process.c (sys_ptrace) [IA64]: For PTRACE_PEEKDATA,
	PTRACE_PEEKTEXT and PTRACE_PEEKUSER the data is returned directly.
2007-11-19 22:11:45 +00:00
Roland McGrath
e5039fb74e 2007-11-03 Roland McGrath <roland@redhat.com>
* process.c (prctl_options): Add numerous constants.
	From Sami Farin <safari@u.safari.iki.fi>.
	Fixes RH#364401.
2007-11-03 23:58:07 +00:00
Roland McGrath
85a3bc4a04 2007-08-01 Roland McGrath <roland@redhat.com>
* process.c (printargv): Handle boundary cases correctly.
	Handle biarch fetching correctly.
2007-08-02 02:13:05 +00:00
Roland McGrath
db8319f2fa 2007-07-23 Ulrich Drepper <drepper@redhat.com>
* process.c (sys_getcpu): New function.
	* linux/syscall.h: Declare sys_getcpu.
	* linux/syscallent.h: Add entry for getcpu.
2007-08-02 01:37:55 +00:00
Roland McGrath
51942a9f14 2007-07-05 Roland McGrath <roland@frob.com>
* process.c [LINUX] (futexops): Add many new values.
	[LINUX] (futexwakeops, futexwakecmps): New tables.
	[LINUX] (sys_futex): Use them.
	From Ulrich Drepper <drepper@redhat.com>.
	Fixes RH#241467.
2007-07-05 18:59:11 +00:00
ab9008bc08 2006-12-27 Dmitry V. Levin <ldv@altlinux.org>
Add const qualifier to xlookup() return value

	* defs.h (xlookup): Add const qualifier to return value.
	* desc.c (sprintflags): Likewise.
	* process.c (printpriv): Update xlookup() use.
	* signal.c (sprintsigmask): Add const qualifier to first argument and return value.
	* util.c (xlookup): Add const qualifier to return value.
	(printxval): Update xlookup() use.
2007-01-11 22:05:04 +00:00
10de62bb05 2006-12-12 Dmitry V. Levin <ldv@altlinux.org>
Fix -ff -o behaviour.  Fix piping trace output.
	* defs.h (newoutf): Remove.
	(alloctcb): Rename to alloc_tcb.  Add alloctcb() macro wrapper
	around alloc_tcb().
	* process.c [!USE_PROCFS] (internal_clone, internal_fork):
	Remove newoutf() call.
	* strace.c (set_cloexec_flag, strace_fopen, strace_popen,
	swap_uid): New functions.
	(popen_pid): New variable.
	(newoutf): Make static, use strace_fopen().
	(main): Use strace_fopen() and strace_popen(), remove uids
	swapping.  Do not open outfname when followfork > 1.
	Reinitialize tcp->outf properly.
	(alloctcb): Rename to alloc_tcb.  Use newoutf().
	(trace): Check popen_pid.  Remove newoutf() call.
	[USE_PROCFS] (proc_open, proc_poll_open): Use set_cloexec_flag().
	Fixes RH#204950, RH#218435.
2006-12-13 21:45:31 +00:00
b9fe011cdf 2006-12-10 Dmitry V. Levin <ldv@altlinux.org>
Make several global variables static.
	#ifdef definitions of rarely unused functions.
	* defs.h (rflag, tflag, outfname): Remove.
	* strace.c (iflag, interactive, pflag_seen, rflag, tflag,
	outfname, username): Make static.
	* desc.c (sys_getdtablesize): Define only for
	ALPHA || FREEBSD || SUNOS4.
	* file.c (sys_fchroot): Define only for SUNOS4 || SVR4.
	(sys_mkfifo): Define only for FREEBSD.
	* mem.c (sys_sbrk): Define only for FREEBSD || SUNOS4.
	(sys_getpagesize): Define only for
	ALPHA || FREEBSD || IA64 || SUNOS4 || SVR4.
	* net.c (sys_so_socket): Define only for SVR4.
	* process.c (sys_gethostid): Define only for
	FREEBSD || SUNOS4 || SVR4.
	(sys_gethostname): Define only for
	ALPHA || FREEBSD || SUNOS4 || SVR4.
	(sys_setpgrp): Define only for ALPHA || SUNOS4 || SVR4.
	(sys_execv): Define only for SPARC || SPARC64 || SUNOS4.
	* signal.c (sys_sigblock): Define only for FREEBSD || SUNOS4.
	(sys_sighold, sys_sigwait): Define only for SVR4.
	(sys_killpg): Define only for FREEBSD || SUNOS4.
	* stream.c (sys_getmsg): Define only for
	SPARC || SPARC64 || SUNOS4 || SVR4.
	* syscall.c (sys_indir): Define only for SUNOS4.
2006-12-13 16:59:44 +00:00
95ebf5abfc 2006-10-13 Ulrich Drepper <drepper@redhat.com>
Bernhard Kaindl <bk@suse.de>
	    Dmitry V. Levin  <ldv@altlinux.org>
	    Michael Holzheu <holzheu@de.ibm.com>

	Add hooks for new syscalls.  Add decoders for *at, inotify*,
	pselect6, ppoll and unshare syscalls.

	* defs.h: Declare print_sigset.
	* desc.c (sys_pselect6): New function.
	* file.c (decode_open, decode_access, decode_mkdir,
	decode_readlink, decode_chmod, decode_utimes, decode_mknod):
	New functions.
	(sys_open, sys_access, sys_mkdir, sys_readlink, sys_chmod,
	sys_utimes, sys_mknod): Use them.
	[LINUX] (fstatatflags, unlinkatflags, inotify_modes): New
	variables.
	[LINUX] (print_dirfd, sys_openat, sys_faccessat,
	sys_newfstatat, sys_mkdirat, sys_linkat, sys_unlinkat,
	sys_symlinkat, sys_readlinkat, sys_renameat, sys_fchownat,
	sys_fchmodat, sys_futimesat, sys_mknodat, sys_inotify_add_watch,
	sys_inotify_rm_watch): New functions.
	* process.c [LINUX] (sys_unshare): New function.
	* signal.c (print_sigset): New function.
	(sys_sigprocmask): Use it.
	* stream.c (decode_poll): New function.
	(sys_poll): Use it.
	[LINUX] (sys_ppoll): New function.
	* linux/syscall.h: Delcare new syscall handlers.
	* linux/syscallent.h: Hook up new syscalls.
	* linux/alpha/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	Fixes RH#178633.
2006-10-13 20:25:12 +00:00
76860f60d7 2006-03-29 Dmitry V. Levin <ldv@altlinux.org>
Fix race conditions in tcb allocation.
	* process.c (fork_tcb): Return error code as documented.  Do not
	print "tcb table full" error message.
	[USE_PROCFS] (internal_fork): Do not print "tcb table full"
	error message.
	[SYS_clone || SYS_clone2] (internal_clone, internal_fork): Call
	fork_tcb() before alloctcb().  Do not print "tcb table full"
	error message.
	* strace.c (main): Do not print "tcb table full" error message.
	(expand_tcbtab): Print error message in case of memory allocation
	failure.
	(alloctcb): Print error message when tcb table is full.
	(trace): Expand tcb table if necessary prior to allocating
	entry there.  Do not print "tcb table full" error message.
	Fixes RH#180293.
2006-10-11 22:55:25 +00:00
Roland McGrath
f691bd2a4f 2006-03-30 Daniel Jacobowitz <dan@codesourcery.com>
* process.c (change_syscall): Add ARM support.
	* syscall.c (get_scno): Handle ARM EABI.
	Fixes Debian#360152.
2006-04-25 07:34:41 +00:00
Roland McGrath
d56a656ec8 2005-08-03 Roland McGrath <roland@redhat.com>
* process.c (internal_wait): Don't suspend when known child is known
	to be exiting already.
2005-08-03 11:23:43 +00:00
Roland McGrath
a4d4853f67 2005-06-08 Dmitry V. Levin <ldv@altlinux.org>
Minor namespace cleanup.
	* defs.h (string_quote): Remove declaration.
	* file.c (openmodessol) [LINUXSPARC]: Make static.
	(fileflags): Likewise.
	(aclcmds, aclipc) [HAVE_SYS_ACL_H]: Likewise.
	(direnttypes) [FREEBSD || LINUX]: Likewise.
	(xattrflags): Likewise.
	* process.c (unalignctl_string): Make static.
	(setarg): Disable.
	* syscall.c (subcalls_table): Make static.
	(socket_map) [!(LINUX && (ALPHA || MIPS))]: Likewise.
	(sparc_socket_decode): Make static, define for [SPARC || SPARC64] only.
	(decode_subcall): Make static.
	(syscall_fixup): Likewise.
	(get_error): Likewise.
	(syscall_enter): Likewise.
	* util.c (tv_tv): Disable.
	(getpc): Likewise.
	(string_quote): Make static.
	Fixes RH#159688.
2005-06-08 20:45:28 +00:00
Roland McGrath
a4f9f2da07 2005-06-06 Roland McGrath <roland@redhat.com>
* process.c (struct_user_offsets) [X86_64]: Reorder elements so
	matching works right.
	Fixes RH#159787.
	* defs.h (struct sysent): New member `native_scno'.
	(known_scno): Declare new function.
	* linux/syscallent.h: Add new final field to interesting syscalls.
	* syscall.c (known_scno): New function.
	(dumpio, internal_syscall, syscall_fixup, trace_syscall): Use it.
	* process.c (internal_fork, internal_exit): Likewise.
	[IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Likewise.
	* strace.c (proc_open): Likewise.
	* util.c [LINUX] (setbpt): Likewise.
	* linux/syscall.h: Remove [!defined(X86_64)] from conditional
	for defining SYS_socket_subcall et al.
	* linux/syscallent.h: Likewise for #error check.
	* syscall.c (trace_syscall): Likewise for SYS_{socketcall,ipc} cases.
	Fixes RH#158934.
2005-06-07 23:21:20 +00:00
Roland McGrath
aa524c88c4 2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
Deal with memory management issues.
	* defs.h (tprint_iov): Update prototype.
	* desc.c (sys_epoll_wait) [HAVE_SYS_EPOLL_H]: Do not allocate
	epoll_event array of arbitrary size on the stack, to avoid
	stack overflow.
	* file.c (print_xattr_val): Check for integer overflow during
	malloc size calculation, to avoid heap corruption.
	* io.c (tprint_iov) [HAVE_SYS_UIO_H]: Check for integer overflow
	during malloc size calculation, to avoid heap corruption.
	Change iovec array handling to avoid heap memory allocation.
	* mem.c (get_nodes) [LINUX]: Check for integer overflow during
	size calculation and do not allocate array of arbitrary size on
	the stack, to avoid stack overflow.
	* net.c (printcmsghdr) [HAVE_SENDMSG]: Do not allocate array of
	arbitrary size on the stack, to avoid stack overflow.  Do not
	trust cmsg.cmsg_len to avoid read beyond the end of allocated
	object.
	(printmsghdr) [HAVE_SENDMSG]: Update tprint_iov() usage.
	* process.c (sys_setgroups): Check for integer overflow during
	malloc size calculation, to avoid heap corruption.  Change gid_t
	array handling to avoid heap memory allocation.
	(sys_getgroups): Likewise.
	(sys_setgroups32) [LINUX]: Likewise.
	(sys_getgroups32) [LINUX]: Likewise.
	* stream.c (sys_poll) [HAVE_SYS_POLL_H]: Check for integer
	overflow during malloc size calculation, to avoid heap corruption.
	Change pollfd array handling to avoid heap memory allocation.
	* system.c (sys_sysctl) [LINUX]: Check for integer overflow
	during malloc size calculation, to avoid heap corruption.
	* util.c (dumpiov) [HAVE_SYS_UIO_H]: Check for integer overflow
	during malloc size calculation, to avoid heap corruption.
	Fixes RH#159196.
2005-06-01 19:22:06 +00:00
Roland McGrath
b2dee13345 2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printxval): Change third argument from "char *" to
	"const char *".
	(printflags): Add third argument, "const char *", with similar
	meaning to the third argument of printxval().
	* defs.h (printxval): Change third argument from "char *" to
	"const char *".
	(printflags): Add third argument.
	* bjm.c (sys_query_module) [LINUX]: Pass third argument to
	printflags().
	* desc.c (sys_fcntl): Likewise.
	(sys_flock) [LOCK_SH]: Likewise.
	(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
	* file.c (sys_open): Likewise.
	(solaris_open) [LINUXSPARC]: Likewise.
	(sys_access): Likewise.
	(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
	(realprintstat) [HAVE_LONG_LONG_OFF_T &&
	HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
	(printstat64) [HAVE_STAT64 &&
	HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
	(sys_setxattr, sys_fsetxattr): Likewise.
	* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
	sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
	(sys_mq_open) [LINUX]: Likewise.
	(printmqattr) [HAVE_MQUEUE_H]: Likewise.
	* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
	(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
	(sys_mprotect): Likewise.
	(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
	(sys_msync) [MS_ASYNC]: Likewise.
	(sys_mctl) [MC_SYNC]: Likewise.
	(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
	Likewise.
	* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
	(sys_send, sys_sendto): Likewise.
	(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
	(sys_recv, sys_recvfrom): Likewise.
	(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
	(printicmpfilter) [ICMP_FILTER]: Likewise.
	* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
	* process.c (sys_clone) [LINUX]: Likewise.
	(printwaitn): Likewise.
	(sys_waitid) [SVR4 || LINUX]: Likewise.
	* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
	(sys_sigaction): Likewise.
	(printcontext) [SVR4]: Likewise.
	(print_stack_t) [LINUX) || FREEBSD]: Likewise.
	(sys_rt_sigaction) [LINUX]: Likewise.
	* sock.c (sock_ioctl) [LINUX]: Likewise.
	* stream.c (sys_putmsg, sys_getmsg): Likewise.
	(sys_putpmsg) [SYS_putpmsg]: Likewise.
	(sys_getpmsg) [SYS_getpmsg]: Likewise.
	(sys_poll): Likewise.
	(print_transport_message) [TI_BIND]: Likewise.
	(stream_ioctl): Likewise.
	* system.c (sys_mount, sys_reboot): Likewise.
	(sys_cacheflush) [LINUX && M68K]: Likewise.
	(sys_capget, sys_capset) [SYS_capget]: Likewise.
	* term.c (term_ioctl) [TIOCMGET]: Likewise.
	* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
	Likewise.
	Fixes RH#159310.
2005-06-01 19:02:36 +00:00
Roland McGrath
f04bb48240 2005-05-05 Anton Blanchard <anton@samba.org>
* process.c (ptrace_cmds): Add PTRACE_GETVRREGS and PTRACE_SETVRREGS
	if defined.
2005-05-09 07:45:33 +00:00
Roland McGrath
15dca8e307 2004-12-19 Dmitry V. Levin <ldv@altlinux.org>
* strace.c (main) [!USE_PROCFS]: In child process, raise SIGSTOP
	right before execv() call.  Remove fake_execve() call.
	* defs.h (fake_execve): Remove unused declaration.
	* process.c (fake_execve): Remove unused function.
	Fixes RH#143365.
2005-02-06 01:16:32 +00:00
Roland McGrath
c2d5eb082d 2005-02-01 Roland McGrath <roland@redhat.com>
* process.c [LINUX] [X86_64] (sys_arch_prctl): New function.
	* linux/syscall.h: Declare it.
	* linux/x86_64/syscallent.h: Use it.
	Part of RH#142667.
	* process.c (sys_sched_setscheduler): Use %#lx format for bad pointer.
	(sys_sched_getparam, sys_sched_setparam): Likewise.
	Part of RH#142667.
2005-02-02 04:16:56 +00:00
Roland McGrath
5e02a5793d 2004-10-19 Roland McGrath <roland@redhat.com>
* process.c (WCOREFLAG): Define if not defined.
	(W_STOPCODE, W_EXITCODE): Likewise.
	Reported by Marty Leisner <mleisner@eng.mc.xerox.com>.
2004-10-19 23:33:47 +00:00
Roland McGrath
39426a359f 2004-09-15 Roland McGrath <roland@redhat.com>
* linux/syscallent.h: waitid takes 5 arguments, and is in TP category.
	* process.c (sys_waitid): Handle fifth argument (struct rusage *).
2004-10-06 22:02:59 +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
c74c0b732b 2004-09-01 Roland McGrath <roland@redhat.com>
* process.c (internal_wait): Take second arg giving index of flags
	argument.
	* defs.h: Update prototype.
	* syscall.c (internal_syscall): Update caller.
	Also use internal_wait for SYS_waitid.
	* process.c (sys_waitid): Define for [LINUX] as well.
	Don't tweak TCB_SUSPENDED--internal_wait does that.
	(waitid_types): Conditionalize use of nonstandard P_* macros.
2004-09-01 19:39:46 +00:00
Roland McGrath
6d1a65c759 2004-07-07 David S. Miller <davem@nuts.davemloft.net>
* linux/sparc/syscallent.h: Sync with reality.
	* linux/sparc/syscall.h (sys_sendfile64, sys_futex, sys_gettid,
	sys_sched_setaffinity, sys_sched_getaffinity, sys_setxattr,
	sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr,
	sys_fgetxattr, sys_listxattr, sys_llistxattr, sys_flistxattr,
	sys_removexattr, sys_lremovexattr, sys_fremovexattr,
	sys_remap_file_pages, sys_readahead, sys_tgkill, sys_statfs64,
	sys_fstatfs64, sys_clock_settime, sys_clock_gettime,
	sys_clock_getres, sys_clock_nanosleep, sys_timer_create,
	sys_timer_settime, sys_timer_gettime): New declarations.
	* linux/sparc64/dummy2.h, linux/sparc64/syscallent2.h,
	linux/sparc64/syscall.h, linux/sparc64/errnoent.h,
	linux/sparc64/errnoent1.h, linux/sparc64/errnoent2.h,
	linux/sparc64/ioctlent.h, linux/sparc64/ioctlent1.h,
	linux/sparc64/ioctlent2.h, linux/sparc64/signalent.h,
	linux/sparc64/signalent.h, linux/sparc64/signalent.h,
	linux/sparc64/signalent1.h, linux/sparc64/signalent2.h,
	linux/sparc64/syscall1.h, linux/sparc64/syscallent.h,
	linux/sparc64/syscallent1.h: New files.
	* defs.h (LINUXSPARC): Define also when SPARC64.
	(LINUX && SPARC64): Set SUPPORTED_PERSONALITIES to 3.
	Ignore SIGTRAP after execve by defining TCB_WAITEXECVE.
	Define possibly missing __NR_exit_group.  Declare getrval2.
	* configure.ac (sparc64): New architecture case.
	* config.h.in (SPARC64): New define.
	* file.c (stat_sparc64): New structure.
	(printstat_sparc64): New output routine for that.
	(printstat): Call it, if personality is 2.
	(printstat64): Likewise.
	* util.c: Conditionalize ptrace defines on LINUXSPARC
	not LINUX && SPARC.
	(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
	to PTRACE_FOOREGS64 so that more sparc code can be shared
	between 64-bit and 32-bit.
	(_hack_syscall5): Correct trap number when SPARC64.
	(PTRACE_WRITE{TEXT,DATA}): Add SPARC64 to ifdef guard.
	(getpc): Handle SPARC64 && LINUX.
	(printcall): Likewise.
	(arg fetching/setting): Use same code for SPARC64 LINUX
	as for SPARC.
	(setbpt): Handle SPARC64 && LINUX.
	(clearbpt): Likewise.
	* signal.c: Conditionalize ptrace defines on SPARC and
	SPARC64.
	(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
	to PTRACE_FOOREGS64 so that more sparc code can be shared
	between 64-bit and 32-bit.
	(m_siginfo): Use same definition on SPARC64 as SPARC.
	(sys_sigreturn): Handle LINUX && SPARC64.
	* syscall.c: Conditionalize ptrace defines on SPARC and
	SPARC64.
	(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
	to PTRACE_FOOREGS64 so that more sparc code can be shared
	between 64-bit and 32-bit.
	(getscno): Use same static state on SPARC64 as SPARC,
	and add SPARC64 handling.
	(get_error): Handle LINUX && SPARC64.
	(force_result): Likewise.
	(syscall_enter): Likewise.
	(trace_syscall): Handle sys_socketcall and sys_ipc on SPARC64
	just like SPARC.
	(getrval2): Handle LINUX && SPARC64.
	* process.c: Conditionalize ptrace defines on SPARC and
	SPARC64.
	(SPARC64 && LINUX): Define r_pc to r_tpc, and PTRACE_FOOREGS
	to PTRACE_FOOREGS64 so that more sparc code can be shared
	between 64-bit and 32-bit.
	(change_syscall): Handle LINUX && SPARC64.
	(struct_user_offsets): Ifdef out those which do not exist
	on SPARC64.
	* net.c (sys_pipe): Handle LINUX && SPARC64.
	* ioctl.c: Fix initializer typo for nioctlents2, was
	nioctlents1 by accident.
2004-07-12 07:44:08 +00:00
Roland McGrath
fdb097f637 2004-06-28 Andreas Schwab <schwab@suse.de>
* process.c (internal_exec): Move TCB_WAITEXECVE handling here.
	(sys_execve): Remove it here.
2004-07-12 07:38:55 +00:00
Roland McGrath
7b54a7ae61 2004-06-03 Roland McGrath <roland@redhat.com>
* strace.c (main) [LINUX]: Expand TCBTAB as necessary for threads
	attached.  Attach threads only under -f.  Set TCB_FOLLOWFORK in them.
	(expand_tcbtab): New function, broken out of ...
	* process.c (fork_tcb): ... here, call that.
	* defs.h: Declare expand_tcbtab.
2004-06-04 01:50:45 +00:00
Roland McGrath
f8cc83c9ef 2004-04-19 Roland McGrath <roland@redhat.com>
* process.c (printstatus): Add a space before | in output.
2004-06-04 01:24:07 +00:00
Roland McGrath
79fbda596a 2004-04-13 Roland McGrath <roland@redhat.com>
* process.c (printstatus): Mask out bits presented symbolically, and
	print "| 0xnnn" if the remaining bits are not all zero.
	Fixes Debian bug #240062.
	* process.c (print_affinitylist): Rewritten to handle indirect values.
	(sys_sched_setaffinity, sys_sched_getaffinity): Update callers.
	From Ulrich Drepper <drepper@redhat.com>.
	Fixes RH#118685.
2004-04-14 02:45:55 +00:00
Roland McGrath
7decfb2298 2004-03-01 Roland McGrath <roland@redhat.com>
* configure.ac: Check for `struct user_desc' in <asm/ldt.h>.
	* process.c [HAVE_STRUCT_USER_DESC]: Use struct user_desc in place of
	struct modify_ldt_ldt_s.
	* mem.c [HAVE_STRUCT_USER_DESC]: Likewise.
2004-03-01 22:10:52 +00:00
Roland McGrath
b09e33a286 2004-03-01 Roland McGrath <roland@redhat.com>
* process.c (sys_execve): Clear instead of set TCB_WAITEXECVE on
	erring syscall.
2004-03-01 22:03:58 +00:00
Roland McGrath
fb1bc07376 2004-03-01 Roland McGrath <roland@redhat.com>
* process.c (struct_user_offsets) [LINUX && IA64]: Conditionalize
	PT_AR_CSD and PT_AR_SSD uses in case of older kernel headers.
	* configure.ac: Check for `struct pt_all_user_regs'
	and `struct ia64_fpreg' in <sys/ptrace.h>.
	* util.c, process.c, syscall.c: Work around conflicts between
	<sys/ptrace.h> and <linux/ptrace.h> for defining those types.
2004-03-01 21:29:24 +00:00
Roland McGrath
279d378b14 2004-03-01 Roland McGrath <roland@redhat.com>
* linux/dummy.h (sys_sched_getscheduler, sys_sched_setparam,
	sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler,
	sys_sched_get_priority_max, sys_sched_get_priority_min): Remove macros.
	* process.c [LINUX] (sys_sched_getscheduler, sys_sched_setparam,
	sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler,
	sys_sched_get_priority_min): New functions.
	From Ulrich Drepper <drepper@redhat.com>.
2004-03-01 20:27:37 +00:00
Roland McGrath
08267b8d67 2003-12-31 David Mosberger <davidm@hpl.hp.com>
* process.c (internal_exit): For ia64, also recognize IA-32 252
	as exit_group().
	(change_syscall): For IA64, also support changing IA-32 syscalls.
	* syscall.c (internal_syscall): For IA64, also recognize IA-32
        syscall 252 (exit_group) as an internal_exit() syscall.
	* util.c (SYS_fork): For IA64, define them to the IA-32 syscall
	number.
	(SYS_vfork): Likewise.
	(arg_setup): For IA64 version, also support IA-32 syscalls.
	(get_arg0): Likewise.
	(get_arg1): Likewise.
	(set_arg0): Likewise.
	(set_arg1): Likewise.
2004-02-20 22:56:43 +00:00
Roland McGrath
5ef24abf00 Revert jhughes commits. 2004-02-20 02:22:35 +00:00
John Hughes
ae25933773 port SSI clustering mods to OpenSSI on Linux 2004-01-29 11:17:50 +00:00
Roland McGrath
ca4e10c060 2003-12-31 David Mosberger <davidm@hpl.hp.com>
* process.c (struct_user_offsets) [IA64]: Fix up register name list.
2004-01-13 10:13:20 +00:00
Roland McGrath
83bd47a91e 2003-09-06 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printuid): New function.
	* defs.h: Declare it.
	* file.c (sys_chown): Use it.
	* file.c (sys_fchown): Likewise.
	* process.c (sys_setreuid, sys_setregid, sys_setresuid,
	sys_setresgid): Likewise.
	* linux/syscallent.h: Better handle getgid32, geteuid32, getegid32,
	setreuid32, setregid32, getgroups32, setgroups32, fchown32,
	setresuid32, getresuid32, setresgid32, getresgid32, chown32,
	setuid32, setgid32, setfsuid32, setfsgid32.
	* process.c [LINUX]: Define GETGROUPS32_T.
	* process.c [LINUX] (sys_setgroups32, sys_getgroups32):
	New functions.
	* linux/syscall.h (sys_setgroups32, sys_getgroups32):
	Declare them.
2003-11-13 22:32:26 +00:00
Roland McGrath
fccfb94863 2003-10-01 Roland McGrath <roland@redhat.com>
* process.c (internal_clone): Don't suspend parent when call requested
	a specific PID that is not a traced child.
2003-10-01 21:59:44 +00:00
Roland McGrath
c0f8bbda62 2003-07-28 Daniel Jacobowitz <drow@mvista.com>
* defs.h (ALIGN64): Define for MIPS.
	* io.c (PREAD_OFFSET_ARG): Define.
	(sys_pread, sys_pwrite): Use it.
	* process.c (struct_user_offsets) [SH]: Check whether REG_XDREG0
	is defined.
	* linux/sh/syscallent.h (pread, pwrite): Take six arguments.
	(truncate64, ftruncate64): Pretty-print.
	* linux/mips/syscallent.h (pread, pwrite): Take six arguments.
	(truncate64, ftruncate64): Take four arguments.
2003-08-21 09:58:00 +00:00
Roland McGrath
9c555e71d2 2003-07-05 Richard Henderson <rth@twiddle.net>
* process.c (sys_clone): Order arguments for alpha the same as x86_64.
	* syscall.c (ERESTART_RESTARTBLOCK): New.
	(trace_syscall): Print it.
	* linux/alpha/syscallent.h (osf_syscall): Name properly.
	(osf_set_program_attributes): Fix typo.
	(osf_nfssvc): Likewise.
	(osf_sigsendset): Likewise.
	(getdents64, gettid, readahead, tkill, setxattr, lsetxattr, fsetxattr,
	getxattr, lgetxattr, fgetxattr, listxattr, llistxattr, flistxattr,
	removexattr, lremovexattr, fremovexattr, futex, sched_setaffinity,
	sched_getaffinity, tuxcall, io_setup, io_destroy, io_getevents,
	io_submit, io_cancel, exit_group, lookup_dcookie, epoll_create,
	epoll_ctl, epoll_wait, remap_file_pages, set_tid_address,
	restart_syscall, fadvise, timer_create, timer_settime, timer_gettime,
	timer_getoverrun, timer_delete, clock_settime, clock_gettime,
	clock_getres, clock_nanosleep, semtimedop): New.
2003-07-09 09:47:59 +00:00
Roland McGrath
f5a477788e 2003-06-26 Roland McGrath <roland@redhat.com>
* configure.ac: SHMEDIA -> SH64
	* defs.h: Likewise.
	* mem.c: Likewise.
	* process.c: Likewise.
	* sock.c: Likewise.
	* syscall.c: Likewise.
	* util.c: Likewise.
	* linux/shmedia/syscallent.h: Moved to ...
	* linux/sh64/syscallent.h: ... here.
2003-06-26 22:40:42 +00:00
Roland McGrath
88812d685d 2003-06-26 Roland McGrath <roland@redhat.com>
* process.c [LINUX] (sys_futex): Grok FUTEX_REQUEUE and print 5th arg.
	* linux/syscallent.h: sys_futex argument count is now 5, not 4.
	* linux/ia64/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	From Jakub Jelinek <jakub@redhat.com>.
2003-06-26 22:27:23 +00:00
Roland McGrath
0f87c4972f 2003-06-03 Roland McGrath <roland@redhat.com>
Linux/ARM improvements from Russell King <rmk@arm.linux.org.uk>:
	* defs.h [LINUX] (TCB_WAITEXECVE): Define for [ARM] too.
	* process.c (struct_user_offsets) [LINUX] [ARM]: Add ARM registers.
	* signal.c [LINUX] (sys_sigreturn) [ARM]: New case.
	* syscall.c (get_scno, syscall_fixup) [LINUX] [ARM]: Case rewritten.
	(get_error) [LINUX] [ARM]: Update.
	(syscall_enter) [LINUX] [ARM]: New case.
	* util.c (printcall) [LINUX] [ARM]: New case.
2003-06-03 23:29:04 +00:00
Roland McGrath
e1e584b8fa 2003-06-02 Roland McGrath <roland@redhat.com>
* configure.ac, defs.h, mem.c, process.c, sock.c, syscall.c, util.c:
	Merged in SHmedia port from Stephen Thomas <stephen.thomas@superh.com>.
2003-06-02 19:18:58 +00:00
Roland McGrath
0962345a57 2003-05-22 Roland McGrath <roland@redhat.com>
* defs.h (struct tcb): New member `nzombies'.
	* strace.c (alloctcb): Initialize it.
	(droptcb): Increment our parent's zombie count.
	* process.c (internal_wait): Don't go into TCB_SUSPENDED if the
	process has zombies it can reap.  On the way out, if we reaped
	an untraced process, decrement the zombie count.
2003-05-23 02:27:13 +00:00
Roland McGrath
984154d246 2003-05-22 Roland McGrath <roland@redhat.com>
* process.c (sys_clone): Mask CSIGNAL out of flags and print that
	separately using signame.
	* process.c (internal_clone) [TCB_CLONE_THREAD]: Use ARG_FLAGS instead
	of literal 0 for index.  Consult the right flags without clobbering
	anything when we reparent the new child to the caller's parent thread.
2003-05-23 01:08:42 +00:00