]> granicus.if.org Git - strace/blobdiff - stream.c
Merge Harald Böhme's solaris patches
[strace] / stream.c
index 4c632f305a332543d37ee9d44db1fd9d69261770..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(LINUXSPARC) || defined(linux)
+#if defined(HAVE_SYS_STREAM_H) || defined(linux) || defined(FREEBSD)
 
-#if defined(LINUXSPARC) || defined(linux)
+#if defined(linux)
+#ifdef HAVE_SYS_POLL_H
 #include <sys/poll.h>
+#endif
 
 #define RS_HIPRI 1
 struct strbuf {
@@ -43,15 +46,19 @@ struct strbuf {
 #define MORECTL 1
 #define MOREDATA 2
 
-#else /* LINUXSPARC */
+#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 /* LINUXSPARC */
+#endif /* linux */
 
 #ifdef HAVE_SYS_TIUSER_H
 #include <sys/tiuser.h>
@@ -59,18 +66,12 @@ struct strbuf {
 #include <sys/timod.h>
 #endif /* HAVE_SYS_TIUSER_H */
 
+#ifndef FREEBSD
 static struct xlat msgflags[] = {
        { RS_HIPRI,     "RS_HIPRI"      },
        { 0,            NULL            },
 };
 
-#if 0
-static struct xlat getmsgflags[] = {
-       { MORECTL,      "MORECTL"       },
-       { MOREDATA,     "MOREDATA"      },
-       { 0,            NULL            },
-};
-#endif
 
 static void
 printstrbuf(tcp, sbp, getting)
@@ -85,7 +86,7 @@ int getting;
                if (getting)
                        tprintf("maxlen=%d, ", sbp->maxlen);
                tprintf("len=%d, buf=", sbp->len);
-               printstr(tcp, (int) sbp->buf, sbp->len);
+               printstr(tcp, (unsigned long) sbp->buf, sbp->len);
                tprintf("}");
        }
 }
@@ -177,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            },
 };
 
@@ -224,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");
@@ -255,10 +263,13 @@ struct tcb *tcp;
 }
 
 #endif /* HAVE_PUTPMSG */
+#endif /* !FREEBSD */
 
-#if !defined(LINUXSPARC)
+
+#ifdef HAVE_SYS_POLL_H
 
 static struct xlat pollflags[] = {
+#ifdef POLLIN
        { POLLIN,       "POLLIN"        },
        { POLLPRI,      "POLLPRI"       },
        { POLLOUT,      "POLLOUT"       },
@@ -277,6 +288,7 @@ static struct xlat pollflags[] = {
        { POLLERR,      "POLLERR"       },
        { POLLHUP,      "POLLHUP"       },
        { POLLNVAL,     "POLLNVAL"      },
+#endif
        { 0,            NULL            },
 };
 
@@ -340,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"        },
@@ -815,8 +836,7 @@ int code, arg;
        }
 }
 
-#endif /* linux */
+#endif /* !linux && !FREEBSD */ 
 
-#endif /* LINUXSPARC && linux */
+#endif /* HAVE_SYS_STREAM_H || linux || FREEBSD */
 
-#endif /* HAVE_SYS_STREAM_H */