This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin 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]

[newlib-cygwin] FreeBSD compatibility for <sys/select.h>


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=01885f533de81ff73e9da1519a4b5f2316b49f86

commit 01885f533de81ff73e9da1519a4b5f2316b49f86
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Mon Dec 14 10:06:18 2015 +0100

    FreeBSD compatibility for <sys/select.h>
    
    	* libc/include/sys/_sigset.h: New.
    	* libc/include/sys/select.h: Do not include <sys/types.h> and
    	<sys/time.h> to avoid cyclic header file dependencies.  Include
    	specialized header files instead.
    	(sigset_t): Conditionally define.
    	* libc/include/sys/signal.h (sigset_t): Likewise.
    	* libc/include/sys/time.h: Include <sys/select.h> if
    	__BSD_VISIBLE.
    	* libc/include/sys/types.h: Likewise.

Diff:
---
 newlib/ChangeLog                      | 12 ++++++++++
 newlib/libc/include/sys/_sigset.h     | 43 +++++++++++++++++++++++++++++++++++
 newlib/libc/include/sys/select.h      | 15 ++++++------
 newlib/libc/include/sys/signal.h      |  7 +++---
 newlib/libc/include/sys/time.h        |  6 ++---
 newlib/libc/include/sys/types.h       |  2 ++
 winsup/cygwin/ChangeLog               |  4 ++++
 winsup/cygwin/include/cygwin/signal.h |  8 -------
 8 files changed, 74 insertions(+), 23 deletions(-)

diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 85e8693..681a573 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,15 @@
+2015-12-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
+
+	* libc/include/sys/_sigset.h: New.
+	* libc/include/sys/select.h: Do not include <sys/types.h> and
+	<sys/time.h> to avoid cyclic header file dependencies.  Include
+	specialized header files instead.
+	(sigset_t): Conditionally define.
+	* libc/include/sys/signal.h (sigset_t): Likewise.
+	* libc/include/sys/time.h: Include <sys/select.h> if
+	__BSD_VISIBLE.
+	* libc/include/sys/types.h: Likewise.
+
 2015-12-12  Freddie Chopin  <freddie.chopin@gmail.com>
 
 	* libc/stdlib/__atexit.c (__register_exitproc): Always release
diff --git a/newlib/libc/include/sys/_sigset.h b/newlib/libc/include/sys/_sigset.h
new file mode 100644
index 0000000..a9c0d2d
--- /dev/null
+++ b/newlib/libc/include/sys/_sigset.h
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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.
+ *
+ *	@(#)signal.h	8.4 (Berkeley) 5/4/95
+ * $FreeBSD$
+ */
+
+#ifndef _SYS__SIGSET_H_
+#define	_SYS__SIGSET_H_
+
+typedef unsigned long __sigset_t;
+
+#endif /* !_SYS__SIGSET_H_ */
diff --git a/newlib/libc/include/sys/select.h b/newlib/libc/include/sys/select.h
index ffe8900..de779e6 100644
--- a/newlib/libc/include/sys/select.h
+++ b/newlib/libc/include/sys/select.h
@@ -23,15 +23,14 @@ details. */
 
 #include <sys/cdefs.h>
 
-/* Get fd_set, and macros like FD_SET */
-#include <sys/types.h>
+#include <sys/_sigset.h>
+#include <sys/_timeval.h>
+#include <sys/timespec.h>
 
-/* Get definition of timeval.  */
-#include <sys/time.h>
-#include <time.h>
-
-/* Get definition of sigset_t. */
-#include <signal.h>
+#if !defined(_SIGSET_T_DECLARED)
+#define	_SIGSET_T_DECLARED
+typedef	__sigset_t	sigset_t;
+#endif
 
 #  define _SYS_TYPES_FD_SET
 /*
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index 09f0778..3ff0eb7 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -10,13 +10,14 @@ extern "C" {
 #include <sys/cdefs.h>
 #include <sys/features.h>
 #include <sys/types.h>
+#include <sys/_sigset.h>
 #include <sys/_timespec.h>
 
 /* #ifndef __STRICT_ANSI__*/
 
-/* Cygwin defines it's own sigset_t in include/cygwin/signal.h */
-#ifndef __CYGWIN__
-typedef unsigned long sigset_t;
+#if !defined(_SIGSET_T_DECLARED)
+#define	_SIGSET_T_DECLARED
+typedef	__sigset_t	sigset_t;
 #endif
 
 #if defined(__rtems__)
diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h
index 7e7205b..521be68 100644
--- a/newlib/libc/include/sys/time.h
+++ b/newlib/libc/include/sys/time.h
@@ -43,11 +43,9 @@
 #include <sys/types.h>
 #include <sys/timespec.h>
 
-/* Cygwin exposes sys/select.h to users of sys/time.h for a couple of years
-   so we have to maintain that.  Note that this is in accordance with POSIX. */
-#ifdef __CYGWIN__
+#if __BSD_VISIBLE
 #include <sys/select.h>
-#endif /* __CYGWIN__ */
+#endif
 
 struct timezone {
 	int	tz_minuteswest;	/* minutes west of Greenwich */
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index 5dd6c75..207c8f8 100644
--- a/newlib/libc/include/sys/types.h
+++ b/newlib/libc/include/sys/types.h
@@ -86,6 +86,8 @@ typedef	quad_t *	qaddr_t;
 
 # if	__BSD_VISIBLE
 
+#include <sys/select.h>
+
 #  define	physadr		physadr_t
 #  define	quad		quad_t
 
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7079baa..4eb418d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2015-12-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
+
+	* include/cygwin/signal.h (sigset_t): Move defintition to newlib.
+
 2015-12-11  Ken Brown  <kbrown@cornell.edu>
 
 	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Align
diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h
index 19dd0a6..350a912 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -315,14 +315,6 @@ enum
 #define SIGEV_NONE   SIGEV_NONE
 #define SIGEV_THREAD SIGEV_THREAD
 
-#if __WORDSIZE == 64
-typedef __uint64_t sigset_t;
-#else
-/* FIXME: We should probably raise the # of signals for 32 bit as well.
-          Unfortunately this is an ABI change so requires some forethought. */
-typedef __uint32_t sigset_t;
-#endif
-
 typedef void (*_sig_func_ptr)(int);
 
 struct sigaction


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