public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 8/8] Add de-facto standard <sys/ioctl.h> for RTEMS
  2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
                   ` (2 preceding siblings ...)
  2017-05-24  9:34 ` [PATCH v2 4/8] Move ARM access.c from machine to sys Sebastian Huber
@ 2017-05-24  9:34 ` Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 3/8] Increase MSIZE " Sebastian Huber
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:34 UTC (permalink / raw)
  To: newlib

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/sys/rtems/include/sys/filio.h  |  64 ++++++++++++++
 newlib/libc/sys/rtems/include/sys/ioctl.h  |  51 +++++++++++
 newlib/libc/sys/rtems/include/sys/sockio.h | 137 +++++++++++++++++++++++++++++
 3 files changed, 252 insertions(+)
 create mode 100644 newlib/libc/sys/rtems/include/sys/filio.h
 create mode 100644 newlib/libc/sys/rtems/include/sys/ioctl.h
 create mode 100644 newlib/libc/sys/rtems/include/sys/sockio.h

diff --git a/newlib/libc/sys/rtems/include/sys/filio.h b/newlib/libc/sys/rtems/include/sys/filio.h
new file mode 100644
index 000000000..471235a88
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/sys/filio.h
@@ -0,0 +1,64 @@
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	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.
+ * 3. 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.
+ *
+ *	@(#)filio.h	8.1 (Berkeley) 3/28/94
+ * $FreeBSD: head/sys/sys/filio.h 314436 2017-02-28 23:42:47Z imp $
+ */
+
+#ifndef	_SYS_FILIO_H_
+#define	_SYS_FILIO_H_
+
+#include <sys/ioccom.h>
+
+/* Generic file-descriptor ioctl's. */
+#define	FIOCLEX		 _IO('f', 1)		/* set close on exec on fd */
+#define	FIONCLEX	 _IO('f', 2)		/* remove close on exec */
+#define	FIONREAD	_IOR('f', 127, int)	/* get # bytes to read */
+#define	FIONBIO		_IOW('f', 126, int)	/* set/clear non-blocking i/o */
+#define	FIOASYNC	_IOW('f', 125, int)	/* set/clear async i/o */
+#define	FIOSETOWN	_IOW('f', 124, int)	/* set owner */
+#define	FIOGETOWN	_IOR('f', 123, int)	/* get owner */
+#define	FIODTYPE	_IOR('f', 122, int)	/* get d_flags type part */
+#define	FIOGETLBA	_IOR('f', 121, int)	/* get start blk # */
+struct fiodgname_arg {
+	int	len;
+	void	*buf;
+};
+#define	FIODGNAME	_IOW('f', 120, struct fiodgname_arg) /* get dev. name */
+#define	FIONWRITE	_IOR('f', 119, int)	/* get # bytes (yet) to write */
+#define	FIONSPACE	_IOR('f', 118, int)	/* get space in send queue */
+/* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
+#define	FIOSEEKDATA	_IOWR('f', 97, off_t)	/* SEEK_DATA */
+#define	FIOSEEKHOLE	_IOWR('f', 98, off_t)	/* SEEK_HOLE */
+
+#endif /* !_SYS_FILIO_H_ */
diff --git a/newlib/libc/sys/rtems/include/sys/ioctl.h b/newlib/libc/sys/rtems/include/sys/ioctl.h
new file mode 100644
index 000000000..5eeeb049a
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/sys/ioctl.h
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	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.
+ * 3. 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.
+ *
+ *	@(#)ioctl.h	8.6 (Berkeley) 3/28/94
+ * $FreeBSD: head/sys/sys/ioctl.h 314436 2017-02-28 23:42:47Z imp $
+ */
+
+#ifndef	_SYS_IOCTL_H_
+#define	_SYS_IOCTL_H_
+
+#ifdef _KERNEL
+#error "Don't #include ioctl.h in the kernel.  Include xxxio.h instead."
+#endif /* _KERNEL */
+
+#include <sys/ioccom.h>
+
+#include <sys/filio.h>
+#include <sys/sockio.h>
+#include <sys/ttycom.h>
+
+#endif /* !_SYS_IOCTL_H_ */
diff --git a/newlib/libc/sys/rtems/include/sys/sockio.h b/newlib/libc/sys/rtems/include/sys/sockio.h
new file mode 100644
index 000000000..0fb01eebd
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/sys/sockio.h
@@ -0,0 +1,137 @@
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ *	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. 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.
+ *
+ *	@(#)sockio.h	8.1 (Berkeley) 3/28/94
+ * $FreeBSD: head/sys/sys/sockio.h 318160 2017-05-10 22:13:47Z rpokala $
+ */
+
+#ifndef _SYS_SOCKIO_H_
+#define	_SYS_SOCKIO_H_
+
+#include <sys/ioccom.h>
+
+/* Socket ioctl's. */
+#define	SIOCSHIWAT	 _IOW('s',  0, int)		/* set high watermark */
+#define	SIOCGHIWAT	 _IOR('s',  1, int)		/* get high watermark */
+#define	SIOCSLOWAT	 _IOW('s',  2, int)		/* set low watermark */
+#define	SIOCGLOWAT	 _IOR('s',  3, int)		/* get low watermark */
+#define	SIOCATMARK	 _IOR('s',  7, int)		/* at oob mark? */
+#define	SIOCSPGRP	 _IOW('s',  8, int)		/* set process group */
+#define	SIOCGPGRP	 _IOR('s',  9, int)		/* get process group */
+
+/*	SIOCADDRT	 _IOW('r', 10, struct ortentry)	4.3BSD */
+/*	SIOCDELRT	 _IOW('r', 11, struct ortentry)	4.3BSD */
+#define	SIOCGETVIFCNT	_IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
+#define	SIOCGETSGCNT	_IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
+
+#define	SIOCSIFADDR	 _IOW('i', 12, struct ifreq)	/* set ifnet address */
+/*	OSIOCGIFADDR	_IOWR('i', 13, struct ifreq)	4.3BSD */
+#define	SIOCGIFADDR	_IOWR('i', 33, struct ifreq)	/* get ifnet address */
+#define	SIOCSIFDSTADDR	 _IOW('i', 14, struct ifreq)	/* set p-p address */
+/*	OSIOCGIFDSTADDR	_IOWR('i', 15, struct ifreq)	4.3BSD */
+#define	SIOCGIFDSTADDR	_IOWR('i', 34, struct ifreq)	/* get p-p address */
+#define	SIOCSIFFLAGS	 _IOW('i', 16, struct ifreq)	/* set ifnet flags */
+#define	SIOCGIFFLAGS	_IOWR('i', 17, struct ifreq)	/* get ifnet flags */
+/*	OSIOCGIFBRDADDR	_IOWR('i', 18, struct ifreq)	4.3BSD */
+#define	SIOCGIFBRDADDR	_IOWR('i', 35, struct ifreq)	/* get broadcast addr */
+#define	SIOCSIFBRDADDR	 _IOW('i', 19, struct ifreq)	/* set broadcast addr */
+/*	OSIOCGIFCONF	_IOWR('i', 20, struct ifconf)	4.3BSD */
+#define	SIOCGIFCONF	_IOWR('i', 36, struct ifconf)	/* get ifnet list */
+/*	OSIOCGIFNETMASK	_IOWR('i', 21, struct ifreq)	4.3BSD */
+#define	SIOCGIFNETMASK	_IOWR('i', 37, struct ifreq)	/* get net addr mask */
+#define	SIOCSIFNETMASK	 _IOW('i', 22, struct ifreq)	/* set net addr mask */
+#define	SIOCGIFMETRIC	_IOWR('i', 23, struct ifreq)	/* get IF metric */
+#define	SIOCSIFMETRIC	 _IOW('i', 24, struct ifreq)	/* set IF metric */
+#define	SIOCDIFADDR	 _IOW('i', 25, struct ifreq)	/* delete IF addr */
+#define	OSIOCAIFADDR	 _IOW('i', 26, struct oifaliasreq) /* FreeBSD 9.x */
+/*	SIOCALIFADDR	 _IOW('i', 27, struct if_laddrreq) KAME */
+/*	SIOCGLIFADDR	_IOWR('i', 28, struct if_laddrreq) KAME */
+/*	SIOCDLIFADDR	 _IOW('i', 29, struct if_laddrreq) KAME */
+#define	SIOCSIFCAP	 _IOW('i', 30, struct ifreq)	/* set IF features */
+#define	SIOCGIFCAP	_IOWR('i', 31, struct ifreq)	/* get IF features */
+#define	SIOCGIFINDEX	_IOWR('i', 32, struct ifreq)	/* get IF index */
+#define	SIOCGIFMAC	_IOWR('i', 38, struct ifreq)	/* get IF MAC label */
+#define	SIOCSIFMAC	 _IOW('i', 39, struct ifreq)	/* set IF MAC label */
+#define	SIOCSIFNAME	 _IOW('i', 40, struct ifreq)	/* set IF name */
+#define	SIOCSIFDESCR	 _IOW('i', 41, struct ifreq)	/* set ifnet descr */ 
+#define	SIOCGIFDESCR	_IOWR('i', 42, struct ifreq)	/* get ifnet descr */ 
+#define	SIOCAIFADDR	 _IOW('i', 43, struct ifaliasreq)/* add/chg IF alias */
+
+#define	SIOCADDMULTI	 _IOW('i', 49, struct ifreq)	/* add m'cast addr */
+#define	SIOCDELMULTI	 _IOW('i', 50, struct ifreq)	/* del m'cast addr */
+#define	SIOCGIFMTU	_IOWR('i', 51, struct ifreq)	/* get IF mtu */
+#define	SIOCSIFMTU	 _IOW('i', 52, struct ifreq)	/* set IF mtu */
+#define	SIOCGIFPHYS	_IOWR('i', 53, struct ifreq)	/* get IF wire */
+#define	SIOCSIFPHYS	 _IOW('i', 54, struct ifreq)	/* set IF wire */
+#define	SIOCSIFMEDIA	_IOWR('i', 55, struct ifreq)	/* set net media */
+#define	SIOCGIFMEDIA	_IOWR('i', 56, struct ifmediareq) /* get net media */
+
+#define	SIOCSIFGENERIC	 _IOW('i', 57, struct ifreq)	/* generic IF set op */
+#define	SIOCGIFGENERIC	_IOWR('i', 58, struct ifreq)	/* generic IF get op */
+
+#define	SIOCGIFSTATUS	_IOWR('i', 59, struct ifstat)	/* get IF status */
+#define	SIOCSIFLLADDR	 _IOW('i', 60, struct ifreq)	/* set linklevel addr */
+#define	SIOCGI2C	_IOWR('i', 61, struct ifreq)	/* get I2C data  */
+#define	SIOCGHWADDR	_IOWR('i', 62, struct ifreq)	/* get hardware lladdr */
+
+#define	SIOCSIFPHYADDR	 _IOW('i', 70, struct ifaliasreq) /* set gif address */
+#define	SIOCGIFPSRCADDR	_IOWR('i', 71, struct ifreq)	/* get gif psrc addr */
+#define	SIOCGIFPDSTADDR	_IOWR('i', 72, struct ifreq)	/* get gif pdst addr */
+#define	SIOCDIFPHYADDR	 _IOW('i', 73, struct ifreq)	/* delete gif addrs */
+/*	SIOCSLIFPHYADDR	 _IOW('i', 74, struct if_laddrreq) KAME */
+/*	SIOCGLIFPHYADDR	_IOWR('i', 75, struct if_laddrreq) KAME */
+
+#define	SIOCGPRIVATE_0	_IOWR('i', 80, struct ifreq)	/* device private 0 */
+#define	SIOCGPRIVATE_1	_IOWR('i', 81, struct ifreq)	/* device private 1 */
+
+#define	SIOCSIFVNET	_IOWR('i', 90, struct ifreq)	/* move IF jail/vnet */
+#define	SIOCSIFRVNET	_IOWR('i', 91, struct ifreq)	/* reclaim vnet IF */
+
+#define	SIOCGIFFIB	_IOWR('i', 92, struct ifreq)	/* get IF fib */
+#define	SIOCSIFFIB	 _IOW('i', 93, struct ifreq)	/* set IF fib */
+
+#define	SIOCGTUNFIB	_IOWR('i', 94, struct ifreq)	/* get tunnel fib */
+#define	SIOCSTUNFIB	 _IOW('i', 95, struct ifreq)	/* set tunnel fib */
+
+#define	SIOCSDRVSPEC	_IOW('i', 123, struct ifdrv)	/* set driver-specific
+								  parameters */
+#define	SIOCGDRVSPEC	_IOWR('i', 123, struct ifdrv)	/* get driver-specific
+								  parameters */
+
+#define	SIOCIFCREATE	_IOWR('i', 122, struct ifreq)	/* create clone if */
+#define	SIOCIFCREATE2	_IOWR('i', 124, struct ifreq)	/* create clone if */
+#define	SIOCIFDESTROY	 _IOW('i', 121, struct ifreq)	/* destroy clone if */
+#define	SIOCIFGCLONERS	_IOWR('i', 120, struct if_clonereq) /* get cloners */
+
+#define	SIOCAIFGROUP	 _IOW('i', 135, struct ifgroupreq) /* add an ifgroup */
+#define	SIOCGIFGROUP	_IOWR('i', 136, struct ifgroupreq) /* get ifgroups */
+#define	SIOCDIFGROUP	 _IOW('i', 137, struct ifgroupreq) /* delete ifgroup */
+#define	SIOCGIFGMEMB	_IOWR('i', 138, struct ifgroupreq) /* get members */
+#define	SIOCGIFXMEDIA	_IOWR('i', 139, struct ifmediareq) /* get net xmedia */
+
+#endif /* !_SYS_SOCKIO_H_ */
-- 
2.12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS
@ 2017-05-24  9:34 Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 6/8] FreeBSD compatibility for RTEMS <sys/cpuset.h> Sebastian Huber
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:34 UTC (permalink / raw)
  To: newlib

It uses __BIGGEST_ALIGNMENT__ which is available in recent GCC and
LLVM/clang.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/sys/rtems/include/machine/_align.h | 38 ++++++++++++++++++++++++++
 newlib/libc/sys/rtems/include/machine/param.h  | 15 +++-------
 2 files changed, 42 insertions(+), 11 deletions(-)
 create mode 100644 newlib/libc/sys/rtems/include/machine/_align.h

diff --git a/newlib/libc/sys/rtems/include/machine/_align.h b/newlib/libc/sys/rtems/include/machine/_align.h
new file mode 100644
index 000000000..f141c7820
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/machine/_align.h
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2017 embedded brains GmbH
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#ifndef _MACHINE__ALIGN_H_
+#define	_MACHINE__ALIGN_H_
+
+#ifdef __BIGGEST_ALIGNMENT__
+#define	_ALIGNBYTES (__BIGGEST_ALIGNMENT__ - 1UL)
+#else
+#define	_ALIGNBYTES (sizeof(long long) - 1UL)
+#endif
+
+#define	_ALIGN(_p) (((unsigned long)(_p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+
+#endif /* !_MACHINE__ALIGN_H_ */
diff --git a/newlib/libc/sys/rtems/include/machine/param.h b/newlib/libc/sys/rtems/include/machine/param.h
index 74891f504..622194bbb 100644
--- a/newlib/libc/sys/rtems/include/machine/param.h
+++ b/newlib/libc/sys/rtems/include/machine/param.h
@@ -14,17 +14,10 @@
 #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 unsigned int
- * and must be cast to any desired pointer type.
- */
-#if defined(__sparc__)
-#define ALIGNBYTES	(sizeof(double) - 1)
-#else
-#define ALIGNBYTES	(sizeof(int) - 1)
-#endif
-#define ALIGN(p)	(((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+#include <machine/_align.h>
+
+#define	ALIGNBYTES	_ALIGNBYTES
+#define	ALIGN(p)	_ALIGN(p)
 
 #define PAGE_SHIFT	12		/* LOG2(PAGE_SIZE) */
 #define PAGE_SIZE	(1<<PAGE_SHIFT)	/* bytes/page */
-- 
2.12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 4/8] Move ARM access.c from machine to sys
  2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 6/8] FreeBSD compatibility for RTEMS <sys/cpuset.h> Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 2/8] FreeBSD compatibility for RTEMS <sys/param.h> Sebastian Huber
@ 2017-05-24  9:34 ` Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 8/8] Add de-facto standard <sys/ioctl.h> for RTEMS Sebastian Huber
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:34 UTC (permalink / raw)
  To: newlib

The implementation of the POSIX access() function is nothing machine
specific like memcpy(), etc.  Move it back to the system domain.  This
avoids problems due to the include search order of the Newlib/GCC build
which picks up machine includes before system includes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/machine/arm/Makefile.am       |  2 +-
 newlib/libc/machine/arm/Makefile.in       | 13 +++----------
 newlib/libc/sys/arm/Makefile.am           |  2 +-
 newlib/libc/sys/arm/Makefile.in           | 10 ++++++++--
 newlib/libc/{machine => sys}/arm/access.c |  0
 5 files changed, 13 insertions(+), 14 deletions(-)
 rename newlib/libc/{machine => sys}/arm/access.c (100%)

diff --git a/newlib/libc/machine/arm/Makefile.am b/newlib/libc/machine/arm/Makefile.am
index 6b6705027..9bd35e733 100644
--- a/newlib/libc/machine/arm/Makefile.am
+++ b/newlib/libc/machine/arm/Makefile.am
@@ -8,7 +8,7 @@ AM_CCASFLAGS = $(INCLUDES)
 
 noinst_LIBRARIES = lib.a
 
-lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c \
+lib_a_SOURCES = setjmp.S strcmp.S strcpy.c \
 		aeabi_memcpy.c aeabi_memcpy-armv7a.S \
 		aeabi_memmove.c aeabi_memmove-soft.S \
 		aeabi_memset.c aeabi_memset-soft.S aeabi_memclr.c
diff --git a/newlib/libc/machine/arm/Makefile.in b/newlib/libc/machine/arm/Makefile.in
index a0e4cc2bd..d9dbcd5c3 100644
--- a/newlib/libc/machine/arm/Makefile.in
+++ b/newlib/libc/machine/arm/Makefile.in
@@ -69,9 +69,8 @@ LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
 lib_a_AR = $(AR) $(ARFLAGS)
 lib_a_LIBADD =
-am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT) \
-	lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) \
-	lib_a-aeabi_memcpy.$(OBJEXT) \
+am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-strcmp.$(OBJEXT) \
+	lib_a-strcpy.$(OBJEXT) lib_a-aeabi_memcpy.$(OBJEXT) \
 	lib_a-aeabi_memcpy-armv7a.$(OBJEXT) \
 	lib_a-aeabi_memmove.$(OBJEXT) \
 	lib_a-aeabi_memmove-soft.$(OBJEXT) \
@@ -206,7 +205,7 @@ AUTOMAKE_OPTIONS = cygnus
 INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
 AM_CCASFLAGS = $(INCLUDES)
 noinst_LIBRARIES = lib.a
-lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c aeabi_memcpy.c \
+lib_a_SOURCES = setjmp.S strcmp.S strcpy.c aeabi_memcpy.c \
 	aeabi_memcpy-armv7a.S aeabi_memmove.c aeabi_memmove-soft.S \
 	aeabi_memset.c aeabi_memset-soft.S aeabi_memclr.c \
 	memchr-stub.c memchr.S memcpy-stub.c memcpy.S strlen-stub.c \
@@ -338,12 +337,6 @@ lib_a-strlen.obj: strlen.S
 .c.obj:
 	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
-lib_a-access.o: access.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-access.o `test -f 'access.c' || echo '$(srcdir)/'`access.c
-
-lib_a-access.obj: access.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-access.obj `if test -f 'access.c'; then $(CYGPATH_W) 'access.c'; else $(CYGPATH_W) '$(srcdir)/access.c'; fi`
-
 lib_a-strcpy.o: strcpy.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy.o `test -f 'strcpy.c' || echo '$(srcdir)/'`strcpy.c
 
diff --git a/newlib/libc/sys/arm/Makefile.am b/newlib/libc/sys/arm/Makefile.am
index 3d8aa9d8b..711872de3 100644
--- a/newlib/libc/sys/arm/Makefile.am
+++ b/newlib/libc/sys/arm/Makefile.am
@@ -14,7 +14,7 @@ else
 extra_objs =
 endif
 
-lib_a_SOURCES = aeabi_atexit.c
+lib_a_SOURCES = access.c aeabi_atexit.c
 lib_a_LIBADD = $(extra_objs)
 EXTRA_lib_a_SOURCES = trap.S syscalls.c libcfunc.c
 lib_a_DEPENDENCIES = $(extra_objs)
diff --git a/newlib/libc/sys/arm/Makefile.in b/newlib/libc/sys/arm/Makefile.in
index ba0f92b3a..c01e4e2ed 100644
--- a/newlib/libc/sys/arm/Makefile.in
+++ b/newlib/libc/sys/arm/Makefile.in
@@ -70,7 +70,7 @@ ARFLAGS = cru
 lib_a_AR = $(AR) $(ARFLAGS)
 @MAY_SUPPLY_SYSCALLS_TRUE@am__DEPENDENCIES_1 = $(lpfx)libcfunc.o \
 @MAY_SUPPLY_SYSCALLS_TRUE@	$(lpfx)trap.o $(lpfx)syscalls.o
-am_lib_a_OBJECTS = lib_a-aeabi_atexit.$(OBJEXT)
+am_lib_a_OBJECTS = lib_a-access.$(OBJEXT) lib_a-aeabi_atexit.$(OBJEXT)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp =
@@ -198,7 +198,7 @@ AM_CCASFLAGS = $(INCLUDES)
 noinst_LIBRARIES = lib.a
 @MAY_SUPPLY_SYSCALLS_FALSE@extra_objs = 
 @MAY_SUPPLY_SYSCALLS_TRUE@extra_objs = $(lpfx)libcfunc.o $(lpfx)trap.o $(lpfx)syscalls.o
-lib_a_SOURCES = aeabi_atexit.c
+lib_a_SOURCES = access.c aeabi_atexit.c
 lib_a_LIBADD = $(extra_objs)
 EXTRA_lib_a_SOURCES = trap.S syscalls.c libcfunc.c
 lib_a_DEPENDENCIES = $(extra_objs)
@@ -276,6 +276,12 @@ lib_a-trap.obj: trap.S
 .c.obj:
 	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
+lib_a-access.o: access.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-access.o `test -f 'access.c' || echo '$(srcdir)/'`access.c
+
+lib_a-access.obj: access.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-access.obj `if test -f 'access.c'; then $(CYGPATH_W) 'access.c'; else $(CYGPATH_W) '$(srcdir)/access.c'; fi`
+
 lib_a-aeabi_atexit.o: aeabi_atexit.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_atexit.o `test -f 'aeabi_atexit.c' || echo '$(srcdir)/'`aeabi_atexit.c
 
diff --git a/newlib/libc/machine/arm/access.c b/newlib/libc/sys/arm/access.c
similarity index 100%
rename from newlib/libc/machine/arm/access.c
rename to newlib/libc/sys/arm/access.c
-- 
2.12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 5/8] Add __bitcount*() to RTEMS <machine/types.h>
  2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
                   ` (4 preceding siblings ...)
  2017-05-24  9:34 ` [PATCH v2 3/8] Increase MSIZE " Sebastian Huber
@ 2017-05-24  9:34 ` Sebastian Huber
  2017-05-24  9:35 ` [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
  6 siblings, 0 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:34 UTC (permalink / raw)
  To: newlib

Use a dedicated header file <machine/_bitcount.h> to avoid cyclic header
dependencies in future changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/sys/rtems/include/machine/_bitcount.h | 90 +++++++++++++++++++++++
 newlib/libc/sys/rtems/include/machine/types.h     |  2 +
 2 files changed, 92 insertions(+)
 create mode 100644 newlib/libc/sys/rtems/include/machine/_bitcount.h

diff --git a/newlib/libc/sys/rtems/include/machine/_bitcount.h b/newlib/libc/sys/rtems/include/machine/_bitcount.h
new file mode 100644
index 000000000..ec324d274
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/machine/_bitcount.h
@@ -0,0 +1,90 @@
+/*-
+ * Copyright (c) 2015 John Baldwin <jhb@FreeBSD.org>.
+ * 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. Neither the name of the author 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.
+ */
+
+#ifndef _MACHINE__BITCOUNT_H
+#define	_MACHINE__BITCOUNT_H
+
+#ifdef __POPCNT__
+#define	__bitcount64(x)	__builtin_popcountll((__uint64_t)(x))
+#define	__bitcount32(x)	__builtin_popcountl((__uint32_t)(x))
+#define	__bitcount16(x)	__builtin_popcount((__uint16_t)(x))
+#define	__bitcountl(x)	__builtin_popcountl((unsigned long)(x))
+#define	__bitcount(x)	__builtin_popcount((unsigned int)(x))
+#else /* !__POPCNT__ */
+static __inline __uint16_t
+__bitcount16(__uint16_t _x)
+{
+	_x = (_x & 0x5555u) + ((_x & 0xaaaau) >> 1);
+	_x = (_x & 0x3333u) + ((_x & 0xccccu) >> 2);
+	_x = (_x + (_x >> 4)) & 0x0f0fu;
+	_x = (_x + (_x >> 8)) & 0x00ffu;
+	return (_x);
+}
+
+static __inline __uint32_t
+__bitcount32(__uint32_t _x)
+{
+	_x = (_x & 0x55555555u) + ((_x & 0xaaaaaaaau) >> 1);
+	_x = (_x & 0x33333333u) + ((_x & 0xccccccccu) >> 2);
+	_x = (_x + (_x >> 4)) & 0x0f0f0f0fu;
+	_x = (_x + (_x >> 8));
+	_x = (_x + (_x >> 16)) & 0x000000ffu;
+	return (_x);
+}
+
+static __inline __uint64_t
+__bitcount64(__uint64_t _x)
+{
+#if __SIZEOF_LONG__ == 8
+	_x = (_x & 0x5555555555555555u) + ((_x & 0xaaaaaaaaaaaaaaaau) >> 1);
+	_x = (_x & 0x3333333333333333u) + ((_x & 0xccccccccccccccccu) >> 2);
+	_x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0fu;
+	_x = (_x + (_x >> 8));
+	_x = (_x + (_x >> 16));
+	_x = (_x + (_x >> 32)) & 0x000000ffu;
+	return (_x);
+#else
+	return (__bitcount32(_x >> 32) + __bitcount32(_x));
+#endif
+}
+
+#if __SIZEOF_LONG__ == 8
+#define	__bitcountl(x)	__bitcount64((unsigned long)(x))
+#else
+#define	__bitcountl(x)	__bitcount32((unsigned long)(x))
+#endif
+
+#if __SIZEOF_INT__ == 8
+#define	__bitcount(x)	__bitcount64((unsigned int)(x))
+#else
+#define	__bitcount(x)	__bitcount32((unsigned int)(x))
+#endif
+#endif /* __POPCNT__ */
+
+#endif /* _MACHINE__BITCOUNT_H */
diff --git a/newlib/libc/sys/rtems/include/machine/types.h b/newlib/libc/sys/rtems/include/machine/types.h
index b28f92310..11ca37f26 100644
--- a/newlib/libc/sys/rtems/include/machine/types.h
+++ b/newlib/libc/sys/rtems/include/machine/types.h
@@ -28,6 +28,8 @@
 #error "must be included via <sys/types.h>"
 #endif /* !_SYS_TYPES_H */
 
+#include <machine/_bitcount.h>
+
 #if __BSD_VISIBLE
 
 #ifndef _ACCMODE_T_DECLARED
-- 
2.12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 6/8] FreeBSD compatibility for RTEMS <sys/cpuset.h>
  2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
@ 2017-05-24  9:34 ` Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 2/8] FreeBSD compatibility for RTEMS <sys/param.h> Sebastian Huber
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:34 UTC (permalink / raw)
  To: newlib

Make the RTEMS <sys/cpuset.h> compatible with the latest FreeBSD
version.

Fix the CPU_COPY() parameter order, see also:

https://devel.rtems.org/ticket/3023

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/sys/rtems/include/sys/_bitset.h |  58 +++++++
 newlib/libc/sys/rtems/include/sys/_cpuset.h |  47 ++++++
 newlib/libc/sys/rtems/include/sys/bitset.h  | 241 ++++++++++++++++++++++++++++
 newlib/libc/sys/rtems/include/sys/cpuset.h  | 194 +++++++---------------
 4 files changed, 402 insertions(+), 138 deletions(-)
 create mode 100644 newlib/libc/sys/rtems/include/sys/_bitset.h
 create mode 100644 newlib/libc/sys/rtems/include/sys/_cpuset.h
 create mode 100644 newlib/libc/sys/rtems/include/sys/bitset.h

diff --git a/newlib/libc/sys/rtems/include/sys/_bitset.h b/newlib/libc/sys/rtems/include/sys/_bitset.h
new file mode 100644
index 000000000..8d8a4c220
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/sys/_bitset.h
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c) 2008, Jeffrey Roberson <jeff@freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * 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 unmodified, 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * $FreeBSD: head/sys/sys/_bitset.h 299184 2016-05-06 16:41:23Z royger $
+ */
+
+#ifndef _SYS__BITSET_H_
+#define	_SYS__BITSET_H_
+
+/*
+ * Macros addressing word and bit within it, tuned to make compiler
+ * optimize cases when SETSIZE fits into single machine word.
+ */
+#define	_BITSET_BITS		(sizeof(long) * 8)
+
+#define	__howmany(x, y)	(((x) + ((y) - 1)) / (y))
+
+#define	__bitset_words(_s)	(__howmany(_s, _BITSET_BITS))
+
+#define	BITSET_DEFINE(t, _s)						\
+struct t {								\
+        long    __bits[__bitset_words((_s))];				\
+}
+
+/*
+ * Helper to declare a bitset without it's size being a constant.
+ *
+ * Sadly we cannot declare a bitset struct with '__bits[]', because it's
+ * the only member of the struct and the compiler complains.
+ */
+#define BITSET_DEFINE_VAR(t)	BITSET_DEFINE(t, 1)
+
+#endif /* !_SYS__BITSET_H_ */
diff --git a/newlib/libc/sys/rtems/include/sys/_cpuset.h b/newlib/libc/sys/rtems/include/sys/_cpuset.h
new file mode 100644
index 000000000..dc4e61f9b
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/sys/_cpuset.h
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 2008,	Jeffrey Roberson <jeff@freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * 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 unmodified, 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * $FreeBSD: head/sys/sys/_cpuset.h 299122 2016-05-05 15:43:26Z jhb $
+ */
+
+#ifndef _SYS__CPUSET_H_
+#define	_SYS__CPUSET_H_
+
+#include <sys/_bitset.h>
+#include <machine/param.h>
+
+#define	CPU_MAXSIZE	256
+
+#ifndef	CPU_SETSIZE
+#define	CPU_SETSIZE	MAXCPU
+#endif
+
+BITSET_DEFINE(_cpuset, CPU_SETSIZE);
+typedef struct _cpuset cpuset_t;
+
+#endif /* !_SYS__CPUSET_H_ */
diff --git a/newlib/libc/sys/rtems/include/sys/bitset.h b/newlib/libc/sys/rtems/include/sys/bitset.h
new file mode 100644
index 000000000..ac01b8005
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/sys/bitset.h
@@ -0,0 +1,241 @@
+/*-
+ * Copyright (c) 2008, Jeffrey Roberson <jeff@freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * 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 unmodified, 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * $FreeBSD: head/sys/sys/bitset.h 299184 2016-05-06 16:41:23Z royger $
+ */
+
+#ifndef _SYS_BITSET_H_
+#define	_SYS_BITSET_H_
+
+#include <sys/_types.h>
+#include <machine/_bitcount.h>
+
+#define	__bitset_mask(_s, n)						\
+	(1L << ((__bitset_words((_s)) == 1) ?				\
+	    (__size_t)(n) : ((n) % _BITSET_BITS)))
+
+#define	__bitset_word(_s, n)						\
+	((__bitset_words((_s)) == 1) ? 0 : ((n) / _BITSET_BITS))
+
+#define	BIT_CLR(_s, n, p)						\
+	((p)->__bits[__bitset_word(_s, n)] &= ~__bitset_mask((_s), (n)))
+
+#define	BIT_COPY(_s, f, t)	(void)(*(t) = *(f))
+
+#define	BIT_ISSET(_s, n, p)						\
+	((((p)->__bits[__bitset_word(_s, n)] & __bitset_mask((_s), (n))) != 0))
+
+#define	BIT_SET(_s, n, p)						\
+	((p)->__bits[__bitset_word(_s, n)] |= __bitset_mask((_s), (n)))
+
+#define	BIT_ZERO(_s, p) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(p)->__bits[__i] = 0L;					\
+} while (0)
+
+#define	BIT_FILL(_s, p) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(p)->__bits[__i] = -1L;					\
+} while (0)
+
+#define	BIT_SETOF(_s, n, p) do {					\
+	BIT_ZERO(_s, p);						\
+	(p)->__bits[__bitset_word(_s, n)] = __bitset_mask((_s), (n));	\
+} while (0)
+
+/* Is p empty. */
+#define	BIT_EMPTY(_s, p) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if ((p)->__bits[__i])					\
+			break;						\
+	__i == __bitset_words((_s));					\
+})
+
+/* Is p full set. */
+#define	BIT_ISFULLSET(_s, p) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if ((p)->__bits[__i] != (long)-1)			\
+			break;						\
+	__i == __bitset_words((_s));					\
+})
+
+/* Is c a subset of p. */
+#define	BIT_SUBSET(_s, p, c) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if (((c)->__bits[__i] &					\
+		    (p)->__bits[__i]) !=				\
+		    (c)->__bits[__i])					\
+			break;						\
+	__i == __bitset_words((_s));					\
+})
+
+/* Are there any common bits between b & c? */
+#define	BIT_OVERLAP(_s, p, c) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if (((c)->__bits[__i] &					\
+		    (p)->__bits[__i]) != 0)				\
+			break;						\
+	__i != __bitset_words((_s));					\
+})
+
+/* Compare two sets, returns 0 if equal 1 otherwise. */
+#define	BIT_CMP(_s, p, c) __extension__ ({				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		if (((c)->__bits[__i] !=				\
+		    (p)->__bits[__i]))					\
+			break;						\
+	__i != __bitset_words((_s));					\
+})
+
+#define	BIT_OR(_s, d, s) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] |= (s)->__bits[__i];			\
+} while (0)
+
+#define	BIT_OR2(_s, d, s1, s2) do {					\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] = (s1)->__bits[__i] | (s2)->__bits[__i];\
+} while (0)
+
+#define	BIT_AND(_s, d, s) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] &= (s)->__bits[__i];			\
+} while (0)
+
+#define	BIT_AND2(_s, d, s1, s2) do {					\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] = (s1)->__bits[__i] & (s2)->__bits[__i];\
+} while (0)
+
+#define	BIT_NAND(_s, d, s) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] &= ~(s)->__bits[__i];			\
+} while (0)
+
+#define	BIT_NAND2(_s, d, s1, s2) do {					\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] = (s1)->__bits[__i] & ~(s2)->__bits[__i];\
+} while (0)
+
+#define	BIT_XOR(_s, d, s) do {						\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] ^= (s)->__bits[__i];			\
+} while (0)
+
+#define	BIT_XOR2(_s, d, s1, s2) do {					\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		(d)->__bits[__i] = (s1)->__bits[__i] ^ (s2)->__bits[__i];\
+} while (0)
+
+#define	BIT_CLR_ATOMIC(_s, n, p)					\
+	atomic_clear_long(&(p)->__bits[__bitset_word(_s, n)],		\
+	    __bitset_mask((_s), n))
+
+#define	BIT_SET_ATOMIC(_s, n, p)					\
+	atomic_set_long(&(p)->__bits[__bitset_word(_s, n)],		\
+	    __bitset_mask((_s), n))
+
+#define	BIT_SET_ATOMIC_ACQ(_s, n, p)					\
+	atomic_set_acq_long(&(p)->__bits[__bitset_word(_s, n)],		\
+	    __bitset_mask((_s), n))
+
+/* Convenience functions catering special cases. */
+#define	BIT_AND_ATOMIC(_s, d, s) do {					\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		atomic_clear_long(&(d)->__bits[__i],			\
+		    ~(s)->__bits[__i]);					\
+} while (0)
+
+#define	BIT_OR_ATOMIC(_s, d, s) do {					\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		atomic_set_long(&(d)->__bits[__i],			\
+		    (s)->__bits[__i]);					\
+} while (0)
+
+#define	BIT_COPY_STORE_REL(_s, f, t) do {				\
+	__size_t __i;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		atomic_store_rel_long(&(t)->__bits[__i],		\
+		    (f)->__bits[__i]);					\
+} while (0)
+
+#define	BIT_FFS(_s, p) __extension__ ({					\
+	__size_t __i;							\
+	int __bit;							\
+									\
+	__bit = 0;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++) {		\
+		if ((p)->__bits[__i] != 0) {				\
+			__bit = ffsl((p)->__bits[__i]);			\
+			__bit += __i * _BITSET_BITS;			\
+			break;						\
+		}							\
+	}								\
+	__bit;								\
+})
+
+#define	BIT_COUNT(_s, p) __extension__ ({				\
+	__size_t __i;							\
+	int __count;							\
+									\
+	__count = 0;							\
+	for (__i = 0; __i < __bitset_words((_s)); __i++)		\
+		__count += __bitcountl((p)->__bits[__i]);		\
+	__count;							\
+})
+
+#define	BITSET_T_INITIALIZER(x)						\
+	{ .__bits = { x } }
+
+#define	BITSET_FSET(n)							\
+	[ 0 ... ((n) - 1) ] = (-1L)
+
+/*
+ * Dynamically allocate a bitset.
+ */
+#define BITSET_ALLOC(_s, mt, mf)					\
+	malloc(__bitset_words(_s) * sizeof(long), mt, (mf))
+
+#endif /* !_SYS_BITSET_H_ */
diff --git a/newlib/libc/sys/rtems/include/sys/cpuset.h b/newlib/libc/sys/rtems/include/sys/cpuset.h
index 8fae475a8..1e09b0275 100644
--- a/newlib/libc/sys/rtems/include/sys/cpuset.h
+++ b/newlib/libc/sys/rtems/include/sys/cpuset.h
@@ -1,4 +1,10 @@
-/*
+/*-
+ * Copyright (c) 2008,	Jeffrey Roberson <jeff@freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved.
+ *
  * Copyright (c) 2013 On-Line Applications Research Corporation.
  * All rights reserved.
  *
@@ -11,7 +17,8 @@
  * 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.
+ *    notice unmodified, 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.
@@ -27,73 +34,53 @@
  * 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.
- */
-
-/*
- *  This file implements an API compatible with static portion of
- *  the GNU/Linux cpu_set_t macros but is independently implemented.
- *  The GNU/Linux manual page and the FreeBSD cpuset_t implementation
- *  were used as reference material.
  *
- *  Not implemented:
- *    + Linux CPU_XXX_S
- *    + FreeBSD CPU_SUBSET
- *    + FreeBSD CPU_OVERLAP
+ * $FreeBSD: head/sys/sys/cpuset.h 317756 2017-05-03 18:41:08Z cem $
  */
 
-
 #ifndef _SYS_CPUSET_H_
-#define _SYS_CPUSET_H_
+#define	_SYS_CPUSET_H_
 
 #include <sys/cdefs.h>
+#include <sys/_cpuset.h>
+#include <sys/bitset.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+#define	_NCPUBITS	_BITSET_BITS
+#define	_NCPUWORDS	__bitset_words(CPU_SETSIZE)
 
-/* RTEMS supports a maximum of 32 CPU cores */
-#ifndef CPU_SETSIZE
-#define CPU_SETSIZE 32
-#endif
+#define	CPUSETBUFSIZ	((2 + sizeof(long) * 2) * _NCPUWORDS)
 
-/* word in the cpu set */
-typedef __uint32_t cpu_set_word_t;
+#define	CPU_SETOF(n, p)			BIT_SETOF(_cpu_set_bits(setsize), n, p)
+#define	CPU_ISFULLSET(p)		BIT_ISFULLSET(_cpu_set_bits(setsize), p)
+#define	CPU_SUBSET(p, c)		BIT_SUBSET(_cpu_set_bits(setsize), p, c)
+#define	CPU_OVERLAP(p, c)		BIT_OVERLAP(_cpu_set_bits(setsize), p, c)
+#define	CPU_CLR_ATOMIC(n, p)		BIT_CLR_ATOMIC(_cpu_set_bits(setsize), n, p)
+#define	CPU_SET_ATOMIC(n, p)		BIT_SET_ATOMIC(_cpu_set_bits(setsize), n, p)
+#define	CPU_SET_ATOMIC_ACQ(n, p)	BIT_SET_ATOMIC_ACQ(_cpu_set_bits(setsize), n, p)
+#define	CPU_AND_ATOMIC(n, p)		BIT_AND_ATOMIC(_cpu_set_bits(setsize), n, p)
+#define	CPU_OR_ATOMIC(d, s)		BIT_OR_ATOMIC(_cpu_set_bits(setsize), d, s)
+#define	CPU_COPY_STORE_REL(f, t)	BIT_COPY_STORE_REL(_cpu_set_bits(setsize), f, t)
+#define	CPU_FFS(p)			BIT_FFS(_cpu_set_bits(setsize), p)
+#define	CPUSET_FSET			BITSET_FSET(_NCPUWORDS)
+#define	CPUSET_T_INITIALIZER		BITSET_T_INITIALIZER
 
-/* Number of bits per cpu_set_t element */
-#define _NCPUBITS  (sizeof(cpu_set_word_t) * 8)
+typedef cpuset_t cpu_set_t;
 
-/* Number of words in the cpu_set_t array */
-#define _NCPUWORDS   (((CPU_SETSIZE)+((_NCPUBITS)-1))/(_NCPUBITS))
+#define	_cpu_set_bits(_setsize) (8 * (_setsize))
 
-/* Define the cpu set structure */
-typedef struct _cpuset {
-  cpu_set_word_t __bits[_NCPUWORDS];
-} cpu_set_t;
+#define	CPU_ALLOC_SIZE(_num_cpus) (sizeof(long) * __bitset_words(_num_cpus))
 
-/* determine the mask for a particular cpu within the element */
-static __inline cpu_set_word_t  __cpuset_mask(int cpu)
-{
-  return (cpu_set_word_t)1 << ((size_t)cpu % _NCPUBITS);
-}
-
-/* determine the index for this cpu within the cpu set array */
-static __inline size_t __cpuset_index(int cpu)
-{
-  return (size_t)cpu / _NCPUBITS;
-}
-
-#define CPU_ALLOC_SIZE(_num_cpus) \
-  (sizeof(cpu_set_word_t) * (((_num_cpus) + _NCPUBITS - 1) / _NCPUBITS))
+__BEGIN_DECLS
 
 cpu_set_t *__cpuset_alloc(int num_cpus);
 
+void __cpuset_free(cpu_set_t *set);
+
 static __inline cpu_set_t *CPU_ALLOC(int num_cpus)
 {
   return __cpuset_alloc(num_cpus);
 }
 
-void __cpuset_free(cpu_set_t *set);
-
 static __inline void CPU_FREE(cpu_set_t *set)
 {
   __cpuset_free(set);
@@ -101,12 +88,7 @@ static __inline void CPU_FREE(cpu_set_t *set)
 
 static __inline void CPU_ZERO_S(size_t setsize, cpu_set_t *set)
 {
-  cpu_set_word_t *w = &set->__bits[0];
-  size_t n = setsize / sizeof(*w);
-  size_t i;
-
-  for (i = 0; i < n; ++i)
-    w[i] = 0;
+  BIT_ZERO(_cpu_set_bits(setsize), set);
 }
 
 static __inline void CPU_ZERO(cpu_set_t *set)
@@ -116,12 +98,7 @@ static __inline void CPU_ZERO(cpu_set_t *set)
 
 static __inline void CPU_FILL_S(size_t setsize, cpu_set_t *set)
 {
-  cpu_set_word_t *w = &set->__bits[0];
-  size_t n = setsize / sizeof(*w);
-  size_t i;
-
-  for (i = 0; i < n; ++i)
-    w[i] = ~(cpu_set_word_t)0;
+  BIT_FILL(_cpu_set_bits(setsize), set);
 }
 
 static __inline void CPU_FILL(cpu_set_t *set)
@@ -131,9 +108,7 @@ static __inline void CPU_FILL(cpu_set_t *set)
 
 static __inline void CPU_SET_S(int cpu, size_t setsize, cpu_set_t *set)
 {
-  cpu_set_word_t *w = &set->__bits[0];
-
-  w[__cpuset_index(cpu)] |= __cpuset_mask(cpu);
+  BIT_SET(_cpu_set_bits(setsize), cpu, set);
 }
 
 static __inline void CPU_SET(int cpu, cpu_set_t *set)
@@ -143,9 +118,7 @@ static __inline void CPU_SET(int cpu, cpu_set_t *set)
 
 static __inline void CPU_CLR_S(int cpu, size_t setsize, cpu_set_t *set)
 {
-  cpu_set_word_t *w = &set->__bits[0];
-
-  w[__cpuset_index(cpu)] &= ~__cpuset_mask(cpu);
+  BIT_CLR(_cpu_set_bits(setsize), cpu, set);
 }
 
 static __inline void CPU_CLR(int cpu, cpu_set_t *set)
@@ -155,9 +128,7 @@ static __inline void CPU_CLR(int cpu, cpu_set_t *set)
 
 static __inline int CPU_ISSET_S(int cpu, size_t setsize, const cpu_set_t *set)
 {
-  const cpu_set_word_t *w = &set->__bits[0];
-
-  return ((w[__cpuset_index(cpu)] & __cpuset_mask(cpu)) != 0);
+  return BIT_ISSET(_cpu_set_bits(setsize), cpu, set);
 }
 
 static __inline int CPU_ISSET(int cpu, const cpu_set_t *set)
@@ -165,23 +136,15 @@ static __inline int CPU_ISSET(int cpu, const cpu_set_t *set)
   return CPU_ISSET_S(cpu, sizeof(*set), set);
 }
 
-/* copy src set to dest set */
-static __inline void CPU_COPY( cpu_set_t *dest, const cpu_set_t *src )
+static __inline void CPU_COPY(const cpu_set_t *src, cpu_set_t *dest)
 {
-  *dest = *src;
+  BIT_COPY(_cpu_set_bits(setsize), src, dest);
 }
 
 static __inline void CPU_AND_S(size_t setsize, cpu_set_t *destset,
   const cpu_set_t *srcset1, const cpu_set_t *srcset2)
 {
-  cpu_set_word_t *wdest = &destset->__bits[0];
-  const cpu_set_word_t *wsrc1 = &srcset1->__bits[0];
-  const cpu_set_word_t *wsrc2 = &srcset2->__bits[0];
-  size_t n = setsize / sizeof(*wdest);
-  size_t i;
-
-  for (i = 0; i < n; ++i)
-    wdest[i] = wsrc1[i] & wsrc2[i];
+  BIT_AND2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
 }
 
 static __inline void CPU_AND(cpu_set_t *destset, const cpu_set_t *srcset1,
@@ -193,14 +156,7 @@ static __inline void CPU_AND(cpu_set_t *destset, const cpu_set_t *srcset1,
 static __inline void CPU_OR_S(size_t setsize, cpu_set_t *destset,
   const cpu_set_t *srcset1, const cpu_set_t *srcset2)
 {
-  cpu_set_word_t *wdest = &destset->__bits[0];
-  const cpu_set_word_t *wsrc1 = &srcset1->__bits[0];
-  const cpu_set_word_t *wsrc2 = &srcset2->__bits[0];
-  size_t n = setsize / sizeof(*wdest);
-  size_t i;
-
-  for (i = 0; i < n; ++i)
-    wdest[i] = wsrc1[i] | wsrc2[i];
+  BIT_OR2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
 }
 
 static __inline void CPU_OR(cpu_set_t *destset, const cpu_set_t *srcset1,
@@ -212,14 +168,7 @@ static __inline void CPU_OR(cpu_set_t *destset, const cpu_set_t *srcset1,
 static __inline void CPU_XOR_S(size_t setsize, cpu_set_t *destset,
   const cpu_set_t *srcset1, const cpu_set_t *srcset2)
 {
-  cpu_set_word_t *wdest = &destset->__bits[0];
-  const cpu_set_word_t *wsrc1 = &srcset1->__bits[0];
-  const cpu_set_word_t *wsrc2 = &srcset2->__bits[0];
-  size_t n = setsize / sizeof(*wdest);
-  size_t i;
-
-  for (i = 0; i < n; ++i)
-    wdest[i] = wsrc1[i] ^ wsrc2[i];
+  BIT_XOR2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
 }
 
 static __inline void CPU_XOR(cpu_set_t *destset, const cpu_set_t *srcset1,
@@ -231,14 +180,7 @@ static __inline void CPU_XOR(cpu_set_t *destset, const cpu_set_t *srcset1,
 static __inline void CPU_NAND_S(size_t setsize, cpu_set_t *destset,
   const cpu_set_t *srcset1, const cpu_set_t *srcset2)
 {
-  cpu_set_word_t *wdest = &destset->__bits[0];
-  const cpu_set_word_t *wsrc1 = &srcset1->__bits[0];
-  const cpu_set_word_t *wsrc2 = &srcset2->__bits[0];
-  size_t n = setsize / sizeof(*wdest);
-  size_t i;
-
-  for (i = 0; i < n; ++i)
-    wdest[i] = ~(wsrc1[i] & wsrc2[i]);
+  BIT_NAND2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
 }
 
 static __inline void CPU_NAND(cpu_set_t *destset, const cpu_set_t *srcset1,
@@ -249,17 +191,7 @@ static __inline void CPU_NAND(cpu_set_t *destset, const cpu_set_t *srcset1,
 
 static __inline int CPU_COUNT_S(size_t setsize, const cpu_set_t *set)
 {
-  int count = 0;
-  const cpu_set_word_t *w = &set->__bits[0];
-  size_t n = setsize / sizeof(*w);
-  size_t i;
-  int cpu;
-
-  for (i = 0; i < n; ++i)
-    for (cpu = 0; cpu < (int)_NCPUBITS; ++cpu)
-      count += (w[i] & __cpuset_mask(cpu)) != 0;
-
-  return count;
+  return BIT_COUNT(_cpu_set_bits(setsize), set);
 }
 
 static __inline int CPU_COUNT(const cpu_set_t *set)
@@ -270,16 +202,7 @@ static __inline int CPU_COUNT(const cpu_set_t *set)
 static __inline int CPU_EQUAL_S(size_t setsize, const cpu_set_t *set1,
   const cpu_set_t *set2)
 {
-  const cpu_set_word_t *w1 = &set1->__bits[0];
-  const cpu_set_word_t *w2 = &set2->__bits[0];
-  size_t n = setsize / sizeof(*w1);
-  size_t i;
-
-  for (i = 0; i < n; ++i)
-    if (w1[i] != w2[i])
-      return 0;
-
-  return 1;
+  return BIT_CMP(_cpu_set_bits(setsize), set1, set2);
 }
 
 static __inline int CPU_EQUAL(const cpu_set_t *set1, const cpu_set_t *set2)
@@ -287,25 +210,20 @@ static __inline int CPU_EQUAL(const cpu_set_t *set1, const cpu_set_t *set2)
   return CPU_EQUAL_S(sizeof(*set1), set1, set2);
 }
 
-/* return 1 if the sets set1 and set2 are equal, otherwise return 0 */
-static __inline int CPU_CMP( const cpu_set_t *set1, const cpu_set_t *set2 )
+static __inline int CPU_CMP(const cpu_set_t *set1, const cpu_set_t *set2)
 {
   return CPU_EQUAL(set1, set2);
 }
 
-/* return 1 if the set is empty, otherwise return 0 */
-static __inline int CPU_EMPTY( const cpu_set_t *set )
+static __inline int CPU_EMPTY(const cpu_set_t *set)
 {
-  size_t i;
-
-  for (i=0; i < _NCPUWORDS; i++)
-    if (set->__bits[i] != 0 )
-      return 0;
-  return 1;
+  return BIT_EMPTY(_cpu_set_bits(sizeof(*set)), set);
 }
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+__END_DECLS
 
+#ifdef _KERNEL
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_cpuset.h>
 #endif
+#endif /* !_SYS_CPUSET_H_ */
-- 
2.12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/8] FreeBSD compatibility for RTEMS <sys/param.h>
  2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 6/8] FreeBSD compatibility for RTEMS <sys/cpuset.h> Sebastian Huber
@ 2017-05-24  9:34 ` Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 4/8] Move ARM access.c from machine to sys Sebastian Huber
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:34 UTC (permalink / raw)
  To: newlib

Update the RTEMS <machine/param.h> and <sys/param.h> to be compatible
with the latest FreeBSD version.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/sys/rtems/include/machine/param.h | 125 +++++++++---------
 newlib/libc/sys/rtems/include/sys/param.h     | 180 +++++++++++++++++---------
 2 files changed, 180 insertions(+), 125 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/machine/param.h b/newlib/libc/sys/rtems/include/machine/param.h
index 622194bbb..4892b6174 100644
--- a/newlib/libc/sys/rtems/include/machine/param.h
+++ b/newlib/libc/sys/rtems/include/machine/param.h
@@ -1,94 +1,85 @@
-/*
- *  $Id$
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
  */
 
 #ifndef _MACHINE_PARAM_H_
 #define	_MACHINE_PARAM_H_
 
 /*
- * These aren't really machine-dependent for RTEMS.....
+ * Machine dependent constants for RTEMS.
  */
 
-/*
-#define MACHINE		"i386"
-#define MID_MACHINE	MID_I386
-*/
-
 #include <machine/_align.h>
 
-#define	ALIGNBYTES	_ALIGNBYTES
-#define	ALIGN(p)	_ALIGN(p)
-
-#define PAGE_SHIFT	12		/* LOG2(PAGE_SIZE) */
-#define PAGE_SIZE	(1<<PAGE_SHIFT)	/* bytes/page */
-#define PAGE_MASK	(PAGE_SIZE-1)
-#define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
-
-#define NPDEPG		(PAGE_SIZE/(sizeof (pd_entry_t)))
-#define PDRSHIFT	22		/* LOG2(NBPDR) */
-#define NBPDR		(1<<PDRSHIFT)	/* bytes/page dir */
-
-#define DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
-#define DEV_BSIZE	(1<<DEV_BSHIFT)
-
-#if defined(__AVR__) || defined(__h8300__)
-#define BLKDEV_IOSIZE	1024
-#define MAXPHYS		(1 * 1024)	/* max raw I/O transfer size */
-#else
-#define BLKDEV_IOSIZE	2048
-#define MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
+#ifndef MAXCPU
+#define	MAXCPU		32
 #endif
 
-#define UPAGES	2		/* pages of u-area */
+#ifndef MAXMEMDOM
+#define	MAXMEMDOM	1
+#endif
 
+#define	ALIGNBYTES	_ALIGNBYTES
+#define	ALIGN(p)	_ALIGN(p)
 /*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
+ * 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).
  */
-#ifndef	MSIZE
-#define MSIZE		128		/* size of an mbuf */
-#endif	/* MSIZE */
-
-#ifndef	MCLSHIFT
-#define MCLSHIFT	11		/* convert bytes to m_buf clusters */
-#endif	/* MCLSHIFT */
-#define MCLBYTES	(1 << MCLSHIFT)	/* size of an m_buf cluster */
-#define MCLOFSET	(MCLBYTES - 1)	/* offset within an m_buf cluster */
+#define	ALIGNED_POINTER(p, t)	((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
 
 /*
- * Some macros for units conversion
+ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
+ * architecture.  It should be used with appropriate caution.
  */
+#ifndef CACHE_LINE_SHIFT
+#define	CACHE_LINE_SHIFT	6
+#endif
+#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
 
-/* clicks to bytes */
-#define ctob(x)	((x)<<PAGE_SHIFT)
-
-/* bytes to clicks */
-#define btoc(x)	(((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT)
-
-/*
- * btodb() is messy and perhaps slow because `bytes' may be an off_t.  We
- * want to shift an unsigned type to avoid sign extension and we don't
- * want to widen `bytes' unnecessarily.  Assume that the result fits in
- * a daddr_t.
- */
-#define btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
-	(sizeof (bytes) > sizeof(long) \
-	 ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
-	 : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
+#define	PAGE_SHIFT	12
+#define	PAGE_SIZE	(1 << PAGE_SHIFT)	/* Page size */
+#define	PAGE_MASK	(PAGE_SIZE - 1)
 
-#define dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
-	((off_t)(db) << DEV_BSHIFT)
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
 
 /*
  * Mach derived conversion macros
  */
-#define trunc_page(x)		((unsigned)(x) & ~PAGE_MASK)
-#define round_page(x)		((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
+#define	round_page(x)		(((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK)
+#define	trunc_page(x)		((unsigned long)(x) & ~PAGE_MASK)
+
+#define	atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
+#define	ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
 
-#define atop(x)			((unsigned)(x) >> PAGE_SHIFT)
-#define ptoa(x)			((unsigned)(x) << PAGE_SHIFT)
+#define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024))
 
 #endif /* !_MACHINE_PARAM_H_ */
diff --git a/newlib/libc/sys/rtems/include/sys/param.h b/newlib/libc/sys/rtems/include/sys/param.h
index db9786b31..1778ec3a8 100644
--- a/newlib/libc/sys/rtems/include/sys/param.h
+++ b/newlib/libc/sys/rtems/include/sys/param.h
@@ -15,7 +15,7 @@
  * 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
+ * 3. 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.
  *
@@ -32,29 +32,16 @@
  * SUCH DAMAGE.
  *
  *	@(#)param.h	8.3 (Berkeley) 4/4/95
- * $Id$
+ * $FreeBSD: head/sys/sys/param.h 317383 2017-04-24 21:21:49Z brooks $
  */
 
 #ifndef _SYS_PARAM_H_
 #define _SYS_PARAM_H_
 
-/* from newlib's <sys/param.h> */
-
-#include <sys/config.h>
-#include <machine/endian.h>
-
-# define PATHSIZE (1024)
-
-/* end of from newlib's <sys/param.h> */
-
 #define	BSD	199506		/* System version (year & month). */
 #define BSD4_3	1
 #define BSD4_4	1
 
-#ifndef NULL
-#define	NULL	0
-#endif
-
 #ifndef LOCORE
 #include <sys/types.h>
 #endif
@@ -78,32 +65,95 @@
 #define MAXHOSTNAMELEN	256		/* max hostname size */
 #define SPECNAMELEN	63		/* max length of devicename */
 
-/* More types and definitions used throughout the kernel. */
-#if defined(KERNEL) || defined(_KERNEL)
-#include <sys/cdefs.h>
-#include <sys/errno.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/uio.h>
-#include <sys/priority.h>
+#ifndef _KERNEL
+/* Signals. */
+#include <sys/signal.h>
+#endif
+
+/* Machine type dependent parameters. */
+#include <machine/param.h>
+#ifndef _KERNEL
+#include <limits.h>
+#endif
+
+#ifndef DEV_BSHIFT
+#define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
+#endif
+#define	DEV_BSIZE	(1<<DEV_BSHIFT)
 
-#ifndef FALSE
-#define	FALSE	0
+#ifndef BLKDEV_IOSIZE
+#define BLKDEV_IOSIZE  PAGE_SIZE	/* default block device I/O size */
+#endif
+#ifndef DFLTPHYS
+#define DFLTPHYS	(64 * 1024)	/* default max raw I/O transfer size */
 #endif
-#ifndef TRUE
-#define	TRUE	1
+#ifndef MAXPHYS
+#define MAXPHYS		(128 * 1024)	/* max raw I/O transfer size */
 #endif
+#ifndef MAXDUMPPGS
+#define MAXDUMPPGS	(DFLTPHYS/PAGE_SIZE)
 #endif
 
-/* Signals. */
-#include <sys/signal.h>
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than PAGE_SIZE.
+ */
+#ifndef	MSIZE
+#define	MSIZE		128		/* size of an mbuf */
+#endif
 
-/* Machine type dependent parameters. */
-#include <machine/param.h>
-#include <machine/limits.h>
+#ifndef	MCLSHIFT
+#define MCLSHIFT	11		/* convert bytes to mbuf clusters */
+#endif	/* MCLSHIFT */
+
+#define MCLBYTES	(1 << MCLSHIFT)	/* size of an mbuf cluster */
+
+#if PAGE_SIZE < 2048
+#define	MJUMPAGESIZE	MCLBYTES
+#elif PAGE_SIZE <= 8192
+#define	MJUMPAGESIZE	PAGE_SIZE
+#else
+#define	MJUMPAGESIZE	(8 * 1024)
+#endif
+
+#define	MJUM9BYTES	(9 * 1024)	/* jumbo cluster 9k */
+#define	MJUM16BYTES	(16 * 1024)	/* jumbo cluster 16k */
+
+/*
+ * Some macros for units conversion
+ */
+
+/* clicks to bytes */
+#ifndef ctob
+#define ctob(x)	((x)<<PAGE_SHIFT)
+#endif
+
+/* bytes to clicks */
+#ifndef btoc
+#define btoc(x)	(((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT)
+#endif
+
+/*
+ * btodb() is messy and perhaps slow because `bytes' may be an off_t.  We
+ * want to shift an unsigned type to avoid sign extension and we don't
+ * want to widen `bytes' unnecessarily.  Assume that the result fits in
+ * a daddr_t.
+ */
+#ifndef btodb
+#define btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
+	(sizeof (bytes) > sizeof(long) \
+	 ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
+	 : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
+#endif
+
+#ifndef dbtob
+#define dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
+	((off_t)(db) << DEV_BSHIFT)
+#endif
 
 #define	PRIMASK	0x0ff
 #define	PCATCH	0x100		/* OR'd with pri for tsleep to check signals */
+#define	PDROP	0x200	/* OR'd with pri to stop re-entry of interlock mutex */
 
 #define	NZERO	0		/* default "nice" */
 
@@ -111,13 +161,8 @@
 #define	NBPW	sizeof(int)	/* number of bytes per word (integer) */
 
 #define	CMASK	022		/* default file mask: S_IWGRP|S_IWOTH */
-#define	NODEV	(dev_t)(-1)	/* non-existent device */
 
-#define	CBLOCK	128		/* Clist block size, must be a power of 2. */
-#define CBQSIZE	(CBLOCK/NBBY)	/* Quote bytes/cblock - can do better. */
-				/* Data chars/clist. */
-#define	CBSIZE	(CBLOCK - sizeof(struct cblock *) - CBQSIZE)
-#define	CROUND	(CBLOCK - 1)	/* Clist rounding. */
+#define	NODEV	(dev_t)(-1)	/* non-existent device */
 
 /*
  * File system parameters and macros.
@@ -128,10 +173,19 @@
  *		and may be made smaller at the risk of not being able to use
  *		filesystems which require a block size exceeding MAXBSIZE.
  *
+ * MAXBCACHEBUF - Maximum size of a buffer in the buffer cache.  This must
+ *		be >= MAXBSIZE and can be set differently for different
+ *		architectures by defining it in <machine/param.h>.
+ *		Making this larger allows NFS to do larger reads/writes.
+ *
  * BKVASIZE -	Nominal buffer space per buffer, in bytes.  BKVASIZE is the
  *		minimum KVM memory reservation the kernel is willing to make.
  *		Filesystems can of course request smaller chunks.  Actual
  *		backing memory uses a chunk size of a page (PAGE_SIZE).
+ *		The default value here can be overridden on a per-architecture
+ *		basis by defining it in <machine/param.h>.  This should
+ *		probably be done to increase its value, when MAXBCACHEBUF is
+ *		defined as a larger value in <machine/param.h>.
  *
  *		If you make BKVASIZE too small you risk seriously fragmenting
  *		the buffer KVM map which may slow things down a bit.  If you
@@ -143,7 +197,12 @@
  *		normal UFS filesystem.
  */
 #define MAXBSIZE	65536	/* must be power of 2 */
+#ifndef	MAXBCACHEBUF
+#define	MAXBCACHEBUF	MAXBSIZE /* must be a power of 2 >= MAXBSIZE */
+#endif
+#ifndef	BKVASIZE
 #define BKVASIZE	16384	/* must be power of 2 */
+#endif
 #define BKVAMASK	(BKVASIZE-1)
 
 /*
@@ -170,34 +229,16 @@
 #ifndef howmany
 #define	howmany(x, y)	(((x)+((y)-1))/(y))
 #endif
+#define	nitems(x)	(sizeof((x)) / sizeof((x)[0]))
 #define	rounddown(x, y)	(((x)/(y))*(y))
+#define	rounddown2(x, y) ((x)&(~((y)-1)))          /* if y is power of two */
 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))  /* to any y */
 #define	roundup2(x, y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
 #define powerof2(x)	((((x)-1)&(x))==0)
 
 /* Macros for min/max. */
-#if !(defined(KERNEL) || defined(_KERNEL))
 #define	MIN(a,b) (((a)<(b))?(a):(b))
 #define	MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-/*
- * Constants for setting the parameters of the kernel memory allocator.
- *
- * 2 ** MINBUCKET is the smallest unit of memory that will be
- * allocated. It must be at least large enough to hold a pointer.
- *
- * Units of memory less or equal to MAXALLOCSAVE will permanently
- * allocate physical memory; requests for these size pieces of
- * memory are quite fast. Allocations greater than MAXALLOCSAVE must
- * always allocate and free physical memory; requests for these
- * size allocations should be done infrequently as they will be slow.
- *
- * Constraints: PAGE_SIZE <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
- * MAXALLOCSIZE must be a power of two.
- */
-#define MINBUCKET	4		/* 4 => min allocation of 16 bytes */
-#define MAXALLOCSAVE	(2 * PAGE_SIZE)
 
 /*
  * Scale factor for scaled integers used to count %cpu time and load avgs.
@@ -213,4 +254,27 @@
 #define	FSHIFT	11		/* bits to right of fixed binary point */
 #define FSCALE	(1<<FSHIFT)
 
+#define dbtoc(db)			/* calculates devblks to pages */ \
+	((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
+
+#define ctodb(db)			/* calculates pages to devblks */ \
+	((db) << (PAGE_SHIFT - DEV_BSHIFT))
+
+/*
+ * Old spelling of __containerof().
+ */
+#define	member2struct(s, m, x)						\
+	((struct s *)(void *)((char *)(x) - offsetof(struct s, m)))
+
+/*
+ * Access a variable length array that has been declared as a fixed
+ * length array.
+ */
+#define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset])
+
+#ifdef _KERNEL
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_param.h>
+#endif
+
 #endif	/* _SYS_PARAM_H_ */
-- 
2.12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 3/8] Increase MSIZE for RTEMS
  2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
                   ` (3 preceding siblings ...)
  2017-05-24  9:34 ` [PATCH v2 8/8] Add de-facto standard <sys/ioctl.h> for RTEMS Sebastian Huber
@ 2017-05-24  9:34 ` Sebastian Huber
  2017-05-24  9:34 ` [PATCH v2 5/8] Add __bitcount*() to RTEMS <machine/types.h> Sebastian Huber
  2017-05-24  9:35 ` [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
  6 siblings, 0 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:34 UTC (permalink / raw)
  To: newlib

Increase the MSIZE for RTEMS to be in line with the latest FreeBSD
version.  The legacy network stack of RTEMS will provides its own
definition.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/sys/rtems/include/sys/param.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/param.h b/newlib/libc/sys/rtems/include/sys/param.h
index 1778ec3a8..06ef0ecff 100644
--- a/newlib/libc/sys/rtems/include/sys/param.h
+++ b/newlib/libc/sys/rtems/include/sys/param.h
@@ -99,7 +99,7 @@
  * MCLBYTES must be no larger than PAGE_SIZE.
  */
 #ifndef	MSIZE
-#define	MSIZE		128		/* size of an mbuf */
+#define	MSIZE		256		/* size of an mbuf */
 #endif
 
 #ifndef	MCLSHIFT
-- 
2.12.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS
  2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
                   ` (5 preceding siblings ...)
  2017-05-24  9:34 ` [PATCH v2 5/8] Add __bitcount*() to RTEMS <machine/types.h> Sebastian Huber
@ 2017-05-24  9:35 ` Sebastian Huber
  6 siblings, 0 replies; 8+ messages in thread
From: Sebastian Huber @ 2017-05-24  9:35 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

Patch 7/8 was rejected due to the mail size limit. Attached is the 
complete patch set as .tar.gz.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


[-- Attachment #2: posix-header-files-for-rtems-v2.tar.gz --]
[-- Type: application/gzip, Size: 59655 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-24  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24  9:34 [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber
2017-05-24  9:34 ` [PATCH v2 6/8] FreeBSD compatibility for RTEMS <sys/cpuset.h> Sebastian Huber
2017-05-24  9:34 ` [PATCH v2 2/8] FreeBSD compatibility for RTEMS <sys/param.h> Sebastian Huber
2017-05-24  9:34 ` [PATCH v2 4/8] Move ARM access.c from machine to sys Sebastian Huber
2017-05-24  9:34 ` [PATCH v2 8/8] Add de-facto standard <sys/ioctl.h> for RTEMS Sebastian Huber
2017-05-24  9:34 ` [PATCH v2 3/8] Increase MSIZE " Sebastian Huber
2017-05-24  9:34 ` [PATCH v2 5/8] Add __bitcount*() to RTEMS <machine/types.h> Sebastian Huber
2017-05-24  9:35 ` [PATCH v2 1/8] Add generic <machine/_align.h> for RTEMS Sebastian Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).