This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] sys/types.h: Avoid bit-manipulation of signed values


Hi all,

On Fri, 2015-11-27 at 14:04 +0100, Corinna Vinschen wrote:
> On Nov 27 19:08, Nick Withers wrote:
> > On Fri, 2015-11-27 at 09:03 +0100, Sebastian Huber wrote:
> > > 
> > > On 27/11/15 08:46, Nick Withers wrote:
> > > > On Fri, 2015-11-27 at 08:26 +0100, Sebastian Huber wrote:
> > > > > > 
> > > > > > On 26/11/15 10:17, Corinna Vinschen wrote:
> > > > > > > > > > > > Looks good. I need some time to use this in
> > > > > > > > > > > > RTEMS,
> > > > > > > > > > > > since I am
> > > > > > > > > > > > currently busy
> > > > > > > > > > > > > > > > with other stuff and this is only a
> > > > > > > > > > > > > > > > nice to
> > > > > > > > > > > > > > > > have.
> > > > > > > > > > > > 
> > > > > > > > > > > > That's ok, I'm pretty busy myself.  Can you
> > > > > > > > > > > > ping
> > > > > > > > > > > > back as soon
> > > > > > > > > > > > as you
> > > > > > > > > > > > tested this?
> > > > > > > > Did you test this in the meantime?
> > > > > > 
> > > > > > Sorry, please don't wait for me. It will be next year
> > > > > > before I
> > > > > > can
> > > > > > work
> > > > > > on this.
> 
> I'm sorry to read that.
> 
> > > > Is this the kind of thing a humble RTEMS user might be able to
> > > > figure
> > > > out?
> > > > 
> > > > It sounds like I'd have to do some hacking on / remove RTEMS'
> > > > sys/select.h at least?
> > > 
> > > The goal is to use a Newlib <sys/select.h> that is capable to
> > > replace
> > > these two files:
> > > 
> > > https://git.rtems.org/rtems/tree/cpukit/libnetworking/sys/select.
> > > h
> > > https://git.rtems.org/rtems-libbsd/tree/freebsd/sys/sys/select.h
> > > 
> > > What complicates the things a bit is that the FreeBSD file uses
> > > 
> > > https://git.rtems.org/rtems-libbsd/tree/freebsd/sys/sys/_sigset.h
> > > 
> > > which is used by other header files as well.
> > 
> > Righto, thanks Sebastian.
> > 
> > I'm heading off for the weekend, but if I don't hear anything I'll
> > have
> > a crack at it on Monday.
> 
> The first thing would be to check if sys/select.h from Cygwin is
> sufficent for RTEMS as well, provided you apply my patch from
> https://sourceware.org/ml/newlib/2015/msg00832.html and move the
> resulting winsup/cygwin/include/sys/select.h to
> newlib/libc/include/sys.
> 
> If that works fine, I apply my patch.

I haven't yet tackled the rtems-libbsd part Sebastian mentioned, but
have made some progress.

With the attached newlib-sys_select.patch* and rtems-sys_select.patch**
patches applied to Newlib and RTEMS Git masters respectively, the RTEMS
tests "syscall01" and "psxreaddir" seem to pass through PSim (psim
-syscall01.out and psxreaddir.out).


How do folk feel about this so far?


* newlib/libc/sys/arm/sys/param.h changes are untested

** I 
 - used the RSB master to build 4.12 tools
 - removed the BSD advertising clause from what's now sys/selinfo.h,
but am not sure that I should have
 - made a few unrelated but minor changes to cpukit/libmisc/shell/*.c
printf()s to ensure format specifiers matched parameter types
 - disabled dltests on PSim after running out of space (in .rodata from
memory) building dl02; dl01 did build fine, though
-- 
Nick Withers

Embedded Systems Programmer
Department of Nuclear Physics, Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)

Attachment: psim-psxreaddir.out
Description: Text document

Attachment: psim-syscall01.out
Description: Text document

diff --git a/newlib/libc/include/sys/param.h b/newlib/libc/include/sys/param.h
index ef203d3..9a6f115 100644
--- a/newlib/libc/include/sys/param.h
+++ b/newlib/libc/include/sys/param.h
@@ -10,6 +10,9 @@
 #include <machine/endian.h>
 #include <machine/param.h>
 
+#ifndef NBBY
+# define NBBY 8		/* number of bits in a byte */
+#endif
 #ifndef HZ
 # define HZ (60)
 #endif
@@ -25,4 +28,8 @@
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 
+#ifndef howmany
+#define    howmany(x, y)   (((x)+((y)-1))/(y))
+#endif
+
 #endif
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index d8d6fdc..5dd6c75 100644
--- a/newlib/libc/include/sys/types.h
+++ b/newlib/libc/include/sys/types.h
@@ -208,52 +208,6 @@ typedef unsigned int mode_t _ST_INT32;
 
 typedef unsigned short nlink_t;
 
-/* We don't define fd_set and friends if we are compiling POSIX
-   source, or if we have included (or may include as indicated
-   by __USE_W32_SOCKETS) the W32api winsock[2].h header which
-   defines Windows versions of them.   Note that a program which
-   includes the W32api winsock[2].h header must know what it is doing;
-   it must not call the cygwin32 select function.
-*/
-# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) 
-#  define _SYS_TYPES_FD_SET
-#  define	NBBY	8		/* number of bits in a byte */
-/*
- * Select uses bit masks of file descriptors in longs.
- * These macros manipulate such bit fields (the filesystem macros use chars).
- * FD_SETSIZE may be defined by the user, but the default here
- * should be >= NOFILE (param.h).
- */
-#  ifndef	FD_SETSIZE
-#	define	FD_SETSIZE	64
-#  endif
-
-typedef	long	fd_mask;
-#  define	NFDBITS	(sizeof (fd_mask) * NBBY)	/* bits per mask */
-#  ifndef	howmany
-#	define	howmany(x,y)	(((x)+((y)-1))/(y))
-#  endif
-
-/* We use a macro for fd_set so that including Sockets.h afterwards
-   can work.  */
-typedef	struct _types_fd_set {
-	fd_mask	fds_bits[howmany(FD_SETSIZE, NFDBITS)];
-} _types_fd_set;
-
-#define fd_set _types_fd_set
-
-#  define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
-#  define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
-#  define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
-#  define	FD_ZERO(p)	(__extension__ (void)({ \
-     size_t __i; \
-     char *__tmp = (char *)p; \
-     for (__i = 0; __i < sizeof (*(p)); ++__i) \
-       *__tmp++ = 0; \
-}))
-
-# endif	/* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) */
-
 #undef __MS_types__
 #undef _ST_INT32
 
diff --git a/newlib/libc/sys/arm/sys/param.h b/newlib/libc/sys/arm/sys/param.h
index b358734..5b9464c 100644
--- a/newlib/libc/sys/arm/sys/param.h
+++ b/newlib/libc/sys/arm/sys/param.h
@@ -6,6 +6,9 @@
 #include <machine/param.h>
 #include <machine/endian.h>
 
+#ifndef NBBY
+# define NBBY 8		/* number of bits in a byte */
+#endif
 #ifndef HZ
 # define HZ (60)
 #endif
diff --git a/newlib/libc/sys/rtems/include/sys/param.h b/newlib/libc/sys/rtems/include/sys/param.h
index f1e598c..aa04352 100644
--- a/newlib/libc/sys/rtems/include/sys/param.h
+++ b/newlib/libc/sys/rtems/include/sys/param.h
@@ -109,6 +109,7 @@
 
 #define	NZERO	0		/* default "nice" */
 
+#define	NBBY	8		/* number of bits in a byte */
 #define	NBPW	sizeof(int)	/* number of bytes per word (integer) */
 
 #define	CMASK	022		/* default file mask: S_IWGRP|S_IWOTH */
diff --git a/winsup/cygwin/include/sys/select.h b/winsup/cygwin/include/sys/select.h
index 9cc6c1e..ffe8900 100644
--- a/winsup/cygwin/include/sys/select.h
+++ b/winsup/cygwin/include/sys/select.h
@@ -12,7 +12,14 @@ details. */
 #ifndef _SYS_SELECT_H
 #define _SYS_SELECT_H
 
-#if !defined (_POSIX_SOURCE) && !defined (__INSIDE_CYGWIN_NET__) && !defined (__USE_W32_SOCKETS)
+/* We don't define fd_set and friends if we are compiling POSIX
+   source, or if we have included (or may include as indicated
+   by __USE_W32_SOCKETS) the W32api winsock[2].h header which
+   defines Windows versions of them.   Note that a program which
+   includes the W32api winsock[2].h header must know what it is doing;
+   it must not call the Cygwin select function.
+*/
+# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
 
 #include <sys/cdefs.h>
 
@@ -26,6 +33,43 @@ details. */
 /* Get definition of sigset_t. */
 #include <signal.h>
 
+#  define _SYS_TYPES_FD_SET
+/*
+ * Select uses bit masks of file descriptors in longs.
+ * These macros manipulate such bit fields (the filesystem macros use chars).
+ * FD_SETSIZE may be defined by the user, but the default here
+ * should be >= NOFILE (param.h).
+ */
+#  ifndef	FD_SETSIZE
+#	define	FD_SETSIZE	64
+#  endif
+
+typedef	unsigned long	fd_mask;
+#  define	NFDBITS	(sizeof (fd_mask) * 8)	/* bits per mask */
+#  ifndef	_howmany
+#	define	_howmany(x,y)	(((x)+((y)-1))/(y))
+#  endif
+
+/* We use a macro for fd_set so that including Sockets.h afterwards
+   can work.  */
+typedef	struct _types_fd_set {
+	fd_mask	fds_bits[_howmany(FD_SETSIZE, NFDBITS)];
+} _types_fd_set;
+
+#define fd_set _types_fd_set
+
+#  define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
+#  define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
+#  define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
+#  define	FD_ZERO(p)	(__extension__ (void)({ \
+     size_t __i; \
+     char *__tmp = (char *)p; \
+     for (__i = 0; __i < sizeof (*(p)); ++__i) \
+       *__tmp++ = 0; \
+}))
+
+#if !defined (__INSIDE_CYGWIN_NET__)
+
 __BEGIN_DECLS
 
 int select __P ((int __n, fd_set *__readfds, fd_set *__writefds,
@@ -36,6 +80,8 @@ int pselect __P ((int __n, fd_set *__readfds, fd_set *__writefds,
 
 __END_DECLS
 
+#endif
+
 #endif /* !_POSIX_SOURCE, !__INSIDE_CYGWIN_NET__ */
 
 #endif /* sys/select.h */
From 00a7b0b1ebf6a29fcaf63f9603210653f2858604 Mon Sep 17 00:00:00 2001
From: Nick Withers <Nick.Withers@anu.edu.au>
Date: Thu, 3 Dec 2015 18:36:19 +1100
Subject: [PATCH] Chase Newlib sys/types.h / sys/select.h changes

---
 .../powerpc/psim/make/custom/psim-testsuite.tcfg   |  5 ++
 cpukit/libmisc/shell/main_ls.c                     |  3 +-
 cpukit/libmisc/shell/print-ls.c                    | 10 ++--
 cpukit/libnetworking/Makefile.am                   |  2 +-
 cpukit/libnetworking/libc/res_send.c               |  3 +
 cpukit/libnetworking/preinstall.am                 |  6 +-
 cpukit/libnetworking/rtems/rtems_select.c          |  1 +
 cpukit/libnetworking/sys/select.h                  | 69 ----------------------
 cpukit/libnetworking/sys/selinfo.h                 | 56 ++++++++++++++++++
 cpukit/libnetworking/sys/socketvar.h               |  2 +-
 cpukit/librpc/include/rpc/svc.h                    |  1 +
 cpukit/librpc/src/rpc/clnt_tcp.c                   |  1 +
 cpukit/librpc/src/rpc/clnt_udp.c                   |  1 +
 cpukit/librpc/src/rpc/pmap_rmt.c                   |  1 +
 cpukit/librpc/src/rpc/rpc_dtablesize.c             |  2 +-
 cpukit/librpc/src/rpc/svc.c                        |  1 +
 16 files changed, 83 insertions(+), 81 deletions(-)
 create mode 100644 c/src/lib/libbsp/powerpc/psim/make/custom/psim-testsuite.tcfg
 delete mode 100644 cpukit/libnetworking/sys/select.h
 create mode 100644 cpukit/libnetworking/sys/selinfo.h

diff --git a/c/src/lib/libbsp/powerpc/psim/make/custom/psim-testsuite.tcfg b/c/src/lib/libbsp/powerpc/psim/make/custom/psim-testsuite.tcfg
new file mode 100644
index 0000000..8728642
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/psim/make/custom/psim-testsuite.tcfg
@@ -0,0 +1,5 @@
+#
+#  This is the set of tests which are known to not link on this BSP
+#
+
+include: testdata/dltests-broken-on-this-bsp.tcfg
diff --git a/cpukit/libmisc/shell/main_ls.c b/cpukit/libmisc/shell/main_ls.c
index 55ad5b3..e23e388 100644
--- a/cpukit/libmisc/shell/main_ls.c
+++ b/cpukit/libmisc/shell/main_ls.c
@@ -58,6 +58,7 @@ __RCSID("$NetBSD: ls.c,v 1.58 2005/10/26 02:24:22 jschauma Exp $");
 #define __need_getopt_newlib
 #include <getopt.h>
 
+#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
@@ -660,7 +661,7 @@ display(rtems_shell_ls_globals* globals, FTSENT *p, FTSENT *list)
 			d.s_block = 4; /* min buf length for humanize_number */
 		} else {
 			(void)snprintf(buf, sizeof(buf), "%llu",
-			    (long long)howmany(maxblock, blocksize));
+			    (unsigned long long)howmany(maxblock, blocksize));
 			d.s_block = strlen(buf);
 		}
 		d.s_flags = maxflags;
diff --git a/cpukit/libmisc/shell/print-ls.c b/cpukit/libmisc/shell/print-ls.c
index e83ed30..5880e6e 100644
--- a/cpukit/libmisc/shell/print-ls.c
+++ b/cpukit/libmisc/shell/print-ls.c
@@ -124,7 +124,7 @@ printlong(rtems_shell_ls_globals* globals, DISPLAY *dp)
 		} else {
 #endif
 			(void)printf("total %llu\n",
-			    (long long)(howmany(dp->btotal, blocksize)));
+			    (unsigned long long)(howmany(dp->btotal, blocksize)));
 #if RTEMS_REMOVED
 		}
 #endif
@@ -138,7 +138,7 @@ printlong(rtems_shell_ls_globals* globals, DISPLAY *dp)
 			(void)printf("%*lu ", dp->s_inode, sp->st_ino);
 		if (f_size && !f_humanize) {
 			(void)printf("%*llu ", dp->s_block,
-			    (long long)howmany(sp->st_blocks, blocksize));
+			    (unsigned long long)howmany(sp->st_blocks, blocksize));
 		}
 		(void)strmode(sp->st_mode, buf);
 		np = p->fts_pointer;
@@ -254,7 +254,7 @@ printcol(rtems_shell_ls_globals* globals, DISPLAY *dp)
 		} else {
 #endif
 			(void)printf("total %llu\n",
-			    (long long)(howmany(dp->btotal, blocksize)));
+			    (unsigned long long)(howmany(dp->btotal, blocksize)));
 #if RTEMS_REMOVED
 		}
 #endif
@@ -313,7 +313,7 @@ printacol(rtems_shell_ls_globals* globals, DISPLAY *dp)
 		} else {
 #endif
 			(void)printf("total %llu\n",
-			    (long long)(howmany(dp->btotal, blocksize)));
+			    (unsigned long long)(howmany(dp->btotal, blocksize)));
 #if RTEMS_REMOVED
 		}
 #endif
@@ -397,7 +397,7 @@ printaname(rtems_shell_ls_globals* globals,
 		} else {
 #endif
 			chcnt += printf("%*llu ", sizefield,
-			    (long long)howmany(sp->st_blocks, blocksize));
+			    (unsigned long long)howmany(sp->st_blocks, blocksize));
 #if RTEMS_REMOVED
 		}
 #endif
diff --git a/cpukit/libnetworking/Makefile.am b/cpukit/libnetworking/Makefile.am
index 927245b..2a8e06a 100644
--- a/cpukit/libnetworking/Makefile.am
+++ b/cpukit/libnetworking/Makefile.am
@@ -177,7 +177,7 @@ include_sys_HEADERS += sys/proc.h
 include_sys_HEADERS += sys/protosw.h
 include_sys_HEADERS += sys/reboot.h
 include_sys_HEADERS += sys/resourcevar.h
-include_sys_HEADERS += sys/select.h
+include_sys_HEADERS += sys/selinfo.h
 include_sys_HEADERS += sys/signalvar.h
 include_sys_HEADERS += sys/socket.h
 include_sys_HEADERS += sys/socketvar.h
diff --git a/cpukit/libnetworking/libc/res_send.c b/cpukit/libnetworking/libc/res_send.c
index b1dc337..316d3ad 100644
--- a/cpukit/libnetworking/libc/res_send.c
+++ b/cpukit/libnetworking/libc/res_send.c
@@ -79,6 +79,9 @@
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/time.h>
+#ifndef NOSELECT
+#include <sys/select.h>
+#endif
 #include <sys/socket.h>
 #include <sys/uio.h>
 
diff --git a/cpukit/libnetworking/preinstall.am b/cpukit/libnetworking/preinstall.am
index bff9065..477b19a 100644
--- a/cpukit/libnetworking/preinstall.am
+++ b/cpukit/libnetworking/preinstall.am
@@ -367,9 +367,9 @@ $(PROJECT_INCLUDE)/sys/resourcevar.h: sys/resourcevar.h $(PROJECT_INCLUDE)/sys/$
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/resourcevar.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/resourcevar.h
 
-$(PROJECT_INCLUDE)/sys/select.h: sys/select.h $(PROJECT_INCLUDE)/sys/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/select.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/select.h
+$(PROJECT_INCLUDE)/sys/selinfo.h: sys/selinfo.h $(PROJECT_INCLUDE)/sys/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/selinfo.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/selinfo.h
 
 $(PROJECT_INCLUDE)/sys/signalvar.h: sys/signalvar.h $(PROJECT_INCLUDE)/sys/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/signalvar.h
diff --git a/cpukit/libnetworking/rtems/rtems_select.c b/cpukit/libnetworking/rtems/rtems_select.c
index 05c8951..eddb122 100644
--- a/cpukit/libnetworking/rtems/rtems_select.c
+++ b/cpukit/libnetworking/rtems/rtems_select.c
@@ -17,6 +17,7 @@
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/mbuf.h>
+#include <sys/select.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/protosw.h>
diff --git a/cpukit/libnetworking/sys/select.h b/cpukit/libnetworking/sys/select.h
deleted file mode 100644
index 8a84e4c..0000000
--- a/cpukit/libnetworking/sys/select.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *	The Regents of the University of California.  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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	@(#)select.h	8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _SYS_SELECT_H_
-#define	_SYS_SELECT_H_
-
-#include <sys/time.h> /* struct timeval */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Used to maintain information about processes that wish to be
- * notified when I/O becomes possible.
- */
-struct selinfo {
-	pid_t	si_pid;		/* process to be notified */
-	short	si_flags;	/* see below */
-};
-#define	SI_COLL	0x0001		/* collision occurred */
-
-/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
-   readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
-   (if not NULL) for exceptional conditions.  If TIMEOUT is not NULL, time out
-   after waiting the interval specified therein.  Returns the number of ready
-   descriptors, or -1 for errors.  */
-extern int select (int __nfds, fd_set *__restrict __readfds,
-                   fd_set *__restrict __writefds,
-                   fd_set *__restrict __exceptfds,
-                   struct timeval *__restrict __timeout);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_SYS_SELECT_H_ */
diff --git a/cpukit/libnetworking/sys/selinfo.h b/cpukit/libnetworking/sys/selinfo.h
new file mode 100644
index 0000000..785c33f
--- /dev/null
+++ b/cpukit/libnetworking/sys/selinfo.h
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  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.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *	@(#)select.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef _SYS_SELINFO_H_
+#define	_SYS_SELINFO_H_
+
+#include <sys/types.h> /* pid_t */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Used to maintain information about processes that wish to be
+ * notified when I/O becomes possible.
+ */
+struct selinfo {
+	pid_t	si_pid;		/* process to be notified */
+	short	si_flags;	/* see below */
+};
+#define	SI_COLL	0x0001		/* collision occurred */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_SYS_SELINFO_H_ */
+
diff --git a/cpukit/libnetworking/sys/socketvar.h b/cpukit/libnetworking/sys/socketvar.h
index 09bb2a5..13b3674 100644
--- a/cpukit/libnetworking/sys/socketvar.h
+++ b/cpukit/libnetworking/sys/socketvar.h
@@ -34,7 +34,7 @@
 #define _SYS_SOCKETVAR_H_
 
 #include <sys/queue.h>			/* for TAILQ macros */
-#include <sys/select.h>			/* for struct selinfo */
+#include <sys/selinfo.h>		/* for struct selinfo */
 
 
 /*
diff --git a/cpukit/librpc/include/rpc/svc.h b/cpukit/librpc/include/rpc/svc.h
index 0ef3b8c..0808ddd 100644
--- a/cpukit/librpc/include/rpc/svc.h
+++ b/cpukit/librpc/include/rpc/svc.h
@@ -43,6 +43,7 @@
 #include <sys/cdefs.h>
 #include <rpc/types.h>
 #include <rpc/xdr.h> /* xdrproc_t */
+#include <sys/select.h> /* fd_set */
 #include <sys/socket.h> /* socklen_t */
 #include <netinet/in.h> /* struct sockaddr_in */
 #include <rpc/auth.h> /* auth_stat */
diff --git a/cpukit/librpc/src/rpc/clnt_tcp.c b/cpukit/librpc/src/rpc/clnt_tcp.c
index f53edae..c85531d 100644
--- a/cpukit/librpc/src/rpc/clnt_tcp.c
+++ b/cpukit/librpc/src/rpc/clnt_tcp.c
@@ -61,6 +61,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_tcp.c,v 1.14 2000/01/27 23
 #include <unistd.h>
 #include <string.h>
 #include <rpc/rpc.h>
+#include <sys/param.h>
 #include <sys/socket.h>
 #include <netdb.h>
 #include <errno.h>
diff --git a/cpukit/librpc/src/rpc/clnt_udp.c b/cpukit/librpc/src/rpc/clnt_udp.c
index 68e085e..e48508b 100644
--- a/cpukit/librpc/src/rpc/clnt_udp.c
+++ b/cpukit/librpc/src/rpc/clnt_udp.c
@@ -48,6 +48,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_udp.c,v 1.15 2000/01/27 23
 #include <unistd.h>
 #include <string.h>
 #include <rpc/rpc.h>
+#include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <netdb.h>
diff --git a/cpukit/librpc/src/rpc/pmap_rmt.c b/cpukit/librpc/src/rpc/pmap_rmt.c
index 1ab72b2..c7d36b0 100644
--- a/cpukit/librpc/src/rpc/pmap_rmt.c
+++ b/cpukit/librpc/src/rpc/pmap_rmt.c
@@ -46,6 +46,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_rmt.c,v 1.15 2000/01/27 23
 #endif
 
 #include <sys/ioctl.h>
+#include <sys/param.h>
 #include <sys/socket.h>
 
 #include <net/if.h>
diff --git a/cpukit/librpc/src/rpc/rpc_dtablesize.c b/cpukit/librpc/src/rpc/rpc_dtablesize.c
index 65f2953..a102acc 100644
--- a/cpukit/librpc/src/rpc/rpc_dtablesize.c
+++ b/cpukit/librpc/src/rpc/rpc_dtablesize.c
@@ -37,7 +37,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/rpc_dtablesize.c,v 1.10 1999/08
 #include "config.h"
 #endif
 
-#include <sys/types.h>
+#include <sys/select.h>
 #include <unistd.h>
 
 /*
diff --git a/cpukit/librpc/src/rpc/svc.c b/cpukit/librpc/src/rpc/svc.c
index 9cc5cf3..64cc964 100644
--- a/cpukit/librpc/src/rpc/svc.c
+++ b/cpukit/librpc/src/rpc/svc.c
@@ -53,6 +53,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc.c,v 1.14 1999/08/28 00:00:4
 #endif
 #include <stdlib.h>
 #include <sys/errno.h>
+#include <sys/param.h>
 #include <rpc/rpc.h>
 #include <rpc/pmap_clnt.h>
 
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]