xref: /freebsd/contrib/tcpdump/machdep.c (revision 5b0fe47811aa43b75fc69dbf7338cace232a4d48)
14edb46e9SPaul Traina /*
24644f044SBill Fenner  * Copyright (c) 1996, 1997
34edb46e9SPaul Traina  *	The Regents of the University of California.  All rights reserved.
44edb46e9SPaul Traina  *
54edb46e9SPaul Traina  * Redistribution and use in source and binary forms, with or without
64edb46e9SPaul Traina  * modification, are permitted provided that: (1) source code distributions
74edb46e9SPaul Traina  * retain the above copyright notice and this paragraph in its entirety, (2)
84edb46e9SPaul Traina  * distributions including binary code include the above copyright notice and
94edb46e9SPaul Traina  * this paragraph in its entirety in the documentation or other materials
104edb46e9SPaul Traina  * provided with the distribution, and (3) all advertising materials mentioning
114edb46e9SPaul Traina  * features or use of this software display the following acknowledgement:
124edb46e9SPaul Traina  * ``This product includes software developed by the University of California,
134edb46e9SPaul Traina  * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
144edb46e9SPaul Traina  * the University nor the names of its contributors may be used to endorse
154edb46e9SPaul Traina  * or promote products derived from this software without specific prior
164edb46e9SPaul Traina  * written permission.
174edb46e9SPaul Traina  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
184edb46e9SPaul Traina  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
194edb46e9SPaul Traina  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
204edb46e9SPaul Traina  */
214edb46e9SPaul Traina 
224edb46e9SPaul Traina #ifndef lint
235b0fe478SBruce M Simpson static const char rcsid[] _U_ =
245b0fe478SBruce M Simpson     "@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.10.2.3 2003/12/15 03:53:42 guy Exp $ (LBL)";
25b0453382SBill Fenner #endif
26b0453382SBill Fenner 
27b0453382SBill Fenner #ifdef HAVE_CONFIG_H
28b0453382SBill Fenner #include "config.h"
294edb46e9SPaul Traina #endif
304edb46e9SPaul Traina 
315b0fe478SBruce M Simpson /*
325b0fe478SBruce M Simpson  * XXX - all we need, on platforms other than DEC OSF/1 (a/k/a Digital UNIX,
335b0fe478SBruce M Simpson  * a/k/a Tru64 UNIX), is "size_t", which is a standard C type; what do we
345b0fe478SBruce M Simpson  * need to do to get it defined?  This is clearly wrong, as we shouldn't
355b0fe478SBruce M Simpson  * have to include UNIX or Windows system header files to get it.
365b0fe478SBruce M Simpson  */
375b0fe478SBruce M Simpson #include <tcpdump-stdinc.h>
385b0fe478SBruce M Simpson 
395b0fe478SBruce M Simpson #ifndef HAVE___ATTRIBUTE__
405b0fe478SBruce M Simpson #define __attribute__(x)
415b0fe478SBruce M Simpson #endif /* HAVE___ATTRIBUTE__ */
425b0fe478SBruce M Simpson 
434edb46e9SPaul Traina #ifdef __osf__
444edb46e9SPaul Traina #include <sys/sysinfo.h>
454edb46e9SPaul Traina #include <sys/proc.h>
46a90e161bSBill Fenner 
47a90e161bSBill Fenner #if !defined(HAVE_SNPRINTF)
48a90e161bSBill Fenner int snprintf(char *, size_t, const char *, ...)
49a90e161bSBill Fenner      __attribute__((format(printf, 3, 4)));
50a90e161bSBill Fenner #endif /* !defined(HAVE_SNPRINTF) */
51a90e161bSBill Fenner #endif /* __osf__ */
524edb46e9SPaul Traina 
534edb46e9SPaul Traina #include "machdep.h"
544edb46e9SPaul Traina 
554edb46e9SPaul Traina int
565b0fe478SBruce M Simpson abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
574edb46e9SPaul Traina {
584edb46e9SPaul Traina #ifdef __osf__
594edb46e9SPaul Traina 	static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
604edb46e9SPaul Traina 
614edb46e9SPaul Traina 	if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) {
62685295f4SBill Fenner 		(void)snprintf(ebuf, ebufsiz, "setsysinfo: errno %d", errno);
634edb46e9SPaul Traina 		return (-1);
644edb46e9SPaul Traina 	}
654edb46e9SPaul Traina #endif
664edb46e9SPaul Traina 	return (0);
674edb46e9SPaul Traina }
68