mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
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.
This commit is contained in:
parent
08637435f2
commit
8a6472b723
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=34925
|
@ -1,5 +1,5 @@
|
|||
# From: @(#)Makefile 8.2 (Berkeley) 1/4/94
|
||||
# $Id: Makefile,v 1.74 1998/03/08 02:17:25 jb Exp $
|
||||
# $Id: Makefile,v 1.75 1998/03/08 21:35:29 jb Exp $
|
||||
#
|
||||
# Doing a make install builds /usr/include
|
||||
#
|
||||
|
@ -35,7 +35,7 @@ RPCFILES= auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
|
|||
MFILES= float.h floatingpoint.h stdarg.h varargs.h
|
||||
|
||||
# posix4/aio.h conflicts with dysons and isn't installed:
|
||||
PFILES= mqueue.h posix4.h sched.h semaphore.h \
|
||||
PFILES= mqueue.h sched.h semaphore.h \
|
||||
# aio.h
|
||||
|
||||
LFILES= errno.h fcntl.h poll.h syslog.h termios.h
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)limits.h 8.2 (Berkeley) 1/4/94
|
||||
* $Id: limits.h,v 1.7 1998/03/08 17:24:31 dufault Exp $
|
||||
* $Id: limits.h,v 1.8 1998/03/08 22:29:56 dufault Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LIMITS_H_
|
||||
|
@ -63,7 +63,7 @@
|
|||
#define _POSIX2_RE_DUP_MAX 255
|
||||
|
||||
|
||||
#ifdef _POSIX4_VISIBLE
|
||||
#ifdef _P1003_1B_VISIBLE
|
||||
|
||||
#define _POSIX_AIO_LISTIO_MAX 16
|
||||
#define _POSIX_AIO_MAX 1
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
#define _SIGNAL_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_posix.h>
|
||||
#include <sys/signal.h>
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/_posix.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
extern __const char *__const sys_signame[NSIG];
|
||||
|
@ -66,13 +66,7 @@ int sigprocmask __P((int, const sigset_t *, sigset_t *));
|
|||
int sigsuspend __P((const sigset_t *));
|
||||
|
||||
|
||||
#ifdef _POSIX4_VISIBLE
|
||||
|
||||
typedef struct siginfo {
|
||||
int si_signo; /* Signal number */
|
||||
int si_code; /* Cause of the signal */
|
||||
union sigval si_value; /* Signal value */
|
||||
} siginfo_t;
|
||||
#ifdef _P1003_1B_VISIBLE
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sigqueue __P((_BSD_PID_T_, int, const union sigval));
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#define _TIME_H_
|
||||
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/_posix.h>
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
/*
|
||||
|
@ -73,7 +74,10 @@ typedef _BSD_SIZE_T_ size_t;
|
|||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
/* XXX I'm not sure if _ANSI_SOURCE is playing properly
|
||||
* with the setups in _posix.h:
|
||||
*/
|
||||
#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY)
|
||||
/*
|
||||
* New in POSIX 1003.1b-1993.
|
||||
*/
|
||||
|
@ -140,7 +144,9 @@ char *timezone __P((int, int));
|
|||
void tzsetwall __P((void));
|
||||
time_t timelocal __P((struct tm * const));
|
||||
time_t timegm __P((struct tm * const));
|
||||
#endif /* neither ANSI nor POSIX */
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY)
|
||||
/* Introduced in POSIX 1003.1b-1993, not part of 1003.1-1990. */
|
||||
int clock_getres __P((clockid_t, struct timespec *));
|
||||
int clock_gettime __P((clockid_t, struct timespec *));
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/_posix.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
@ -176,110 +177,110 @@ sysconf(name)
|
|||
mib[1] = USER_POSIX2_UPE;
|
||||
goto yesno;
|
||||
|
||||
#if _POSIX_VERSION >= 199309L
|
||||
/* POSIX.4 */
|
||||
#ifdef _P1003_1B_VISIBLE
|
||||
/* POSIX.1B */
|
||||
|
||||
case _SC_ASYNCHRONOUS_IO:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_ASYNCHRONOUS_IO;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_ASYNCHRONOUS_IO;
|
||||
goto yesno;
|
||||
case _SC_MAPPED_FILES:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_MAPPED_FILES;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_MAPPED_FILES;
|
||||
goto yesno;
|
||||
case _SC_MEMLOCK:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_MEMLOCK;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_MEMLOCK;
|
||||
goto yesno;
|
||||
case _SC_MEMLOCK_RANGE:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_MEMLOCK_RANGE;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_MEMLOCK_RANGE;
|
||||
goto yesno;
|
||||
case _SC_MEMORY_PROTECTION:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_MEMORY_PROTECTION;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_MEMORY_PROTECTION;
|
||||
goto yesno;
|
||||
case _SC_MESSAGE_PASSING:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_MESSAGE_PASSING;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_MESSAGE_PASSING;
|
||||
goto yesno;
|
||||
case _SC_PRIORITIZED_IO:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_PRIORITIZED_IO;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_PRIORITIZED_IO;
|
||||
goto yesno;
|
||||
case _SC_PRIORITY_SCHEDULING:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_PRIORITY_SCHEDULING;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_PRIORITY_SCHEDULING;
|
||||
goto yesno;
|
||||
case _SC_REALTIME_SIGNALS:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_REALTIME_SIGNALS;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_REALTIME_SIGNALS;
|
||||
goto yesno;
|
||||
case _SC_SEMAPHORES:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_SEMAPHORES;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_SEMAPHORES;
|
||||
goto yesno;
|
||||
case _SC_FSYNC:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_FSYNC;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_FSYNC;
|
||||
goto yesno;
|
||||
case _SC_SHARED_MEMORY_OBJECTS:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_SHARED_MEMORY_OBJECTS;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_SHARED_MEMORY_OBJECTS;
|
||||
goto yesno;
|
||||
case _SC_SYNCHRONIZED_IO:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_SYNCHRONIZED_IO;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_SYNCHRONIZED_IO;
|
||||
goto yesno;
|
||||
case _SC_TIMERS:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_TIMERS;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_TIMERS;
|
||||
goto yesno;
|
||||
case _SC_AIO_LISTIO_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_AIO_LISTIO_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_AIO_LISTIO_MAX;
|
||||
goto yesno;
|
||||
case _SC_AIO_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_AIO_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_AIO_MAX;
|
||||
goto yesno;
|
||||
case _SC_AIO_PRIO_DELTA_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_AIO_PRIO_DELTA_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_AIO_PRIO_DELTA_MAX;
|
||||
goto yesno;
|
||||
case _SC_DELAYTIMER_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_DELAYTIMER_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_DELAYTIMER_MAX;
|
||||
goto yesno;
|
||||
case _SC_MQ_OPEN_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_MQ_OPEN_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_MQ_OPEN_MAX;
|
||||
goto yesno;
|
||||
case _SC_PAGESIZE:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_PAGESIZE;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_PAGESIZE;
|
||||
goto yesno;
|
||||
case _SC_RTSIG_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_RTSIG_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_RTSIG_MAX;
|
||||
goto yesno;
|
||||
case _SC_SEM_NSEMS_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_SEM_NSEMS_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_SEM_NSEMS_MAX;
|
||||
goto yesno;
|
||||
case _SC_SEM_VALUE_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_SEM_VALUE_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_SEM_VALUE_MAX;
|
||||
goto yesno;
|
||||
case _SC_SIGQUEUE_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_SIGQUEUE_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_SIGQUEUE_MAX;
|
||||
goto yesno;
|
||||
case _SC_TIMER_MAX:
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_TIMER_MAX;
|
||||
mib[0] = CTL_P1003_1B;
|
||||
mib[1] = CTL_P1003_1B_TIMER_MAX;
|
||||
goto yesno;
|
||||
#endif /* _POSIX_VERSION >= 199309L */
|
||||
#endif /* _P1003_1B_VISIBLE */
|
||||
|
||||
yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
|
||||
return (-1);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
|
||||
# $Id: Makefile.inc,v 1.48 1998/03/23 06:58:06 jb Exp $
|
||||
# $Id: Makefile.inc,v 1.49 1998/03/23 21:04:06 jb Exp $
|
||||
|
||||
# sys sources
|
||||
.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/sys ${.CURDIR}/../libc/sys
|
||||
|
@ -100,6 +100,12 @@ MAN2+= _exit.2 accept.2 access.2 acct.2 adjtime.2 \
|
|||
swapon.2 symlink.2 sync.2 syscall.2 truncate.2 umask.2 undelete.2 \
|
||||
unlink.2 utimes.2 vfork.2 wait.2 write.2
|
||||
|
||||
.if !defined(NO_P1003_1B)
|
||||
MAN2+= sched_get_priority_max.2 sched_setscheduler.2 \
|
||||
sched_setparam.2 sched_yield.2
|
||||
.endif
|
||||
|
||||
|
||||
MLINKS+=brk.2 sbrk.2
|
||||
MLINKS+=dup.2 dup2.2
|
||||
MLINKS+=chdir.2 fchdir.2
|
||||
|
@ -135,4 +141,10 @@ MLINKS+=syscall.2 __syscall.2
|
|||
MLINKS+=truncate.2 ftruncate.2
|
||||
MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2
|
||||
MLINKS+=write.2 writev.2
|
||||
.if !defined(NO_P1003_1B)
|
||||
MLINKS+=sched_get_priority_max.2 sched_get_priority_min.2 \
|
||||
sched_get_priority_max.2 sched_rr_get_interval.2
|
||||
MLINKS+=sched_setscheduler.2 sched_getscheduler.2
|
||||
MLINKS+=sched_setparam.2 sched_getparam.2
|
||||
.endif
|
||||
.endif
|
||||
|
|
121
lib/libc/sys/sched_get_priority_max.2
Normal file
121
lib/libc/sys/sched_get_priority_max.2
Normal file
|
@ -0,0 +1,121 @@
|
|||
.\" $Id:$
|
||||
.\" Copyright (c) 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Mar 12, 1998
|
||||
.Dt SCHED_GET_PRIORITY_MAX 2
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
.Nm sched_get_priority_max ,
|
||||
.Nm sched_get_priority_min ,
|
||||
.Nm sched_rr_get_interval
|
||||
.Nd Get scheduling parameter limits
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sched.h>
|
||||
.Ft int
|
||||
.Fn sched_get_priority_max "int policy"
|
||||
.Ft int
|
||||
.Fn sched_get_priority_min "int policy"
|
||||
.Ft int
|
||||
.Fn sched_rr_get_interval "pid_t pid" "struct timespec *interval"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn sched_get_priority_max
|
||||
and
|
||||
.Fn sched_get_priority_min
|
||||
functions return the appropriate maximum or minimum, respectfully,
|
||||
for the scheduling policy specified by policy. The
|
||||
.Fn sched_rr_get_interval
|
||||
function updates the
|
||||
.Fa timespec
|
||||
structure referenced by the
|
||||
.Fa interval
|
||||
argument to contain the current execution time limit (i.e., time
|
||||
quantum) for the process specified by
|
||||
.Fa pid .
|
||||
If
|
||||
.Fa pid
|
||||
is zero, the current execution time limit for the calling process is
|
||||
returned.
|
||||
.Pp
|
||||
The value of
|
||||
.Fa policy
|
||||
should be one of the scheduling policy values defined in
|
||||
.Fa <sched.h> :
|
||||
.Bl -tag -width [SCHED_OTHER]
|
||||
.It Bq Er SCHED_FIFO
|
||||
First-in-first-out fixed priority scheduling with no round robin scheduling;
|
||||
.It Bq Er SCHED_OTHER
|
||||
The standard time sharing scheduler;
|
||||
.It Bq Er SCHED_RR
|
||||
Round-robin scheduling across same priority processes.
|
||||
.El
|
||||
.Sh RETURN
|
||||
If successful, the
|
||||
.Fn sched_get_priority_max
|
||||
and
|
||||
.Fn sched_get_priority_min
|
||||
functions shall return the appropriate maximum or minimum values,
|
||||
respectively. If unsuccessful, the shall return a value of -1 and set
|
||||
.Fa errno
|
||||
to indicate the error.
|
||||
.Pp
|
||||
If successful, the
|
||||
.Fn sched_rr_get_interval
|
||||
function will return 0. Otherwise, it will
|
||||
return a value of -1 and set
|
||||
.Fa errno
|
||||
to indicate the error.
|
||||
.Sh ERRORS
|
||||
On failure
|
||||
.Va errno
|
||||
will be set to the corresponding value:
|
||||
.Bl -tag -width [EFAULT]
|
||||
.It Bq Er EINVAL
|
||||
The value of the
|
||||
.Fa policy
|
||||
parameter does not represent a defined scheduling policy.
|
||||
.It Bq Er ENOSYS
|
||||
The
|
||||
.Fn sched_get_priority_max ,
|
||||
.Fn sched_get_priority_min ,
|
||||
and
|
||||
.Fn sched_rr_get_interval
|
||||
functions are not supported by the implementation.
|
||||
.It Bq Er ESRCH
|
||||
No process can be found corresponding to that specified by
|
||||
.Fa pid .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr sched_getparam 2 ,
|
||||
.Xr sched_setparam 2 ,
|
||||
.Xr sched_get_scheduler 2 ,
|
||||
.Xr sched_set_scheduler 2
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn sched_setscheduler
|
||||
and
|
||||
.Fn sched_getscheduler
|
||||
functions conform to
|
||||
.St -p1003.1b-93 .
|
172
lib/libc/sys/sched_setparam.2
Normal file
172
lib/libc/sys/sched_setparam.2
Normal file
|
@ -0,0 +1,172 @@
|
|||
.\" $Id:$
|
||||
.\" Copyright (c) 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Mar 12, 1998
|
||||
.Dt SCHED_SETPARAM 2
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
.Nm sched_setparam ,
|
||||
.Nm sched_getparam
|
||||
.Nd set/get scheduling paramaters
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sched.h>
|
||||
.Ft int
|
||||
.Fn sched_setparam "pid_t pid" "const struct sched_param *param"
|
||||
.Ft int
|
||||
.Fn sched_getparam "pid_t pid" "struct sched_param *param"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn sched_setparam
|
||||
function sets the scheduling parameters of the process specified by
|
||||
.Fa pid
|
||||
to the values specified by the
|
||||
.Fa sched_param
|
||||
structure pointed to by
|
||||
.Fa param .
|
||||
The value of the
|
||||
.Fa sched_priority
|
||||
member in the
|
||||
.Fa param
|
||||
structure must be any integer within the inclusive priority range for
|
||||
the current scheduling policy of the process specified by
|
||||
.Fa pid .
|
||||
Higher numerical values for the priority represent higher priorities.
|
||||
.Pp
|
||||
In this implementation, if the value of
|
||||
.Fa pid
|
||||
is negative the function will fail.
|
||||
.Pp
|
||||
If a process specified by
|
||||
.Fa pid
|
||||
exists and if the calling process has permission, the scheduling
|
||||
parameters are set for the process whose process ID is equal to
|
||||
.Fa pid .
|
||||
.Pp
|
||||
If
|
||||
.Fa pid
|
||||
is zero, the scheduling parameters are set for the calling process.
|
||||
.Pp
|
||||
In this implementation, the policy of when a process can affect
|
||||
the scheduling parameters of another process is specified in
|
||||
.Xr p1003_1b
|
||||
as a write-style operation.
|
||||
.Pp
|
||||
The target process, whether it is running or not running, will resume
|
||||
execution after all other runnable processes of equal or greater
|
||||
priority have been scheduled to run.
|
||||
.Pp
|
||||
If the priority of the process specified by the
|
||||
.Fa pid
|
||||
argument is set higher than that of the lowest priority running process
|
||||
and if the specified process is ready to run, the process specified by
|
||||
the
|
||||
.Fa pid
|
||||
argument will preempt a lowest priority running process. Similarly, if
|
||||
the process calling
|
||||
.Fn sched_setparam
|
||||
sets its own priority lower than that of one or more other nonempty
|
||||
process lists, then the process that is the head of the highest priority
|
||||
list will also preempt the calling process. Thus, in either case, the
|
||||
originating process might not receive notification of the completion of
|
||||
the requested priority change until the higher priority process has
|
||||
executed.
|
||||
.Pp
|
||||
In this implementation, when the current scheduling policy for the
|
||||
process specified by
|
||||
.Fa pid
|
||||
is normal timesharing (SCHED_OTHER, aka SCHED_NORMAL when not POSIX-source)
|
||||
or the idle policy (SCHED_IDLE when not POSIX-source) then the behavior
|
||||
is as if the process had been running under SCHED_RR with a priority
|
||||
lower than any actual realtime priority.
|
||||
.Pp
|
||||
The
|
||||
.Fn sched_getparam
|
||||
function will return the scheduling parameters of a process specified
|
||||
by
|
||||
.Fa pid
|
||||
in the
|
||||
.Fa sched_param
|
||||
structure pointed to by
|
||||
.Fa param .
|
||||
.Pp
|
||||
If a process specified by
|
||||
.Fa pid
|
||||
exists and if the calling process has permission,
|
||||
the scheduling parameters for the process whose process ID is equal to
|
||||
.Fa pid
|
||||
are returned.
|
||||
.Pp
|
||||
In this implementation, the policy of when a process can obtain the
|
||||
scheduling parameters of another process are detailed in
|
||||
.Xr p1003_1b
|
||||
as a read-style operation.
|
||||
.Pp
|
||||
If
|
||||
.Fa pid
|
||||
is zero, the scheduling parameters for the calling process will be
|
||||
returned. In this implementation, the
|
||||
.Fa sched_getparam
|
||||
function will fail if
|
||||
.Fa pid
|
||||
is negative.
|
||||
.Sh RETURN
|
||||
The function will return zero if it completes successfully, or it
|
||||
will return a value of -1 and set
|
||||
.Va errno
|
||||
to indicate the error.
|
||||
.Sh ERRORS
|
||||
On failure
|
||||
.Va errno
|
||||
will be set to the corresponding value:
|
||||
.Bl -tag -width [EFAULT]
|
||||
.It Bq Er ENOSYS
|
||||
The system is not configured to support this functionality.
|
||||
.It Bq Er EPERM
|
||||
The requesting process doesn not have permission as detailed in
|
||||
.Xr p1003_1b .
|
||||
.It Bq Er ESRCH
|
||||
No process can be found corresponding to that specified by
|
||||
.Fa pid .
|
||||
.It Bq Er EINVAL
|
||||
For
|
||||
.Fn sched_setparam :
|
||||
one or more of the requested scheduling parameters
|
||||
is outside the range defined for the scheduling policy of the specified
|
||||
.Fa pid .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr sched_getscheduler 2 ,
|
||||
.Xr sched_setscheduler 2 ,
|
||||
.Xr sched_get_priority_max 2 ,
|
||||
.Xr sched_get_priority_min 2 ,
|
||||
.Xr sched_rr_get_interval 2 ,
|
||||
.Xr sched_yield 2
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn sched_setparam
|
||||
and
|
||||
.Fn sched_getparam
|
||||
functions conform to
|
||||
.St -p1003.1b-93 .
|
167
lib/libc/sys/sched_setscheduler.2
Normal file
167
lib/libc/sys/sched_setscheduler.2
Normal file
|
@ -0,0 +1,167 @@
|
|||
.\" $Id:$
|
||||
.\" Copyright (c) 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Mar 12, 1998
|
||||
.Dt SCHED_SETSCHEDULER 2
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
.Nm sched_setscheduler ,
|
||||
.Nm sched_getscheduler
|
||||
.Nd set/get scheduling policy and scheduler parameters
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sched.h>
|
||||
.Ft int
|
||||
.Fn sched_setscheduler "pid_t pid" "int policy" "const struct sched_param *param"
|
||||
.Ft int
|
||||
.Fn sched_getscheduler "pid_t pid"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn sched_setscheduler
|
||||
function sets the scheduling policy and scheduling parameters
|
||||
of the process specified by
|
||||
.Fa pid
|
||||
to
|
||||
.Fa policy
|
||||
and the parameters specified in the
|
||||
.Fa sched_param
|
||||
structure pointed to by
|
||||
.Fa param ,
|
||||
respectively.
|
||||
The value of the
|
||||
.Fa sched_priority
|
||||
member in the
|
||||
.Fa param
|
||||
structure must be any integer within the inclusive priority range for
|
||||
the scheduling policy specified by
|
||||
.Fa policy .
|
||||
.Pp
|
||||
In this implementation, if the value of
|
||||
.Fa pid
|
||||
is negative the function will fail.
|
||||
.Pp
|
||||
If a process specified by
|
||||
.Fa pid
|
||||
exists and if the calling process has permission, the scheduling
|
||||
policy and scheduling parameters will be set for the process
|
||||
whose process ID is equal to
|
||||
.Fa pid .
|
||||
.Pp
|
||||
If
|
||||
.Fa pid
|
||||
is zero, the scheduling policy and scheduling
|
||||
parameters are set for the calling process.
|
||||
.Pp
|
||||
In this implementation, the policy of when a process can affect
|
||||
the scheduling parameters of another process is specified in
|
||||
.Xr p1003_1b
|
||||
as a write-style operation.
|
||||
.Pp
|
||||
The scheduling policies are in
|
||||
.Fa <sched.h> :
|
||||
.Bl -tag -width [SCHED_OTHER]
|
||||
.It Bq Er SCHED_FIFO
|
||||
First-in-first-out fixed priority scheduling with no round robin scheduling;
|
||||
.It Bq Er SCHED_OTHER
|
||||
The standard time sharing scheduler;
|
||||
.It Bq Er SCHED_RR
|
||||
Round-robin scheduling across same priority processes.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Fa sched_param
|
||||
structure is defined in
|
||||
.Fa <sched.h> :
|
||||
|
||||
.Bd -literal -offset indent
|
||||
struct sched_param {
|
||||
int sched_priority; /* scheduling priority */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The
|
||||
.Fn sched_getscheduler
|
||||
function returns the scheduling policy of the process specified
|
||||
by
|
||||
.Fa pid .
|
||||
.Pp
|
||||
If a process specified by
|
||||
.Fa pid
|
||||
exists and if the calling process has permission,
|
||||
the scheduling parameters for the process whose process ID is equal to
|
||||
.Fa pid
|
||||
are returned.
|
||||
.Pp
|
||||
In this implementation, the policy of when a process can obtain the
|
||||
scheduling parameters of another process are detailed in
|
||||
.Xr p1003_1b
|
||||
as a read-style operation.
|
||||
.Pp
|
||||
If
|
||||
.Fa pid
|
||||
is zero, the scheduling parameters for the calling process will be
|
||||
returned. In this implementation, the
|
||||
.Fa sched_getscheduler
|
||||
function will fail if
|
||||
.Fa pid
|
||||
is negative.
|
||||
.Sh RETURN
|
||||
The function will return zero if it completes successfully, or it
|
||||
will return a value of -1 and set
|
||||
.Va errno
|
||||
to indicate the error.
|
||||
.Sh ERRORS
|
||||
On failure
|
||||
.Va errno
|
||||
will be set to the corresponding value:
|
||||
.Bl -tag -width [EFAULT]
|
||||
.It Bq Er ENOSYS
|
||||
The system is not configured to support this functionality.
|
||||
.It Bq Er EPERM
|
||||
The requesting process doesn not have permission as detailed in
|
||||
.Xr p1003_1b .
|
||||
.It Bq Er ESRCH
|
||||
No process can be found corresponding to that specified by
|
||||
.Fa pid .
|
||||
.It Bq Er EINVAL
|
||||
The value of the
|
||||
.Fa policy
|
||||
parameter is invalid, or one or more of the parameters contained in
|
||||
.Fa param
|
||||
is outside the valid range for the specified scheduling policy.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr sched_getparam 2 ,
|
||||
.Xr sched_setparam 2 ,
|
||||
.Xr sched_get_priority_max 2 ,
|
||||
.Xr sched_get_priority_min 2 ,
|
||||
.Xr sched_rr_get_interval 2 ,
|
||||
.Xr sched_yield 2
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn sched_setscheduler
|
||||
and
|
||||
.Fn sched_getscheduler
|
||||
functions conform to
|
||||
.St -p1003.1b-93 .
|
59
lib/libc/sys/sched_yield.2
Normal file
59
lib/libc/sys/sched_yield.2
Normal file
|
@ -0,0 +1,59 @@
|
|||
.\" $Id:$
|
||||
.\" Copyright (c) 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Mar 12, 1998
|
||||
.Dt SCHED_YIELD 2
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
.Nm sched_yield
|
||||
.Nd yield processor
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sched.h>
|
||||
.Ft int
|
||||
.Fn sched_yield void
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn sched_yield
|
||||
function forces the running process to relinquish the processor until it
|
||||
again becomes the head of its process list. It takes no arguments.
|
||||
.Sh RETURN
|
||||
The
|
||||
.Fn sched_yield
|
||||
function will return zero if it completes successfully, or it
|
||||
will return a value of -1 and set
|
||||
.Va errno
|
||||
to indicate the error.
|
||||
.Sh ERRORS
|
||||
On failure
|
||||
.Va errno
|
||||
will be set to the corresponding value:
|
||||
.Bl -tag -width [EFAULT]
|
||||
.It Bq Er ENOSYS
|
||||
The system is not configured to support this functionality.
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn sched_yield
|
||||
function conforms to
|
||||
.St -p1003.1b-93 .
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.6 1997/05/03 03:57:21 jb Exp $
|
||||
# $Id: Makefile,v 1.7 1998/03/09 05:09:43 jb Exp $
|
||||
#
|
||||
# All library objects contain rcsid strings by default; they may be
|
||||
# excluded as a space-saving measure. To produce a library that does
|
||||
|
@ -22,9 +22,9 @@ HIDDEN_SYSCALLS= accept.o bind.o close.o connect.o dup.o dup2.o \
|
|||
flock.o fpathconf.o fstat.o fstatfs.o fsync.o getdirentries.o \
|
||||
getpeername.o getsockname.o getsockopt.o ioctl.o listen.o \
|
||||
mkfifo.o mknod.o nanosleep.o nfssvc.o open.o read.o readv.o \
|
||||
recvfrom.o recvmsg.o select.o sendmsg.o sendto.o setsockopt.o \
|
||||
shutdown.o sigaction.o sigaltstack.o signanosleep.o socket.o \
|
||||
socketpair.o wait4.o write.o writev.o
|
||||
recvfrom.o recvmsg.o sched_yield.o select.o sendmsg.o sendto.o \
|
||||
setsockopt.o shutdown.o sigaction.o sigaltstack.o signanosleep.o \
|
||||
socket.o socketpair.o wait4.o write.o writev.o
|
||||
|
||||
.include "${.CURDIR}/../libc/Makefile.inc"
|
||||
.include "${.CURDIR}/man/Makefile.inc"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.6 1997/05/03 03:57:21 jb Exp $
|
||||
# $Id: Makefile,v 1.7 1998/03/09 05:09:43 jb Exp $
|
||||
#
|
||||
# All library objects contain rcsid strings by default; they may be
|
||||
# excluded as a space-saving measure. To produce a library that does
|
||||
|
@ -22,9 +22,9 @@ HIDDEN_SYSCALLS= accept.o bind.o close.o connect.o dup.o dup2.o \
|
|||
flock.o fpathconf.o fstat.o fstatfs.o fsync.o getdirentries.o \
|
||||
getpeername.o getsockname.o getsockopt.o ioctl.o listen.o \
|
||||
mkfifo.o mknod.o nanosleep.o nfssvc.o open.o read.o readv.o \
|
||||
recvfrom.o recvmsg.o select.o sendmsg.o sendto.o setsockopt.o \
|
||||
shutdown.o sigaction.o sigaltstack.o signanosleep.o socket.o \
|
||||
socketpair.o wait4.o write.o writev.o
|
||||
recvfrom.o recvmsg.o sched_yield.o select.o sendmsg.o sendto.o \
|
||||
setsockopt.o shutdown.o sigaction.o sigaltstack.o signanosleep.o \
|
||||
socket.o socketpair.o wait4.o write.o writev.o
|
||||
|
||||
.include "${.CURDIR}/../libc/Makefile.inc"
|
||||
.include "${.CURDIR}/man/Makefile.inc"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.6 1997/05/03 03:57:21 jb Exp $
|
||||
# $Id: Makefile,v 1.7 1998/03/09 05:09:43 jb Exp $
|
||||
#
|
||||
# All library objects contain rcsid strings by default; they may be
|
||||
# excluded as a space-saving measure. To produce a library that does
|
||||
|
@ -22,9 +22,9 @@ HIDDEN_SYSCALLS= accept.o bind.o close.o connect.o dup.o dup2.o \
|
|||
flock.o fpathconf.o fstat.o fstatfs.o fsync.o getdirentries.o \
|
||||
getpeername.o getsockname.o getsockopt.o ioctl.o listen.o \
|
||||
mkfifo.o mknod.o nanosleep.o nfssvc.o open.o read.o readv.o \
|
||||
recvfrom.o recvmsg.o select.o sendmsg.o sendto.o setsockopt.o \
|
||||
shutdown.o sigaction.o sigaltstack.o signanosleep.o socket.o \
|
||||
socketpair.o wait4.o write.o writev.o
|
||||
recvfrom.o recvmsg.o sched_yield.o select.o sendmsg.o sendto.o \
|
||||
setsockopt.o shutdown.o sigaction.o sigaltstack.o signanosleep.o \
|
||||
socket.o socketpair.o wait4.o write.o writev.o
|
||||
|
||||
.include "${.CURDIR}/../libc/Makefile.inc"
|
||||
.include "${.CURDIR}/man/Makefile.inc"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.34 1998/01/16 18:49:42 bde Exp $
|
||||
# $Id: Makefile,v 1.35 1998/03/04 10:23:48 dufault Exp $
|
||||
|
||||
MAN9= MD5.9 \
|
||||
VFS.9 VFS_FHTOVP.9 VFS_INIT.9 VFS_MOUNT.9 VFS_QUOTACTL.9 \
|
||||
|
@ -43,6 +43,7 @@ MLINKS+=ifnet.9 if_data.9 ifnet.9 ifaddr.9 ifnet.9 ifqueue.9
|
|||
MLINKS+=kernacc.9 useracc.9
|
||||
MLINKS+=malloc.9 FREE.9 malloc.9 MALLOC.9 malloc.9 free.9
|
||||
MLINKS+=mi_switch.9 cpu_switch.9
|
||||
MLINKS+=posix4.9 p1003_1b.9
|
||||
MLINKS+=psignal.9 gsignal.9 psignal.9 pgsignal.9
|
||||
MLINKS+=rtalloc.9 rtalloc1.9 rtalloc.9 rtalloc_ign.9
|
||||
MLINKS+=sleep.9 tsleep.9 sleep.9 wakeup.9 sleep.9 wakeup_one.9
|
||||
|
|
|
@ -22,42 +22,34 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: posix4.9,v 1.1 1998/03/04 10:23:50 dufault Exp $
|
||||
.\" $Id: posix1b.9,v 1.2 1998/03/08 17:25:01 dufault Exp $
|
||||
.Dd March 1, 1998
|
||||
.Dt POSIX.4 9
|
||||
.Dt POSIX.1B 9
|
||||
.Os FreeBSD 3.0
|
||||
.Sh NAME
|
||||
.Nm posix4
|
||||
.Nd "POSIX.4 extensions"
|
||||
.Nm posix1b
|
||||
.Nd "Posix P1003-1B extensions"
|
||||
.Sh DESCRIPTION
|
||||
POSIX.4 adds real time extensions and some commonly used
|
||||
POSIX.1B adds real time extensions and some commonly used
|
||||
Berkeley extensions to POSIX.1
|
||||
This section contains preliminary information about avoiding conflicts
|
||||
and adding support for the required ability to specify the interface
|
||||
version.
|
||||
.Sh STATUS
|
||||
March 7, 1998: adding header file changes to 3.0. There should be no
|
||||
visible differences as long as _POSIX_VERSION is left undefined.
|
||||
Defining _POSIX_VERSION, even to the current value of 199009L, will
|
||||
change the behavior of the system per the POSIX spec: if you define
|
||||
_POSIX_VERSION to be 199009L then any extensions
|
||||
already added to the system (for example,
|
||||
John Dyson's aio work) may no longer be visible - this is happening
|
||||
slowly.
|
||||
.Pp
|
||||
In spite of what I said at first, don't set _POSIX_VERSION into the
|
||||
future until I say it is working.
|
||||
.Pp
|
||||
Since this only brings in the headers I'm only explaining the feature
|
||||
test options.
|
||||
March 28, 1998: _POSIX_PRIORITY_SCHEDULING works with these kernel
|
||||
options in your configuration:
|
||||
.Bd -literal -offset 0i
|
||||
options "P1003_1B"
|
||||
options "_KPOSIX_PRIORITY_SCHEDULING"
|
||||
.Ed
|
||||
.Sh SPECIFYING THE VERSION
|
||||
There are three manifest constants that set the version and programming interface
|
||||
for POSIX.4.
|
||||
for POSIX.1B.
|
||||
.Bd -literal -offset 0i
|
||||
_POSIX_VERSION
|
||||
.Ed
|
||||
specifies the system for which the system is built. The default
|
||||
is POSIX.1 and is 199009L. POSIX.4 is 199309L. This defines
|
||||
is POSIX.1 and is 199009L. POSIX.1B is 199309L. This defines
|
||||
the base features of the operating system.
|
||||
.Bd -literal -offset 0i
|
||||
_POSIX_SOURCE
|
||||
|
@ -68,23 +60,24 @@ in the name space.
|
|||
.Bd -literal -offset 0i
|
||||
_POSIX_C_SOURCE
|
||||
.Ed
|
||||
is a macro from POSIX.4 that can be defined to specify that only
|
||||
is a macro from POSIX.1B that can be defined to specify that only
|
||||
POSIX and ANSI functionality from a specific POSIX version should occur
|
||||
in the name space, i.e., if _POSIX_VERSION is 199309L (POSIX.4) but
|
||||
in the name space, i.e., if _POSIX_VERSION is 199309L (POSIX.1B) but
|
||||
_POSIX_C_SOURCE is 199009L (POSIX.1) then only POSIX.1 features should
|
||||
appear.
|
||||
.Sh PROPERLY HIDING EXTENSIONS
|
||||
The following test macros are set up in <sys/_posix.h>. They should
|
||||
used by system header files to avoid the kind of tests you see in
|
||||
<sys/_posix.h>. Source programs should not use these FreeBSD specific
|
||||
implementation details and should test _POSIX_VERSION.
|
||||
These should not be used in the kernel either - the kernel should be
|
||||
immune to the user land setting of _POSIX_VERSION. The POSIX4 option can
|
||||
implementation details and should test _POSIX_VERSION, _POSIX_SOURCE
|
||||
and _POSIX_C_SOURCE.
|
||||
These should not be used in the kernel though - the kernel should be
|
||||
immune to the user land setting of _POSIX_VERSION. The P1003_1B option can
|
||||
be used in the kernel to limit inclusion of new code, but make sure
|
||||
things work properly when a POSIX.4 program is run on a kernel without
|
||||
the POSIX4 option.
|
||||
things work properly when a POSIX.1B program is run on a kernel without
|
||||
the P1003_1B option.
|
||||
.Bd -literal -offset 0i
|
||||
_POSIX4_VISIBLE
|
||||
_P1003_1B_VISIBLE
|
||||
.Ed
|
||||
is a test macro that sorts out when extensions should be
|
||||
visible. It is defined in <sys/_posix.h>.
|
||||
|
@ -92,41 +85,44 @@ visible. It is defined in <sys/_posix.h>.
|
|||
In normal C program development
|
||||
only _POSIX_VERSION is set, permitting BSD extensions to
|
||||
appear to the programs. However, when adding new functionality mandated
|
||||
by POSIX.4, it
|
||||
by POSIX.1B, it
|
||||
is important to satisfy the requirements added by the
|
||||
new _POSIX_C_SOURCE macro. _POSIX4_VISIBLE (not a standard feature test macro)
|
||||
new _POSIX_C_SOURCE macro. _P1003_1B_VISIBLE (not a standard feature test macro)
|
||||
is defined in sys/unistd.h when the combination of _POSIX_VERSION,
|
||||
_POSIX_SOURCE, and _POSIX_C_SOURCE indicate that the extensions are in scope.
|
||||
.Bd -literal -offset 0i
|
||||
_POSIX4_VISIBLE_HISTORICALLY
|
||||
is present to conditionalize POSIX.4 extensions that were historically
|
||||
_P1003_1B_VISIBLE_HISTORICALLY
|
||||
is present to conditionalize POSIX.1B extensions that were historically
|
||||
in the system. These are visible when _POSIX_SOURCE and _POSIX_C_SOURCE
|
||||
are not set at all or when _POSIX_C_SOURCE enables POSIX.4 features.
|
||||
are not set at all or when _POSIX_C_SOURCE enables POSIX.1B features.
|
||||
The intent of this feature test is to permit hiding the new extensions
|
||||
while still letting BSD extensions show up to avoid breaking existing
|
||||
programs without trying to use the "big hammer" of _POSIX_C_SOURCE.
|
||||
.Pp
|
||||
Some of these are new enough that they should be changed to
|
||||
be dependent on _POSIX4_VISIBLE instead.
|
||||
Some recent additions to header files
|
||||
are new enough that they should be changed to
|
||||
be dependent on _P1003_1B_VISIBLE instead of _HISTORICALLY.
|
||||
.Pp
|
||||
Traditional BSD headers (e.g., mmap.h) that are now specified
|
||||
in POSIX.4 should include <sys/_posix.h> and conditionalize
|
||||
BSD extensions on _POSIX4_VISIBLE_HISTORICALLY.
|
||||
Traditional BSD headers (e.g., mmap.h) now specified
|
||||
in POSIX.1B can include <sys/_posix.h> and conditionalize
|
||||
BSD extensions on _P1003_1B_VISIBLE_HISTORICALLY.
|
||||
.Sh NON STANDARD TEST MACROS
|
||||
.Bd -literal -offset 0i
|
||||
_POSIX4_INCLUDE_MAYBES
|
||||
_P1003_1B_INCLUDE_MAYBES
|
||||
.Ed
|
||||
when set before the inclusion of any other header file
|
||||
requests that all header files that the POSIX.4 spec says a standard
|
||||
requests that all header files that the POSIX.1B spec says a standard
|
||||
header may include should be included. Normally no non-required
|
||||
headers are included. Setting this pre-processor definition should
|
||||
make any compliant program compile without issues of header file
|
||||
inclusion.
|
||||
.Bd -literal -offset 0i
|
||||
POSIX4
|
||||
P1003_1B
|
||||
.Ed
|
||||
is a config option and (currently) a request to build POSIX.4 by
|
||||
setting the _POSIX_VERSION to 199309L in sys/unistd.h.
|
||||
is a config option to build in POSIX.1B support in the kernel.
|
||||
.Sh SEE ALSO
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm posix4
|
||||
.Nm posix1b
|
||||
section manual page appeared in
|
||||
.Fx 3.0 .
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -616,6 +616,19 @@ options OD_BOGUS_NOT_READY
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -616,6 +616,19 @@ options OD_BOGUS_NOT_READY
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
@ -616,6 +616,19 @@ options OD_BOGUS_NOT_READY
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <sys/signal.h>
|
||||
|
||||
struct proc;
|
||||
|
||||
struct linux_setup_args {
|
||||
int dummy;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
|
|
@ -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, "");
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
@ -104,6 +104,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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
239
sys/kern/p1003_1b.c
Normal file
239
sys/kern/p1003_1b.c
Normal file
|
@ -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);
|
|
@ -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];
|
||||
|
||||
#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);
|
||||
|
||||
/* posix4_facility: Set a facility to a value. This is
|
||||
* probably a temporary measure until the LKM code is combined with this.
|
||||
/* 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.
|
||||
*/
|
||||
void posix4_facility(int num, int value)
|
||||
|
||||
#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
|
||||
|
||||
|
||||
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);
|
||||
|
||||
/* p31b_setcfg: Set the configuration
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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/types.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
struct timespec;
|
||||
#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;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -104,4 +107,4 @@ __END_DECLS
|
|||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _POSIX4_AIO_H_ */
|
||||
#endif /* _P1003_1B_AIO_H_ */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
239
sys/posix4/p1003_1b.c
Normal file
239
sys/posix4/p1003_1b.c
Normal file
|
@ -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);
|
|
@ -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;
|
||||
};
|
||||
struct ksched;
|
||||
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
int ksched_attach(struct ksched **);
|
||||
int ksched_detach(struct ksched *);
|
||||
|
||||
#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 ));
|
||||
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
|
||||
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_getscheduler(int *, struct ksched *, struct proc *);
|
||||
|
||||
int ksched_yield(int *, void *);
|
||||
int ksched_yield(int *, struct ksched *);
|
||||
|
||||
int ksched_get_priority_max(int *, void *, int);
|
||||
int ksched_get_priority_min(int *, void *, int);
|
||||
int ksched_get_priority_max(int *, struct ksched *, int);
|
||||
int ksched_get_priority_min(int *, struct ksched *, int);
|
||||
|
||||
int ksched_rr_get_interval(int *, void *, struct proc *, struct timespec *);
|
||||
int ksched_rr_get_interval(int *, struct ksched *, struct proc *, struct timespec *);
|
||||
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
#endif /* _KPOSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE)
|
||||
|
||||
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 );
|
||||
|
||||
#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
/* 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)
|
||||
|
||||
#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_ */
|
||||
|
|
|
@ -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];
|
||||
|
||||
#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);
|
||||
|
||||
/* posix4_facility: Set a facility to a value. This is
|
||||
* probably a temporary measure until the LKM code is combined with this.
|
||||
/* 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.
|
||||
*/
|
||||
void posix4_facility(int num, int value)
|
||||
|
||||
#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
|
||||
|
||||
|
||||
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);
|
||||
|
||||
/* p31b_setcfg: Set the configuration
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#ifndef ACTUALLY_LKM_NOT_KERNEL
|
||||
#include "opt_posix.h"
|
||||
#endif
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
#ifdef P1003_1B
|
||||
#define _P1003_1B_VISIBLE
|
||||
#ifndef _KPOSIX_VERSION
|
||||
#define _KPOSIX_VERSION 199309L
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _KPOSIX_VERSION
|
||||
#define _KPOSIX_VERSION 199009L
|
||||
#endif
|
||||
|
||||
#define _P1003_1B_VISIBLE_HISTORICALLY
|
||||
|
||||
#else
|
||||
|
||||
/* Default to existing user space version.
|
||||
*/
|
||||
#ifndef _POSIX_VERSION
|
||||
#define _POSIX_VERSION 199009L
|
||||
#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:
|
||||
*/
|
||||
#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
|
||||
#define _POSIX4_VISIBLE_HISTORICALLY
|
||||
#endif
|
||||
|
||||
/* Test for visibility of additional POSIX.4 features:
|
||||
*/
|
||||
#if _POSIX_VERSION >= 199309L && \
|
||||
(!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE >= 199309L)
|
||||
#define _POSIX4_VISIBLE
|
||||
#define _POSIX4_VISIBLE_HISTORICALLY
|
||||
#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_ */
|
||||
|
|
|
@ -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>.
|
||||
|
|
|
@ -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.)
|
||||
|
|
|
@ -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*/
|
||||
|
|
|
@ -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
|
||||
|
|
256
sys/sys/posix4.h
256
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;
|
||||
};
|
||||
struct ksched;
|
||||
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
int ksched_attach(struct ksched **);
|
||||
int ksched_detach(struct ksched *);
|
||||
|
||||
#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 ));
|
||||
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
|
||||
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_getscheduler(int *, struct ksched *, struct proc *);
|
||||
|
||||
int ksched_yield(int *, void *);
|
||||
int ksched_yield(int *, struct ksched *);
|
||||
|
||||
int ksched_get_priority_max(int *, void *, int);
|
||||
int ksched_get_priority_min(int *, void *, int);
|
||||
int ksched_get_priority_max(int *, struct ksched *, int);
|
||||
int ksched_get_priority_min(int *, struct ksched *, int);
|
||||
|
||||
int ksched_rr_get_interval(int *, void *, struct proc *, struct timespec *);
|
||||
int ksched_rr_get_interval(int *, struct ksched *, struct proc *, struct timespec *);
|
||||
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
#endif /* _KPOSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE)
|
||||
|
||||
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 );
|
||||
|
||||
#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
/* 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)
|
||||
|
||||
#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_ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -192,4 +192,12 @@ MIASM = \
|
|||
thr_wakeup.o \
|
||||
mlockall.o \
|
||||
munlockall.o \
|
||||
__getcwd.o
|
||||
__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
|
||||
|
|
|
@ -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[];
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue