141c99275SPeter Avalos /*
241c99275SPeter Avalos * Copyright (c) 1996, 1997
341c99275SPeter Avalos * The Regents of the University of California. All rights reserved.
441c99275SPeter Avalos *
541c99275SPeter Avalos * Redistribution and use in source and binary forms, with or without
641c99275SPeter Avalos * modification, are permitted provided that: (1) source code distributions
741c99275SPeter Avalos * retain the above copyright notice and this paragraph in its entirety, (2)
841c99275SPeter Avalos * distributions including binary code include the above copyright notice and
941c99275SPeter Avalos * this paragraph in its entirety in the documentation or other materials
1041c99275SPeter Avalos * provided with the distribution, and (3) all advertising materials mentioning
1141c99275SPeter Avalos * features or use of this software display the following acknowledgement:
1241c99275SPeter Avalos * ``This product includes software developed by the University of California,
1341c99275SPeter Avalos * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1441c99275SPeter Avalos * the University nor the names of its contributors may be used to endorse
1541c99275SPeter Avalos * or promote products derived from this software without specific prior
1641c99275SPeter Avalos * written permission.
1741c99275SPeter Avalos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1841c99275SPeter Avalos * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1941c99275SPeter Avalos * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2041c99275SPeter Avalos */
2141c99275SPeter Avalos
2241c99275SPeter Avalos #ifdef HAVE_CONFIG_H
23*ed775ee7SAntonio Huete Jimenez #include <config.h>
2441c99275SPeter Avalos #endif
2541c99275SPeter Avalos
26*ed775ee7SAntonio Huete Jimenez #include <stddef.h>
2741c99275SPeter Avalos
2841c99275SPeter Avalos #ifdef __osf__
29*ed775ee7SAntonio Huete Jimenez #include <stdio.h>
3041c99275SPeter Avalos #include <sys/sysinfo.h>
3141c99275SPeter Avalos #include <sys/proc.h>
3241c99275SPeter Avalos #endif /* __osf__ */
3341c99275SPeter Avalos
34*ed775ee7SAntonio Huete Jimenez #include "varattrs.h"
3541c99275SPeter Avalos #include "machdep.h"
3641c99275SPeter Avalos
37411677aeSAaron LI /*
38411677aeSAaron LI * On platforms where the CPU doesn't support unaligned loads, force
39411677aeSAaron LI * unaligned accesses to abort with SIGBUS, rather than being fixed
40411677aeSAaron LI * up (slowly) by the OS kernel; on those platforms, misaligned accesses
41411677aeSAaron LI * are bugs, and we want tcpdump to crash so that the bugs are reported.
42411677aeSAaron LI *
43411677aeSAaron LI * The only OS on which this is necessary is DEC OSF/1^W^WDigital
44411677aeSAaron LI * UNIX^W^WTru64 UNIX.
45411677aeSAaron LI */
4641c99275SPeter Avalos int
abort_on_misalignment(char * ebuf _U_,size_t ebufsiz _U_)4741c99275SPeter Avalos abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
4841c99275SPeter Avalos {
4941c99275SPeter Avalos #ifdef __osf__
5041c99275SPeter Avalos static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
5141c99275SPeter Avalos
5241c99275SPeter Avalos if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) {
5341c99275SPeter Avalos (void)snprintf(ebuf, ebufsiz, "setsysinfo: errno %d", errno);
5441c99275SPeter Avalos return (-1);
5541c99275SPeter Avalos }
5641c99275SPeter Avalos #endif
5741c99275SPeter Avalos return (0);
5841c99275SPeter Avalos }
59