Index: file.c
--- file.c.orig	2009-10-21 15:44:04 +0200
+++ file.c	2009-10-22 08:55:42 +0200
@@ -1642,7 +1642,11 @@
 		statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
 	tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
 		statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree,
+#ifdef LINUX
 		statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
+#else
+		statbuf.f_fsid.val[0], statbuf.f_fsid.val[1],
+#endif
 		statbuf.f_namelen);
 #else /* !ALPHA */
 	tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
@@ -1654,7 +1658,11 @@
 		(unsigned long)statbuf.f_bavail,
 		(unsigned long)statbuf.f_files,
 		(unsigned long)statbuf.f_ffree,
+#ifdef LINUX
 		statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
+#else
+		statbuf.f_fsid.val[0], statbuf.f_fsid.val[1]);
+#endif
 #ifdef LINUX
 	tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
 #endif /* LINUX */
@@ -2799,6 +2807,7 @@
 }
 
 
+#ifdef LINUX
 static const struct xlat advise[] = {
   { POSIX_FADV_NORMAL,		"POSIX_FADV_NORMAL"	},
   { POSIX_FADV_RANDOM,		"POSIX_FADV_RANDOM"	},
@@ -2808,6 +2817,7 @@
   { POSIX_FADV_NOREUSE,		"POSIX_FADV_NOREUSE"	},
   { 0,				NULL			}
 };
+#endif
 
 
 #ifdef LINUX
@@ -2830,6 +2840,7 @@
 #endif
 
 
+#ifdef LINUX
 int
 sys_fadvise64_64(struct tcb *tcp)
 {
@@ -2854,6 +2865,7 @@
 	}
 	return 0;
 }
+#endif
 
 #ifdef LINUX
 static const struct xlat inotify_modes[] = {
Index: freebsd/i386/syscall.h
--- freebsd/i386/syscall.h.orig	2001-03-08 18:27:20 +0100
+++ freebsd/i386/syscall.h	2009-10-22 08:55:42 +0200
@@ -9,6 +9,7 @@
 int sys_write();
 int sys_open();
 int sys_close();
+int sys_waitpid();
 int sys_wait4();
 int sys_creat();
 int sys_link();
Index: net.c
--- net.c.orig	2009-09-01 21:53:29 +0200
+++ net.c	2009-10-22 08:55:42 +0200
@@ -43,12 +43,8 @@
 #endif
 
 #include <netinet/in.h>
-#ifdef HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
-#endif
-#ifdef HAVE_NETINET_UDP_H
 #include <netinet/udp.h>
-#endif
 #include <arpa/inet.h>
 #include <net/if.h>
 #if defined(LINUX)
@@ -1103,6 +1099,9 @@
 #ifdef SCM_RIGHTS
 	{ SCM_RIGHTS,		"SCM_RIGHTS"		},
 #endif
+#ifdef SCM_CREDS
+	{ SCM_CREDS,		"SCM_CREDS"			},
+#endif
 #ifdef SCM_CREDENTIALS
 	{ SCM_CREDENTIALS,	"SCM_CREDENTIALS"	},
 #endif
@@ -1146,6 +1145,13 @@
 			free(cmsg);
 			return;
 		}
+#ifdef SCM_CREDS
+		if (cmsg->cmsg_type == SCM_CREDS
+		    && CMSG_LEN(sizeof(struct cmsgcred)) <= cmsg_len) {
+			struct cmsgcred *uc = (struct cmsgcred *) CMSG_DATA (cmsg);
+			tprintf("{pid=%ld, uid=%ld, gid=%ld}}",
+				(long)uc->cmcred_pid, (long)uc->cmcred_uid, (long)uc->cmcred_gid);
+#else
 		if (cmsg->cmsg_type == SCM_CREDENTIALS
 		    && CMSG_LEN(sizeof(struct ucred)) <= cmsg_len) {
 			struct ucred *uc = (struct ucred *) CMSG_DATA (cmsg);
@@ -1153,6 +1159,7 @@
 			tprintf("{pid=%ld, uid=%ld, gid=%ld}}",
 				(long)uc->pid, (long)uc->uid, (long)uc->gid);
 			free(cmsg);
+#endif
 			return;
 		}
 	}
@@ -1178,17 +1185,12 @@
 	tprint_iov(tcp, (unsigned long)msg.msg_iovlen,
 		   (unsigned long)msg.msg_iov);
 
-#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
 	tprintf(", msg_controllen=%lu", (unsigned long)msg.msg_controllen);
 	if (msg.msg_controllen)
 		printcmsghdr(tcp, (unsigned long) msg.msg_control,
 			     msg.msg_controllen);
 	tprintf(", msg_flags=");
 	printflags(msg_flags, msg.msg_flags, "MSG_???");
-#else /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */
-	tprintf("msg_accrights=%#lx, msg_accrightslen=%u",
-		(unsigned long) msg.msg_accrights, msg.msg_accrightslen);
-#endif /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */
 	tprintf("}");
 }
 
Index: process.c
--- process.c.orig	2009-10-12 21:54:21 +0200
+++ process.c	2009-10-22 08:55:42 +0200
@@ -3280,7 +3280,9 @@
 int
 sys_ptrace(struct tcb *tcp)
 {
+#ifndef FREEBSD
 	const struct xlat *x;
+#endif
 	long addr;
 
 	if (entering(tcp)) {
Index: sock.c
--- sock.c.orig	2009-01-13 19:30:55 +0100
+++ sock.c	2009-10-22 08:55:42 +0200
@@ -37,6 +37,7 @@
 #include <sys/sockio.h>
 #endif
 #include <arpa/inet.h>
+#include <netinet/in.h>
 
 #if defined (ALPHA) || defined(SH) || defined(SH64)
 #ifdef HAVE_SYS_IOCTL_H
@@ -53,20 +54,31 @@
 	{ IFF_DEBUG,		"IFF_DEBUG"		},
 	{ IFF_LOOPBACK,		"IFF_LOOPBACK"		},
 	{ IFF_POINTOPOINT,	"IFF_POINTOPOINT"	},
+#ifdef IFF_NOTRAILERS
 	{ IFF_NOTRAILERS,	"IFF_NOTRAILERS"	},
+#endif
 	{ IFF_RUNNING,		"IFF_RUNNING"		},
 	{ IFF_NOARP,		"IFF_NOARP"		},
 	{ IFF_PROMISC,		"IFF_PROMISC"		},
 	{ IFF_ALLMULTI,		"IFF_ALLMULTI"		},
+#ifdef IFF_MASTER
 	{ IFF_MASTER,		"IFF_MASTER"		},
+#endif
+#ifdef IFF_SLAVE
 	{ IFF_SLAVE,		"IFF_SLAVE"		},
+#endif
 	{ IFF_MULTICAST,	"IFF_MULTICAST"		},
+#ifdef IFF_PORTSEL
 	{ IFF_PORTSEL,		"IFF_PORTSEL"		},
+#endif
+#ifdef IFF_AUTOMEDIA
 	{ IFF_AUTOMEDIA,	"IFF_AUTOMEDIA"		},
+#endif
 	{ 0,			NULL			}
 };
 
 
+#ifdef LINUX
 static void
 print_addr(tcp, addr, ifr)
 struct tcb *tcp;
@@ -80,14 +92,19 @@
 	} else
 		printstr(tcp, addr, sizeof(ifr->ifr_addr.sa_data));
 }
+#endif
 
 int
 sock_ioctl(struct tcb *tcp, long code, long arg)
 {
+#ifdef LINUX
 	struct ifreq ifr;
+#endif
 	struct ifconf ifc;
+#ifdef LINUX
 	const char *str = NULL;
 	unsigned char *bytes;
+#endif
 
 	if (entering(tcp)) {
 		if (code == SIOCGIFCONF) {
Index: time.c
--- time.c.orig	2009-04-14 14:51:00 +0200
+++ time.c	2009-10-22 08:55:42 +0200
@@ -36,6 +36,7 @@
 #include <sys/timex.h>
 #include <linux/ioctl.h>
 #include <linux/rtc.h>
+#endif /* LINUX */
 
 #ifndef UTIME_NOW
 #define UTIME_NOW ((1l << 30) - 1l)
@@ -43,7 +44,6 @@
 #ifndef UTIME_OMIT
 #define UTIME_OMIT ((1l << 30) - 2l)
 #endif
-#endif /* LINUX */
 
 struct timeval32
 {
Index: util.c
--- util.c.orig	2009-10-12 21:54:21 +0200
+++ util.c	2009-10-22 09:01:31 +0200
@@ -231,10 +231,14 @@
 
 	tcp->ptrace_errno = err;
 	msg = "SYSCALL";
+#ifdef PTRACE_CONT
 	if (op == PTRACE_CONT)
 		msg = "CONT";
+#endif
+#ifdef PTRACE_DETACH
 	if (op == PTRACE_DETACH)
 		msg = "DETACH";
+#endif
 	fprintf(stderr, "strace: ptrace(PTRACE_%s,1,%d): %s\n",
 			msg, sig, strerror(err));
 	return -1;
