* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id$
*/
#include "defs.h"
-#include <sys/syscall.h>
-
-#ifdef HAVE_POLL_H
-#include <poll.h>
-#endif
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
-#endif
-#ifdef HAVE_STROPTS_H
-#include <stropts.h>
+#if defined HAVE_POLL_H
+# include <poll.h>
+#elif defined HAVE_SYS_POLL_H
+# include <sys/poll.h>
#endif
#ifdef HAVE_SYS_CONF_H
-#include <sys/conf.h>
+# include <sys/conf.h>
#endif
-#ifndef HAVE_STROPTS_H
-#define RS_HIPRI 1
+/* Who has STREAMS syscalls?
+ * Linux hasn't. Solaris has (had?).
+ * Just in case I miss something, retain in for Sparc...
+ */
+#if defined(SPARC) || defined(SPARC64)
+
+# ifdef HAVE_STROPTS_H
+# include <stropts.h>
+# else
+# define RS_HIPRI 1
struct strbuf {
int maxlen; /* no. of bytes in buffer */
int len; /* no. of bytes returned */
const char *buf; /* pointer to data */
};
-#define MORECTL 1
-#define MOREDATA 2
-#endif /* !HAVE_STROPTS_H */
+# define MORECTL 1
+# define MOREDATA 2
+# endif
-static const struct xlat msgflags[] = {
- { RS_HIPRI, "RS_HIPRI" },
- { 0, NULL },
-};
+#include "xlat/msgflags.h"
static void
printstrbuf(struct tcb *tcp, struct strbuf *sbp, int getting)
}
static void
-printstrbufarg(struct tcb *tcp, int arg, int getting)
+printstrbufarg(struct tcb *tcp, long arg, int getting)
{
struct strbuf buf;
return 0;
}
-#if defined(SPARC) || defined(SPARC64)
int
sys_getmsg(struct tcb *tcp)
{
}
return RVAL_HEX | RVAL_STR;
}
-#endif
-#if defined SYS_putpmsg || defined SYS_getpmsg
-static const 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 },
-};
-#endif
-
-#ifdef SYS_putpmsg
+# if defined SYS_putpmsg || defined SYS_getpmsg
+#include "xlat/pmsgflags.h"
+# ifdef SYS_putpmsg
int
sys_putpmsg(struct tcb *tcp)
{
}
return 0;
}
-#endif /* SYS_putpmsg */
-
-#ifdef SYS_getpmsg
+# endif
+# ifdef SYS_getpmsg
int
sys_getpmsg(struct tcb *tcp)
{
for (i = 1; i < 3; i++)
printstrbufarg(tcp, tcp->u_arg[i], 1);
/* pointer to band */
- printnum(tcp, tcp->u_arg[3], "%d");
+ printnum_int(tcp, tcp->u_arg[3], "%d");
tprints(", ");
/* pointer to flags */
if (tcp->u_arg[4] == 0)
}
return RVAL_HEX | RVAL_STR;
}
-#endif /* SYS_getpmsg */
+# endif
+# endif /* getpmsg/putpmsg */
+
+#endif /* STREAMS syscalls support */
+
#ifdef HAVE_SYS_POLL_H
-static const struct xlat pollflags[] = {
-#ifdef POLLIN
- { POLLIN, "POLLIN" },
- { POLLPRI, "POLLPRI" },
- { POLLOUT, "POLLOUT" },
-#ifdef POLLRDNORM
- { POLLRDNORM, "POLLRDNORM" },
-#endif
-#ifdef POLLWRNORM
- { POLLWRNORM, "POLLWRNORM" },
-#endif
-#ifdef POLLRDBAND
- { POLLRDBAND, "POLLRDBAND" },
-#endif
-#ifdef POLLWRBAND
- { POLLWRBAND, "POLLWRBAND" },
-#endif
- { POLLERR, "POLLERR" },
- { POLLHUP, "POLLHUP" },
- { POLLNVAL, "POLLNVAL" },
-#endif
- { 0, NULL },
-};
+#include "xlat/pollflags.h"
static int
decode_poll(struct tcb *tcp, long pts)
{
int rc = decode_poll(tcp, 0);
if (entering(tcp)) {
-#ifdef INFTIM
+# ifdef INFTIM
if (tcp->u_arg[2] == INFTIM)
tprints("INFTIM");
else
-#endif
+# endif
tprintf("%ld", tcp->u_arg[2]);
}
return rc;
if (entering(tcp)) {
print_timespec(tcp, tcp->u_arg[2]);
tprints(", ");
- print_sigset(tcp, tcp->u_arg[3], 0);
+ /* NB: kernel requires arg[4] == NSIG / 8 */
+ print_sigset_addr_len(tcp, tcp->u_arg[3], tcp->u_arg[4]);
tprintf(", %lu", tcp->u_arg[4]);
}
return rc;