New Patch [was: Re: cvs rm sys/posix4 && enable sem]
Tom Rhodes
trhodes at FreeBSD.org
Fri Nov 10 03:04:41 UTC 2006
On Tue, 7 Nov 2006 09:11:28 -0500
Tom Rhodes <trhodes at freebsd.org> wrote:
Following up to myself,
> Hi,
>
> I spent some time this morning working over the P1003_1B_SEMAPHORES
> option and figured I might as well play with the task of merging
> posix4/ into regular sys. In light of of this, I also enabled and
> tested on all architectures, the sem module disabled by Alfred
> for some unknown (later learned via old email) reason.
>
> Does anyone object to the following:
>
> 1: Repocopy posix4/* files to sys/sys and sys/kern;
> 2: patch CURRENT for the change;
> 3: remove posix4/*;
> 4: enable sem module;
> 5: add P1003_1B_SEMAPHORES to GENERIC;
> 6: (eventually and maybe) merge psched.h and sched.h (I renamed
> posix4/sched.h to sys/psched.h in this patch). This one is
> completely optional.
>
> The included patch is pretty vanilla and does *most* of this,
> not counting the repo-copy and added P1003_1B_SEMAPHORES to
> GENERIC. It also passes my universe build. This also has the
> side effect of differentiating between the two sched.h files we
> have in the tree. Thanks,
>
New patch which merges posix4/sched.h and sys/sched.h into the
same file. This will add an extra step to my above list of
"steps" as, in place of a repo-copy, I'll commit the diff to
sys/sched.h with a note. And, because I'm not a lawyer, I also
included the posix4/sched.h copyright; I'd prefer to be safe
than sorry.
I'm sorry for the wait on this new patch; but I wanted to give others
a chance to chime in before making major changes. If there
are no problems, I would hope to get this in the tree this weekend
or perhaps Monday. Yes, it survived another make universe. Thanks,
--
Tom Rhodes
? posix.diff
? sys/kern/ksched.c
? sys/kern/p1003_1b.c
? sys/kern/posix4_mib.c
? sys/sys/_semaphore.h
? sys/sys/ksem.h
? sys/sys/posix4.h
? sys/sys/semaphore.h
Index: include/Makefile
===================================================================
RCS file: /home/ncvs/src/include/Makefile,v
retrieving revision 1.265
diff -u -r1.265 Makefile
--- include/Makefile 31 Oct 2006 22:22:29 -0000 1.265
+++ include/Makefile 9 Nov 2006 11:06:09 -0000
@@ -36,7 +36,7 @@
LDIRS= bsm cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
netipsec ${_netipx} netkey netnatm ${_netncp} netsmb \
nfs nfsclient nfsserver \
- pccard posix4 sys vm
+ pccard sys vm
LSUBDIRS= cam/scsi \
dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
@@ -111,7 +111,7 @@
INCSLINKS+= machine/$i ${INCLUDEDIR}/$i
.endfor
.for i in ${PHDRS}
-INCSLINKS+= posix4/$i ${INCLUDEDIR}/$i
+INCSLINKS+= sys/$i ${INCLUDEDIR}/$i
.endfor
.if ${MACHINE} != ${MACHINE_ARCH}
Index: share/man/man4/sem.4
===================================================================
RCS file: /home/ncvs/src/share/man/man4/sem.4,v
retrieving revision 1.2
diff -u -r1.2 sem.4
--- share/man/man4/sem.4 2 Jun 2003 11:19:23 -0000 1.2
+++ share/man/man4/sem.4 9 Nov 2006 11:06:44 -0000
@@ -24,19 +24,26 @@
.\"
.\" $FreeBSD: src/share/man/man4/sem.4,v 1.2 2003/06/02 11:19:23 ru Exp $
.\"
-.Dd January 14, 2003
+.Dd November 6, 2006
.Dt SEM 4
.Os
.Sh NAME
.Nm sem
.Nd POSIX semaphores
.Sh SYNOPSIS
-To link into the kernel:
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
.Bd -ragged -offset indent
.Cd "options P1003_1B_SEMAPHORES"
.Ed
.Pp
-To load as a kernel loadable module:
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+sem_load="YES"
+.Ed
.Pp
.Dl "kldload sem"
.Sh DESCRIPTION
@@ -47,6 +54,10 @@
to implement
.Tn POSIX
semaphores.
+This facility offers support for such functions as
+.Fn sem_init
+and
+.Fn sem_wait .
It is available both as a kernel option for static inclusion and as a
dynamic kernel module.
.Sh SEE ALSO
@@ -68,3 +79,4 @@
.Nm
kernel module appeared in
.Fx 5.0 .
+.\" XXX: This manual page is weak with details and info.
Index: sys/Makefile
===================================================================
RCS file: /home/ncvs/src/sys/Makefile,v
retrieving revision 1.38
diff -u -r1.38 Makefile
--- sys/Makefile 10 Aug 2006 06:29:43 -0000 1.38
+++ sys/Makefile 9 Nov 2006 11:06:45 -0000
@@ -11,7 +11,7 @@
CSCOPEDIRS= coda compat conf contrib crypto ddb dev fs geom gnu i4b isa \
isofs kern libkern modules net net80211 netatalk netatm \
netgraph netinet netinet6 netipx netkey netnatm netncp \
- netsmb nfs nfsclient nfs4client rpc pccard pci posix4 sys \
+ netsmb nfs nfsclient nfs4client rpc pccard pci sys \
ufs vm ${ARCHDIR}
ARCHDIR ?= ${MACHINE}
Index: sys/compat/linux/linux_misc.c
===================================================================
RCS file: /home/ncvs/src/sys/compat/linux/linux_misc.c,v
retrieving revision 1.192
diff -u -r1.192 linux_misc.c
--- sys/compat/linux/linux_misc.c 6 Nov 2006 13:41:49 -0000 1.192
+++ sys/compat/linux/linux_misc.c 9 Nov 2006 11:06:46 -0000
@@ -52,6 +52,7 @@
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/resourcevar.h>
+#include <sys/sched.h>
#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/syscallsubr.h>
@@ -73,8 +74,6 @@
#include <vm/vm_object.h>
#include <vm/swap_pager.h>
-#include <posix4/sched.h>
-
#include <compat/linux/linux_sysproto.h>
#include <compat/linux/linux_emul.h>
#include <compat/linux/linux_misc.h>
Index: sys/conf/files
===================================================================
RCS file: /home/ncvs/src/sys/conf/files,v
retrieving revision 1.1160
diff -u -r1.1160 files
--- sys/conf/files 6 Nov 2006 13:37:18 -0000 1.1160
+++ sys/conf/files 9 Nov 2006 11:06:53 -0000
@@ -1315,6 +1315,7 @@
kern/inflate.c optional gzip
kern/init_main.c standard
kern/init_sysent.c standard
+kern/ksched.c optional _kposix_priority_scheduling
kern/kern_acct.c standard
kern/kern_acl.c standard
kern/kern_alq.c optional alq
@@ -1375,6 +1376,8 @@
kern/linker_if.m standard
kern/md4c.c optional netsmb
kern/md5c.c standard
+kern/p1003_1b.c standard
+kern/posix4_mib.c standard
kern/sched_4bsd.c optional sched_4bsd
kern/sched_core.c optional sched_core
kern/sched_ule.c optional sched_ule
@@ -1919,9 +1922,6 @@
pci/nfsmb.c optional nfsmb pci
pci/viapm.c optional viapm pci
pci/xrpu.c optional xrpu pci
-posix4/ksched.c optional _kposix_priority_scheduling
-posix4/p1003_1b.c standard
-posix4/posix4_mib.c standard
rpc/rpcclnt.c optional nfsclient
security/audit/audit.c optional audit
security/audit/audit_arg.c optional audit
Index: sys/i386/ibcs2/ibcs2_proto.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/ibcs2/ibcs2_proto.h,v
retrieving revision 1.30
diff -u -r1.30 ibcs2_proto.h
--- sys/i386/ibcs2/ibcs2_proto.h 15 Aug 2006 17:37:00 -0000 1.30
+++ sys/i386/ibcs2/ibcs2_proto.h 9 Nov 2006 11:07:02 -0000
@@ -11,7 +11,7 @@
#include <sys/signal.h>
#include <sys/acl.h>
-#include <posix4/_semaphore.h>
+#include <sys/_semaphore.h>
#include <sys/ucontext.h>
#include <bsm/audit_kevents.h>
Index: sys/i386/ibcs2/ibcs2_xenix.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/ibcs2/ibcs2_xenix.h,v
retrieving revision 1.21
diff -u -r1.21 ibcs2_xenix.h
--- sys/i386/ibcs2/ibcs2_xenix.h 15 Aug 2006 17:37:00 -0000 1.21
+++ sys/i386/ibcs2/ibcs2_xenix.h 9 Nov 2006 11:07:02 -0000
@@ -11,7 +11,7 @@
#include <sys/signal.h>
#include <sys/acl.h>
-#include <posix4/_semaphore.h>
+#include <sys/_semaphore.h>
#include <sys/ucontext.h>
#include <bsm/audit_kevents.h>
Index: sys/i386/linux/linux_proto.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/linux/linux_proto.h,v
retrieving revision 1.86
diff -u -r1.86 linux_proto.h
--- sys/i386/linux/linux_proto.h 29 Oct 2006 14:12:44 -0000 1.86
+++ sys/i386/linux/linux_proto.h 9 Nov 2006 11:07:02 -0000
@@ -11,7 +11,7 @@
#include <sys/signal.h>
#include <sys/acl.h>
-#include <posix4/_semaphore.h>
+#include <sys/_semaphore.h>
#include <sys/ucontext.h>
#include <bsm/audit_kevents.h>
Index: sys/kern/Make.tags.inc
===================================================================
RCS file: /home/ncvs/src/sys/kern/Make.tags.inc,v
retrieving revision 1.15
diff -u -r1.15 Make.tags.inc
--- sys/kern/Make.tags.inc 5 Mar 2003 19:24:21 -0000 1.15
+++ sys/kern/Make.tags.inc 9 Nov 2006 11:07:03 -0000
@@ -47,7 +47,6 @@
${SYS}/netnatm/*.[ch] \
${SYS}/nfs/*.[ch] \
${SYS}/pci/*.[ch] \
- ${SYS}/posix4/*.[ch] \
${SYS}/ufs/ffs/*.[ch] \
${SYS}/ufs/ufs/*.[ch] \
${SYS}/vm/*.[ch] \
@@ -64,7 +63,6 @@
${SYS}/netnatm \
${SYS}/nfs \
${SYS}/pci \
- ${SYS}/posix4 \
${SYS}/vm \
${SYS}/sys
Index: sys/kern/kern_time.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_time.c,v
retrieving revision 1.135
diff -u -r1.135 kern_time.c
--- sys/kern/kern_time.c 6 Nov 2006 13:42:01 -0000 1.135
+++ sys/kern/kern_time.c 9 Nov 2006 11:07:03 -0000
@@ -50,13 +50,12 @@
#include <sys/sysent.h>
#include <sys/priv.h>
#include <sys/proc.h>
+#include <sys/posix4.h>
#include <sys/time.h>
#include <sys/timers.h>
#include <sys/timetc.h>
#include <sys/vnode.h>
-#include <posix4/posix4.h>
-
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
Index: sys/kern/makesyscalls.sh
===================================================================
RCS file: /home/ncvs/src/sys/kern/makesyscalls.sh,v
retrieving revision 1.66
diff -u -r1.66 makesyscalls.sh
--- sys/kern/makesyscalls.sh 15 Aug 2006 17:09:32 -0000 1.66
+++ sys/kern/makesyscalls.sh 9 Nov 2006 11:07:03 -0000
@@ -125,7 +125,7 @@
printf "#define\t%s\n\n", sysproto_h > sysarg
printf "#include <sys/signal.h>\n" > sysarg
printf "#include <sys/acl.h>\n" > sysarg
- printf "#include <posix4/_semaphore.h>\n" > sysarg
+ printf "#include <sys/_semaphore.h>\n" > sysarg
printf "#include <sys/ucontext.h>\n\n" > sysarg
printf "#include <bsm/audit_kevents.h>\n\n" > sysarg
printf "struct proc;\n\n" > sysarg
Index: sys/kern/uipc_mqueue.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_mqueue.c,v
retrieving revision 1.17
diff -u -r1.17 uipc_mqueue.c
--- sys/kern/uipc_mqueue.c 6 Nov 2006 13:42:01 -0000 1.17
+++ sys/kern/uipc_mqueue.c 9 Nov 2006 11:07:03 -0000
@@ -64,6 +64,7 @@
#include <sys/mqueue.h>
#include <sys/mutex.h>
#include <sys/namei.h>
+#include <sys/posix4.h>
#include <sys/poll.h>
#include <sys/priv.h>
#include <sys/proc.h>
@@ -79,7 +80,6 @@
#include <sys/unistd.h>
#include <sys/vnode.h>
#include <machine/atomic.h>
-#include <posix4/posix4.h>
/*
* Limits and constants
Index: sys/kern/uipc_sem.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_sem.c,v
retrieving revision 1.26
diff -u -r1.26 uipc_sem.c
--- sys/kern/uipc_sem.c 6 Nov 2006 13:42:01 -0000 1.26
+++ sys/kern/uipc_sem.c 9 Nov 2006 11:07:40 -0000
@@ -42,14 +42,17 @@
#include <sys/sysproto.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
+#include <sys/ksem.h>
#include <sys/priv.h>
#include <sys/proc.h>
+#include <sys/posix4.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/condvar.h>
#include <sys/sem.h>
#include <sys/uio.h>
+#include <sys/semaphore.h>
#include <sys/syscall.h>
#include <sys/stat.h>
#include <sys/sysent.h>
@@ -57,11 +60,7 @@
#include <sys/time.h>
#include <sys/malloc.h>
#include <sys/fcntl.h>
-
-#include <posix4/ksem.h>
-#include <posix4/posix4.h>
-#include <posix4/semaphore.h>
-#include <posix4/_semaphore.h>
+#include <sys/_semaphore.h>
#include <security/mac/mac_framework.h>
Index: sys/kern/vfs_aio.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/vfs_aio.c,v
retrieving revision 1.228
diff -u -r1.228 vfs_aio.c
--- sys/kern/vfs_aio.c 15 Oct 2006 14:22:13 -0000 1.228
+++ sys/kern/vfs_aio.c 9 Nov 2006 11:07:40 -0000
@@ -38,6 +38,7 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/unistd.h>
+#include <sys/posix4.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
@@ -57,7 +58,6 @@
#include <machine/atomic.h>
-#include <posix4/posix4.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/pmap.h>
Index: sys/modules/Makefile
===================================================================
RCS file: /home/ncvs/src/sys/modules/Makefile,v
retrieving revision 1.510
diff -u -r1.510 Makefile
--- sys/modules/Makefile 9 Sep 2006 16:58:22 -0000 1.510
+++ sys/modules/Makefile 9 Nov 2006 11:07:41 -0000
@@ -219,6 +219,7 @@
scc \
scd \
${_scsi_low} \
+ sem \
sf \
${_sio} \
sis \
Index: sys/security/mac/mac_posix_sem.c
===================================================================
RCS file: /home/ncvs/src/sys/security/mac/mac_posix_sem.c,v
retrieving revision 1.3
diff -u -r1.3 mac_posix_sem.c
--- sys/security/mac/mac_posix_sem.c 22 Oct 2006 11:52:18 -0000 1.3
+++ sys/security/mac/mac_posix_sem.c 9 Nov 2006 11:07:49 -0000
@@ -37,14 +37,13 @@
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/ksem.h>
#include <sys/malloc.h>
#include <sys/mac.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
-#include <posix4/ksem.h>
-
#include <sys/mac_policy.h>
#include <security/mac/mac_framework.h>
Index: sys/security/mac_biba/mac_biba.c
===================================================================
RCS file: /home/ncvs/src/sys/security/mac_biba/mac_biba.c,v
retrieving revision 1.94
diff -u -r1.94 mac_biba.c
--- sys/security/mac_biba/mac_biba.c 12 Sep 2006 04:25:12 -0000 1.94
+++ sys/security/mac_biba/mac_biba.c 9 Nov 2006 11:07:49 -0000
@@ -45,6 +45,7 @@
#include <sys/conf.h>
#include <sys/extattr.h>
#include <sys/kernel.h>
+#include <sys/ksem.h>
#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mman.h>
@@ -66,8 +67,6 @@
#include <sys/sem.h>
#include <sys/shm.h>
-#include <posix4/ksem.h>
-
#include <fs/devfs/devfs.h>
#include <net/bpfdesc.h>
Index: sys/security/mac_mls/mac_mls.c
===================================================================
RCS file: /home/ncvs/src/sys/security/mac_mls/mac_mls.c,v
retrieving revision 1.77
diff -u -r1.77 mac_mls.c
--- sys/security/mac_mls/mac_mls.c 12 Sep 2006 04:25:12 -0000 1.77
+++ sys/security/mac_mls/mac_mls.c 9 Nov 2006 11:07:49 -0000
@@ -45,6 +45,7 @@
#include <sys/conf.h>
#include <sys/extattr.h>
#include <sys/kernel.h>
+#include <sys/ksem.h>
#include <sys/mac.h>
#include <sys/mman.h>
#include <sys/malloc.h>
@@ -66,8 +67,6 @@
#include <sys/sem.h>
#include <sys/shm.h>
-#include <posix4/ksem.h>
-
#include <fs/devfs/devfs.h>
#include <net/bpfdesc.h>
Index: sys/security/mac_stub/mac_stub.c
===================================================================
RCS file: /home/ncvs/src/sys/security/mac_stub/mac_stub.c,v
retrieving revision 1.57
diff -u -r1.57 mac_stub.c
--- sys/security/mac_stub/mac_stub.c 6 Nov 2006 13:45:45 -0000 1.57
+++ sys/security/mac_stub/mac_stub.c 9 Nov 2006 11:07:49 -0000
@@ -51,6 +51,7 @@
#include <sys/conf.h>
#include <sys/extattr.h>
#include <sys/kernel.h>
+#include <sys/ksem.h>
#include <sys/mac.h>
#include <sys/mount.h>
#include <sys/proc.h>
@@ -68,8 +69,6 @@
#include <sys/sem.h>
#include <sys/shm.h>
-#include <posix4/ksem.h>
-
#include <fs/devfs/devfs.h>
#include <net/bpfdesc.h>
Index: sys/security/mac_test/mac_test.c
===================================================================
RCS file: /home/ncvs/src/sys/security/mac_test/mac_test.c,v
retrieving revision 1.63
diff -u -r1.63 mac_test.c
--- sys/security/mac_test/mac_test.c 19 Sep 2005 18:52:51 -0000 1.63
+++ sys/security/mac_test/mac_test.c 9 Nov 2006 11:07:49 -0000
@@ -46,6 +46,7 @@
#include <sys/kdb.h>
#include <sys/extattr.h>
#include <sys/kernel.h>
+#include <sys/ksem.h>
#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mount.h>
@@ -63,8 +64,6 @@
#include <sys/sem.h>
#include <sys/shm.h>
-#include <posix4/ksem.h>
-
#include <fs/devfs/devfs.h>
#include <net/bpfdesc.h>
Index: sys/sys/sysproto.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/sysproto.h,v
retrieving revision 1.211
diff -u -r1.211 sysproto.h
--- sys/sys/sysproto.h 3 Nov 2006 18:57:49 -0000 1.211
+++ sys/sys/sysproto.h 9 Nov 2006 11:08:05 -0000
@@ -11,8 +11,8 @@
#include <sys/signal.h>
#include <sys/acl.h>
-#include <posix4/_semaphore.h>
#include <sys/ucontext.h>
+#include <sys/_semaphore.h>
#include <bsm/audit_kevents.h>
Index: sys/sys/thr.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/thr.h,v
retrieving revision 1.11
diff -u -r1.11 thr.h
--- sys/sys/thr.h 22 Sep 2006 15:04:28 -0000 1.11
+++ sys/sys/thr.h 9 Nov 2006 11:08:05 -0000
@@ -30,7 +30,7 @@
#ifndef _SYS_THR_H_
#define _SYS_THR_H_
-#include <posix4/sched.h>
+#include <sys/sched.h>
/* Create the thread in the suspended state. */
#define THR_SUSPENDED 0x0001
Index: sys/sys/sched.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/sched.h,v
retrieving revision 1.28
diff -u -r1.28 sched.h
--- sys/sys/sched.h 26 Oct 2006 21:42:22 -0000 1.28
+++ sys/sys/sched.h 9 Nov 2006 11:38:13 -0000
@@ -1,4 +1,37 @@
/*-
+ * Copyright (c) 1996, 1997
+ * 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
+ * and Jukka Antero Ukkonen.
+ * 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.
+ */
+
+/*-
* Copyright (c) 2002, Jeffrey Roberson <jeff at freebsd.org>
* All rights reserved.
*
@@ -26,9 +59,10 @@
* $FreeBSD: src/sys/sys/sched.h,v 1.28 2006/10/26 21:42:22 jb Exp $
*/
-#ifndef _SYS_SCHED_H_
-#define _SYS_SCHED_H_
+#ifndef _SCHED_H_
+#define _SCHED_H_
+#ifdef _KERNEL
/*
* General scheduling info.
*
@@ -138,5 +172,45 @@
void sched_thread_exit(struct thread *td);
#endif
void sched_newthread(struct thread *td);
+#endif /* _KERNEL */
+
+/* POSIX 1003.1b Process Scheduling */
-#endif /* !_SYS_SCHED_H_ */
+/*
+ * POSIX scheduling policies
+ */
+#define SCHED_FIFO 1
+#define SCHED_OTHER 2
+#define SCHED_RR 3
+
+struct sched_param {
+ int sched_priority;
+};
+
+/*
+ * POSIX scheduling declarations for userland.
+ */
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+#include <sys/_types.h>
+
+#ifndef _PID_T_DECLARED
+typedef __pid_t pid_t;
+#define _PID_T_DECLARED
+#endif
+
+struct timespec;
+
+__BEGIN_DECLS
+int sched_get_priority_max(int);
+int sched_get_priority_min(int);
+int sched_getparam(pid_t, struct sched_param *);
+int sched_getscheduler(pid_t);
+int sched_rr_get_interval(pid_t, struct timespec *);
+int sched_setparam(pid_t, const struct sched_param *);
+int sched_setscheduler(pid_t, int, const struct sched_param *);
+int sched_yield(void);
+__END_DECLS
+
+#endif
+#endif /* !_SCHED_H_ */
Index: sys/kern/kern_sig.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_sig.c,v
retrieving revision 1.335
diff -u -r1.335 kern_sig.c
--- sys/kern/kern_sig.c 26 Oct 2006 21:42:19 -0000 1.335
+++ sys/kern/kern_sig.c 9 Nov 2006 11:42:43 -0000
@@ -57,9 +57,9 @@
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
+#include <sys/posix4.h>
#include <sys/pioctl.h>
#include <sys/resourcevar.h>
-#include <sys/sched.h>
#include <sys/sleepqueue.h>
#include <sys/smp.h>
#include <sys/stat.h>
@@ -76,7 +76,6 @@
#include <vm/vm_extern.h>
#include <vm/uma.h>
-#include <posix4/posix4.h>
#include <machine/cpu.h>
#include <security/audit/audit.h>
More information about the freebsd-arch
mailing list