diff --git a/Makefile b/Makefile index 4aa6841..2cbda41 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,9 @@ dist: $(RM) -r $(PACKAGE)-$(VERSION) $(LN) -s . $(PACKAGE)-$(VERSION) @$(TAR) $(PACKAGE)-$(VERSION).tar.gz \ + $(PACKAGE)-$(VERSION)/src/linux.c \ $(PACKAGE)-$(VERSION)/src/strace.c \ + $(PACKAGE)-$(VERSION)/src/Makefile \ $(PACKAGE)-$(VERSION)/src/project.conf \ $(PACKAGE)-$(VERSION)/Makefile \ $(PACKAGE)-$(VERSION)/COPYING \ diff --git a/src/Makefile b/src/Makefile index 742e826..2e21540 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,13 +15,16 @@ INSTALL = install all: $(TARGETS) -strace_OBJS = strace.o +strace_OBJS = linux.o strace.o strace_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) strace_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) strace: $(strace_OBJS) $(CC) -o strace $(strace_OBJS) $(strace_LDFLAGS) +linux.o: linux.c + $(CC) $(strace_CFLAGS) -c linux.c + strace.o: strace.c $(CC) $(strace_CFLAGS) -c strace.c diff --git a/src/linux.c b/src/linux.c index fadacbc..f56ca0b 100644 --- a/src/linux.c +++ b/src/linux.c @@ -20,7 +20,7 @@ #include "linux.h" -char * syscall[] = +char const * _syscall[] = { "exit", "fork", diff --git a/src/project.conf b/src/project.conf index b9d6c9b..f7d5dcb 100644 --- a/src/project.conf +++ b/src/project.conf @@ -1,8 +1,9 @@ targets=strace cflags_force=-W cflags=-Wall -g -O2 -pedantic +dist=Makefile [strace] type=binary -sources=strace.c +sources=linux.c,strace.c install=$(BINDIR) diff --git a/src/strace.c b/src/strace.c index 0989744..ee8520f 100644 --- a/src/strace.c +++ b/src/strace.c @@ -64,7 +64,7 @@ static int _strace_parent(pid_t pid) static int _handle(pid_t pid, int status) { struct user context; - int size = sizeof(syscall) / 4; + int size = sizeof(_syscall) / 4; if(!WIFSTOPPED(status)) return -1; @@ -74,7 +74,7 @@ static int _handle(pid_t pid, int status) ptrace(PTRACE_GETREGS, pid, NULL, &context); if(size >= context.regs.orig_eax) fprintf(stderr, "%s();\n", - syscall[context.regs.orig_eax - 1]); + _syscall[context.regs.orig_eax - 1]); else fprintf(stderr, "%ld\n", context.regs.orig_eax); ptrace(PTRACE_SYSCALL, pid, NULL, NULL);