From 83c568a6a0aca3d9b2421ccc987b98fd83b40533 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Tue, 23 Mar 2021 13:33:31 +0100
Subject: [PATCH] include: Stop using symlinks a few headers that are shared
 with the kernel.

This helps header parsing tools like fixincludes etc.

Reported-by: zrj
---
 include/Makefile                      | 21 ++++++---------
 include/aio.h                         | 37 +++++++++++++++++++++++++++
 include/errno.h                       | 37 +++++++++++++++++++++++++++
 include/fcntl.h                       | 37 +++++++++++++++++++++++++++
 include/linker_set.h                  | 37 +++++++++++++++++++++++++++
 include/poll.h                        | 37 +++++++++++++++++++++++++++
 include/sched.h                       | 37 +++++++++++++++++++++++++++
 include/syslog.h                      | 37 +++++++++++++++++++++++++++
 include/ucontext.h                    | 37 +++++++++++++++++++++++++++
 lib/libthread_xu/thread/thr_private.h |  4 +--
 sys/sys/sched.h                       |  6 ++---
 11 files changed, 309 insertions(+), 18 deletions(-)
 create mode 100644 include/aio.h
 create mode 100644 include/errno.h
 create mode 100644 include/fcntl.h
 create mode 100644 include/linker_set.h
 create mode 100644 include/poll.h
 create mode 100644 include/sched.h
 create mode 100644 include/syslog.h
 create mode 100644 include/ucontext.h

diff --git a/include/Makefile b/include/Makefile
index 265f6547fe0..16d272fd36b 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -8,26 +8,26 @@
 
 CLEANFILES= osreldate.h version vers.c vers.txt
 SUBDIR= arpa protocols rpc rpcsvc xlocale
-INCS=	a.out.h alloca.h ar.h assert.h bitstring.h byteswap.h \
+INCS=	a.out.h aio.h alloca.h ar.h assert.h bitstring.h byteswap.h \
 	cpio.h ctype.h db.h dirent.h disktab.h \
-	dlfcn.h elf.h elf-hints.h endian.h err.h \
-	float.h fmtmsg.h fnmatch.h fstab.h fts.h ftw.h \
+	dlfcn.h elf.h elf-hints.h endian.h err.h errno.h \
+	fcntl.h float.h fmtmsg.h fnmatch.h fstab.h fts.h ftw.h \
 	getopt.h glob.h grp.h \
 	iconv.h ieeefp.h ifaddrs.h iso646.h inttypes.h kenv.h \
-	langinfo.h libgen.h limits.h link.h locale.h memory.h \
+	langinfo.h libgen.h limits.h link.h linker_set.h locale.h memory.h \
 	mntopts.h mpool.h mqueue.h monetary.h ndbm.h netconfig.h \
 	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h \
-	paths.h printf.h pthread.h pthread_np.h pwd.h \
+	paths.h poll.h printf.h pthread.h pthread_np.h pwd.h \
 	ranlib.h readpassphrase.h \
 	re_comp.h resolv.h res_update.h runetype.h \
-	search.h semaphore.h setjmp.h signal.h spawn.h \
+	sched.h search.h semaphore.h setjmp.h signal.h spawn.h \
 	stdalign.h stdarg.h stdbool.h \
 	stddef.h stdint.h stdio.h stdlib.h stdnoreturn.h \
-	string.h stringlist.h strings.h sysexits.h \
+	string.h stringlist.h strings.h sysexits.h syslog.h \
 	tar.h termios.h time.h \
 	timeconv.h \
 	timers.h ttyent.h \
-	uchar.h unistd.h ulimit.h utime.h utmpx.h \
+	uchar.h ucontext.h unistd.h ulimit.h utime.h utmpx.h \
 	uuid.h vis.h \
 	wchar.h wctype.h wordexp.h xlocale.h
 
@@ -38,8 +38,6 @@ INCS+=	hesiod.h
 # Only for default SHARED=copies case
 SHDRS=	soundcard.h joystick.h
 
-LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h sched.h syslog.h ucontext.h
-
 # directories which also contain header files that need to be copied.
 # Other directories, like 'bus' and 'netproto', are created using mtree.
 #
@@ -116,9 +114,6 @@ osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
 	echo "#define __DragonFly_version $$RELDATE" >> osreldate.h; \
 	echo "#endif" >> osreldate.h
 
-.for i in ${LHDRS}
-INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
-.endfor
 .for i in ${MHDRS}
 INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
 .endfor
diff --git a/include/aio.h b/include/aio.h
new file mode 100644
index 00000000000..20973b489b0
--- /dev/null
+++ b/include/aio.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _AIO_H_
+#define	_AIO_H_
+
+#include <sys/aio.h>
+
+#endif /* !_AIO_H_ */
diff --git a/include/errno.h b/include/errno.h
new file mode 100644
index 00000000000..1e903d09172
--- /dev/null
+++ b/include/errno.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _ERRNO_H_
+#define	_ERRNO_H_
+
+#include <sys/errno.h>
+
+#endif /* !_ERRNO_H_ */
diff --git a/include/fcntl.h b/include/fcntl.h
new file mode 100644
index 00000000000..3186e50b358
--- /dev/null
+++ b/include/fcntl.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _FCNTL_H_
+#define	_FCNTL_H_
+
+#include <sys/fcntl.h>
+
+#endif /* !_FCNTL_H_ */
diff --git a/include/linker_set.h b/include/linker_set.h
new file mode 100644
index 00000000000..7490d1f6f00
--- /dev/null
+++ b/include/linker_set.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _LINKER_SET_H_
+#define	_LINKER_SET_H_
+
+#include <sys/linker_set.h>
+
+#endif /* !_LINKER_SET_H_ */
diff --git a/include/poll.h b/include/poll.h
new file mode 100644
index 00000000000..b7caf785630
--- /dev/null
+++ b/include/poll.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _POLL_H_
+#define	_POLL_H_
+
+#include <sys/poll.h>
+
+#endif /* !_POLL_H_ */
diff --git a/include/sched.h b/include/sched.h
new file mode 100644
index 00000000000..336d7a9662f
--- /dev/null
+++ b/include/sched.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _SCHED_H_
+#define	_SCHED_H_
+
+#include <sys/sched.h>
+
+#endif /* !_SCHED_H_ */
diff --git a/include/syslog.h b/include/syslog.h
new file mode 100644
index 00000000000..df6884eca2d
--- /dev/null
+++ b/include/syslog.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _SYSLOG_H_
+#define	_SYSLOG_H_
+
+#include <sys/syslog.h>
+
+#endif /* !_SYSLOG_H_ */
diff --git a/include/ucontext.h b/include/ucontext.h
new file mode 100644
index 00000000000..e51f5345989
--- /dev/null
+++ b/include/ucontext.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2021 The DragonFly Project.  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 DragonFly Project 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 _UCONTEXT_H_
+#define	_UCONTEXT_H_
+
+#include <sys/ucontext.h>
+
+#endif /* !_UCONTEXT_H_ */
diff --git a/lib/libthread_xu/thread/thr_private.h b/lib/libthread_xu/thread/thr_private.h
index abba8acfe76..f24ad6cec99 100644
--- a/lib/libthread_xu/thread/thr_private.h
+++ b/lib/libthread_xu/thread/thr_private.h
@@ -47,9 +47,9 @@
 #include <machine/atomic.h>
 #include <errno.h>
 #include <limits.h>
+#include <sched.h>
 #include <signal.h>
 #include <sys/cpumask.h>
-#include <sys/sched.h>
 #include <stdarg.h>
 #include <unistd.h>
 #include <pthread.h>
@@ -728,7 +728,7 @@ int	_umtx_sleep_err(volatile const int *, int, int);
 int	_umtx_wakeup_err(volatile const int *, int);
 
 /* #include <fcntl.h> */
-#ifdef  _SYS_FCNTL_H_
+#ifdef  _FCNTL_H_
 int     __sys_fcntl(int, int, ...);
 int     __sys_open(const char *, int, ...);
 int     __sys_openat(int, const char *, int, ...);
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 38566d32032..6dc93b22f28 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -35,8 +35,8 @@
 
 /* sched.h: POSIX 1003.1b Process Scheduling header */
 
-#ifndef _SCHED_H_
-#define	_SCHED_H_
+#ifndef _SYS_SCHED_H_
+#define	_SYS_SCHED_H_
 
 /* Scheduling policies
  */
@@ -87,4 +87,4 @@ __END_DECLS
 
 #endif /* !_KERNEL */
 
-#endif /* _SCHED_H_ */
+#endif /* _SYS_SCHED_H_ */
-- 
2.30.0

