Deleted Added
full compact
machdep.c (276788) machdep.c (285275)
1/*
2 * Copyright (c) 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and

--- 36 unchanged lines hidden (view full) ---

45 __attribute__((format(printf, 3, 4)))
46#endif /* __ATTRIBUTE___FORMAT_OK */
47 ;
48#endif /* !defined(HAVE_SNPRINTF) */
49#endif /* __osf__ */
50
51#include "machdep.h"
52
1/*
2 * Copyright (c) 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and

--- 36 unchanged lines hidden (view full) ---

45 __attribute__((format(printf, 3, 4)))
46#endif /* __ATTRIBUTE___FORMAT_OK */
47 ;
48#endif /* !defined(HAVE_SNPRINTF) */
49#endif /* __osf__ */
50
51#include "machdep.h"
52
53/*
54 * On platforms where the CPU doesn't support unaligned loads, force
55 * unaligned accesses to abort with SIGBUS, rather than being fixed
56 * up (slowly) by the OS kernel; on those platforms, misaligned accesses
57 * are bugs, and we want tcpdump to crash so that the bugs are reported.
58 *
59 * The only OS on which this is necessary is DEC OSF/1^W^WDigital
60 * UNIX^W^WTru64 UNIX.
61 */
53int
54abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
55{
56#ifdef __osf__
57 static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
58
59 if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) {
60 (void)snprintf(ebuf, ebufsiz, "setsysinfo: errno %d", errno);
61 return (-1);
62 }
63#endif
64 return (0);
65}
62int
63abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
64{
65#ifdef __osf__
66 static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
67
68 if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) {
69 (void)snprintf(ebuf, ebufsiz, "setsysinfo: errno %d", errno);
70 return (-1);
71 }
72#endif
73 return (0);
74}