summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-09-08 03:40:33 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-09-08 03:40:33 +0000
commit211427d868f8aecd29999f2831103f73bfc92516 (patch)
tree5a25fcd1af5efcfaa5c78baf48489585ce16228e
parent6f53e4ebb844e940e8bd7264ebb259719834ebe2 (diff)
Provide namespace-safe alignment macros in <machine/_types.h>, with
compat names kept in <machine/param.h>. In <sys/socket.h>, pull in <sys/_types.h> instead of the namespace polluting <machine/param.h> and completely eliminate __CMSG_ALIGN, replaced by _ALIGN ok deraadt@
-rw-r--r--sys/arch/alpha/include/_types.h16
-rw-r--r--sys/arch/alpha/include/param.h19
-rw-r--r--sys/arch/amd64/include/_types.h16
-rw-r--r--sys/arch/amd64/include/param.h19
-rw-r--r--sys/arch/arm/include/_types.h16
-rw-r--r--sys/arch/arm/include/param.h20
-rw-r--r--sys/arch/hppa/include/_types.h16
-rw-r--r--sys/arch/hppa/include/param.h13
-rw-r--r--sys/arch/hppa64/include/_types.h16
-rw-r--r--sys/arch/hppa64/include/param.h13
-rw-r--r--sys/arch/i386/include/_types.h16
-rw-r--r--sys/arch/i386/include/param.h18
-rw-r--r--sys/arch/ia64/include/_types.h17
-rw-r--r--sys/arch/ia64/include/param.h6
-rw-r--r--sys/arch/m68k/include/_types.h16
-rw-r--r--sys/arch/m68k/include/param.h19
-rw-r--r--sys/arch/m88k/include/_types.h20
-rw-r--r--sys/arch/m88k/include/param.h16
-rw-r--r--sys/arch/mips64/include/_types.h16
-rw-r--r--sys/arch/mips64/include/param.h13
-rw-r--r--sys/arch/powerpc/include/_types.h16
-rw-r--r--sys/arch/powerpc/include/param.h8
-rw-r--r--sys/arch/sh/include/_types.h16
-rw-r--r--sys/arch/sh/include/param.h19
-rw-r--r--sys/arch/solbourne/include/param.h19
-rw-r--r--sys/arch/sparc/include/_types.h16
-rw-r--r--sys/arch/sparc/include/param.h19
-rw-r--r--sys/arch/sparc64/include/_types.h16
-rw-r--r--sys/arch/sparc64/include/param.h19
-rw-r--r--sys/arch/vax/include/_types.h16
-rw-r--r--sys/arch/vax/include/param.h20
-rw-r--r--sys/sys/socket.h22
32 files changed, 305 insertions, 222 deletions
diff --git a/sys/arch/alpha/include/_types.h b/sys/arch/alpha/include/_types.h
index 48123f9f0df..55f1fa0e8be 100644
--- a/sys/arch/alpha/include/_types.h
+++ b/sys/arch/alpha/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.14 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.15 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES 7
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h
index ace9b16468c..db908ff515e 100644
--- a/sys/arch/alpha/include/param.h
+++ b/sys/arch/alpha/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.34 2009/10/02 17:57:23 miod Exp $ */
+/* $OpenBSD: param.h,v 1.35 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.30 2000/06/09 16:03:04 thorpej Exp $ */
/*
@@ -51,20 +51,9 @@
#include <machine/alpha_cpu.h>
#include <machine/cpu.h>
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...). The result is u_long and must be cast to
- * any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define NBPG (1 << ALPHA_PGSHIFT) /* bytes/page */
#define PGOFSET (NBPG-1) /* byte off. into pg */
diff --git a/sys/arch/amd64/include/_types.h b/sys/arch/amd64/include/_types.h
index b0a0b51e129..ed5ce0d4990 100644
--- a/sys/arch/amd64/include/_types.h
+++ b/sys/arch/amd64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.8 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.9 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -35,6 +35,20 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES (sizeof(long) - 1)
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) &~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) 1
+
#if defined(_KERNEL)
typedef struct label_t {
long val[8];
diff --git a/sys/arch/amd64/include/param.h b/sys/arch/amd64/include/param.h
index 89cfe97cde1..f7a1017d30a 100644
--- a/sys/arch/amd64/include/param.h
+++ b/sys/arch/amd64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.17 2010/11/29 00:06:04 dlg Exp $ */
+/* $OpenBSD: param.h,v 1.18 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -48,20 +48,9 @@
#define MACHINE_ARCH "amd64"
#define MID_MACHINE MID_AMD64
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_long and
- * must be cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES (sizeof(long) - 1)
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) 1
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PGSHIFT 12 /* LOG2(NBPG) */
#define NBPG (1 << PGSHIFT) /* bytes/page */
diff --git a/sys/arch/arm/include/_types.h b/sys/arch/arm/include/_types.h
index 23c7cf04c67..731ea0f04a3 100644
--- a/sys/arch/arm/include/_types.h
+++ b/sys/arch/arm/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.7 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.8 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES (sizeof(int) - 1)
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/arm/include/param.h b/sys/arch/arm/include/param.h
index 15327ffeb85..25a67007b87 100644
--- a/sys/arch/arm/include/param.h
+++ b/sys/arch/arm/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.15 2011/04/07 15:45:16 miod Exp $ */
+/* $OpenBSD: param.h,v 1.16 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.9 2002/03/24 03:37:23 thorpej Exp $ */
/*
@@ -126,20 +126,10 @@ void delay (unsigned);
#define MID_MACHINE MID_ARM6
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_int and
- * must be cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
+
/* ARM-specific macro to align a stack pointer (downwards). */
#define STACKALIGNBYTES (8 - 1)
#define STACKALIGN(p) ((u_long)(p) &~ STACKALIGNBYTES)
diff --git a/sys/arch/hppa/include/_types.h b/sys/arch/hppa/include/_types.h
index a8293327c7f..6e77c4429a8 100644
--- a/sys/arch/hppa/include/_types.h
+++ b/sys/arch/hppa/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.13 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.14 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -45,6 +45,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES 7
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
typedef unsigned long hppa_hpa_t; /* XXX */
typedef unsigned long hppa_spa_t; /* XXX */
typedef unsigned int pa_space_t; /* XXX */
diff --git a/sys/arch/hppa/include/param.h b/sys/arch/hppa/include/param.h
index 56a137d65e2..62bc1581785 100644
--- a/sys/arch/hppa/include/param.h
+++ b/sys/arch/hppa/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.40 2011/04/07 15:45:17 miod Exp $ */
+/* $OpenBSD: param.h,v 1.41 2011/09/08 03:40:32 guenther Exp $ */
/*
* Copyright (c) 1988-1994, The University of Utah and
@@ -36,14 +36,9 @@
#define MACHINE_ARCH "hppa"
#define MID_MACHINE MID_HPUX800
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...). The result is u_long and must be cast to
- * any desired pointer type.
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PAGE_SIZE 4096
#define PAGE_MASK (PAGE_SIZE-1)
diff --git a/sys/arch/hppa64/include/_types.h b/sys/arch/hppa64/include/_types.h
index 75ef9282688..a05a83ca069 100644
--- a/sys/arch/hppa64/include/_types.h
+++ b/sys/arch/hppa64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.7 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.8 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -45,6 +45,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES 7
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
typedef unsigned long hppa_hpa_t; /* XXX */
typedef unsigned long hppa_spa_t; /* XXX */
typedef unsigned int pa_space_t; /* XXX */
diff --git a/sys/arch/hppa64/include/param.h b/sys/arch/hppa64/include/param.h
index cea95f720e5..6a6ee024fff 100644
--- a/sys/arch/hppa64/include/param.h
+++ b/sys/arch/hppa64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.14 2011/05/03 21:00:23 kettenis Exp $ */
+/* $OpenBSD: param.h,v 1.15 2011/09/08 03:40:32 guenther Exp $ */
/*
* Copyright (c) 1988-1994, The University of Utah and
@@ -36,14 +36,9 @@
#define MACHINE_ARCH "hppa64"
#define MID_MACHINE MID_HPPA20
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...). The result is u_long and must be cast to
- * any desired pointer type.
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PAGE_SIZE 4096
#define PAGE_MASK (PAGE_SIZE-1)
diff --git a/sys/arch/i386/include/_types.h b/sys/arch/i386/include/_types.h
index be5c6cfc317..7cd81c4a218 100644
--- a/sys/arch/i386/include/_types.h
+++ b/sys/arch/i386/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.12 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.13 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -35,6 +35,20 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES (sizeof(int) - 1)
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) 1
+
#if defined(_KERNEL)
typedef struct label_t {
int val[6];
diff --git a/sys/arch/i386/include/param.h b/sys/arch/i386/include/param.h
index d243514739b..6c6a81e70cc 100644
--- a/sys/arch/i386/include/param.h
+++ b/sys/arch/i386/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.43 2011/04/07 15:45:17 miod Exp $ */
+/* $OpenBSD: param.h,v 1.44 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.29 1996/03/04 05:04:26 cgd Exp $ */
/*-
@@ -53,19 +53,9 @@
#define MACHINE_ARCH "i386"
#define MID_MACHINE MID_I386
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_long and
- * must be cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) 1
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PGSHIFT 12 /* LOG2(NBPG) */
#define NBPG (1 << PGSHIFT) /* bytes/page */
diff --git a/sys/arch/ia64/include/_types.h b/sys/arch/ia64/include/_types.h
index 3eaaa256c7f..c0ac6e5ec6a 100644
--- a/sys/arch/ia64/include/_types.h
+++ b/sys/arch/ia64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,21 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES 15 /* XXX guess/assumption */
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) 1
+
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/ia64/include/param.h b/sys/arch/ia64/include/param.h
index cb69567d3b0..b13d6609a53 100644
--- a/sys/arch/ia64/include/param.h
+++ b/sys/arch/ia64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.1 2011/07/04 23:29:08 pirofti Exp $ */
+/* $OpenBSD: param.h,v 1.2 2011/09/08 03:40:32 guenther Exp $ */
/*
* Written by Paul Irofti <pirofti@openbsd.org>. Public Domain.
@@ -13,4 +13,8 @@
#define MACHINE_ARCH "ia64"
#define MID_MACHINE MID_IA64
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
+
#endif /* _IA64_PARAM_H_ */
diff --git a/sys/arch/m68k/include/_types.h b/sys/arch/m68k/include/_types.h
index 413277ba96a..8dc53b2ea71 100644
--- a/sys/arch/m68k/include/_types.h
+++ b/sys/arch/m68k/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.10 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.11 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES (sizeof(int) - 1)
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/m68k/include/param.h b/sys/arch/m68k/include/param.h
index 59c8932eeff..91253b953fe 100644
--- a/sys/arch/m68k/include/param.h
+++ b/sys/arch/m68k/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.25 2011/04/07 15:45:17 miod Exp $ */
+/* $OpenBSD: param.h,v 1.26 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.2 1997/06/10 18:21:23 veego Exp $ */
/*
@@ -48,20 +48,9 @@
#define MACHINE_ARCH "m68k"
#define MID_MACHINE MID_M68K
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...). The result is u_long and must be cast to
- * any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
diff --git a/sys/arch/m88k/include/_types.h b/sys/arch/m88k/include/_types.h
index a6c63f9d1fb..eca53f7e629 100644
--- a/sys/arch/m88k/include/_types.h
+++ b/sys/arch/m88k/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.8 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.9 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,24 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+/*
+ * XXX These are also used for aligning stack, which needs to be on a quad
+ * word boundary for 88k.
+ */
+#define _ALIGNBYTES 15
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/m88k/include/param.h b/sys/arch/m88k/include/param.h
index a5b5a70c9ee..88e042dd1fe 100644
--- a/sys/arch/m88k/include/param.h
+++ b/sys/arch/m88k/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.13 2011/04/07 15:45:17 miod Exp $ */
+/* $OpenBSD: param.h,v 1.14 2011/09/08 03:40:32 guenther Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1988 University of Utah.
@@ -50,17 +50,9 @@
#define MACHINE_ARCH "m88k"
#define MID_MACHINE MID_M88K
-/*
- * Round p (pointer or byte index) down to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_long and
- * must be cast to any desired pointer type. ALIGN() is used for
- * aligning stack, which needs to be on a double word boundary for
- * 88k.
- */
-
-#define ALIGNBYTES 15 /* 64 bit alignment */
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define NBPG (1 << PGSHIFT) /* bytes/page */
#define PGOFSET (NBPG-1) /* byte offset into page */
diff --git a/sys/arch/mips64/include/_types.h b/sys/arch/mips64/include/_types.h
index 6b0cd50fc96..0d61a79b77b 100644
--- a/sys/arch/mips64/include/_types.h
+++ b/sys/arch/mips64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.9 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.10 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -36,6 +36,20 @@
#define _MIPS64__TYPES_H_
/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES 7
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
+/*
* We need to handle the various ISA levels for sizes.
*/
#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
diff --git a/sys/arch/mips64/include/param.h b/sys/arch/mips64/include/param.h
index 4c87da6be83..3347a9042fe 100644
--- a/sys/arch/mips64/include/param.h
+++ b/sys/arch/mips64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.29 2011/04/07 15:45:17 miod Exp $ */
+/* $OpenBSD: param.h,v 1.30 2011/09/08 03:40:32 guenther Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -44,14 +44,9 @@
#include <machine/cpu.h>
#endif
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...). The result is u_long and must be cast to
- * any desired pointer type.
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p, t) ((((u_long)(p)) & (sizeof (t) - 1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
diff --git a/sys/arch/powerpc/include/_types.h b/sys/arch/powerpc/include/_types.h
index 6480833b5e7..ccba4a48ce0 100644
--- a/sys/arch/powerpc/include/_types.h
+++ b/sys/arch/powerpc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.11 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.12 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES (sizeof(double) - 1)
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/powerpc/include/param.h b/sys/arch/powerpc/include/param.h
index 640348a0be4..6f8337d2bcc 100644
--- a/sys/arch/powerpc/include/param.h
+++ b/sys/arch/powerpc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.31 2011/04/07 15:45:17 miod Exp $ */
+/* $OpenBSD: param.h,v 1.32 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */
/*-
@@ -49,9 +49,9 @@
#define MID_MACHINE MID_POWERPC
-#define ALIGNBYTES (sizeof(double) - 1)
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PAGE_SHIFT 12
#define PAGE_SIZE 4096
diff --git a/sys/arch/sh/include/_types.h b/sys/arch/sh/include/_types.h
index 39ff7f66070..a690f51bcd8 100644
--- a/sys/arch/sh/include/_types.h
+++ b/sys/arch/sh/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.8 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.9 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES (sizeof(int) - 1)
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/sh/include/param.h b/sys/arch/sh/include/param.h
index 320d8b0e909..03f39929a21 100644
--- a/sys/arch/sh/include/param.h
+++ b/sys/arch/sh/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.7 2011/04/07 15:45:18 miod Exp $ */
+/* $OpenBSD: param.h,v 1.8 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.15 2006/08/28 13:43:35 yamt Exp $ */
/*-
@@ -66,20 +66,9 @@
#define NBPG PAGE_SIZE
#define PGOFSET PAGE_MASK
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_long and
- * must be cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-#define ALIGNED_POINTER(p, t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define DEV_BSIZE (1 << DEV_BSHIFT)
diff --git a/sys/arch/solbourne/include/param.h b/sys/arch/solbourne/include/param.h
index 2932a7423ee..5ae0c528f8e 100644
--- a/sys/arch/solbourne/include/param.h
+++ b/sys/arch/solbourne/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.9 2011/04/07 15:45:18 miod Exp $ */
+/* $OpenBSD: param.h,v 1.10 2011/09/08 03:40:32 guenther Exp $ */
/* OpenBSD: param.h,v 1.29 2004/08/06 22:31:31 mickey Exp */
/*
@@ -56,20 +56,9 @@
#endif /* XXX */
#endif /* XXX */
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for
- * the machine's strictest data type. The result is u_long and must be
- * cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define SUN4_PGSHIFT 13 /* for a sun4 machine */
#define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */
diff --git a/sys/arch/sparc/include/_types.h b/sys/arch/sparc/include/_types.h
index 78f2007ed61..8185af96b71 100644
--- a/sys/arch/sparc/include/_types.h
+++ b/sys/arch/sparc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.13 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.14 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES 7
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h
index 4fa007fb73b..c06665e4770 100644
--- a/sys/arch/sparc/include/param.h
+++ b/sys/arch/sparc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.45 2011/04/07 15:45:18 miod Exp $ */
+/* $OpenBSD: param.h,v 1.46 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */
/*
@@ -61,20 +61,9 @@
#endif /* XXX */
#endif /* XXX */
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for
- * the machine's strictest data type. The result is u_long and must be
- * cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define SUN4_PGSHIFT 13 /* for a sun4 machine */
#define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */
diff --git a/sys/arch/sparc64/include/_types.h b/sys/arch/sparc64/include/_types.h
index 567996d27b0..fad34490b9e 100644
--- a/sys/arch/sparc64/include/_types.h
+++ b/sys/arch/sparc64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.12 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.13 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES 0xf
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/sparc64/include/param.h b/sys/arch/sparc64/include/param.h
index 94c98840529..3e1b685677c 100644
--- a/sys/arch/sparc64/include/param.h
+++ b/sys/arch/sparc64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.35 2011/04/07 15:45:18 miod Exp $ */
+/* $OpenBSD: param.h,v 1.36 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.25 2001/05/30 12:28:51 mrg Exp $ */
/*
@@ -73,20 +73,9 @@
#define MACHINE_ARCH "sparc64"
#define MID_MACHINE MID_SPARC64
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for
- * the machine's strictest data type. The result is u_long and must be
- * cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-#define ALIGNBYTES 0xf
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define DEV_BSIZE (1 << DEV_BSHIFT)
diff --git a/sys/arch/vax/include/_types.h b/sys/arch/vax/include/_types.h
index 3e6f226cf1e..cbe54c2234e 100644
--- a/sys/arch/vax/include/_types.h
+++ b/sys/arch/vax/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.11 2011/09/08 02:47:13 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.12 2011/09/08 03:40:32 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,6 +41,20 @@ typedef struct label_t {
} label_t;
#endif
+/*
+ * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
+ * value for all data types (int, long, ...). The result is an
+ * unsigned long and must be cast to any desired pointer type.
+ *
+ * _ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ */
+#define _ALIGNBYTES (sizeof(int) - 1)
+#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
+
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h
index db5dc86a438..6373bca8f23 100644
--- a/sys/arch/vax/include/param.h
+++ b/sys/arch/vax/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.36 2011/04/07 15:45:18 miod Exp $ */
+/* $OpenBSD: param.h,v 1.37 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: param.h,v 1.39 1999/10/22 21:14:34 ragge Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -47,21 +47,9 @@
#define MACHINE_ARCH "vax"
#define MID_MACHINE MID_VAX
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_long and
- * must be cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- *
- */
-
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+#define ALIGNBYTES _ALIGNBYTES
+#define ALIGN(p) _ALIGN(p)
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
#define PGSHIFT 12 /* LOG2(NBPG) */
#define NBPG (1 << PGSHIFT) /* (1 << PGSHIFT) bytes/page */
diff --git a/sys/sys/socket.h b/sys/sys/socket.h
index 02139217ff1..19c8c0b7de3 100644
--- a/sys/sys/socket.h
+++ b/sys/sys/socket.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socket.h,v 1.76 2011/07/08 20:53:59 deraadt Exp $ */
+/* $OpenBSD: socket.h,v 1.77 2011/09/08 03:40:32 guenther Exp $ */
/* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */
/*
@@ -35,10 +35,7 @@
#ifndef _SYS_SOCKET_H_
#define _SYS_SOCKET_H_
-/*
- * needed for ALIGNBYTES
- */
-#include <machine/param.h>
+#include <sys/_types.h>
/*
* Definitions related to sockets: types, address families, options.
@@ -431,15 +428,15 @@ struct cmsghdr {
/* given pointer to struct cmsghdr, return pointer to data */
#define CMSG_DATA(cmsg) \
- ((u_char *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr)))
+ ((u_char *)(cmsg) + _ALIGN(sizeof(struct cmsghdr)))
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
#define CMSG_NXTHDR(mhdr, cmsg) \
- (((caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \
- __CMSG_ALIGN(sizeof(struct cmsghdr)) > \
+ (((caddr_t)(cmsg) + _ALIGN((cmsg)->cmsg_len) + \
+ _ALIGN(sizeof(struct cmsghdr)) > \
((caddr_t)(mhdr)->msg_control) + (mhdr)->msg_controllen) ? \
(struct cmsghdr *)NULL : \
- (struct cmsghdr *)((caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len)))
+ (struct cmsghdr *)((caddr_t)(cmsg) + _ALIGN((cmsg)->cmsg_len)))
/*
* RFC 2292 requires to check msg_controllen, in case that the kernel returns
@@ -451,16 +448,15 @@ struct cmsghdr {
(struct cmsghdr *)NULL)
/* Round len up to next alignment boundary */
-#define __CMSG_ALIGN(len) ALIGN(len)
#ifdef _KERNEL
-#define CMSG_ALIGN(n) __CMSG_ALIGN(n)
+#define CMSG_ALIGN(n) _ALIGN(n)
#endif
/* Length of the contents of a control message of length len */
-#define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+#define CMSG_LEN(len) (_ALIGN(sizeof(struct cmsghdr)) + (len))
/* Length of the space taken up by a padded control message of length len */
-#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len))
+#define CMSG_SPACE(len) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(len))
/* "Socket"-level control message types: */
#define SCM_RIGHTS 0x01 /* access rights (array of int) */