Version: 0.3.18

* Simplified arch-dependent stuff
* Updated list of syscalls and signals to Linux 2.4.18
* Unified coding-style of all function declarations
* Do not indent lines indicating signals, exit codes, etc
* Updated description
* fix off-by-one problem in checking syscall number (Tim Waugh
  <twaugh@redhat.com> fixed this problem in RedHat two years ago;
  thank you for NOT noticing me...)
diff --git a/sysdeps/linux-gnu/arm/breakpoint.c b/sysdeps/linux-gnu/arm/breakpoint.c
index 446c38b..f2eed98 100644
--- a/sysdeps/linux-gnu/arm/breakpoint.c
+++ b/sysdeps/linux-gnu/arm/breakpoint.c
@@ -5,8 +5,8 @@
 #include <sys/ptrace.h>
 #include "ltrace.h"
 
-void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
-{
+void
+enable_breakpoint(pid_t pid, struct breakpoint * sbp) {
 	int a;
 
 	a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
@@ -18,8 +18,8 @@
 	ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
 }
 
-void disable_breakpoint(pid_t pid, const struct breakpoint * sbp)
-{
+void
+disable_breakpoint(pid_t pid, const struct breakpoint * sbp) {
 	int a;
 
 	a = sbp->orig_value[0] + (sbp->orig_value[1]<<8) + (sbp->orig_value[2]<<16) + (sbp->orig_value[3]<<24);
diff --git a/sysdeps/linux-gnu/arm/regs.c b/sysdeps/linux-gnu/arm/regs.c
index 78ee60f..97a3bfe 100644
--- a/sysdeps/linux-gnu/arm/regs.c
+++ b/sysdeps/linux-gnu/arm/regs.c
@@ -18,20 +18,19 @@
 #define off_lr 56
 #define off_sp 52
 
-void * get_instruction_pointer(pid_t pid)
-{
+void *
+get_instruction_pointer(pid_t pid) {
 	return (void *)ptrace(PTRACE_PEEKUSER, pid, off_pc, 0);
 }
 
-void * get_stack_pointer(pid_t pid)
-{
+void *
+get_stack_pointer(pid_t pid) {
 	return (void *)ptrace(PTRACE_PEEKUSER, pid, off_sp, 0);
 }
 
 /* really, this is given the *stack_pointer expecting
  * a CISC architecture; in our case, we don't need that */
-void * get_return_addr(pid_t pid, void * stack_pointer)
-{
+void *
+get_return_addr(pid_t pid, void * stack_pointer) {
 	return (void *)ptrace(PTRACE_PEEKUSER, pid, off_lr, 0);
 }
-
diff --git a/sysdeps/linux-gnu/arm/syscallent.h b/sysdeps/linux-gnu/arm/syscallent.h
index 5f61c6d..26d7bbf 100644
--- a/sysdeps/linux-gnu/arm/syscallent.h
+++ b/sysdeps/linux-gnu/arm/syscallent.h
@@ -74,7 +74,7 @@
 	"sigpending",                      /* 73 */
 	"sethostname",                     /* 74 */
 	"setrlimit",                       /* 75 */
-	"old_getrlimit",                   /* 76 */
+	"getrlimit",                       /* 76 */
 	"getrusage",                       /* 77 */
 	"gettimeofday",                    /* 78 */
 	"settimeofday",                    /* 79 */
@@ -189,7 +189,7 @@
 	"188",                             /* 188 */
 	"189",                             /* 189 */
 	"vfork",                           /* 190 */
-	"getrlimit",                       /* 191 */
+	"ugetrlimit",                      /* 191 */
 	"mmap2",                           /* 192 */
 	"truncate64",                      /* 193 */
 	"ftruncate64",                     /* 194 */
diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
index 49d2f20..5e48b2e 100644
--- a/sysdeps/linux-gnu/arm/trace.c
+++ b/sysdeps/linux-gnu/arm/trace.c
@@ -84,25 +84,3 @@
 
 	return 0;
 }
-
-int umovestr(struct process * proc, void * addr, int len, void * laddr)
-{
-	long a;
-	int i;
-	int offset=0;
-
-	while(offset<len) {
-		a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
-		for(i=0; i<sizeof(long); i++) {
-			if (((char*)&a)[i] && offset+i < len) {
-				*(char *)(laddr+offset+i) = ((char*)&a)[i];
-			} else {
-				*(char *)(laddr+offset+i) = '\0';
-				return 0;
-			}
-		}
-		offset += sizeof(long);
-	}
-	*(char *)(laddr+offset) = '\0';
-	return 0;
-}
diff --git a/sysdeps/linux-gnu/i386/regs.c b/sysdeps/linux-gnu/i386/regs.c
index f36be55..e60634b 100644
--- a/sysdeps/linux-gnu/i386/regs.c
+++ b/sysdeps/linux-gnu/i386/regs.c
@@ -14,18 +14,17 @@
 # define PTRACE_POKEUSER PTRACE_POKEUSR
 #endif
 
-void * get_instruction_pointer(pid_t pid)
-{
+void *
+get_instruction_pointer(pid_t pid) {
 	return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*EIP, 0);
 }
 
-void * get_stack_pointer(pid_t pid)
-{
+void *
+get_stack_pointer(pid_t pid) {
 	return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*UESP, 0);
 }
 
-void * get_return_addr(pid_t pid, void * stack_pointer)
-{
+void *
+get_return_addr(pid_t pid, void * stack_pointer) {
 	return (void *)ptrace(PTRACE_PEEKTEXT, pid, stack_pointer, 0);
 }
-
diff --git a/sysdeps/linux-gnu/i386/syscallent.h b/sysdeps/linux-gnu/i386/syscallent.h
index 52f69c4..e27b529 100644
--- a/sysdeps/linux-gnu/i386/syscallent.h
+++ b/sysdeps/linux-gnu/i386/syscallent.h
@@ -220,3 +220,19 @@
 	"madvise1",                        /* 219 */
 	"getdents64",                      /* 220 */
 	"fcntl64",                         /* 221 */
+	"222",                             /* 222 */
+	"security",                        /* 223 */
+	"gettid",                          /* 224 */
+	"readahead",                       /* 225 */
+	"setxattr",                        /* 226 */
+	"lsetxattr",                       /* 227 */
+	"fsetxattr",                       /* 228 */
+	"getxattr",                        /* 229 */
+	"lgetxattr",                       /* 230 */
+	"fgetxattr",                       /* 231 */
+	"listxattr",                       /* 232 */
+	"llistxattr",                      /* 233 */
+	"flistxattr",                      /* 234 */
+	"removexattr",                     /* 235 */
+	"lremovexattr",                    /* 236 */
+	"fremovexattr",                    /* 237 */
diff --git a/sysdeps/linux-gnu/i386/trace.c b/sysdeps/linux-gnu/i386/trace.c
index 047ae51..1e38a27 100644
--- a/sysdeps/linux-gnu/i386/trace.c
+++ b/sysdeps/linux-gnu/i386/trace.c
@@ -22,8 +22,6 @@
  */
 int syscall_p(struct process * proc, int status, int * sysnum)
 {
-	static int syscall_active = 0;
-
 	if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
 		*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4*ORIG_EAX, 0);
 
@@ -81,25 +79,3 @@
 
 	return 0;
 }
-
-int umovestr(struct process * proc, void * addr, int len, void * laddr)
-{
-	long a;
-	int i;
-	int offset=0;
-
-	while(offset<len) {
-		a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
-		for(i=0; i<sizeof(long); i++) {
-			if (((char*)&a)[i] && offset+i < len) {
-				*(char *)(laddr+offset+i) = ((char*)&a)[i];
-			} else {
-				*(char *)(laddr+offset+i) = '\0';
-				return 0;
-			}
-		}
-		offset += sizeof(long);
-	}
-	*(char *)(laddr+offset) = '\0';
-	return 0;
-}
diff --git a/sysdeps/linux-gnu/m68k/breakpoint.c b/sysdeps/linux-gnu/m68k/breakpoint.c
index 46c84ce..c74c4d2 100644
--- a/sysdeps/linux-gnu/m68k/breakpoint.c
+++ b/sysdeps/linux-gnu/m68k/breakpoint.c
@@ -5,8 +5,8 @@
 #include <sys/ptrace.h>
 #include "ltrace.h"
 
-void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
-{
+void
+enable_breakpoint(pid_t pid, struct breakpoint * sbp) {
 	int a;
 
 	a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
@@ -17,8 +17,8 @@
 	ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
 }
 
-void disable_breakpoint(pid_t pid, const struct breakpoint * sbp)
-{
+void
+disable_breakpoint(pid_t pid, const struct breakpoint * sbp) {
 	int a;
 
 	a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
diff --git a/sysdeps/linux-gnu/m68k/regs.c b/sysdeps/linux-gnu/m68k/regs.c
index f046f19..1f51417 100644
--- a/sysdeps/linux-gnu/m68k/regs.c
+++ b/sysdeps/linux-gnu/m68k/regs.c
@@ -14,18 +14,17 @@
 # define PTRACE_POKEUSER PTRACE_POKEUSR
 #endif
 
-void * get_instruction_pointer(pid_t pid)
-{
+void *
+get_instruction_pointer(pid_t pid) {
 	return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*PT_PC, 0);
 }
 
-void * get_stack_pointer(pid_t pid)
-{
+void *
+get_stack_pointer(pid_t pid) {
 	return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*PT_USP, 0);
 }
 
-void * get_return_addr(pid_t pid, void * stack_pointer)
-{
+void *
+get_return_addr(pid_t pid, void * stack_pointer) {
 	return (void *)ptrace(PTRACE_PEEKTEXT, pid, stack_pointer, 0);
 }
-
diff --git a/sysdeps/linux-gnu/m68k/trace.c b/sysdeps/linux-gnu/m68k/trace.c
index 8d8af67..43586de 100644
--- a/sysdeps/linux-gnu/m68k/trace.c
+++ b/sysdeps/linux-gnu/m68k/trace.c
@@ -84,25 +84,3 @@
 
 	return 0;
 }
-
-int umovestr(struct process * proc, void * addr, int len, void * laddr)
-{
-	long a;
-	int i;
-	int offset=0;
-
-	while(offset<len) {
-		a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
-		for(i=0; i<sizeof(long); i++) {
-			if (((char*)&a)[i] && offset+i < len) {
-				*(char *)(laddr+offset+i) = ((char*)&a)[i];
-			} else {
-				*(char *)(laddr+offset+i) = '\0';
-				return 0;
-			}
-		}
-		offset += sizeof(long);
-	}
-	*(char *)(laddr+offset) = '\0';
-	return 0;
-}
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index 8390136..a5c18f6 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -18,8 +18,8 @@
 /*
  * Returns a file name corresponding to a running pid
  */
-char * pid2name(pid_t pid)
-{
+char *
+pid2name(pid_t pid) {
 	char proc_exe[1024];
 
 	if (!kill(pid, 0)) {
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index e9397dd..797fc13 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -12,8 +12,8 @@
  * (ie, with fork() or clone())
  * Returns 0 otherwise.
  */
-int fork_p(int sysnum)
-{
+int
+fork_p(int sysnum) {
 	return 0
 #if defined(__NR_fork)
 		|| (sysnum == __NR_fork)
@@ -29,45 +29,67 @@
 
 /* Returns 1 if the sysnum may make the process exec other program
  */
-int exec_p(int sysnum)
-{
+int
+exec_p(int sysnum) {
 	return (sysnum == __NR_execve);
 }
 
-void trace_me(void)
-{
+void
+trace_me(void) {
 	if (ptrace(PTRACE_TRACEME, 0, 1, 0)<0) {
 		perror("PTRACE_TRACEME");
 		exit(1);
 	}
 }
 
-int trace_pid(pid_t pid)
-{
+int
+trace_pid(pid_t pid) {
 	if (ptrace(PTRACE_ATTACH, pid, 1, 0) < 0) {
 		return -1;
 	}
 	return 0;
 }
 
-void untrace_pid(pid_t pid)
-{
+void
+untrace_pid(pid_t pid) {
 	ptrace(PTRACE_DETACH, pid, 1, 0);
 }
 
-void continue_after_signal(pid_t pid, int signum)
-{
+void
+continue_after_signal(pid_t pid, int signum) {
 	/* We should always trace syscalls to be able to control fork(), clone(), execve()... */
 	ptrace(PTRACE_SYSCALL, pid, 0, signum);
 }
 
-void continue_process(pid_t pid)
-{
+void
+continue_process(pid_t pid) {
 	continue_after_signal(pid, 0);
 }
 
-void continue_enabling_breakpoint(pid_t pid, struct breakpoint * sbp)
-{
+void
+continue_enabling_breakpoint(pid_t pid, struct breakpoint * sbp) {
 	enable_breakpoint(pid, sbp);
 	continue_process(pid);
 }
+
+int
+umovestr(struct process * proc, void * addr, int len, void * laddr) {
+	long a;
+	int i;
+	int offset=0;
+
+	while(offset<len) {
+		a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
+		for(i=0; i<sizeof(long); i++) {
+			if (((char*)&a)[i] && offset+i < len) {
+				*(char *)(laddr+offset+i) = ((char*)&a)[i];
+			} else {
+				*(char *)(laddr+offset+i) = '\0';
+				return 0;
+			}
+		}
+		offset += sizeof(long);
+	}
+	*(char *)(laddr+offset) = '\0';
+	return 0;
+}