.if (${MACHINE_ARCH} == "i386")
SRCS+= i386-fbsd.c i386-linux.c linux_syscalls.h
.endif
-WARNS?= 1
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../sys -I.
char procfs_path[FILENAME_MAX];
int have_procfs;
+extern int Procfd;
+
extern int setup_and_wait(char **);
extern int start_tracing(int, int);
extern void restore_proc(int);
#include <machine/reg.h>
#include <machine/psl.h>
+#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
static int fd = -1;
static int cpid = -1;
-extern int Procfd;
extern FILE *outfile;
#include "syscalls.h"
*/
static struct freebsd_syscall {
struct syscall *sc;
- char *name;
+ const char *name;
int number;
unsigned long *args;
int nargs; /* number of arguments -- *not* number of words! */
void
i386_syscall_entry(int pid, int nargs) {
char *buf;
- struct reg regs = { 0 };
- int syscall;
+ struct reg regs = { .r_err = 0 };
+ int syscall_num;
int i;
unsigned int parm_offset;
struct syscall *sc;
* SYS_syscall, and SYS___syscall. The former is the old syscall()
* routine, basicly; the latter is for quad-aligned arguments.
*/
- syscall = regs.r_eax;
- switch (syscall) {
+ syscall_num = regs.r_eax;
+ switch (syscall_num) {
case SYS_syscall:
lseek(Procfd, parm_offset, SEEK_SET);
- read(Procfd, &syscall, sizeof(int));
+ read(Procfd, &syscall_num, sizeof(int));
parm_offset += sizeof(int);
break;
case SYS___syscall:
lseek(Procfd, parm_offset, SEEK_SET);
- read(Procfd, &syscall, sizeof(int));
+ read(Procfd, &syscall_num, sizeof(int));
parm_offset += sizeof(quad_t);
break;
}
- fsc.number = syscall;
+ fsc.number = syscall_num;
fsc.name =
- (syscall < 0 || syscall >= nsyscalls) ? NULL : syscallnames[syscall];
+ (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
if (!fsc.name) {
- fprintf(outfile, "-- UNKNOWN SYSCALL %d --\n", syscall);
+ fprintf(outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}
if (nargs == 0)
*/
void
-i386_syscall_exit(int pid, int syscall) {
+i386_syscall_exit(int pid, int syscall_num __unused) {
char *buf;
struct reg regs;
int retval;
#include <machine/reg.h>
#include <machine/psl.h>
+#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
static int fd = -1;
static int cpid = -1;
-extern int Procfd;
extern FILE *outfile;
#include "linux_syscalls.h"
/* See the comment in i386-fbsd.c about this structure. */
static struct linux_syscall {
struct syscall *sc;
- char *name;
+ const char *name;
int number;
unsigned long args[5];
int nargs; /* number of arguments -- *not* number of words! */
void
i386_linux_syscall_entry(int pid, int nargs) {
char *buf;
- struct reg regs = { 0 };
- int syscall;
+ struct reg regs = { .r_err = 0 };
+ int syscall_num;
int i;
struct syscall *sc;
clear_lsc();
lseek(fd, 0L, 0);
i = read(fd, ®s, sizeof(regs));
- syscall = regs.r_eax;
+ syscall_num = regs.r_eax;
- lsc.number = syscall;
+ lsc.number = syscall_num;
lsc.name =
- (syscall < 0 || syscall >= nsyscalls) ? NULL : linux_syscallnames[syscall];
+ (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : linux_syscallnames[syscall_num];
if (!lsc.name) {
- fprintf (outfile, "-- UNKNOWN SYSCALL %d\n", syscall);
+ fprintf (outfile, "-- UNKNOWN SYSCALL %d\n", syscall_num);
}
if (nargs == 0)
};
void
-i386_linux_syscall_exit(int pid, int syscall) {
+i386_linux_syscall_exit(int pid, int syscall_num __unused) {
char *buf;
struct reg regs;
int retval;
- int size, i;
+ int i;
int errorp;
struct syscall *sc;
}
}
if (errorp) {
- for (i = 0; i < sizeof(bsd_to_linux_errno) / sizeof(int); i++)
+ for (i = 0; i < (int)(sizeof(bsd_to_linux_errno) / sizeof(int)); i++)
if (retval == bsd_to_linux_errno[i])
break;
}
*/
void
restore_proc(int signo __unused) {
- extern int Procfd;
-
ioctl(Procfd, PIOCBIC, ~0);
if (evflags)
ioctl(Procfd, PIOCBIS, evflags);