summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Le <r0bertz@gentoo.org>2009-11-25 01:01:46 +0800
committerZhang Le <r0bertz@gentoo.org>2009-11-25 01:01:46 +0800
commit318568ec040b971ee86662b6a2a2f7594acf525c (patch)
treefd69f570d93eb661940db9adedaa3e1595015bed /dev-util/strace/files/strace-4.5.11-fbsd.patch
parentbinutils: added latest patch (diff)
downloadloongson-318568ec040b971ee86662b6a2a2f7594acf525c.tar.gz
loongson-318568ec040b971ee86662b6a2a2f7594acf525c.tar.bz2
loongson-318568ec040b971ee86662b6a2a2f7594acf525c.zip
added strace
Signed-off-by: Zhang Le <r0bertz@gentoo.org>
Diffstat (limited to 'dev-util/strace/files/strace-4.5.11-fbsd.patch')
-rw-r--r--dev-util/strace/files/strace-4.5.11-fbsd.patch181
1 files changed, 181 insertions, 0 deletions
diff --git a/dev-util/strace/files/strace-4.5.11-fbsd.patch b/dev-util/strace/files/strace-4.5.11-fbsd.patch
new file mode 100644
index 0000000..1c1e31f
--- /dev/null
+++ b/dev-util/strace/files/strace-4.5.11-fbsd.patch
@@ -0,0 +1,181 @@
+Add support for FreeBSD.
+
+Patch by Piego Pettenò
+
+http://bugs.gentoo.org/93657
+
+--- strace-4.5.11/configure.ac
++++ strace-4.5.11/configure.ac
+@@ -192,16 +192,24 @@
+ fi
+
+ AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
+-AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h], [], [])
++AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h sys/param.h], [], [])
+ AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
+ [], [], [#include <linux/socket.h>])
+ AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
+-AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
++AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,,
++[#include <sys/types.h>
++#include <netinet/in.h>])
++
++AC_CHECK_HEADERS([sys/mount.h],,,
++[#include <sys/types.h>
++#include <sys/param.h>])
+
+ AC_MP_PROCFS
+ AC_POLLABLE_PROCFS
+
+-AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
++AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
++[#include <sys/types.h>
++#include <sys/socket.h>])
+ AC_STRUCT_PR_SYSCALL
+
+ AC_CHECK_MEMBERS([struct T_conn_res.QUEUE_ptr,
+@@ -209,6 +217,19 @@
+ [#include <sys/stream.h>
+ #include <sys/tihdr.h>])
+
++AC_CHECK_MEMBERS([struct fsid.val,
++ struct fsid.__val],,,
++[#include <sys/types.h>
++#ifdef HAVE_SYS_PARAM_H
++# include <sys/param.h>
++#endif
++#ifdef HAVE_SYS_VFS_H
++# include <sys/vfs.h>
++#endif
++#ifdef HAVE_SYS_MOUNT_H
++# include <sys/mount.h>
++#endif])
++
+ AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
+
+ AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg],,,
+--- strace-4.5.11/file.c
++++ strace-4.5.11/file.c
+@@ -200,6 +200,10 @@
+ #include <ustat.h>
+ #endif
+
++#if defined(HAVE_STRUCT_FSID_VAL) && ! defined(HAVE_STRUCT_FSID___VAL)
++#define __val val
++#endif
++
+ /*
+ * This is a really dirty trick but it should always work. Traditional
+ * Unix says r/w/rw are 0/1/2, so we make them true flags 1/2/3 by
+@@ -2495,6 +2499,8 @@
+ }
+
+
++#ifdef LINUX
++
+ static const struct xlat advise[] = {
+ { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
+ { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
+@@ -2506,7 +2512,6 @@
+ };
+
+
+-#ifdef LINUX
+ int
+ sys_fadvise64(tcp)
+ struct tcb *tcp;
+@@ -2524,7 +2529,6 @@
+ }
+ return 0;
+ }
+-#endif
+
+
+ int
+@@ -2545,3 +2549,5 @@
+ }
+ return 0;
+ }
++
++#endif
+--- strace-4.5.11/net.c
++++ strace-4.5.11/net.c
+@@ -1112,6 +1112,7 @@
+ tprintf("}}");
+ return;
+ }
++#ifdef SCM_CREDENTIALS
+ if (u.cmsg.cmsg_type == SCM_CREDENTIALS
+ && CMSG_LEN(sizeof(struct ucred)) <= u.cmsg.cmsg_len) {
+ struct ucred *uc = (struct ucred *) CMSG_DATA (&u.cmsg);
+@@ -1119,6 +1120,7 @@
+ (long)uc->pid, (long)uc->uid, (long)uc->gid);
+ return;
+ }
++#endif
+ }
+ tprintf(", ...}");
+ }
+--- strace-4.5.11/sock.c
++++ strace-4.5.11/sock.c
+@@ -46,6 +46,7 @@
+ #endif
+ #endif
+ #include <net/if.h>
++#include <netinet/in.h>
+
+ extern const struct xlat addrfams[];
+
+@@ -55,16 +56,26 @@
+ { 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 }
+ };
+
+--- strace-4.5.11/strace.c
++++ strace-4.5.11/strace.c
+@@ -617,6 +617,23 @@
+ cleanup();
+ exit(1);
+ }
++#ifdef FREEBSD
++ {
++ int status;
++ pid_t err;
++
++ do {
++ err = waitpid(pid, &status, WUNTRACED);
++ } while (err == -1 && errno == EINTR);
++ if (err == -1) {
++ fprintf(stderr,
++ "waitpid() failed: %s\n",
++ strerror(errno));
++ cleanup();
++ exit(1);
++ }
++ }
++#endif
+ #ifdef USE_PROCFS
+ if (proc_open(tcp, 0) < 0) {
+ fprintf(stderr, "trouble opening proc file\n");