]> granicus.if.org Git - strace/blobdiff - stream.c
Merge Harald Böhme's solaris patches
[strace] / stream.c
index 0ddb5f12f092e5dd864b1f1fef1923922ac2be18..1c2667270bfb3b2483e1e980ad5b2372def12f57 100644 (file)
--- a/stream.c
+++ b/stream.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
+ * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #include "defs.h"
 
-#if defined(HAVE_SYS_STREAM_H) || defined(linux)
+#if defined(HAVE_SYS_STREAM_H) || defined(linux) || defined(FREEBSD)
 
 #if defined(linux)
+#ifdef HAVE_SYS_POLL_H
 #include <sys/poll.h>
+#endif
 
 #define RS_HIPRI 1
 struct strbuf {
@@ -45,11 +48,15 @@ struct strbuf {
 
 #else /* linux */
 
+#ifndef FREEBSD
 #include <stropts.h>
 #include <poll.h>
 #include <sys/conf.h>
 #include <sys/stream.h>
 #include <sys/tihdr.h>
+#else /* FREEBSD */
+#include <poll.h>
+#endif /* FREEBSD */
 
 #endif /* linux */
 
@@ -59,6 +66,7 @@ struct strbuf {
 #include <sys/timod.h>
 #endif /* HAVE_SYS_TIUSER_H */
 
+#ifndef FREEBSD
 static struct xlat msgflags[] = {
        { RS_HIPRI,     "RS_HIPRI"      },
        { 0,            NULL            },
@@ -170,9 +178,15 @@ struct tcb *tcp;
 #ifdef HAVE_PUTPMSG
 
 static struct xlat pmsgflags[] = {
+#ifdef MSG_HIPRI
        { MSG_HIPRI,    "MSG_HIPRI"     },
+#endif
+#ifdef MSG_AND
        { MSG_ANY,      "MSG_ANY"       },
+#endif
+#ifdef MSG_BAND
        { MSG_BAND,     "MSG_BAND"      },
+#endif
        { 0,            NULL            },
 };
 
@@ -217,6 +231,7 @@ struct tcb *tcp;
                        printstrbufarg(tcp, tcp->u_arg[i], 1);
                /* pointer to band */
                printnum(tcp, tcp->u_arg[3], "%d");
+               tprintf(", ");
                /* pointer to flags */
                if (tcp->u_arg[4] == 0)
                        tprintf("NULL");
@@ -248,9 +263,13 @@ struct tcb *tcp;
 }
 
 #endif /* HAVE_PUTPMSG */
+#endif /* !FREEBSD */
 
 
+#ifdef HAVE_SYS_POLL_H
+
 static struct xlat pollflags[] = {
+#ifdef POLLIN
        { POLLIN,       "POLLIN"        },
        { POLLPRI,      "POLLPRI"       },
        { POLLOUT,      "POLLOUT"       },
@@ -269,6 +288,7 @@ static struct xlat pollflags[] = {
        { POLLERR,      "POLLERR"       },
        { POLLHUP,      "POLLHUP"       },
        { POLLNVAL,     "POLLNVAL"      },
+#endif
        { 0,            NULL            },
 };
 
@@ -332,7 +352,16 @@ struct tcb *tcp;
        return 0;
 }
 
-#ifndef linux
+#else /* !HAVE_SYS_POLL_H */
+int
+sys_poll(tcp)
+struct tcb *tcp;
+{
+       return 0;
+}
+#endif
+
+#if !defined(linux) && !defined(FREEBSD)
 
 static struct xlat stream_flush_options[] = {
        { FLUSHR,       "FLUSHR"        },
@@ -807,7 +836,7 @@ int code, arg;
        }
 }
 
-#endif /* linux */
+#endif /* !linux && !FREEBSD */ 
 
-#endif /* LINUXSPARC && linux */
+#endif /* HAVE_SYS_STREAM_H || linux || FREEBSD */