Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2000 00:30:50 +0900
From:      Yoshinobu Inoue <shin@nd.net.fujitsu.co.jp>
To:        bde@zeta.org.au
Cc:        bmah@CA.Sandia.GOV, nnd@mail.nsk.ru, current@FreeBSD.ORG
Subject:   Re: 'machine/param.h' required for 'sys/socket.h' 
Message-ID:  <20000329003050L.shin@nd.net.fujitsu.co.jp>
In-Reply-To: <Pine.BSF.4.21.0003262249530.2515-100000@alphplex.bde.org>
References:  <20000326004417L.shin@nd.net.fujitsu.co.jp> <Pine.BSF.4.21.0003262249530.2515-100000@alphplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Wed_Mar_29_00:30:47_2000_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> > sys/socket.h:
> > #ifdef  _NO_NAME_SPACE_POLLUTION
> > #include <machine/param.h>
> > #else
> > #define _NO_NAME_SPACE_POLLUTION
> > #include <machine/param.h>
> > #undef _NO_NAME_SPACE_POLLUTION
> > #endif
> 
> I like this for a quick fix.  Only define _ALIGN() like the current
> ALIGN().  Don't define all the variants given in your previous mail.

I created the patches.
It become a little bit more complicated than I expected, to
avoid duplicated inclusion independently in each of namespace
polluted part and non polluted part.

Please give me comments if any.

Thanks,
Yoshinobu Inoue


----Next_Part(Wed_Mar_29_00:30:47_2000_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="namespace.diff"

Index: sys/socket.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/socket.h,v
retrieving revision 1.39
diff -u -r1.39 socket.h
--- sys/socket.h	2000/03/11 19:51:04	1.39
+++ sys/socket.h	2000/03/28 12:02:12
@@ -37,6 +37,14 @@
 #ifndef _SYS_SOCKET_H_
 #define	_SYS_SOCKET_H_
 
+#ifdef _NO_NAMESPACE_POLLUTION
+#include <machine/param.h>
+#else
+#define	_NO_NAMESPACE_POLLUTION
+#include <machine/param.h>
+#undef	_NO_NAMESPACE_POLLUTION
+#endif
+
 /*
  * Definitions related to sockets: types, address families, options.
  */
Index: i386/include/param.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/param.h,v
retrieving revision 1.54
diff -u -r1.54 param.h
--- i386/include/param.h	1999/12/11 10:54:06	1.54
+++ i386/include/param.h	2000/03/28 12:02:13
@@ -37,8 +37,16 @@
  * $FreeBSD: src/sys/i386/include/param.h,v 1.54 1999/12/11 10:54:06 peter Exp $
  */
 
-#ifndef _MACHINE_PARAM_H_
-#define	_MACHINE_PARAM_H_
+#ifndef _MACHINE_PARAM_H_NO_NAMESPACE_POLLUTION
+#define	_MACHINE_PARAM_H_NO_NAMESPACE_POLLUTION
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...).   The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#define _ALIGNBYTES	(sizeof(int) - 1)
+#define _ALIGN(p)	(((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
 
 /*
  * Machine dependent constants for Intel 386.
@@ -46,12 +54,23 @@
 #ifndef _MACHINE
 #define	_MACHINE	i386
 #endif
-#ifndef MACHINE
-#define MACHINE		"i386"
-#endif
 #ifndef _MACHINE_ARCH
 #define	_MACHINE_ARCH	i386
 #endif
+
+#endif /* !_MACHINE_PARAM_H_NO_NAMESPACE_POLLUTION */
+
+#ifndef _NO_NAMESPACE_POLLUTION
+
+#ifndef _MACHINE_PARAM_H_
+#define	_MACHINE_PARAM_H_
+
+/*
+ * Machine dependent constants for Intel 386.
+ */
+#ifndef MACHINE
+#define MACHINE		"i386"
+#endif
 #ifndef MACHINE_ARCH
 #define	MACHINE_ARCH	"i386"
 #endif
@@ -70,13 +89,8 @@
 #define NCPUS		1
 #endif
 
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...).   The result is unsigned int
- * and must be cast to any desired pointer type.
- */
-#define ALIGNBYTES	(sizeof(int) - 1)
-#define ALIGN(p)	(((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+#define ALIGNBYTES	_ALIGNBYTES
+#define ALIGN(p)	_ALIGN(p)
 
 #define PAGE_SHIFT	12		/* LOG2(PAGE_SIZE) */
 #define PAGE_SIZE	(1<<PAGE_SHIFT)	/* bytes/page */
@@ -158,3 +172,5 @@
 #define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
 
 #endif /* !_MACHINE_PARAM_H_ */
+#endif /* !_NO_NAMESPACE_POLLUTION */
+
Index: alpha/include/param.h
===================================================================
RCS file: /home/ncvs/src/sys/alpha/include/param.h,v
retrieving revision 1.17
diff -u -r1.17 param.h
--- alpha/include/param.h	2000/02/29 08:48:10	1.17
+++ alpha/include/param.h	2000/03/28 12:02:14
@@ -43,18 +43,47 @@
  *	@(#)param.h	8.1 (Berkeley) 6/10/93
  */
 
+#ifndef _MACHINE_PARAM_H_NO_NAMESPACE_POLLUTION
+#define	_MACHINE_PARAM_H_NO_NAMESPACE_POLLUTION
+
+/*
+ * 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)
+
 /*
  * Machine dependent constants for the Alpha.
  */
 #ifndef _MACHINE
 #define	_MACHINE	alpha
 #endif
-#ifndef MACHINE
-#define	MACHINE		"alpha"
-#endif
 #ifndef _MACHINE_ARCH
 #define	_MACHINE_ARCH	alpha
 #endif
+
+#endif /* !_MACHINE_PARAM_H_NO_NAMESPACE_POLLUTION */
+
+#ifndef _NO_NAMESPACE_POLLUTION
+
+#ifndef _MACHINE_PARAM_H_
+#define	_MACHINE_PARAM_H_
+
+/*
+ * Machine dependent constants for the Alpha.
+ */
+#ifndef MACHINE
+#define	MACHINE		"alpha"
+#endif
 #ifndef MACHINE_ARCH
 #define	MACHINE_ARCH	"alpha"
 #endif
@@ -72,20 +101,9 @@
 
 #define NCPUS		1
 
-/*
- * 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	PAGE_SIZE	(1 << ALPHA_PGSHIFT)		/* bytes/page */
 #define PAGE_SHIFT	ALPHA_PGSHIFT
@@ -161,3 +179,7 @@
 #define	alpha_ptob(x)		((unsigned long)(x) << PAGE_SHIFT)
 
 #define pgtok(x)                ((x) * (PAGE_SIZE / 1024)) 
+
+#endif /* !_MACHINE_PARAM_H_ */
+#endif /* !_NO_NAMESPACE_POLLUTION */
+

----Next_Part(Wed_Mar_29_00:30:47_2000_809)----


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000329003050L.shin>