Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Don't use __cmsg_alignbytes in the kernel. Mark it as co...
details: https://anonhg.NetBSD.org/src/rev/eb5a0f71be91
branches: trunk
changeset: 772888:eb5a0f71be91
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Jan 20 00:25:29 2012 +0000
description:
Don't use __cmsg_alignbytes in the kernel. Mark it as constant function
for userland as its value never changes. This allows the compiler to
optimise most invocations away.
diffstat:
sys/lib/libkern/Makefile.libkern | 4 ++--
sys/sys/socket.h | 11 ++++++++---
2 files changed, 10 insertions(+), 5 deletions(-)
diffs (53 lines):
diff -r c3c4287da0ae -r eb5a0f71be91 sys/lib/libkern/Makefile.libkern
--- a/sys/lib/libkern/Makefile.libkern Thu Jan 19 23:37:23 2012 +0000
+++ b/sys/lib/libkern/Makefile.libkern Fri Jan 20 00:25:29 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.libkern,v 1.15 2011/11/19 22:51:25 tls Exp $
+# $NetBSD: Makefile.libkern,v 1.16 2012/01/20 00:25:29 joerg Exp $
#
# Variable definitions for libkern.
@@ -58,7 +58,7 @@
# Other stuff
SRCS+= kern_assert.c __main.c
-SRCS+= __cmsg_alignbytes.c cpuset.c inet_addr.c intoa.c
+SRCS+= cpuset.c inet_addr.c intoa.c
.if empty(SRCS:Mbyte_swap_8.*)
SRCS+= bswap64.c
.endif
diff -r c3c4287da0ae -r eb5a0f71be91 sys/sys/socket.h
--- a/sys/sys/socket.h Thu Jan 19 23:37:23 2012 +0000
+++ b/sys/sys/socket.h Fri Jan 20 00:25:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: socket.h,v 1.101 2011/12/20 23:56:29 christos Exp $ */
+/* $NetBSD: socket.h,v 1.102 2012/01/20 00:25:29 joerg Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -531,8 +531,11 @@
* without (2), we can't guarantee binary compatibility in case of future
* changes in ALIGNBYTES.
*/
+#ifdef _KERNEL
+#define __CMSG_ALIGN(n) (((n) + ALIGNBYTES) & ~ALIGNBYTES)
+#define CMSG_ALIGN(n) __CMSG_ALIGN(n)
+#else
#define __CMSG_ALIGN(n) (((n) + __cmsg_alignbytes()) & ~__cmsg_alignbytes())
-#ifdef _KERNEL
#define CMSG_ALIGN(n) __CMSG_ALIGN(n)
#endif
@@ -574,9 +577,11 @@
#include <sys/cdefs.h>
+#ifndef _KERNEL
__BEGIN_DECLS
-int __cmsg_alignbytes(void);
+int __cmsg_alignbytes(void) __constfunc;
__END_DECLS
+#endif
#ifdef _KERNEL
static inline socklen_t
Home |
Main Index |
Thread Index |
Old Index