117680Spst/*
239297Sfenner * Copyright (c) 1996, 1997
317680Spst *	The Regents of the University of California.  All rights reserved.
417680Spst *
517680Spst * Redistribution and use in source and binary forms, with or without
617680Spst * modification, are permitted provided that: (1) source code distributions
717680Spst * retain the above copyright notice and this paragraph in its entirety, (2)
817680Spst * distributions including binary code include the above copyright notice and
917680Spst * this paragraph in its entirety in the documentation or other materials
1017680Spst * provided with the distribution, and (3) all advertising materials mentioning
1117680Spst * features or use of this software display the following acknowledgement:
1217680Spst * ``This product includes software developed by the University of California,
1317680Spst * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1417680Spst * the University nor the names of its contributors may be used to endorse
1517680Spst * or promote products derived from this software without specific prior
1617680Spst * written permission.
1717680Spst * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1817680Spst * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1917680Spst * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2017680Spst */
2117680Spst
2217680Spst#ifndef lint
23127668Sbmsstatic const char rcsid[] _U_ =
24190207Srpaulo    "@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.13 2003-12-15 03:53:21 guy Exp $ (LBL)";
2517680Spst#endif
2617680Spst
2756893Sfenner#ifdef HAVE_CONFIG_H
2856893Sfenner#include "config.h"
2956893Sfenner#endif
3056893Sfenner
31127668Sbms/*
32127668Sbms * XXX - all we need, on platforms other than DEC OSF/1 (a/k/a Digital UNIX,
33127668Sbms * a/k/a Tru64 UNIX), is "size_t", which is a standard C type; what do we
34127668Sbms * need to do to get it defined?  This is clearly wrong, as we shouldn't
35127668Sbms * have to include UNIX or Windows system header files to get it.
36127668Sbms */
37127668Sbms#include <tcpdump-stdinc.h>
38127668Sbms
39127668Sbms#ifndef HAVE___ATTRIBUTE__
40127668Sbms#define __attribute__(x)
41127668Sbms#endif /* HAVE___ATTRIBUTE__ */
42127668Sbms
4317680Spst#ifdef __osf__
4417680Spst#include <sys/sysinfo.h>
4517680Spst#include <sys/proc.h>
4617680Spst
4798524Sfenner#if !defined(HAVE_SNPRINTF)
4898524Sfennerint snprintf(char *, size_t, const char *, ...)
4998524Sfenner     __attribute__((format(printf, 3, 4)));
5098524Sfenner#endif /* !defined(HAVE_SNPRINTF) */
5198524Sfenner#endif /* __osf__ */
5298524Sfenner
5317680Spst#include "machdep.h"
5417680Spst
5517680Spstint
56127668Sbmsabort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
5717680Spst{
5817680Spst#ifdef __osf__
5917680Spst	static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
6017680Spst
6117680Spst	if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) {
6275115Sfenner		(void)snprintf(ebuf, ebufsiz, "setsysinfo: errno %d", errno);
6317680Spst		return (-1);
6417680Spst	}
6517680Spst#endif
6617680Spst	return (0);
6717680Spst}
68