summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordufault <dufault@FreeBSD.org>1998-03-28 11:51:01 +0000
committerdufault <dufault@FreeBSD.org>1998-03-28 11:51:01 +0000
commit8ed0defc6e5c9d291026302e0d45357454484c5d (patch)
tree805e852c0dbabdcdb6254773c9023caa32928e3a /sys
parentcd450d67141a2e84500ff624dc9d39c255a7de77 (diff)
downloadFreeBSD-src-8ed0defc6e5c9d291026302e0d45357454484c5d.zip
FreeBSD-src-8ed0defc6e5c9d291026302e0d45357454484c5d.tar.gz
Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work. Changes: Change all "posix4" to "p1003_1b". Misnamed files are left as "posix4" until I'm told if I can simply delete them and add new ones; Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux; Add man pages for _POSIX_PRIORITY_SCHEDULING system calls; Add options to LINT; Minor fixes to P1003_1B code during testing.
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/linux/syscalls.master28
-rw-r--r--sys/amd64/amd64/cpu_switch.S8
-rw-r--r--sys/amd64/amd64/swtch.s8
-rw-r--r--sys/conf/NOTES15
-rw-r--r--sys/conf/files5
-rw-r--r--sys/conf/options8
-rw-r--r--sys/i386/conf/LINT15
-rw-r--r--sys/i386/conf/NOTES15
-rw-r--r--sys/i386/i386/swtch.s8
-rw-r--r--sys/i386/linux/linux_proto.h2
-rw-r--r--sys/i386/linux/linux_syscall.h15
-rw-r--r--sys/i386/linux/linux_sysent.c16
-rw-r--r--sys/i386/linux/syscalls.master28
-rw-r--r--sys/kern/init_sysent.c8
-rw-r--r--sys/kern/kern_mib.c12
-rw-r--r--sys/kern/kern_synch.c5
-rw-r--r--sys/kern/ksched.c52
-rw-r--r--sys/kern/p1003_1b.c239
-rw-r--r--sys/kern/posix4_mib.c83
-rw-r--r--sys/kern/syscalls.c8
-rw-r--r--sys/kern/syscalls.master13
-rw-r--r--sys/kern/vfs_aio.c4
-rw-r--r--sys/posix4/aio.h23
-rw-r--r--sys/posix4/ksched.c52
-rw-r--r--sys/posix4/mqueue.h6
-rw-r--r--sys/posix4/p1003_1b.c239
-rw-r--r--sys/posix4/posix4.h256
-rw-r--r--sys/posix4/posix4_mib.c83
-rw-r--r--sys/posix4/sched.h3
-rw-r--r--sys/posix4/semaphore.h6
-rw-r--r--sys/sys/_posix.h64
-rw-r--r--sys/sys/_sigset.h29
-rw-r--r--sys/sys/aio.h30
-rw-r--r--sys/sys/kernel.h3
-rw-r--r--sys/sys/mman.h10
-rw-r--r--sys/sys/posix4.h256
-rw-r--r--sys/sys/rtprio.h4
-rw-r--r--sys/sys/semaphore.h6
-rw-r--r--sys/sys/signal.h29
-rw-r--r--sys/sys/syscall-hide.h8
-rw-r--r--sys/sys/syscall.h10
-rw-r--r--sys/sys/syscall.mk10
-rw-r--r--sys/sys/sysctl.h75
-rw-r--r--sys/sys/sysproto.h37
-rw-r--r--sys/sys/unistd.h17
45 files changed, 1172 insertions, 679 deletions
diff --git a/sys/alpha/linux/syscalls.master b/sys/alpha/linux/syscalls.master
index 910710a..b1ae549 100644
--- a/sys/alpha/linux/syscalls.master
+++ b/sys/alpha/linux/syscalls.master
@@ -1,4 +1,4 @@
- $Id: syscalls.master,v 1.5 1997/04/09 15:34:09 bde Exp $
+ $Id: syscalls.master,v 1.6 1997/12/17 03:12:35 kato Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from LINUX).
@@ -207,3 +207,29 @@
u_int iovcnt); }
146 NOPROTO LINUX { int writev(int fd, struct iovec *iovp, \
u_int iovcnt); }
+
+; Turn on getsid after checking that it matches.
+
+147 UNIMPL LINUX getsid
+148 UNIMPL LINUX fdatasync
+149 UNIMPL LINUX _sysctl
+
+150 NOPROTO BSD { int mlock(const void *addr, size_t len); }
+151 NOPROTO BSD { int munlock(const void *addr, size_t len); }
+152 NOPROTO BSD { int mlockall(int how); }
+153 NOPROTO BSD { int munlockall(void); }
+
+
+154 NOPROTO POSIX { int sched_setparam (pid_t pid, const struct sched_param *param); }
+155 NOPROTO POSIX { int sched_getparam (pid_t pid, struct sched_param *param); }
+
+156 NOPROTO POSIX { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); }
+157 NOPROTO POSIX { int sched_getscheduler (pid_t pid); }
+
+158 NOPROTO POSIX { int sched_yield (void); }
+159 NOPROTO POSIX { int sched_get_priority_max (int policy); }
+160 NOPROTO POSIX { int sched_get_priority_min (int policy); }
+161 NOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
+
+162 NOPROTO POSIX { int nanosleep(const struct timespec *rqtp, \
+ struct timespec *rmtp); }
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index 7a63d34..e5f336b 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -33,11 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: swtch.s,v 1.68 1998/02/06 12:13:10 eivind Exp $
+ * $Id: swtch.s,v 1.69 1998/03/04 10:25:03 dufault Exp $
*/
#include "npx.h"
-#include "opt_posix4.h"
+#include "opt_posix.h"
#include "opt_user_ldt.h"
#include "opt_vm86.h"
@@ -114,7 +114,7 @@ set1:
movzwl P_RTPRIO_PRIO(%eax),%edx
cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* RR realtime priority? */
-#ifdef POSIX4
+#ifdef P1003_1B
je set_rt /* RT priority */
cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority? */
#endif
@@ -170,7 +170,7 @@ ENTRY(remrq)
movzwl P_RTPRIO_PRIO(%eax),%edx
cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* realtime priority process? */
-#ifdef POSIX4
+#ifdef P1003_1B
je rem0rt
cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority process? */
#endif
diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s
index 7a63d34..e5f336b 100644
--- a/sys/amd64/amd64/swtch.s
+++ b/sys/amd64/amd64/swtch.s
@@ -33,11 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: swtch.s,v 1.68 1998/02/06 12:13:10 eivind Exp $
+ * $Id: swtch.s,v 1.69 1998/03/04 10:25:03 dufault Exp $
*/
#include "npx.h"
-#include "opt_posix4.h"
+#include "opt_posix.h"
#include "opt_user_ldt.h"
#include "opt_vm86.h"
@@ -114,7 +114,7 @@ set1:
movzwl P_RTPRIO_PRIO(%eax),%edx
cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* RR realtime priority? */
-#ifdef POSIX4
+#ifdef P1003_1B
je set_rt /* RT priority */
cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority? */
#endif
@@ -170,7 +170,7 @@ ENTRY(remrq)
movzwl P_RTPRIO_PRIO(%eax),%edx
cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* realtime priority process? */
-#ifdef POSIX4
+#ifdef P1003_1B
je rem0rt
cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority process? */
#endif
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 682914c..c72b9d6 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.420 1998/03/21 14:13:47 peter Exp $
+# $Id: LINT,v 1.421 1998/03/24 02:55:03 yokota Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -618,6 +618,19 @@ options OD_AUTO_TURNOFF
#####################################################################
+# POSIX P1003.1B
+
+# Real time extensions added int the 1993 Posix
+# P1003_1B: Infrastructure
+# _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING
+# _KPOSIX_VERSION: Version kernel is built for
+
+options "P1003_1B"
+options "_KPOSIX_PRIORITY_SCHEDULING"
+options "_KPOSIX_VERSION=199309L"
+
+
+#####################################################################
# MISCELLANEOUS DEVICES AND OPTIONS
# The `pty' device usually turns out to be ``effectively mandatory'',
diff --git a/sys/conf/files b/sys/conf/files
index a7eea28..83bf0fe 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -395,8 +395,9 @@ pci/pci_compat.c optional pci
pci/pcisupport.c optional pci
pci/tek390.c optional amd device-driver
pci/wdc_p.c optional wdc device-driver
-posix4/posix4_mib.c optional posix4
-posix4/ksched.c optional posix4
+posix4/posix4_mib.c optional p1003_1b
+posix4/p1003_1b.c optional p1003_1b
+posix4/ksched.c optional _kposix_priority_scheduling
scsi/cd.c optional cd
scsi/ch.c optional ch
scsi/od.c optional od
diff --git a/sys/conf/options b/sys/conf/options
index 1d4d852..996f1b5 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -1,4 +1,4 @@
-# $Id: options,v 1.68 1998/03/19 22:37:37 dyson Exp $
+# $Id: options,v 1.69 1998/03/21 11:33:49 peter Exp $
#
# On the handling of kernel options
#
@@ -57,8 +57,10 @@ SYSVSEM opt_sysvipc.h
SYSVSHM opt_sysvipc.h
UCONSOLE
-# POSIX 4.
-POSIX4 opt_posix4.h
+# POSIX kernel options
+P1003_1B opt_posix.h
+_KPOSIX_PRIORITY_SCHEDULING opt_posix.h
+_KPOSIX_VERSION opt_posix.h
# Do we want the config file compiled into the kernel?
INCLUDE_CONFIG_FILE opt_config.h
diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT
index 682914c..c72b9d6 100644
--- a/sys/i386/conf/LINT
+++ b/sys/i386/conf/LINT
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.420 1998/03/21 14:13:47 peter Exp $
+# $Id: LINT,v 1.421 1998/03/24 02:55:03 yokota Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -618,6 +618,19 @@ options OD_AUTO_TURNOFF
#####################################################################
+# POSIX P1003.1B
+
+# Real time extensions added int the 1993 Posix
+# P1003_1B: Infrastructure
+# _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING
+# _KPOSIX_VERSION: Version kernel is built for
+
+options "P1003_1B"
+options "_KPOSIX_PRIORITY_SCHEDULING"
+options "_KPOSIX_VERSION=199309L"
+
+
+#####################################################################
# MISCELLANEOUS DEVICES AND OPTIONS
# The `pty' device usually turns out to be ``effectively mandatory'',
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 682914c..c72b9d6 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.420 1998/03/21 14:13:47 peter Exp $
+# $Id: LINT,v 1.421 1998/03/24 02:55:03 yokota Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -618,6 +618,19 @@ options OD_AUTO_TURNOFF
#####################################################################
+# POSIX P1003.1B
+
+# Real time extensions added int the 1993 Posix
+# P1003_1B: Infrastructure
+# _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING
+# _KPOSIX_VERSION: Version kernel is built for
+
+options "P1003_1B"
+options "_KPOSIX_PRIORITY_SCHEDULING"
+options "_KPOSIX_VERSION=199309L"
+
+
+#####################################################################
# MISCELLANEOUS DEVICES AND OPTIONS
# The `pty' device usually turns out to be ``effectively mandatory'',
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 7a63d34..e5f336b 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -33,11 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: swtch.s,v 1.68 1998/02/06 12:13:10 eivind Exp $
+ * $Id: swtch.s,v 1.69 1998/03/04 10:25:03 dufault Exp $
*/
#include "npx.h"
-#include "opt_posix4.h"
+#include "opt_posix.h"
#include "opt_user_ldt.h"
#include "opt_vm86.h"
@@ -114,7 +114,7 @@ set1:
movzwl P_RTPRIO_PRIO(%eax),%edx
cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* RR realtime priority? */
-#ifdef POSIX4
+#ifdef P1003_1B
je set_rt /* RT priority */
cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority? */
#endif
@@ -170,7 +170,7 @@ ENTRY(remrq)
movzwl P_RTPRIO_PRIO(%eax),%edx
cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* realtime priority process? */
-#ifdef POSIX4
+#ifdef P1003_1B
je rem0rt
cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority process? */
#endif
diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h
index 698cc7f..4383dcf 100644
--- a/sys/i386/linux/linux_proto.h
+++ b/sys/i386/linux/linux_proto.h
@@ -10,6 +10,8 @@
#include <sys/signal.h>
+struct proc;
+
struct linux_setup_args {
int dummy;
};
diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h
index a54706f..7d8404c 100644
--- a/sys/i386/linux/linux_syscall.h
+++ b/sys/i386/linux/linux_syscall.h
@@ -148,4 +148,17 @@
#define LINUX_SYS_linux_msync 144
#define LINUX_SYS_readv 145
#define LINUX_SYS_writev 146
-#define LINUX_SYS_MAXSYSCALL 147
+#define LINUX_SYS_mlock 150
+#define LINUX_SYS_munlock 151
+#define LINUX_SYS_mlockall 152
+#define LINUX_SYS_munlockall 153
+#define LINUX_SYS_sched_setparam 154
+#define LINUX_SYS_sched_getparam 155
+#define LINUX_SYS_sched_setscheduler 156
+#define LINUX_SYS_sched_getscheduler 157
+#define LINUX_SYS_sched_yield 158
+#define LINUX_SYS_sched_get_priority_max 159
+#define LINUX_SYS_sched_get_priority_min 160
+#define LINUX_SYS_sched_rr_get_interval 161
+#define LINUX_SYS_nanosleep 162
+#define LINUX_SYS_MAXSYSCALL 163
diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c
index 2f79d4d..512b66a 100644
--- a/sys/i386/linux/linux_sysent.c
+++ b/sys/i386/linux/linux_sysent.c
@@ -168,4 +168,20 @@ struct sysent linux_sysent[] = {
{ 3, (sy_call_t *)linux_msync }, /* 144 = linux_msync */
{ 3, (sy_call_t *)readv }, /* 145 = readv */
{ 3, (sy_call_t *)writev }, /* 146 = writev */
+ { 0, (sy_call_t *)nosys }, /* 147 = getsid */
+ { 0, (sy_call_t *)nosys }, /* 148 = fdatasync */
+ { 0, (sy_call_t *)nosys }, /* 149 = _sysctl */
+ { 2, (sy_call_t *)mlock }, /* 150 = mlock */
+ { 2, (sy_call_t *)munlock }, /* 151 = munlock */
+ { 1, (sy_call_t *)mlockall }, /* 152 = mlockall */
+ { 0, (sy_call_t *)munlockall }, /* 153 = munlockall */
+ { 2, (sy_call_t *)sched_setparam }, /* 154 = sched_setparam */
+ { 2, (sy_call_t *)sched_getparam }, /* 155 = sched_getparam */
+ { 3, (sy_call_t *)sched_setscheduler }, /* 156 = sched_setscheduler */
+ { 1, (sy_call_t *)sched_getscheduler }, /* 157 = sched_getscheduler */
+ { 0, (sy_call_t *)sched_yield }, /* 158 = sched_yield */
+ { 1, (sy_call_t *)sched_get_priority_max }, /* 159 = sched_get_priority_max */
+ { 1, (sy_call_t *)sched_get_priority_min }, /* 160 = sched_get_priority_min */
+ { 2, (sy_call_t *)sched_rr_get_interval }, /* 161 = sched_rr_get_interval */
+ { 2, (sy_call_t *)nanosleep }, /* 162 = nanosleep */
};
diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master
index 910710a..b1ae549 100644
--- a/sys/i386/linux/syscalls.master
+++ b/sys/i386/linux/syscalls.master
@@ -1,4 +1,4 @@
- $Id: syscalls.master,v 1.5 1997/04/09 15:34:09 bde Exp $
+ $Id: syscalls.master,v 1.6 1997/12/17 03:12:35 kato Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from LINUX).
@@ -207,3 +207,29 @@
u_int iovcnt); }
146 NOPROTO LINUX { int writev(int fd, struct iovec *iovp, \
u_int iovcnt); }
+
+; Turn on getsid after checking that it matches.
+
+147 UNIMPL LINUX getsid
+148 UNIMPL LINUX fdatasync
+149 UNIMPL LINUX _sysctl
+
+150 NOPROTO BSD { int mlock(const void *addr, size_t len); }
+151 NOPROTO BSD { int munlock(const void *addr, size_t len); }
+152 NOPROTO BSD { int mlockall(int how); }
+153 NOPROTO BSD { int munlockall(void); }
+
+
+154 NOPROTO POSIX { int sched_setparam (pid_t pid, const struct sched_param *param); }
+155 NOPROTO POSIX { int sched_getparam (pid_t pid, struct sched_param *param); }
+
+156 NOPROTO POSIX { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); }
+157 NOPROTO POSIX { int sched_getscheduler (pid_t pid); }
+
+158 NOPROTO POSIX { int sched_yield (void); }
+159 NOPROTO POSIX { int sched_get_priority_max (int policy); }
+160 NOPROTO POSIX { int sched_get_priority_min (int policy); }
+161 NOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
+
+162 NOPROTO POSIX { int nanosleep(const struct timespec *rqtp, \
+ struct timespec *rmtp); }
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index 7f62e27..7336ac8 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -346,4 +346,12 @@ struct sysent sysent[] = {
{ 1, (sy_call_t *)mlockall }, /* 324 = mlockall */
{ 0, (sy_call_t *)munlockall }, /* 325 = munlockall */
{ 2, (sy_call_t *)__getcwd }, /* 326 = __getcwd */
+ { 2, (sy_call_t *)sched_setparam }, /* 327 = sched_setparam */
+ { 2, (sy_call_t *)sched_getparam }, /* 328 = sched_getparam */
+ { 3, (sy_call_t *)sched_setscheduler }, /* 329 = sched_setscheduler */
+ { 1, (sy_call_t *)sched_getscheduler }, /* 330 = sched_getscheduler */
+ { 0, (sy_call_t *)sched_yield }, /* 331 = sched_yield */
+ { 1, (sy_call_t *)sched_get_priority_max }, /* 332 = sched_get_priority_max */
+ { 1, (sy_call_t *)sched_get_priority_min }, /* 333 = sched_get_priority_min */
+ { 2, (sy_call_t *)sched_rr_get_interval }, /* 334 = sched_rr_get_interval */
};
diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c
index 9718f6b..5278b34 100644
--- a/sys/kern/kern_mib.c
+++ b/sys/kern/kern_mib.c
@@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
- * $Id: kern_mib.c,v 1.13 1997/12/25 13:14:21 gpalmer Exp $
+ * $Id: kern_mib.c,v 1.14 1998/03/04 10:25:50 dufault Exp $
*/
#include <sys/param.h>
@@ -52,8 +52,6 @@
#include <machine/smp.h>
#endif
-#include "opt_posix4.h"
-
SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0,
"Sysctl internal magic");
SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0,
@@ -73,10 +71,8 @@ SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0,
SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0,
"user-level");
-#ifdef POSIX4
-SYSCTL_NODE(, CTL_POSIX4, posix4, CTLFLAG_RW, 0,
- "posix4, (see posix4.h)");
-#endif
+SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0,
+ "p1003_1b, (see p1003_1b.h)");
SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD, osrelease, 0, "");
@@ -96,7 +92,7 @@ SYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid,
SYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD, 0, ARG_MAX, "");
-SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD, 0, _POSIX_VERSION, "");
+SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD, 0, _KPOSIX_VERSION, "");
SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD, 0, NGROUPS_MAX, "");
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 46089c7..c0437d5 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
- * $Id: kern_synch.c,v 1.50 1998/03/11 20:50:42 dufault Exp $
+ * $Id: kern_synch.c,v 1.51 1998/03/28 10:33:06 bde Exp $
*/
#include "opt_ktrace.h"
@@ -105,6 +105,9 @@ static void maybe_resched(struct proc *chk)
struct proc *p = curproc; /* XXX */
/* If the current scheduler is the idle scheduler or
+ * the priority is of the new one is higher then reschedule.
+ */
+ /* If the current scheduler is the idle scheduler or
* the priority of the new one is higher then reschedule.
*/
if (p == 0 ||
diff --git a/sys/kern/ksched.c b/sys/kern/ksched.c
index 7ff85d6..90c029a 100644
--- a/sys/kern/ksched.c
+++ b/sys/kern/ksched.c
@@ -39,34 +39,38 @@
#include <sys/proc.h>
#include <sys/kernel.h>
#include <machine/cpu.h> /* For need_resched */
-#include <fcntl.h>
-#include <sys/posix4.h>
+#include <posix4/posix4.h>
/* ksched: Real-time extension to support POSIX priority scheduling.
*/
-static struct timespec rr_interval;
+struct ksched {
+ struct timespec rr_interval;
+};
-int ksched_attach(int p4_instance, int fac_code, void **p)
+int ksched_attach(struct ksched **p)
{
- rr_interval.tv_sec = 0;
- rr_interval.tv_nsec = 1000000000L / roundrobin_interval();
+ struct ksched *ksched= p31b_malloc(sizeof(*ksched));
- *p = 0;
+ ksched->rr_interval.tv_sec = 0;
+ ksched->rr_interval.tv_nsec = 1000000000L / roundrobin_interval();
+ *p = ksched;
return 0;
}
-int ksched_detach(void *p)
+int ksched_detach(struct ksched *p)
{
+ p31b_free(p);
+
return 0;
}
/*
* XXX About priorities
*
- * POSIX4 requires that numerically higher priorities be of
+ * POSIX 1003.1b requires that numerically higher priorities be of
* higher priority. It also permits sched_setparam to be
* implementation defined for SCHED_OTHER. I don't like
* the notion of inverted priorites for normal processes when
@@ -76,14 +80,14 @@ int ksched_detach(void *p)
*/
/* Macros to convert between the unix (lower numerically is higher priority)
- * and POSIX4 (higher numerically is higher priority)
+ * and POSIX 1003.1b (higher numerically is higher priority)
*/
#define p4prio_to_rtpprio(P) (RTP_PRIO_MAX - (P))
#define rtpprio_to_p4prio(P) (RTP_PRIO_MAX - (P))
static inline int
-getscheduler(int *ret, void *hook, struct proc *p)
+getscheduler(int *ret, struct ksched *ksched, struct proc *p)
{
int e = 0;
@@ -105,25 +109,25 @@ getscheduler(int *ret, void *hook, struct proc *p)
return e;
}
-int ksched_setparam(int *ret, void *hook,
+int ksched_setparam(int *ret, struct ksched *ksched,
struct proc *p, const struct sched_param *param)
{
int e, policy;
- e = getscheduler(&policy, hook, p);
+ e = getscheduler(&policy, ksched, p);
if (e == 0)
{
if (policy == SCHED_OTHER)
e = EINVAL;
else
- e = ksched_setscheduler(ret, hook, p, policy, param);
+ e = ksched_setscheduler(ret, ksched, p, policy, param);
}
return e;
}
-int ksched_getparam(int *ret, void *hook,
+int ksched_getparam(int *ret, struct ksched *ksched,
struct proc *p, struct sched_param *param)
{
if (RTP_PRIO_IS_REALTIME(p->p_rtprio.type))
@@ -136,10 +140,10 @@ int ksched_getparam(int *ret, void *hook,
* XXX The priority and scheduler modifications should
* be moved into published interfaces in kern/kern_sync.
*
- * The permissions to modify process p were checked in "posix4proc()".
+ * The permissions to modify process p were checked in "p31b_proc()".
*
*/
-int ksched_setscheduler(int *ret, void *hook,
+int ksched_setscheduler(int *ret, struct ksched *ksched,
struct proc *p, int policy, const struct sched_param *param)
{
int e = 0;
@@ -186,20 +190,20 @@ int ksched_setscheduler(int *ret, void *hook,
return e;
}
-int ksched_getscheduler(int *ret, void *hook, struct proc *p)
+int ksched_getscheduler(int *ret, struct ksched *ksched, struct proc *p)
{
- return getscheduler(ret, hook, p);
+ return getscheduler(ret, ksched, p);
}
/* ksched_yield: Yield the CPU.
*/
-int ksched_yield(int *ret, void *hook)
+int ksched_yield(int *ret, struct ksched *ksched)
{
need_resched();
return 0;
}
-int ksched_get_priority_max(int *ret, void *hook, int policy)
+int ksched_get_priority_max(int *ret, struct ksched *ksched, int policy)
{
int e = 0;
@@ -221,7 +225,7 @@ int ksched_get_priority_max(int *ret, void *hook, int policy)
return e;
}
-int ksched_get_priority_min(int *ret, void *hook, int policy)
+int ksched_get_priority_min(int *ret, struct ksched *ksched, int policy)
{
int e = 0;
@@ -243,10 +247,10 @@ int ksched_get_priority_min(int *ret, void *hook, int policy)
return e;
}
-int ksched_rr_get_interval(int *ret, void *hook,
+int ksched_rr_get_interval(int *ret, struct ksched *ksched,
struct proc *p, struct timespec *timespec)
{
- *timespec = rr_interval;
+ *timespec = ksched->rr_interval;
return 0;
}
diff --git a/sys/kern/p1003_1b.c b/sys/kern/p1003_1b.c
new file mode 100644
index 0000000..ccbee6b
--- /dev/null
+++ b/sys/kern/p1003_1b.c
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 1996, 1997, 1998
+ * HD Associates, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by HD Associates, Inc
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES 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 HD ASSOCIATES 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.
+ *
+ */
+
+/* p1003_1b: Real Time common code.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sysent.h>
+#include <sys/proc.h>
+#include <sys/syslog.h>
+#include <sys/module.h>
+#include <sys/sysproto.h>
+#include <sys/sysctl.h>
+
+#include <posix4/posix4.h>
+
+MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B");
+
+/* p31b_proc: Return a proc struct corresponding to a pid to operate on.
+ *
+ * Enforce permission policy.
+ *
+ * The policy is the same as for sending signals except there
+ * is no notion of process groups.
+ *
+ * pid == 0 means my process.
+ *
+ * This is disabled until I've got a permission gate in again:
+ * only root can do this.
+ */
+
+#if 0
+/*
+ * This is stolen from CANSIGNAL in kern_sig:
+ *
+ * Can process p, with pcred pc, do "write flavor" operations to process q?
+ */
+#define CAN_AFFECT(p, pc, q) \
+ ((pc)->pc_ucred->cr_uid == 0 || \
+ (pc)->p_ruid == (q)->p_cred->p_ruid || \
+ (pc)->pc_ucred->cr_uid == (q)->p_cred->p_ruid || \
+ (pc)->p_ruid == (q)->p_ucred->cr_uid || \
+ (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid)
+#else
+#define CAN_AFFECT(p, pc, q) ((pc)->pc_ucred->cr_uid == 0)
+#endif
+
+/*
+ * p31b_proc: Look up a proc from a PID. If proc is 0 it is
+ * my own proc.
+ */
+int p31b_proc(struct proc *p, pid_t pid, struct proc **pp)
+{
+ int ret = 0;
+ struct proc *other_proc = 0;
+
+ if (pid == 0)
+ other_proc = p;
+ else
+ other_proc = pfind(pid);
+
+ if (other_proc)
+ {
+ /* Enforce permission policy.
+ */
+ if (CAN_AFFECT(p, p->p_cred, other_proc))
+ *pp = other_proc;
+ else
+ ret = EPERM;
+ }
+ else
+ ret = ESRCH;
+
+ return ret;
+}
+
+int
+syscall_not_present(struct proc *p, const char *s, struct nosys_args *uap)
+{
+ log(LOG_ERR, "cmd %s pid %d tried to use non-present %s\n",
+ p->p_comm, p->p_pid, s);
+ return nosys(p, uap);
+}
+
+#if !defined(_KPOSIX_PRIORITY_SCHEDULING)
+
+/* Not configured but loadable via an LKM:
+ */
+
+static int sched_attach(void)
+{
+ return 0;
+}
+
+SYSCALL_NOT_PRESENT_GEN(sched_setparam)
+SYSCALL_NOT_PRESENT_GEN(sched_getparam)
+SYSCALL_NOT_PRESENT_GEN(sched_setscheduler)
+SYSCALL_NOT_PRESENT_GEN(sched_getscheduler)
+SYSCALL_NOT_PRESENT_GEN(sched_yield)
+SYSCALL_NOT_PRESENT_GEN(sched_get_priority_max)
+SYSCALL_NOT_PRESENT_GEN(sched_get_priority_min)
+SYSCALL_NOT_PRESENT_GEN(sched_rr_get_interval)
+
+#else
+
+/* Configured in kernel version:
+ */
+static struct ksched *ksched;
+
+static int sched_attach(void)
+{
+ int ret = ksched_attach(&ksched);
+
+ if (ret == 0)
+ p31b_setcfg(CTL_P1003_1B_PRIORITY_SCHEDULING, 1);
+
+ return ret;
+}
+
+int sched_setparam(struct proc *p,
+ struct sched_setparam_args *uap)
+{
+ int e;
+
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_setparam(&p->p_retval[0], ksched, p,
+ (const struct sched_param *) &uap->param))
+ );
+
+ return e;
+}
+
+int sched_getparam(struct proc *p,
+ struct sched_getparam_args *uap)
+{
+ int e;
+
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_getparam(&p->p_retval[0], ksched, p, uap->param))
+ );
+
+ return e;
+}
+int sched_setscheduler(struct proc *p,
+ struct sched_setscheduler_args *uap)
+{
+ int e;
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_setscheduler(&p->p_retval[0],
+ ksched, p, uap->policy, uap->param))
+ );
+
+ return e;
+}
+int sched_getscheduler(struct proc *p,
+ struct sched_getscheduler_args *uap)
+{
+ int e;
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_getscheduler(&p->p_retval[0], ksched, p))
+ );
+
+ return e;
+}
+int sched_yield(struct proc *p,
+ struct sched_yield_args *uap)
+{
+ return ksched_yield(&p->p_retval[0], ksched);
+}
+int sched_get_priority_max(struct proc *p,
+ struct sched_get_priority_max_args *uap)
+{
+ return ksched_get_priority_max(&p->p_retval[0],
+ ksched, uap->policy);
+}
+int sched_get_priority_min(struct proc *p,
+ struct sched_get_priority_min_args *uap)
+{
+ return ksched_get_priority_min(&p->p_retval[0],
+ ksched, uap->policy);
+}
+int sched_rr_get_interval(struct proc *p,
+ struct sched_rr_get_interval_args *uap)
+{
+ int e;
+
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_rr_get_interval(&p->p_retval[0], ksched,
+ p, uap->interval))
+ );
+
+ return e;
+}
+
+#endif
+
+static void p31binit(void *notused)
+{
+ (void) sched_attach();
+}
+
+SYSINIT(p31b, SI_SUB_P1003_1B, SI_ORDER_FIRST, p31binit, NULL);
diff --git a/sys/kern/posix4_mib.c b/sys/kern/posix4_mib.c
index 84532b8..523f76b 100644
--- a/sys/kern/posix4_mib.c
+++ b/sys/kern/posix4_mib.c
@@ -34,44 +34,61 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
-#include <sys/unistd.h>
+#include <posix4/posix4.h>
-static int facility[CTL_POSIX4_N_CTLS];
+static int facility[CTL_P1003_1B_MAXID - 1];
+
+/* OID_AUTO isn't working with sysconf(3). I guess I'd have to
+ * modify it to do a lookup by name from the index.
+ * For now I've left it a top-level sysctl.
+ */
+
+#if 1
+
+#define P1B_SYSCTL(num, name) \
+SYSCTL_INT(_p1003_1b, num, \
+ name, CTLFLAG_RD, facility + num - 1, 0, "");
+
+#else
+
+#define P1B_SYSCTL(num, name) \
+SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \
+ name, CTLFLAG_RD, facility + num - 1, 0, "");
+SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
+
+#endif
-#define P4_SYSCTL(num, name) \
- SYSCTL_INT(_posix4, num, name, CTLFLAG_RD, facility + num - 1, 0, "");
-P4_SYSCTL(CTL_POSIX4_ASYNCHRONOUS_IO, asynchronous_io);
-P4_SYSCTL(CTL_POSIX4_MAPPED_FILES, mapped_files);
-P4_SYSCTL(CTL_POSIX4_MEMLOCK, memlock);
-P4_SYSCTL(CTL_POSIX4_MEMLOCK_RANGE, memlock_range);
-P4_SYSCTL(CTL_POSIX4_MEMORY_PROTECTION, memory_protection);
-P4_SYSCTL(CTL_POSIX4_MESSAGE_PASSING, message_passing);
-P4_SYSCTL(CTL_POSIX4_PRIORITIZED_IO, prioritized_io);
-P4_SYSCTL(CTL_POSIX4_PRIORITY_SCHEDULING, priority_scheduling);
-P4_SYSCTL(CTL_POSIX4_REALTIME_SIGNALS, realtime_signals);
-P4_SYSCTL(CTL_POSIX4_SEMAPHORES, semaphores);
-P4_SYSCTL(CTL_POSIX4_FSYNC, fsync);
-P4_SYSCTL(CTL_POSIX4_SHARED_MEMORY_OBJECTS, shared_memory_objects);
-P4_SYSCTL(CTL_POSIX4_SYNCHRONIZED_IO, synchronized_io);
-P4_SYSCTL(CTL_POSIX4_TIMERS, timers);
-P4_SYSCTL(CTL_POSIX4_AIO_LISTIO_MAX, aio_listio_max);
-P4_SYSCTL(CTL_POSIX4_AIO_MAX, aio_max);
-P4_SYSCTL(CTL_POSIX4_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
-P4_SYSCTL(CTL_POSIX4_DELAYTIMER_MAX, delaytimer_max);
-P4_SYSCTL(CTL_POSIX4_MQ_OPEN_MAX, mq_open_max);
-P4_SYSCTL(CTL_POSIX4_PAGESIZE, pagesize);
-P4_SYSCTL(CTL_POSIX4_RTSIG_MAX, rtsig_max);
-P4_SYSCTL(CTL_POSIX4_SEM_NSEMS_MAX, sem_nsems_max);
-P4_SYSCTL(CTL_POSIX4_SEM_VALUE_MAX, sem_value_max);
-P4_SYSCTL(CTL_POSIX4_SIGQUEUE_MAX, sigqueue_max);
-P4_SYSCTL(CTL_POSIX4_TIMER_MAX, timer_max);
+P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io);
+P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
+P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);
+P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range);
+P1B_SYSCTL(CTL_P1003_1B_MEMORY_PROTECTION, memory_protection);
+P1B_SYSCTL(CTL_P1003_1B_MESSAGE_PASSING, message_passing);
+P1B_SYSCTL(CTL_P1003_1B_PRIORITIZED_IO, prioritized_io);
+P1B_SYSCTL(CTL_P1003_1B_PRIORITY_SCHEDULING, priority_scheduling);
+P1B_SYSCTL(CTL_P1003_1B_REALTIME_SIGNALS, realtime_signals);
+P1B_SYSCTL(CTL_P1003_1B_SEMAPHORES, semaphores);
+P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync);
+P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects);
+P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io);
+P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers);
+P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max);
+P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max);
+P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
+P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max);
+P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max);
+P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize);
+P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max);
+P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max);
+P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max);
+P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max);
+P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max);
-/* posix4_facility: Set a facility to a value. This is
- * probably a temporary measure until the LKM code is combined with this.
+/* p31b_setcfg: Set the configuration
*/
-void posix4_facility(int num, int value)
+void p31b_setcfg(int num, int value)
{
- if (num >= 1 && num <= CTL_POSIX4_N_CTLS)
+ if (num >= 1 && num < CTL_P1003_1B_MAXID)
facility[num - 1] = value;
}
diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c
index ee2f340..5a64091 100644
--- a/sys/kern/syscalls.c
+++ b/sys/kern/syscalls.c
@@ -333,4 +333,12 @@ char *syscallnames[] = {
"mlockall", /* 324 = mlockall */
"munlockall", /* 325 = munlockall */
"__getcwd", /* 326 = __getcwd */
+ "sched_setparam", /* 327 = sched_setparam */
+ "sched_getparam", /* 328 = sched_getparam */
+ "sched_setscheduler", /* 329 = sched_setscheduler */
+ "sched_getscheduler", /* 330 = sched_getscheduler */
+ "sched_yield", /* 331 = sched_yield */
+ "sched_get_priority_max", /* 332 = sched_get_priority_max */
+ "sched_get_priority_min", /* 333 = sched_get_priority_min */
+ "sched_rr_get_interval", /* 334 = sched_rr_get_interval */
};
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index a79702e..e233348 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
- $Id: syscalls.master,v 1.47 1998/01/30 11:33:01 phk Exp $
+ $Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp $
; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94
;
; System call name/number master file.
@@ -461,3 +461,14 @@
324 STD BSD { int mlockall(int how); }
325 STD BSD { int munlockall(void); }
326 STD BSD { int __getcwd(u_char *buf, u_int buflen); }
+
+327 STD POSIX { int sched_setparam (pid_t pid, const struct sched_param *param); }
+328 STD POSIX { int sched_getparam (pid_t pid, struct sched_param *param); }
+
+329 STD POSIX { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); }
+330 STD POSIX { int sched_getscheduler (pid_t pid); }
+
+331 STD POSIX { int sched_yield (void); }
+332 STD POSIX { int sched_get_priority_max (int policy); }
+333 STD POSIX { int sched_get_priority_min (int policy); }
+334 STD POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 33e524e..247eef0 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -13,11 +13,11 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
- * $Id: vfs_aio.c,v 1.24 1998/02/25 06:30:15 bde Exp $
+ * $Id: vfs_aio.c,v 1.25 1998/03/28 10:33:09 bde Exp $
*/
/*
- * This file contains support for the POSIX.4 AIO/LIO facility.
+ * This file contains support for the POSIX 1003.1B AIO/LIO facility.
*/
#include <sys/param.h>
diff --git a/sys/posix4/aio.h b/sys/posix4/aio.h
index 25e7d1c..73319ec 100644
--- a/sys/posix4/aio.h
+++ b/sys/posix4/aio.h
@@ -31,26 +31,29 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aio.h,v 1.2 1998/03/08 17:25:11 dufault Exp $
+ * $Id: aio.h,v 1.3 1998/03/23 14:05:25 bde Exp $
*/
/* aio.h: P1003.1B-1993 Asynchronous I/O */
-#ifndef _AIO_H_
-#define _AIO_H_
+#ifndef _P1003_1B_AIO_H_
+#define _P1003_1B_AIO_H_
-#ifdef _POSIX4_INCLUDE_MAYBES
+#include <sys/_posix.h>
#include <sys/types.h>
+
+/* For struct sigevent:
+ */
+#ifdef KERNEL
+#include <sys/signal.h>
+#else
#include <signal.h>
+
+#ifdef _P1003_1B_INCLUDE_MAYBES
#include <time.h>
#include <fcntl.h>
#else
struct timespec;
-#include <sys/types.h>
-#ifdef KERNEL
-#include <sys/signal.h>
-#else
-#include <signal.h>
#endif
#endif
@@ -104,4 +107,4 @@ __END_DECLS
#endif /* KERNEL */
-#endif /* _POSIX4_AIO_H_ */
+#endif /* _P1003_1B_AIO_H_ */
diff --git a/sys/posix4/ksched.c b/sys/posix4/ksched.c
index 7ff85d6..90c029a 100644
--- a/sys/posix4/ksched.c
+++ b/sys/posix4/ksched.c
@@ -39,34 +39,38 @@
#include <sys/proc.h>
#include <sys/kernel.h>
#include <machine/cpu.h> /* For need_resched */
-#include <fcntl.h>
-#include <sys/posix4.h>
+#include <posix4/posix4.h>
/* ksched: Real-time extension to support POSIX priority scheduling.
*/
-static struct timespec rr_interval;
+struct ksched {
+ struct timespec rr_interval;
+};
-int ksched_attach(int p4_instance, int fac_code, void **p)
+int ksched_attach(struct ksched **p)
{
- rr_interval.tv_sec = 0;
- rr_interval.tv_nsec = 1000000000L / roundrobin_interval();
+ struct ksched *ksched= p31b_malloc(sizeof(*ksched));
- *p = 0;
+ ksched->rr_interval.tv_sec = 0;
+ ksched->rr_interval.tv_nsec = 1000000000L / roundrobin_interval();
+ *p = ksched;
return 0;
}
-int ksched_detach(void *p)
+int ksched_detach(struct ksched *p)
{
+ p31b_free(p);
+
return 0;
}
/*
* XXX About priorities
*
- * POSIX4 requires that numerically higher priorities be of
+ * POSIX 1003.1b requires that numerically higher priorities be of
* higher priority. It also permits sched_setparam to be
* implementation defined for SCHED_OTHER. I don't like
* the notion of inverted priorites for normal processes when
@@ -76,14 +80,14 @@ int ksched_detach(void *p)
*/
/* Macros to convert between the unix (lower numerically is higher priority)
- * and POSIX4 (higher numerically is higher priority)
+ * and POSIX 1003.1b (higher numerically is higher priority)
*/
#define p4prio_to_rtpprio(P) (RTP_PRIO_MAX - (P))
#define rtpprio_to_p4prio(P) (RTP_PRIO_MAX - (P))
static inline int
-getscheduler(int *ret, void *hook, struct proc *p)
+getscheduler(int *ret, struct ksched *ksched, struct proc *p)
{
int e = 0;
@@ -105,25 +109,25 @@ getscheduler(int *ret, void *hook, struct proc *p)
return e;
}
-int ksched_setparam(int *ret, void *hook,
+int ksched_setparam(int *ret, struct ksched *ksched,
struct proc *p, const struct sched_param *param)
{
int e, policy;
- e = getscheduler(&policy, hook, p);
+ e = getscheduler(&policy, ksched, p);
if (e == 0)
{
if (policy == SCHED_OTHER)
e = EINVAL;
else
- e = ksched_setscheduler(ret, hook, p, policy, param);
+ e = ksched_setscheduler(ret, ksched, p, policy, param);
}
return e;
}
-int ksched_getparam(int *ret, void *hook,
+int ksched_getparam(int *ret, struct ksched *ksched,
struct proc *p, struct sched_param *param)
{
if (RTP_PRIO_IS_REALTIME(p->p_rtprio.type))
@@ -136,10 +140,10 @@ int ksched_getparam(int *ret, void *hook,
* XXX The priority and scheduler modifications should
* be moved into published interfaces in kern/kern_sync.
*
- * The permissions to modify process p were checked in "posix4proc()".
+ * The permissions to modify process p were checked in "p31b_proc()".
*
*/
-int ksched_setscheduler(int *ret, void *hook,
+int ksched_setscheduler(int *ret, struct ksched *ksched,
struct proc *p, int policy, const struct sched_param *param)
{
int e = 0;
@@ -186,20 +190,20 @@ int ksched_setscheduler(int *ret, void *hook,
return e;
}
-int ksched_getscheduler(int *ret, void *hook, struct proc *p)
+int ksched_getscheduler(int *ret, struct ksched *ksched, struct proc *p)
{
- return getscheduler(ret, hook, p);
+ return getscheduler(ret, ksched, p);
}
/* ksched_yield: Yield the CPU.
*/
-int ksched_yield(int *ret, void *hook)
+int ksched_yield(int *ret, struct ksched *ksched)
{
need_resched();
return 0;
}
-int ksched_get_priority_max(int *ret, void *hook, int policy)
+int ksched_get_priority_max(int *ret, struct ksched *ksched, int policy)
{
int e = 0;
@@ -221,7 +225,7 @@ int ksched_get_priority_max(int *ret, void *hook, int policy)
return e;
}
-int ksched_get_priority_min(int *ret, void *hook, int policy)
+int ksched_get_priority_min(int *ret, struct ksched *ksched, int policy)
{
int e = 0;
@@ -243,10 +247,10 @@ int ksched_get_priority_min(int *ret, void *hook, int policy)
return e;
}
-int ksched_rr_get_interval(int *ret, void *hook,
+int ksched_rr_get_interval(int *ret, struct ksched *ksched,
struct proc *p, struct timespec *timespec)
{
- *timespec = rr_interval;
+ *timespec = ksched->rr_interval;
return 0;
}
diff --git a/sys/posix4/mqueue.h b/sys/posix4/mqueue.h
index 6fcf440..c59a4aa 100644
--- a/sys/posix4/mqueue.h
+++ b/sys/posix4/mqueue.h
@@ -1,7 +1,7 @@
#ifndef _MQUEUE_H_
#define _MQUEUE_H_
-/* mqueue.h: POSIX.4 Message Queues */
+/* mqueue.h: POSIX 1003.1b Message Queues */
/*-
* Copyright (c) 1996, 1997
@@ -36,7 +36,9 @@
*
*/
-#ifdef _POSIX4_INCLUDE_MAYBES
+#include <sys/_posix.h>
+
+#ifdef _P1003_1B_INCLUDE_MAYBES
#include <sys/types.h>
#include <fcntl.h>
#include <time.h>
diff --git a/sys/posix4/p1003_1b.c b/sys/posix4/p1003_1b.c
new file mode 100644
index 0000000..ccbee6b
--- /dev/null
+++ b/sys/posix4/p1003_1b.c
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 1996, 1997, 1998
+ * HD Associates, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by HD Associates, Inc
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES 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 HD ASSOCIATES 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.
+ *
+ */
+
+/* p1003_1b: Real Time common code.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sysent.h>
+#include <sys/proc.h>
+#include <sys/syslog.h>
+#include <sys/module.h>
+#include <sys/sysproto.h>
+#include <sys/sysctl.h>
+
+#include <posix4/posix4.h>
+
+MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B");
+
+/* p31b_proc: Return a proc struct corresponding to a pid to operate on.
+ *
+ * Enforce permission policy.
+ *
+ * The policy is the same as for sending signals except there
+ * is no notion of process groups.
+ *
+ * pid == 0 means my process.
+ *
+ * This is disabled until I've got a permission gate in again:
+ * only root can do this.
+ */
+
+#if 0
+/*
+ * This is stolen from CANSIGNAL in kern_sig:
+ *
+ * Can process p, with pcred pc, do "write flavor" operations to process q?
+ */
+#define CAN_AFFECT(p, pc, q) \
+ ((pc)->pc_ucred->cr_uid == 0 || \
+ (pc)->p_ruid == (q)->p_cred->p_ruid || \
+ (pc)->pc_ucred->cr_uid == (q)->p_cred->p_ruid || \
+ (pc)->p_ruid == (q)->p_ucred->cr_uid || \
+ (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid)
+#else
+#define CAN_AFFECT(p, pc, q) ((pc)->pc_ucred->cr_uid == 0)
+#endif
+
+/*
+ * p31b_proc: Look up a proc from a PID. If proc is 0 it is
+ * my own proc.
+ */
+int p31b_proc(struct proc *p, pid_t pid, struct proc **pp)
+{
+ int ret = 0;
+ struct proc *other_proc = 0;
+
+ if (pid == 0)
+ other_proc = p;
+ else
+ other_proc = pfind(pid);
+
+ if (other_proc)
+ {
+ /* Enforce permission policy.
+ */
+ if (CAN_AFFECT(p, p->p_cred, other_proc))
+ *pp = other_proc;
+ else
+ ret = EPERM;
+ }
+ else
+ ret = ESRCH;
+
+ return ret;
+}
+
+int
+syscall_not_present(struct proc *p, const char *s, struct nosys_args *uap)
+{
+ log(LOG_ERR, "cmd %s pid %d tried to use non-present %s\n",
+ p->p_comm, p->p_pid, s);
+ return nosys(p, uap);
+}
+
+#if !defined(_KPOSIX_PRIORITY_SCHEDULING)
+
+/* Not configured but loadable via an LKM:
+ */
+
+static int sched_attach(void)
+{
+ return 0;
+}
+
+SYSCALL_NOT_PRESENT_GEN(sched_setparam)
+SYSCALL_NOT_PRESENT_GEN(sched_getparam)
+SYSCALL_NOT_PRESENT_GEN(sched_setscheduler)
+SYSCALL_NOT_PRESENT_GEN(sched_getscheduler)
+SYSCALL_NOT_PRESENT_GEN(sched_yield)
+SYSCALL_NOT_PRESENT_GEN(sched_get_priority_max)
+SYSCALL_NOT_PRESENT_GEN(sched_get_priority_min)
+SYSCALL_NOT_PRESENT_GEN(sched_rr_get_interval)
+
+#else
+
+/* Configured in kernel version:
+ */
+static struct ksched *ksched;
+
+static int sched_attach(void)
+{
+ int ret = ksched_attach(&ksched);
+
+ if (ret == 0)
+ p31b_setcfg(CTL_P1003_1B_PRIORITY_SCHEDULING, 1);
+
+ return ret;
+}
+
+int sched_setparam(struct proc *p,
+ struct sched_setparam_args *uap)
+{
+ int e;
+
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_setparam(&p->p_retval[0], ksched, p,
+ (const struct sched_param *) &uap->param))
+ );
+
+ return e;
+}
+
+int sched_getparam(struct proc *p,
+ struct sched_getparam_args *uap)
+{
+ int e;
+
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_getparam(&p->p_retval[0], ksched, p, uap->param))
+ );
+
+ return e;
+}
+int sched_setscheduler(struct proc *p,
+ struct sched_setscheduler_args *uap)
+{
+ int e;
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_setscheduler(&p->p_retval[0],
+ ksched, p, uap->policy, uap->param))
+ );
+
+ return e;
+}
+int sched_getscheduler(struct proc *p,
+ struct sched_getscheduler_args *uap)
+{
+ int e;
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_getscheduler(&p->p_retval[0], ksched, p))
+ );
+
+ return e;
+}
+int sched_yield(struct proc *p,
+ struct sched_yield_args *uap)
+{
+ return ksched_yield(&p->p_retval[0], ksched);
+}
+int sched_get_priority_max(struct proc *p,
+ struct sched_get_priority_max_args *uap)
+{
+ return ksched_get_priority_max(&p->p_retval[0],
+ ksched, uap->policy);
+}
+int sched_get_priority_min(struct proc *p,
+ struct sched_get_priority_min_args *uap)
+{
+ return ksched_get_priority_min(&p->p_retval[0],
+ ksched, uap->policy);
+}
+int sched_rr_get_interval(struct proc *p,
+ struct sched_rr_get_interval_args *uap)
+{
+ int e;
+
+ (void) (0
+ || (e = p31b_proc(p, uap->pid, &p))
+ || (e = ksched_rr_get_interval(&p->p_retval[0], ksched,
+ p, uap->interval))
+ );
+
+ return e;
+}
+
+#endif
+
+static void p31binit(void *notused)
+{
+ (void) sched_attach();
+}
+
+SYSINIT(p31b, SI_SUB_P1003_1B, SI_ORDER_FIRST, p31binit, NULL);
diff --git a/sys/posix4/posix4.h b/sys/posix4/posix4.h
index 99ba882..dd3418c 100644
--- a/sys/posix4/posix4.h
+++ b/sys/posix4/posix4.h
@@ -1,5 +1,5 @@
-#ifndef _POSIX4_POSIX4_H_
-#define _POSIX4_POSIX4_H_
+#ifndef _P1003_1B_P1003_1B_H_
+#define _P1003_1B_P1003_1B_H_
/*-
* Copyright (c) 1996, 1997, 1998
* HD Associates, Inc. All rights reserved.
@@ -33,56 +33,40 @@
*
*/
-#include <sys/_posix.h>
+#include "opt_posix.h"
-#ifdef _POSIX4_VISIBLE
+#ifdef P1003_1B
#include <sys/param.h>
#include <sys/ioccom.h>
-#include <sched.h>
+#include <sys/malloc.h>
+#include <posix4/sched.h>
-/*
- *
- * March 1, 1998: Details from here on change and this header file
- * is volatile.
- *
- * Locally I've got PRIORITY SCHEDULING
- * set as a system call available only to root
- * and I'm still using a pseudo device to gate everything else.
- *
- * This interface vectors us into the kernel through a
- * POSIX4 pseudo device with some user privilege authorization along
- * the way.
- *
- * XXX I'm going with option 3.
- *
- * This has drawbacks from the point of view of ktrace. There
- * are (at least) three ways to do this:
- *
- * 1. As it is being done, which is bad for ktrace and is hokey
- * but is easy to extend during development;
- * 2. Add a system call for every POSIX4 entry point, which
- * will result in many more system calls (on the order of 64)
- * 3. Add a system call for each POSIX4 option, which is a bit more
- * useful for ktrace and will add only about 14 new system calls.
- *
+/* Generate syscall stubs for when something is optionally
+ * LKM'd. References "syscall_not_present".
+ * XXX Good candidate for sys/syscall.h
*/
+struct proc;
+struct nosys_args;
+extern int syscall_not_present(struct proc *, const char *, struct nosys_args *);
-#define POSIX4_FACILITIES 16
-#define POSIX4_ONE_ONLY
+#define SYSCALL_NOT_PRESENT_GEN(SC) \
+int SC (struct proc *p, struct SC##_args *uap) \
+{ \
+ return syscall_not_present(p, #SC , (struct nosys_args *)uap); \
+}
-/*
- * All facility request structures have a posix4_dispatch header
- * at the front. Return values are always an indication of
- * success or failure and are automatically converted into an errno
- * by the kernel. "Non-errno" return codes are handled via ret.
- */
-struct posix4_dispatch {
- int op;
- int ret;
-};
-#if defined(_POSIX_PRIORITY_SCHEDULING)
+MALLOC_DECLARE(M_P31B);
+
+#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK)
+#define p31b_free(P) free((P), M_P31B)
+
+int p31b_proc __P((struct proc *, pid_t, struct proc **));
+
+void p31b_setcfg __P((int, int));
+
+#ifdef _KPOSIX_PRIORITY_SCHEDULING
/*
* KSCHED_OP_RW is a vector of read/write flags for each entry indexed
@@ -106,187 +90,29 @@ enum ksched_op {
SCHED_OP_MAX
};
-struct ksched
-{
- struct posix4_dispatch dispatch;
- pid_t pid;
- int policy;
- struct sched_param param;
- struct timespec interval;
-};
-
-#endif /* _POSIX_PRIORITY_SCHEDULING */
-
-#if defined(_POSIX_MEMLOCK) ^ defined(_POSIX_MEMLOCK_RANGE)
-/* This implementation expects these two options to always be together.
- * If one isn't handled it should be disabled at
- * run time.
- */
-#error _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE should always be together
-#endif
-
-#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE)
-
-enum kmemlock_op {
-
-#define KMEMLOCK_OP_RW { 1, 1, 1, 1 }
-
- MEMLOCK_MLOCKALL,
- MEMLOCK_MUNLOCKALL,
- MEMLOCK_MLOCK,
- MEMLOCK_MUNLOCK,
- MEMLOCK_OP_MAX
-};
-
-struct kmemlock
-{
- struct posix4_dispatch dispatch;
- int flags;
- void *addr;
- size_t len;
-};
-
-#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */
-
-#if defined(KERNEL)
-
-struct proc;
-
-void *posix4malloc __P((int *, size_t));
-void posix4free __P((int *, void *));
-int posix4proc __P((struct proc *, pid_t, struct proc **));
-int posix4ioctl __P((dev_t, int, caddr_t, int, struct proc *));
-void posix4attach __P((int));
-void posix4_facility __P((int, int));
-
-struct lkm_table;
-int posix4_init __P((struct lkm_table *, int , int ));
+struct ksched;
-#ifdef _POSIX_PRIORITY_SCHEDULING
+int ksched_attach(struct ksched **);
+int ksched_detach(struct ksched *);
-int ksched_attach(int, int, void **);
-int ksched_detach(void *);
-
-int ksched_setparam(int *, void *,
+int ksched_setparam(int *, struct ksched *,
struct proc *, const struct sched_param *);
-int ksched_getparam(int *, void *,
+int ksched_getparam(int *, struct ksched *,
struct proc *, struct sched_param *);
-int ksched_setscheduler(int *, void *,
+int ksched_setscheduler(int *, struct ksched *,
struct proc *, int, const struct sched_param *);
-int ksched_getscheduler(int *, void *, struct proc *);
-
-int ksched_yield(int *, void *);
-
-int ksched_get_priority_max(int *, void *, int);
-int ksched_get_priority_min(int *, void *, int);
-
-int ksched_rr_get_interval(int *, void *, struct proc *, struct timespec *);
-
-#endif /* _POSIX_PRIORITY_SCHEDULING */
-
-#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE)
+int ksched_getscheduler(int *, struct ksched *, struct proc *);
-int kmemlock_attach(int, int, void **);
-int kmemlock_detach(void *);
-int kmlockall(int *, void *, int);
-int kmunlockall(int *, void *);
-int kmlock(int *, void *, const void *, size_t);
-int kmunlock(int *, void *, const void *, size_t );
+int ksched_yield(int *, struct ksched *);
-#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */
+int ksched_get_priority_max(int *, struct ksched *, int);
+int ksched_get_priority_min(int *, struct ksched *, int);
-#endif /* KERNEL */
+int ksched_rr_get_interval(int *, struct ksched *, struct proc *, struct timespec *);
-/* A facility is an implementation of one of the optional portions of
- * POSIX4 as selected by the feature test macros, such as the fixed
- * priority scheduler or the realtime signals.
- */
-
-/* Each facility has a facility code, an opcode, and r-w attributes.
- * To exercise the operation associated with an opcode you need the
- * appropriate privileges on the POSIX4 device with the facility
- * bit set in the minor number. This means that every facility has
- * a protection bit: Probably more than we need, but it may have
- * advantages.
- *
- */
-
-#define posix4encode(FACILITY, RW) (FACILITY)
-#define posix4decode(X, FACILITY_P) \
- do { \
- *(FACILITY_P) = ((X) & 0xff); \
- } while (0)
-
-/*
- * The dispatch codes:
- */
-#define IO_POSIX4_PRIORITY_SCHEDULING _IOWR('r', \
- CTL_POSIX4_PRIORITY_SCHEDULING, struct ksched)
+#endif /* _KPOSIX_PRIORITY_SCHEDULING */
-#define IO_POSIX4_MEMLOCK _IOWR('r', \
- CTL_POSIX4_MEMLOCK, struct ksched)
-
-/*
- * CTL_POSIX4 definitions for syscfg
- */
-
-#define CTL_POSIX4_ASYNCHRONOUS_IO 1 /* boolean */
-#define CTL_POSIX4_MAPPED_FILES 2 /* boolean */
-#define CTL_POSIX4_MEMLOCK 3 /* boolean */
-#define CTL_POSIX4_MEMLOCK_RANGE 4 /* boolean */
-#define CTL_POSIX4_MEMORY_PROTECTION 5 /* boolean */
-#define CTL_POSIX4_MESSAGE_PASSING 6 /* boolean */
-#define CTL_POSIX4_PRIORITIZED_IO 7 /* boolean */
-#define CTL_POSIX4_PRIORITY_SCHEDULING 8 /* boolean */
-#define CTL_POSIX4_REALTIME_SIGNALS 9 /* boolean */
-#define CTL_POSIX4_SEMAPHORES 10 /* boolean */
-#define CTL_POSIX4_FSYNC 11 /* boolean */
-#define CTL_POSIX4_SHARED_MEMORY_OBJECTS 12 /* boolean */
-#define CTL_POSIX4_SYNCHRONIZED_IO 13 /* boolean */
-#define CTL_POSIX4_TIMERS 14 /* boolean */
-#define CTL_POSIX4_AIO_LISTIO_MAX 15 /* int */
-#define CTL_POSIX4_AIO_MAX 16 /* int */
-#define CTL_POSIX4_AIO_PRIO_DELTA_MAX 17 /* int */
-#define CTL_POSIX4_DELAYTIMER_MAX 18 /* int */
-#define CTL_POSIX4_MQ_OPEN_MAX 19 /* int */
-#define CTL_POSIX4_PAGESIZE 20 /* int */
-#define CTL_POSIX4_RTSIG_MAX 21 /* int */
-#define CTL_POSIX4_SEM_NSEMS_MAX 22 /* int */
-#define CTL_POSIX4_SEM_VALUE_MAX 23 /* int */
-#define CTL_POSIX4_SIGQUEUE_MAX 24 /* int */
-#define CTL_POSIX4_TIMER_MAX 25 /* int */
-
-#define CTL_POSIX4_N_CTLS 25
-
-#define CTL_POSIX4_NAMES { \
- { 0, 0 }, \
- { "asynchronous_io", CTLTYPE_INT }, \
- { "mapped_files", CTLTYPE_INT }, \
- { "memlock", CTLTYPE_INT }, \
- { "memlock_range", CTLTYPE_INT }, \
- { "memory_protection", CTLTYPE_INT }, \
- { "message_passing", CTLTYPE_INT }, \
- { "prioritized_io", CTLTYPE_INT }, \
- { "priority_scheduling", CTLTYPE_INT }, \
- { "realtime_signals", CTLTYPE_INT }, \
- { "semaphores", CTLTYPE_INT }, \
- { "fsync", CTLTYPE_INT }, \
- { "shared_memory_objects", CTLTYPE_INT }, \
- { "synchronized_io", CTLTYPE_INT }, \
- { "timers", CTLTYPE_INT }, \
- { "aio_listio_max", CTLTYPE_INT }, \
- { "aio_max", CTLTYPE_INT }, \
- { "aio_prio_delta_max", CTLTYPE_INT }, \
- { "delaytimer_max", CTLTYPE_INT }, \
- { "mq_open_max", CTLTYPE_INT }, \
- { "pagesize", CTLTYPE_INT }, \
- { "rtsig_max", CTLTYPE_INT }, \
- { "nsems_max", CTLTYPE_INT }, \
- { "sem_value_max", CTLTYPE_INT }, \
- { "sigqueue_max", CTLTYPE_INT }, \
- { "timer_max", CTLTYPE_INT }, \
-}
-#endif /* _POSIX4_VISIBLE */
-#endif /* _POSIX4_POSIX4_H_ */
+#endif /* P1003_1B */
+#endif /* _P1003_1B_P1003_1B_H_ */
diff --git a/sys/posix4/posix4_mib.c b/sys/posix4/posix4_mib.c
index 84532b8..523f76b 100644
--- a/sys/posix4/posix4_mib.c
+++ b/sys/posix4/posix4_mib.c
@@ -34,44 +34,61 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
-#include <sys/unistd.h>
+#include <posix4/posix4.h>
-static int facility[CTL_POSIX4_N_CTLS];
+static int facility[CTL_P1003_1B_MAXID - 1];
+
+/* OID_AUTO isn't working with sysconf(3). I guess I'd have to
+ * modify it to do a lookup by name from the index.
+ * For now I've left it a top-level sysctl.
+ */
+
+#if 1
+
+#define P1B_SYSCTL(num, name) \
+SYSCTL_INT(_p1003_1b, num, \
+ name, CTLFLAG_RD, facility + num - 1, 0, "");
+
+#else
+
+#define P1B_SYSCTL(num, name) \
+SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \
+ name, CTLFLAG_RD, facility + num - 1, 0, "");
+SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
+
+#endif
-#define P4_SYSCTL(num, name) \
- SYSCTL_INT(_posix4, num, name, CTLFLAG_RD, facility + num - 1, 0, "");
-P4_SYSCTL(CTL_POSIX4_ASYNCHRONOUS_IO, asynchronous_io);
-P4_SYSCTL(CTL_POSIX4_MAPPED_FILES, mapped_files);
-P4_SYSCTL(CTL_POSIX4_MEMLOCK, memlock);
-P4_SYSCTL(CTL_POSIX4_MEMLOCK_RANGE, memlock_range);
-P4_SYSCTL(CTL_POSIX4_MEMORY_PROTECTION, memory_protection);
-P4_SYSCTL(CTL_POSIX4_MESSAGE_PASSING, message_passing);
-P4_SYSCTL(CTL_POSIX4_PRIORITIZED_IO, prioritized_io);
-P4_SYSCTL(CTL_POSIX4_PRIORITY_SCHEDULING, priority_scheduling);
-P4_SYSCTL(CTL_POSIX4_REALTIME_SIGNALS, realtime_signals);
-P4_SYSCTL(CTL_POSIX4_SEMAPHORES, semaphores);
-P4_SYSCTL(CTL_POSIX4_FSYNC, fsync);
-P4_SYSCTL(CTL_POSIX4_SHARED_MEMORY_OBJECTS, shared_memory_objects);
-P4_SYSCTL(CTL_POSIX4_SYNCHRONIZED_IO, synchronized_io);
-P4_SYSCTL(CTL_POSIX4_TIMERS, timers);
-P4_SYSCTL(CTL_POSIX4_AIO_LISTIO_MAX, aio_listio_max);
-P4_SYSCTL(CTL_POSIX4_AIO_MAX, aio_max);
-P4_SYSCTL(CTL_POSIX4_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
-P4_SYSCTL(CTL_POSIX4_DELAYTIMER_MAX, delaytimer_max);
-P4_SYSCTL(CTL_POSIX4_MQ_OPEN_MAX, mq_open_max);
-P4_SYSCTL(CTL_POSIX4_PAGESIZE, pagesize);
-P4_SYSCTL(CTL_POSIX4_RTSIG_MAX, rtsig_max);
-P4_SYSCTL(CTL_POSIX4_SEM_NSEMS_MAX, sem_nsems_max);
-P4_SYSCTL(CTL_POSIX4_SEM_VALUE_MAX, sem_value_max);
-P4_SYSCTL(CTL_POSIX4_SIGQUEUE_MAX, sigqueue_max);
-P4_SYSCTL(CTL_POSIX4_TIMER_MAX, timer_max);
+P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io);
+P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
+P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);
+P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range);
+P1B_SYSCTL(CTL_P1003_1B_MEMORY_PROTECTION, memory_protection);
+P1B_SYSCTL(CTL_P1003_1B_MESSAGE_PASSING, message_passing);
+P1B_SYSCTL(CTL_P1003_1B_PRIORITIZED_IO, prioritized_io);
+P1B_SYSCTL(CTL_P1003_1B_PRIORITY_SCHEDULING, priority_scheduling);
+P1B_SYSCTL(CTL_P1003_1B_REALTIME_SIGNALS, realtime_signals);
+P1B_SYSCTL(CTL_P1003_1B_SEMAPHORES, semaphores);
+P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync);
+P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects);
+P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io);
+P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers);
+P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max);
+P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max);
+P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
+P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max);
+P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max);
+P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize);
+P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max);
+P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max);
+P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max);
+P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max);
+P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max);
-/* posix4_facility: Set a facility to a value. This is
- * probably a temporary measure until the LKM code is combined with this.
+/* p31b_setcfg: Set the configuration
*/
-void posix4_facility(int num, int value)
+void p31b_setcfg(int num, int value)
{
- if (num >= 1 && num <= CTL_POSIX4_N_CTLS)
+ if (num >= 1 && num < CTL_P1003_1B_MAXID)
facility[num - 1] = value;
}
diff --git a/sys/posix4/sched.h b/sys/posix4/sched.h
index 50bc3c6..bd04933 100644
--- a/sys/posix4/sched.h
+++ b/sys/posix4/sched.h
@@ -1,7 +1,7 @@
#ifndef _SCHED_H_
#define _SCHED_H_
-/* sched.h: POSIX.4 Process Scheduling header */
+/* sched.h: POSIX 1003.1b Process Scheduling header */
/*-
* Copyright (c) 1996, 1997
@@ -37,7 +37,6 @@
*
*/
-#include <unistd.h>
#include <sys/types.h> /* For pid_t */
#ifndef KERNEL
diff --git a/sys/posix4/semaphore.h b/sys/posix4/semaphore.h
index 02cde3e..f57a96f 100644
--- a/sys/posix4/semaphore.h
+++ b/sys/posix4/semaphore.h
@@ -1,7 +1,7 @@
#ifndef _SEMAPHORE_H_
#define _SEMAPHORE_H_
-/* semaphore.h: POSIX.4 semaphores */
+/* semaphore.h: POSIX 1003.1b semaphores */
/*-
* Copyright (c) 1996, 1997
@@ -36,7 +36,9 @@
*
*/
-#ifdef _POSIX4_INCLUDE_MAYBES
+#include <sys/_posix.h>
+
+#ifdef _P1003_1B_INCLUDE_MAYBES
#include <sys/types.h>
#include <fcntl.h>
#endif
diff --git a/sys/sys/_posix.h b/sys/sys/_posix.h
index daf4fe2..143596b 100644
--- a/sys/sys/_posix.h
+++ b/sys/sys/_posix.h
@@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: $
+ * $Id: _posix.h,v 1.1 1998/03/08 17:25:27 dufault Exp $
*/
/*
@@ -39,35 +39,59 @@
*
*/
-#ifndef _POSIX_VERSION
-#define _POSIX_VERSION 199009L
+#ifdef KERNEL
+
+#ifndef ACTUALLY_LKM_NOT_KERNEL
+#include "opt_posix.h"
#endif
-/* Test for visibility of pre-existing POSIX.4 features that should really
- * be conditional. If _POSIX_C_SOURCE and _POSIX_SOURCE are not
- * defined then permit the pre-existing features to show up:
+/* Only kern_mib.c uses _POSIX_VERSION. Introduce a kernel
+ * one to avoid other pieces of the kernel getting dependant
+ * on that.
+ * XXX Complain if you think this dumb.
+ */
+
+/* Make P1003 structures visible for the kernel if
+ * the P1003_1B option is in effect.
*/
-#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
-#define _POSIX4_VISIBLE_HISTORICALLY
+#ifdef P1003_1B
+#define _P1003_1B_VISIBLE
+#ifndef _KPOSIX_VERSION
+#define _KPOSIX_VERSION 199309L
+#endif
+#endif
+
+#ifndef _KPOSIX_VERSION
+#define _KPOSIX_VERSION 199009L
#endif
-/* Test for visibility of additional POSIX.4 features:
+#define _P1003_1B_VISIBLE_HISTORICALLY
+
+#else
+
+/* Default to existing user space version.
*/
-#if _POSIX_VERSION >= 199309L && \
- (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE >= 199309L)
-#define _POSIX4_VISIBLE
-#define _POSIX4_VISIBLE_HISTORICALLY
+#ifndef _POSIX_VERSION
+#define _POSIX_VERSION 199009L
#endif
-/* I'm not sure if I'm allowed to do this, but at least initially
- * it may catch some teething problems:
+/* Test for visibility of P1003.1B features:
+ * If _POSIX_SOURCE and POSIX_C_SOURCE are completely undefined
+ * they show up.
+ *
+ * If they specify a version including P1003.1B then they show up.
+ *
+ * (Two macros are added to permit hiding new extensions while
+ * keeping historic BSD features - that is not done now)
+ *
*/
-#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE > _POSIX_VERSION)
-#error _POSIX_C_SOURCE > _POSIX_VERSION
+#if (!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)) || \
+ (_POSIX_VERSION >= 199309L && defined(_POSIX_C_SOURCE) && \
+ _POSIX_C_SOURCE >= 199309L)
+#define _P1003_1B_VISIBLE
+#define _P1003_1B_VISIBLE_HISTORICALLY
#endif
-#define POSIX4_VISIBLE You missed the leading _!!
-#define POSIX4_VISIBLE_FORCEABLY You left the old define in the code!!
-
+#endif /* not KERNEL */
#endif /* _SYS__POSIX_H_ */
diff --git a/sys/sys/_sigset.h b/sys/sys/_sigset.h
index ee3cabb..c02f9d8 100644
--- a/sys/sys/_sigset.h
+++ b/sys/sys/_sigset.h
@@ -36,13 +36,14 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.4 (Berkeley) 5/4/95
- * $Id: signal.h,v 1.11 1997/02/22 09:45:53 peter Exp $
+ * $Id: signal.h,v 1.12 1997/09/13 19:42:29 joerg Exp $
*/
#ifndef _SYS_SIGNAL_H_
#define _SYS_SIGNAL_H_
#include <sys/cdefs.h>
+#include <sys/_posix.h>
#include <machine/signal.h> /* sig_atomic_t; trap codes; sigcontext */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
@@ -198,6 +199,32 @@ struct sigstack {
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
+#ifdef _P1003_1B_VISIBLE_HISTORICALLY
+
+/* sys/aio.h unconditionally defined these */
+
+union sigval {
+ int sival_int; /* Integer signal value */
+ void *sival_ptr; /* Pointer signal value */
+};
+
+typedef struct siginfo {
+ int si_signo; /* Signal number */
+ int si_code; /* Cause of the signal */
+ union sigval si_value; /* Signal value */
+} siginfo_t;
+
+struct sigevent {
+ int sigev_notify; /* Notification type */
+ int sigev_signo; /* Signal number */
+ union sigval sigev_value; /* Signal value */
+};
+
+#define SIGEV_NONE 0 /* No async notification */
+#define SIGEV_SIGNAL 1 /* Generate a queued signal */
+
+#endif
+
/*
* For historical reasons; programs expect signal's return value to be
* defined by <sys/signal.h>.
diff --git a/sys/sys/aio.h b/sys/sys/aio.h
index 24a2ad7..29d2605 100644
--- a/sys/sys/aio.h
+++ b/sys/sys/aio.h
@@ -16,37 +16,11 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
- * $Id: aio.h,v 1.5 1998/03/08 22:21:12 dufault Exp $
+ * $Id: aio.h,v 1.6 1998/03/09 00:15:08 dufault Exp $
*/
#include <sys/types.h>
-
-/**************************************************************************/
-/* Additions to signal.h -- hack alert. */
-/**************************************************************************/
-/*
- * sigval structure:
- */
-union sigval {
- int sival_int;
- void *sival_ptr;
-};
-
-/*
- * this is the sigevent structure:
- */
-struct sigevent {
- int sigev_notify; /* Notification */
- int sigev_signo; /* Signal number */
- union sigval sigev_value; /* Not used yet in FreeBSD */
-};
-
-/*
- * values for sigev_notify:
- */
-#define SIGEV_NONE 0 /* Don't post a signal */
-#define SIGEV_SIGNAL 1 /* Post specified signal */
-
+#include <sys/signal.h>
/*
* Returned by aio_cancel:
* (Note that FreeBSD's aio is not cancellable -- yet.)
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index dcd682e..e5c14f6 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)kernel.h 8.3 (Berkeley) 1/21/94
- * $Id: kernel.h,v 1.35 1997/11/18 07:23:40 bde Exp $
+ * $Id: kernel.h,v 1.36 1997/12/12 04:00:47 dyson Exp $
*/
#ifndef _SYS_KERNEL_H_
@@ -157,6 +157,7 @@ enum sysinit_sub_id {
SI_SUB_SYSV_SHM = 0x64000000, /* System V shared memory*/
SI_SUB_SYSV_SEM = 0x68000000, /* System V semaphores*/
SI_SUB_SYSV_MSG = 0x6C000000, /* System V message queues*/
+ SI_SUB_P1003_1B = 0x6E000000, /* P1003.1B realtime */
SI_SUB_PSEUDO = 0x70000000, /* pseudo devices*/
SI_SUB_PROTO_BEGIN = 0x80000000, /* XXX: set splimp (kludge)*/
SI_SUB_PROTO_IF = 0x84000000, /* interfaces*/
diff --git a/sys/sys/mman.h b/sys/sys/mman.h
index 764ef35..1ef5669 100644
--- a/sys/sys/mman.h
+++ b/sys/sys/mman.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mman.h 8.2 (Berkeley) 1/9/95
- * $Id: mman.h,v 1.21 1998/03/04 10:26:35 dufault Exp $
+ * $Id: mman.h,v 1.22 1998/03/08 17:25:33 dufault Exp $
*/
#ifndef _SYS_MMAN_H_
@@ -65,14 +65,14 @@
#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */
#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
-#ifdef _POSIX4_VISIBLE
+#ifdef _P1003_1B_VISIBLE
/*
* Process memory locking
*/
#define MCL_CURRENT 0x0001 /* Lock only current memory */
#define MCL_FUTURE 0x0002 /* Lock all future memory as well */
-#endif /* _POSIX4_VISIBLE */
+#endif /* _P1003_1B_VISIBLE */
/*
* Error return from mmap()
@@ -117,12 +117,12 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
-#ifdef _POSIX4_VISIBLE
+#ifdef _P1003_1B_VISIBLE
int mlockall __P((int));
int munlockall __P((void));
int shm_open __P((const char *, int, mode_t));
int shm_unlink __P((const char *));
-#endif /* _POSIX4_VISIBLE */
+#endif /* _P1003_1B_VISIBLE */
int mlock __P((const void *, size_t));
#ifndef _MMAP_DECLARED
#define _MMAP_DECLARED
diff --git a/sys/sys/posix4.h b/sys/sys/posix4.h
index 99ba882..dd3418c 100644
--- a/sys/sys/posix4.h
+++ b/sys/sys/posix4.h
@@ -1,5 +1,5 @@
-#ifndef _POSIX4_POSIX4_H_
-#define _POSIX4_POSIX4_H_
+#ifndef _P1003_1B_P1003_1B_H_
+#define _P1003_1B_P1003_1B_H_
/*-
* Copyright (c) 1996, 1997, 1998
* HD Associates, Inc. All rights reserved.
@@ -33,56 +33,40 @@
*
*/
-#include <sys/_posix.h>
+#include "opt_posix.h"
-#ifdef _POSIX4_VISIBLE
+#ifdef P1003_1B
#include <sys/param.h>
#include <sys/ioccom.h>
-#include <sched.h>
+#include <sys/malloc.h>
+#include <posix4/sched.h>
-/*
- *
- * March 1, 1998: Details from here on change and this header file
- * is volatile.
- *
- * Locally I've got PRIORITY SCHEDULING
- * set as a system call available only to root
- * and I'm still using a pseudo device to gate everything else.
- *
- * This interface vectors us into the kernel through a
- * POSIX4 pseudo device with some user privilege authorization along
- * the way.
- *
- * XXX I'm going with option 3.
- *
- * This has drawbacks from the point of view of ktrace. There
- * are (at least) three ways to do this:
- *
- * 1. As it is being done, which is bad for ktrace and is hokey
- * but is easy to extend during development;
- * 2. Add a system call for every POSIX4 entry point, which
- * will result in many more system calls (on the order of 64)
- * 3. Add a system call for each POSIX4 option, which is a bit more
- * useful for ktrace and will add only about 14 new system calls.
- *
+/* Generate syscall stubs for when something is optionally
+ * LKM'd. References "syscall_not_present".
+ * XXX Good candidate for sys/syscall.h
*/
+struct proc;
+struct nosys_args;
+extern int syscall_not_present(struct proc *, const char *, struct nosys_args *);
-#define POSIX4_FACILITIES 16
-#define POSIX4_ONE_ONLY
+#define SYSCALL_NOT_PRESENT_GEN(SC) \
+int SC (struct proc *p, struct SC##_args *uap) \
+{ \
+ return syscall_not_present(p, #SC , (struct nosys_args *)uap); \
+}
-/*
- * All facility request structures have a posix4_dispatch header
- * at the front. Return values are always an indication of
- * success or failure and are automatically converted into an errno
- * by the kernel. "Non-errno" return codes are handled via ret.
- */
-struct posix4_dispatch {
- int op;
- int ret;
-};
-#if defined(_POSIX_PRIORITY_SCHEDULING)
+MALLOC_DECLARE(M_P31B);
+
+#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK)
+#define p31b_free(P) free((P), M_P31B)
+
+int p31b_proc __P((struct proc *, pid_t, struct proc **));
+
+void p31b_setcfg __P((int, int));
+
+#ifdef _KPOSIX_PRIORITY_SCHEDULING
/*
* KSCHED_OP_RW is a vector of read/write flags for each entry indexed
@@ -106,187 +90,29 @@ enum ksched_op {
SCHED_OP_MAX
};
-struct ksched
-{
- struct posix4_dispatch dispatch;
- pid_t pid;
- int policy;
- struct sched_param param;
- struct timespec interval;
-};
-
-#endif /* _POSIX_PRIORITY_SCHEDULING */
-
-#if defined(_POSIX_MEMLOCK) ^ defined(_POSIX_MEMLOCK_RANGE)
-/* This implementation expects these two options to always be together.
- * If one isn't handled it should be disabled at
- * run time.
- */
-#error _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE should always be together
-#endif
-
-#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE)
-
-enum kmemlock_op {
-
-#define KMEMLOCK_OP_RW { 1, 1, 1, 1 }
-
- MEMLOCK_MLOCKALL,
- MEMLOCK_MUNLOCKALL,
- MEMLOCK_MLOCK,
- MEMLOCK_MUNLOCK,
- MEMLOCK_OP_MAX
-};
-
-struct kmemlock
-{
- struct posix4_dispatch dispatch;
- int flags;
- void *addr;
- size_t len;
-};
-
-#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */
-
-#if defined(KERNEL)
-
-struct proc;
-
-void *posix4malloc __P((int *, size_t));
-void posix4free __P((int *, void *));
-int posix4proc __P((struct proc *, pid_t, struct proc **));
-int posix4ioctl __P((dev_t, int, caddr_t, int, struct proc *));
-void posix4attach __P((int));
-void posix4_facility __P((int, int));
-
-struct lkm_table;
-int posix4_init __P((struct lkm_table *, int , int ));
+struct ksched;
-#ifdef _POSIX_PRIORITY_SCHEDULING
+int ksched_attach(struct ksched **);
+int ksched_detach(struct ksched *);
-int ksched_attach(int, int, void **);
-int ksched_detach(void *);
-
-int ksched_setparam(int *, void *,
+int ksched_setparam(int *, struct ksched *,
struct proc *, const struct sched_param *);
-int ksched_getparam(int *, void *,
+int ksched_getparam(int *, struct ksched *,
struct proc *, struct sched_param *);
-int ksched_setscheduler(int *, void *,
+int ksched_setscheduler(int *, struct ksched *,
struct proc *, int, const struct sched_param *);
-int ksched_getscheduler(int *, void *, struct proc *);
-
-int ksched_yield(int *, void *);
-
-int ksched_get_priority_max(int *, void *, int);
-int ksched_get_priority_min(int *, void *, int);
-
-int ksched_rr_get_interval(int *, void *, struct proc *, struct timespec *);
-
-#endif /* _POSIX_PRIORITY_SCHEDULING */
-
-#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE)
+int ksched_getscheduler(int *, struct ksched *, struct proc *);
-int kmemlock_attach(int, int, void **);
-int kmemlock_detach(void *);
-int kmlockall(int *, void *, int);
-int kmunlockall(int *, void *);
-int kmlock(int *, void *, const void *, size_t);
-int kmunlock(int *, void *, const void *, size_t );
+int ksched_yield(int *, struct ksched *);
-#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */
+int ksched_get_priority_max(int *, struct ksched *, int);
+int ksched_get_priority_min(int *, struct ksched *, int);
-#endif /* KERNEL */
+int ksched_rr_get_interval(int *, struct ksched *, struct proc *, struct timespec *);
-/* A facility is an implementation of one of the optional portions of
- * POSIX4 as selected by the feature test macros, such as the fixed
- * priority scheduler or the realtime signals.
- */
-
-/* Each facility has a facility code, an opcode, and r-w attributes.
- * To exercise the operation associated with an opcode you need the
- * appropriate privileges on the POSIX4 device with the facility
- * bit set in the minor number. This means that every facility has
- * a protection bit: Probably more than we need, but it may have
- * advantages.
- *
- */
-
-#define posix4encode(FACILITY, RW) (FACILITY)
-#define posix4decode(X, FACILITY_P) \
- do { \
- *(FACILITY_P) = ((X) & 0xff); \
- } while (0)
-
-/*
- * The dispatch codes:
- */
-#define IO_POSIX4_PRIORITY_SCHEDULING _IOWR('r', \
- CTL_POSIX4_PRIORITY_SCHEDULING, struct ksched)
+#endif /* _KPOSIX_PRIORITY_SCHEDULING */
-#define IO_POSIX4_MEMLOCK _IOWR('r', \
- CTL_POSIX4_MEMLOCK, struct ksched)
-
-/*
- * CTL_POSIX4 definitions for syscfg
- */
-
-#define CTL_POSIX4_ASYNCHRONOUS_IO 1 /* boolean */
-#define CTL_POSIX4_MAPPED_FILES 2 /* boolean */
-#define CTL_POSIX4_MEMLOCK 3 /* boolean */
-#define CTL_POSIX4_MEMLOCK_RANGE 4 /* boolean */
-#define CTL_POSIX4_MEMORY_PROTECTION 5 /* boolean */
-#define CTL_POSIX4_MESSAGE_PASSING 6 /* boolean */
-#define CTL_POSIX4_PRIORITIZED_IO 7 /* boolean */
-#define CTL_POSIX4_PRIORITY_SCHEDULING 8 /* boolean */
-#define CTL_POSIX4_REALTIME_SIGNALS 9 /* boolean */
-#define CTL_POSIX4_SEMAPHORES 10 /* boolean */
-#define CTL_POSIX4_FSYNC 11 /* boolean */
-#define CTL_POSIX4_SHARED_MEMORY_OBJECTS 12 /* boolean */
-#define CTL_POSIX4_SYNCHRONIZED_IO 13 /* boolean */
-#define CTL_POSIX4_TIMERS 14 /* boolean */
-#define CTL_POSIX4_AIO_LISTIO_MAX 15 /* int */
-#define CTL_POSIX4_AIO_MAX 16 /* int */
-#define CTL_POSIX4_AIO_PRIO_DELTA_MAX 17 /* int */
-#define CTL_POSIX4_DELAYTIMER_MAX 18 /* int */
-#define CTL_POSIX4_MQ_OPEN_MAX 19 /* int */
-#define CTL_POSIX4_PAGESIZE 20 /* int */
-#define CTL_POSIX4_RTSIG_MAX 21 /* int */
-#define CTL_POSIX4_SEM_NSEMS_MAX 22 /* int */
-#define CTL_POSIX4_SEM_VALUE_MAX 23 /* int */
-#define CTL_POSIX4_SIGQUEUE_MAX 24 /* int */
-#define CTL_POSIX4_TIMER_MAX 25 /* int */
-
-#define CTL_POSIX4_N_CTLS 25
-
-#define CTL_POSIX4_NAMES { \
- { 0, 0 }, \
- { "asynchronous_io", CTLTYPE_INT }, \
- { "mapped_files", CTLTYPE_INT }, \
- { "memlock", CTLTYPE_INT }, \
- { "memlock_range", CTLTYPE_INT }, \
- { "memory_protection", CTLTYPE_INT }, \
- { "message_passing", CTLTYPE_INT }, \
- { "prioritized_io", CTLTYPE_INT }, \
- { "priority_scheduling", CTLTYPE_INT }, \
- { "realtime_signals", CTLTYPE_INT }, \
- { "semaphores", CTLTYPE_INT }, \
- { "fsync", CTLTYPE_INT }, \
- { "shared_memory_objects", CTLTYPE_INT }, \
- { "synchronized_io", CTLTYPE_INT }, \
- { "timers", CTLTYPE_INT }, \
- { "aio_listio_max", CTLTYPE_INT }, \
- { "aio_max", CTLTYPE_INT }, \
- { "aio_prio_delta_max", CTLTYPE_INT }, \
- { "delaytimer_max", CTLTYPE_INT }, \
- { "mq_open_max", CTLTYPE_INT }, \
- { "pagesize", CTLTYPE_INT }, \
- { "rtsig_max", CTLTYPE_INT }, \
- { "nsems_max", CTLTYPE_INT }, \
- { "sem_value_max", CTLTYPE_INT }, \
- { "sigqueue_max", CTLTYPE_INT }, \
- { "timer_max", CTLTYPE_INT }, \
-}
-#endif /* _POSIX4_VISIBLE */
-#endif /* _POSIX4_POSIX4_H_ */
+#endif /* P1003_1B */
+#endif /* _P1003_1B_P1003_1B_H_ */
diff --git a/sys/sys/rtprio.h b/sys/sys/rtprio.h
index c4a031c..6f196ab 100644
--- a/sys/sys/rtprio.h
+++ b/sys/sys/rtprio.h
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: rtprio.h,v 1.5 1998/03/04 10:26:39 dufault Exp $
+ * $Id: rtprio.h,v 1.6 1998/03/08 17:25:35 dufault Exp $
*/
#ifndef _SYS_RTPRIO_H_
@@ -44,7 +44,7 @@
#define RTP_PRIO_NORMAL 1
#define RTP_PRIO_IDLE 2
-/* RTP_PRIO_FIFO is POSIX.4 SCHED_FIFO.
+/* RTP_PRIO_FIFO is POSIX.1B SCHED_FIFO.
*/
#define RTP_PRIO_FIFO_BIT 4
diff --git a/sys/sys/semaphore.h b/sys/sys/semaphore.h
index 02cde3e..f57a96f 100644
--- a/sys/sys/semaphore.h
+++ b/sys/sys/semaphore.h
@@ -1,7 +1,7 @@
#ifndef _SEMAPHORE_H_
#define _SEMAPHORE_H_
-/* semaphore.h: POSIX.4 semaphores */
+/* semaphore.h: POSIX 1003.1b semaphores */
/*-
* Copyright (c) 1996, 1997
@@ -36,7 +36,9 @@
*
*/
-#ifdef _POSIX4_INCLUDE_MAYBES
+#include <sys/_posix.h>
+
+#ifdef _P1003_1B_INCLUDE_MAYBES
#include <sys/types.h>
#include <fcntl.h>
#endif
diff --git a/sys/sys/signal.h b/sys/sys/signal.h
index ee3cabb..c02f9d8 100644
--- a/sys/sys/signal.h
+++ b/sys/sys/signal.h
@@ -36,13 +36,14 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.4 (Berkeley) 5/4/95
- * $Id: signal.h,v 1.11 1997/02/22 09:45:53 peter Exp $
+ * $Id: signal.h,v 1.12 1997/09/13 19:42:29 joerg Exp $
*/
#ifndef _SYS_SIGNAL_H_
#define _SYS_SIGNAL_H_
#include <sys/cdefs.h>
+#include <sys/_posix.h>
#include <machine/signal.h> /* sig_atomic_t; trap codes; sigcontext */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
@@ -198,6 +199,32 @@ struct sigstack {
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
+#ifdef _P1003_1B_VISIBLE_HISTORICALLY
+
+/* sys/aio.h unconditionally defined these */
+
+union sigval {
+ int sival_int; /* Integer signal value */
+ void *sival_ptr; /* Pointer signal value */
+};
+
+typedef struct siginfo {
+ int si_signo; /* Signal number */
+ int si_code; /* Cause of the signal */
+ union sigval si_value; /* Signal value */
+} siginfo_t;
+
+struct sigevent {
+ int sigev_notify; /* Notification type */
+ int sigev_signo; /* Signal number */
+ union sigval sigev_value; /* Signal value */
+};
+
+#define SIGEV_NONE 0 /* No async notification */
+#define SIGEV_SIGNAL 1 /* Generate a queued signal */
+
+#endif
+
/*
* For historical reasons; programs expect signal's return value to be
* defined by <sys/signal.h>.
diff --git a/sys/sys/syscall-hide.h b/sys/sys/syscall-hide.h
index b79c0a8..4f9a7ab 100644
--- a/sys/sys/syscall-hide.h
+++ b/sys/sys/syscall-hide.h
@@ -231,3 +231,11 @@ HIDE_BSD(thr_wakeup)
HIDE_BSD(mlockall)
HIDE_BSD(munlockall)
HIDE_BSD(__getcwd)
+HIDE_POSIX(sched_setparam)
+HIDE_POSIX(sched_getparam)
+HIDE_POSIX(sched_setscheduler)
+HIDE_POSIX(sched_getscheduler)
+HIDE_POSIX(sched_yield)
+HIDE_POSIX(sched_get_priority_max)
+HIDE_POSIX(sched_get_priority_min)
+HIDE_POSIX(sched_rr_get_interval)
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index c9397e8..ec74463 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -236,4 +236,12 @@
#define SYS_mlockall 324
#define SYS_munlockall 325
#define SYS___getcwd 326
-#define SYS_MAXSYSCALL 327
+#define SYS_sched_setparam 327
+#define SYS_sched_getparam 328
+#define SYS_sched_setscheduler 329
+#define SYS_sched_getscheduler 330
+#define SYS_sched_yield 331
+#define SYS_sched_get_priority_max 332
+#define SYS_sched_get_priority_min 333
+#define SYS_sched_rr_get_interval 334
+#define SYS_MAXSYSCALL 335
diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk
index b083dd7..3a85bd9 100644
--- a/sys/sys/syscall.mk
+++ b/sys/sys/syscall.mk
@@ -192,4 +192,12 @@ MIASM = \
thr_wakeup.o \
mlockall.o \
munlockall.o \
- __getcwd.o \ No newline at end of file
+ __getcwd.o \
+ sched_setparam.o \
+ sched_getparam.o \
+ sched_setscheduler.o \
+ sched_getscheduler.o \
+ sched_yield.o \
+ sched_get_priority_max.o \
+ sched_get_priority_min.o \
+ sched_rr_get_interval.o
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index cd8f293..542f6ce 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -34,12 +34,14 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
- * $Id: sysctl.h,v 1.57 1997/09/07 16:53:52 bde Exp $
+ * $Id: sysctl.h,v 1.58 1998/03/04 10:26:42 dufault Exp $
*/
#ifndef _SYS_SYSCTL_H_
#define _SYS_SYSCTL_H_
+#include <sys/_posix.h>
+
/*
* Definitions for sysctl call. The sysctl call uses a hierarchical name
* for objects that can be examined or modified. The name is expressed as
@@ -81,7 +83,7 @@ struct ctlname {
* USE THIS instead of a hardwired number from the categories below
* to get dynamically assigned sysctl entries using the linker-set
* technology. This is the way nearly all new sysctl variables should
- * be implimented.
+ * be implemented.
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
*/
#define OID_AUTO (-1)
@@ -180,17 +182,9 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
#define CTL_HW 6 /* generic cpu/io */
#define CTL_MACHDEP 7 /* machine dependent */
#define CTL_USER 8 /* user-level */
-
-#ifdef POSIX4
-#define CTL_POSIX4 9 /* user-level */
+#define CTL_P1003_1B 9 /* POSIX 1003.1B */
#define CTL_MAXID 10 /* number of valid top-level ids */
-#define CTL_POSIX4_NAME { "posix4", CTLTYPE_NODE },
-#else
-#define CTL_MAXID 9 /* number of valid top-level ids */
-#define CTL_POSIX4_NAME
-#endif /* POSIX4 */
-
#define CTL_NAMES { \
{ 0, 0 }, \
{ "kern", CTLTYPE_NODE }, \
@@ -201,7 +195,7 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "hw", CTLTYPE_NODE }, \
{ "machdep", CTLTYPE_NODE }, \
{ "user", CTLTYPE_NODE }, \
- CTL_POSIX4_NAME \
+ { "p1003_1b", CTLTYPE_NODE }, \
}
/*
@@ -388,6 +382,63 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "tzname_max", CTLTYPE_INT }, \
}
+#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
+#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
+#define CTL_P1003_1B_MEMLOCK 3 /* boolean */
+#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */
+#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */
+#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */
+#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */
+#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */
+#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */
+#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */
+#define CTL_P1003_1B_FSYNC 11 /* boolean */
+#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */
+#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */
+#define CTL_P1003_1B_TIMERS 14 /* boolean */
+#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */
+#define CTL_P1003_1B_AIO_MAX 16 /* int */
+#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */
+#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */
+#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */
+#define CTL_P1003_1B_PAGESIZE 20 /* int */
+#define CTL_P1003_1B_RTSIG_MAX 21 /* int */
+#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */
+#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */
+#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */
+#define CTL_P1003_1B_TIMER_MAX 25 /* int */
+
+#define CTL_P1003_1B_MAXID 26
+
+#define CTL_P1003_1B_NAMES { \
+ { 0, 0 }, \
+ { "asynchronous_io", CTLTYPE_INT }, \
+ { "mapped_files", CTLTYPE_INT }, \
+ { "memlock", CTLTYPE_INT }, \
+ { "memlock_range", CTLTYPE_INT }, \
+ { "memory_protection", CTLTYPE_INT }, \
+ { "message_passing", CTLTYPE_INT }, \
+ { "prioritized_io", CTLTYPE_INT }, \
+ { "priority_scheduling", CTLTYPE_INT }, \
+ { "realtime_signals", CTLTYPE_INT }, \
+ { "semaphores", CTLTYPE_INT }, \
+ { "fsync", CTLTYPE_INT }, \
+ { "shared_memory_objects", CTLTYPE_INT }, \
+ { "synchronized_io", CTLTYPE_INT }, \
+ { "timers", CTLTYPE_INT }, \
+ { "aio_listio_max", CTLTYPE_INT }, \
+ { "aio_max", CTLTYPE_INT }, \
+ { "aio_prio_delta_max", CTLTYPE_INT }, \
+ { "delaytimer_max", CTLTYPE_INT }, \
+ { "mq_open_max", CTLTYPE_INT }, \
+ { "pagesize", CTLTYPE_INT }, \
+ { "rtsig_max", CTLTYPE_INT }, \
+ { "nsems_max", CTLTYPE_INT }, \
+ { "sem_value_max", CTLTYPE_INT }, \
+ { "sigqueue_max", CTLTYPE_INT }, \
+ { "timer_max", CTLTYPE_INT }, \
+}
+
#ifdef KERNEL
extern char machine[];
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index 6d3d8e0..16c56c6 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -823,6 +823,35 @@ struct __getcwd_args {
u_char * buf;
u_int buflen;
};
+struct sched_setparam_args {
+ pid_t pid;
+ const struct sched_param * param;
+};
+struct sched_getparam_args {
+ pid_t pid;
+ struct sched_param * param;
+};
+struct sched_setscheduler_args {
+ pid_t pid;
+ int policy;
+ const struct sched_param * param;
+};
+struct sched_getscheduler_args {
+ pid_t pid;
+};
+struct sched_yield_args {
+ int dummy;
+};
+struct sched_get_priority_max_args {
+ int policy;
+};
+struct sched_get_priority_min_args {
+ int policy;
+};
+struct sched_rr_get_interval_args {
+ pid_t pid;
+ struct timespec * interval;
+};
int nosys __P((struct proc *, struct nosys_args *));
void exit __P((struct proc *, struct rexit_args *)) __dead2;
int fork __P((struct proc *, struct fork_args *));
@@ -1014,6 +1043,14 @@ int thr_wakeup __P((struct proc *, struct thr_wakeup_args *));
int mlockall __P((struct proc *, struct mlockall_args *));
int munlockall __P((struct proc *, struct munlockall_args *));
int __getcwd __P((struct proc *, struct __getcwd_args *));
+int sched_setparam __P((struct proc *, struct sched_setparam_args *));
+int sched_getparam __P((struct proc *, struct sched_getparam_args *));
+int sched_setscheduler __P((struct proc *, struct sched_setscheduler_args *));
+int sched_getscheduler __P((struct proc *, struct sched_getscheduler_args *));
+int sched_yield __P((struct proc *, struct sched_yield_args *));
+int sched_get_priority_max __P((struct proc *, struct sched_get_priority_max_args *));
+int sched_get_priority_min __P((struct proc *, struct sched_get_priority_min_args *));
+int sched_rr_get_interval __P((struct proc *, struct sched_rr_get_interval_args *));
#ifdef COMPAT_43
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index 9ac2c03..b96572d 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)unistd.h 8.2 (Berkeley) 1/7/94
- * $Id: unistd.h,v 1.15 1998/03/04 10:26:46 dufault Exp $
+ * $Id: unistd.h,v 1.16 1998/03/08 17:25:38 dufault Exp $
*/
#ifndef _SYS_UNISTD_H_
@@ -52,10 +52,6 @@
#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */
#endif
-#if _POSIX_VERSION >= 199309L
-#include <posix4/posix4.h>
-#endif
-
#define _POSIX2_VERSION 199212L
/* execution-time symbolic constants */
@@ -127,18 +123,19 @@
/* configurable system strings */
#define _CS_PATH 1
-#ifdef _POSIX4_VISIBLE
+#ifdef _P1003_1B_VISIBLE
+
+#define _POSIX_PRIORITY_SCHEDULING
#if 0
/* Not until the dust settles after the header commit
*/
-#define _POSIX_PRIORITY_SCHEDULING
#define _POSIX_ASYNCHRONOUS_IO
#define _POSIX_MEMLOCK
#define _POSIX_MEMLOCK_RANGE
#endif
-/* POSIX 4 sysconf options */
+/* POSIX.1B sysconf options */
#define _SC_ASYNCHRONOUS_IO 28
#define _SC_MAPPED_FILES 29
#define _SC_MEMLOCK 30
@@ -165,12 +162,12 @@
#define _SC_SIGQUEUE_MAX 51
#define _SC_TIMER_MAX 52
-/* POSIX 4 pathconf and fpathconf options */
+/* POSIX.1B pathconf and fpathconf options */
#define _PC_ASYNC_IO 53
#define _PC_PRIO_IO 54
#define _PC_SYNC_IO 55
-#endif /* _POSIX4_VISIBLE */
+#endif /* _P1003_1B_VISIBLE */
#ifndef _POSIX_SOURCE
/*
OpenPOWER on IntegriCloud