summaryrefslogtreecommitdiffstats
path: root/contrib/openbsm/compat
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-04-16 15:37:10 +0000
committerrwatson <rwatson@FreeBSD.org>2007-04-16 15:37:10 +0000
commit9d9ec51b2c47983a8f8c8d48ed2fca487c2b272a (patch)
tree103f2ad3fab79dfe5e3b4ca02ebf1d9c1e2e4e82 /contrib/openbsm/compat
parent6b46b736cc84f6697b21608e304026e847ac155d (diff)
downloadFreeBSD-src-9d9ec51b2c47983a8f8c8d48ed2fca487c2b272a.zip
FreeBSD-src-9d9ec51b2c47983a8f8c8d48ed2fca487c2b272a.tar.gz
Vendor import TrustedBSD OpenBSM 1.0 alpha 14, with the following change
history notes since the last import: OpenBSM 1.0 alpha 14 - Fix endian issues when processing IPv6 addresses for extended subject and process tokens. - gcc41 warnings clean. - Teach audit_submit(3) about getaudit_addr(2). - Add support for zonename tokens. OpenBSM 1.0 alpha 13 - compat/clock_gettime.h now provides a compatibility implementation of clock_gettime(), which fixes building on Mac OS X. - Countless man page improvements, markup fixes, content fixs, etc. - XML printing support via "praudit -x". - audit.log.5 expanded to include additional BSM token types. - Added encoding and decoding routines for process64_ex, process32_ex, subject32_ex, header64, and attr64 tokens. - Additional audit event identifiers for listen, mlockall/munlockall, getpath, POSIX message queues, and mandatory access control. Approved by: re (bmah) MFC after: 3 weeks Obtained from: TrustedBSD Project
Diffstat (limited to 'contrib/openbsm/compat')
-rw-r--r--contrib/openbsm/compat/clock_gettime.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/contrib/openbsm/compat/clock_gettime.h b/contrib/openbsm/compat/clock_gettime.h
new file mode 100644
index 0000000..fe6a806
--- /dev/null
+++ b/contrib/openbsm/compat/clock_gettime.h
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2006 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $P4: //depot/projects/trustedbsd/openbsm/compat/clock_gettime.h#2 $
+ */
+
+/*
+ * Compatibility routines for clock_gettime(CLOCK_REALTIME, ...) for systems
+ * that don't have it. We don't use clockid_t in order to avoid conflicts
+ * with the native OS if it has one but not clock_gettime(). We also assume
+ * that the sys/time.h include has already happened at this point, so we have
+ * access to gettimeofday().
+ */
+#include <errno.h>
+
+#define CLOCK_REALTIME 0x2d4e1588
+
+static inline int
+clock_gettime(int clock_id, struct timespec *ts)
+{
+ struct timeval tv;
+
+ if (clock_id != CLOCK_REALTIME) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if (gettimeofday(&tv, NULL) < 0)
+ return (-1);
+ ts->tv_sec = tv.tv_sec;
+ ts->tv_nsec = tv.tv_usec * 1000;
+ return (0);
+}
OpenPOWER on IntegriCloud