machdep.c revision 146774
1218885Sdim/* 2218885Sdim * Copyright (c) 1996, 1997 3218885Sdim * The Regents of the University of California. All rights reserved. 4218885Sdim * 5218885Sdim * Redistribution and use in source and binary forms, with or without 6218885Sdim * modification, are permitted provided that: (1) source code distributions 7218885Sdim * retain the above copyright notice and this paragraph in its entirety, (2) 8218885Sdim * distributions including binary code include the above copyright notice and 9218885Sdim * this paragraph in its entirety in the documentation or other materials 10218885Sdim * provided with the distribution, and (3) all advertising materials mentioning 11218885Sdim * features or use of this software display the following acknowledgement: 12218885Sdim * ``This product includes software developed by the University of California, 13218885Sdim * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14218885Sdim * the University nor the names of its contributors may be used to endorse 15221345Sdim * or promote products derived from this software without specific prior 16218885Sdim * written permission. 17218885Sdim * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18218885Sdim * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19218885Sdim * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20218885Sdim */ 21218885Sdim 22218885Sdim#ifndef lint 23218885Sdimstatic const char rcsid[] _U_ = 24218885Sdim "@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.13 2003/12/15 03:53:21 guy Exp $ (LBL)"; 25218885Sdim#endif 26218885Sdim 27218885Sdim#ifdef HAVE_CONFIG_H 28218885Sdim#include "config.h" 29218885Sdim#endif 30218885Sdim 31218885Sdim/* 32218885Sdim * XXX - all we need, on platforms other than DEC OSF/1 (a/k/a Digital UNIX, 33218885Sdim * a/k/a Tru64 UNIX), is "size_t", which is a standard C type; what do we 34218885Sdim * need to do to get it defined? This is clearly wrong, as we shouldn't 35218885Sdim * have to include UNIX or Windows system header files to get it. 36218885Sdim */ 37218885Sdim#include <tcpdump-stdinc.h> 38218885Sdim 39218885Sdim#ifndef HAVE___ATTRIBUTE__ 40218885Sdim#define __attribute__(x) 41218885Sdim#endif /* HAVE___ATTRIBUTE__ */ 42218885Sdim 43218885Sdim#ifdef __osf__ 44218885Sdim#include <sys/sysinfo.h> 45218885Sdim#include <sys/proc.h> 46218885Sdim 47218885Sdim#if !defined(HAVE_SNPRINTF) 48218885Sdimint snprintf(char *, size_t, const char *, ...) 49218885Sdim __attribute__((format(printf, 3, 4))); 50218885Sdim#endif /* !defined(HAVE_SNPRINTF) */ 51218885Sdim#endif /* __osf__ */ 52218885Sdim 53#include "machdep.h" 54 55int 56abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_) 57{ 58#ifdef __osf__ 59 static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS }; 60 61 if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) { 62 (void)snprintf(ebuf, ebufsiz, "setsysinfo: errno %d", errno); 63 return (-1); 64 } 65#endif 66 return (0); 67} 68