changeset 408:dbc601e76824

* include/sys/types.h: Add define/undefine for __NEED_FD_SETS_ONLY around include of sys/select.h to avoid circular dependencies in headers. * include/sys/select.h: Reorganized definitions so that the include from sys/types.h only defines the fd_set type and macros and not the select() and pselect() functions. The latter needs sigset_t from signal.h, which can result in circularity.
author nickg
date Mon, 11 Nov 2002 23:55:20 +0000
parents 74f0dcfdc166
children 10e7722168ad
files packages/isoinfra/current/ChangeLog packages/isoinfra/current/include/sys/select.h packages/isoinfra/current/include/sys/types.h
diffstat 3 files changed, 46 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/packages/isoinfra/current/ChangeLog
+++ b/packages/isoinfra/current/ChangeLog
@@ -1,3 +1,14 @@
+2002-11-10  Nick Garnett  <nickg@ecoscentric.com>
+
+	* include/sys/types.h: Add define/undefine for __NEED_FD_SETS_ONLY
+	around include of sys/select.h to avoid circular dependencies in
+	headers.
+
+	* include/sys/select.h: Reorganized definitions so that the
+	include from sys/types.h only defines the fd_set type and macros
+	and not the select() and pselect() functions. The latter needs
+	sigset_t from signal.h, which can result in circularity.
+
 2002-04-09  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/stdlib.h: use NORET attributes from cyg_type.h.
--- a/packages/isoinfra/current/include/sys/select.h
+++ b/packages/isoinfra/current/include/sys/select.h
@@ -1,5 +1,3 @@
-#ifndef CYGONCE_ISO_SYS_SELECT_H
-#define CYGONCE_ISO_SYS_SELECT_H
 /*========================================================================
 //
 //      sys/select.h
@@ -11,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Nick Garnett
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -60,7 +59,6 @@
 
 #include <pkgconf/isoinfra.h>          /* Configuration header */
 
-
 /* ------------------------------------------------------------------- */
 
 #if !defined(_POSIX_SOURCE)
@@ -70,6 +68,9 @@
 #  include CYGBLD_ISO_SELECT_HEADER
 # else
 
+#   ifndef CYGONCE_ISO_SYS_SELECT_FD_SETS
+#   define CYGONCE_ISO_SYS_SELECT_FD_SETS
+
 #define	NBBY	8		/* number of bits in a byte */
 
 /*
@@ -111,23 +112,45 @@ typedef	struct fd_set {
         (__p)->fds_bits[_i] = 0;                                \
 }
 
-#  ifdef __cplusplus
+#   endif /* CYGONCE_ISO_SYS_SELECT_FD_SETS */
+
+#  ifndef __NEED_FD_SETS_ONLY
+
+#   ifndef CYGONCE_ISO_SYS_SELECT_H
+#   define CYGONCE_ISO_SYS_SELECT_H
+
+#include <signal.h>
+
+#   ifdef __cplusplus
 extern "C" {
-#  endif
+#   endif
 
 struct timeval;
 extern int
 select( int /* nfd */, fd_set * /* in */, fd_set * /* out */,
         fd_set * /* ex */, struct timeval * /* tv */ );
-        
-#  ifdef __cplusplus
+
+#ifdef CYGPKG_POSIX
+struct timespec;
+extern int
+pselect( int /* nfd */, fd_set * /* in */, fd_set * /* out */,
+        fd_set * /* ex */, const struct timespec * /* ts */,
+        const sigset_t * /* mask */);
+#endif
+    
+#   ifdef __cplusplus
 }   /* extern "C" */
-#  endif
+#   endif
+
+#   endif /* CYGONCE_ISO_SYS_SELECT_H multiple inclusion protection */
+
+#  endif /* __NEED_FD_SETS_ONLY */
+
 # endif
 #endif
 
+
 #endif /* if !defined(_POSIX_SOURCE) */
 /* ------------------------------------------------------------------- */
-#endif /* CYGONCE_ISO_SYS_SELECT_H multiple inclusion protection */
 
 /* EOF sys/select.h */
--- a/packages/isoinfra/current/include/sys/types.h
+++ b/packages/isoinfra/current/include/sys/types.h
@@ -11,6 +11,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Nick Garnett
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -101,7 +102,9 @@ typedef int pid_t;
 #endif
 
 /* Include <sys/select.h> for backward compatibility for now */
+#define __NEED_FD_SETS_ONLY
 #include <sys/select.h>
+#undef __NEED_FD_SETS_ONLY
 
 #if !defined(_POSIX_SOURCE)
 # if CYGINT_ISO_BSDTYPES