diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index 99338653a6f6..96bc4724d0b5 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -33,15 +33,16 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.10 1994/08/19 22:49:42 davidg Exp $ + * $Id: swtch.s,v 1.11 1994/08/30 17:19:10 bde Exp $ */ #include "npx.h" /* for NNPX */ #include "assym.s" /* for preprocessor defines */ -#include "errno.h" /* for error codes */ +#include /* for error codes */ -#include "machine/asmacros.h" /* for miscellaneous assembly macros */ -#include "machine/spl.h" /* for SWI_AST_MASK ... */ +#include /* for miscellaneous assembly macros */ +#include /* for SWI_AST_MASK ... */ +#include /*****************************************************************************/ @@ -58,9 +59,10 @@ * queues. */ .data - .globl _curpcb, _whichqs + .globl _curpcb, _whichqs, _whichrtqs _curpcb: .long 0 /* pointer to curproc's PCB area */ _whichqs: .long 0 /* which run queues have data */ +_whichrtqs: .long 0 /* which realtime run queues have data */ .globl _qs,_cnt,_panic .comm _noproc,4 @@ -82,6 +84,20 @@ ENTRY(setrunqueue) pushl $set2 call _panic set1: + cmpl $RTPRIO_RTOFF,P_RTPRIO(%eax) /* Realtime process ? */ + je set1_nort + + movl P_RTPRIO(%eax),%edx + btsl %edx,_whichrtqs /* set q full bit */ + shll $3,%edx + addl $_rtqs,%edx /* locate q hdr */ + movl %edx,P_LINK(%eax) /* link process on tail of q */ + movl P_RLINK(%edx),%ecx + movl %ecx,P_RLINK(%eax) + movl %eax,P_RLINK(%edx) + movl %eax,P_LINK(%ecx) + ret +set1_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btsl %edx,_whichqs /* set q full bit */ @@ -103,6 +119,34 @@ set2: .asciz "setrunqueue" */ ENTRY(remrq) movl 4(%esp),%eax + cmpl $RTPRIO_RTOFF,P_RTPRIO(%eax) /* Realtime process ? */ + je rem_nort + + movl P_RTPRIO(%eax),%edx + btrl %edx,_whichrtqs /* clear full bit, panic if clear already */ + jb rem1rt + pushl $rem3 + call _panic +rem1rt: + pushl %edx + movl P_LINK(%eax),%ecx /* unlink process */ + movl P_RLINK(%eax),%edx + movl %edx,P_RLINK(%ecx) + movl P_RLINK(%eax),%ecx + movl P_LINK(%eax),%edx + movl %edx,P_LINK(%ecx) + popl %edx + movl $_rtqs,%ecx + shll $3,%edx + addl %edx,%ecx + cmpl P_LINK(%ecx),%ecx /* q still has something? */ + je rem2rt + shrl $3,%edx /* yes, set bit as still full */ + btsl %edx,_whichrtqs +rem2rt: + movl $0,P_RLINK(%eax) /* zap reverse link to indicate off list */ + ret +rem_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btrl %edx,_whichqs /* clear full bit, panic if clear already */ @@ -156,8 +200,10 @@ _idle: ALIGN_TEXT idle_loop: cli - cmpl $0,_whichqs + cmpl $0,_whichrtqs jne sw1a + cmpl $0,_whichqs + jne nortqr sti hlt /* wait for interrupt */ jmp idle_loop @@ -214,6 +260,41 @@ ENTRY(cpu_switch) sw1: cli sw1a: + movl _whichrtqs,%edi /* pick next p. from rtqs */ + +rt2: + /* XXX - bsf is sloow */ + bsfl %edi,%eax /* find a full q */ + je nortqr /* no proc on rt q - try normal ... */ + + /* XX update whichqs? */ + btrl %eax,%edi /* clear q full status */ + jnb rt2 /* if it was clear, look for another */ + movl %eax,%ebx /* save which one we are using */ + shll $3,%eax + addl $_rtqs,%eax /* select q */ + movl %eax,%esi + +#ifdef DIAGNOSTIC + cmpl P_LINK(%eax),%eax /* linked to self? (e.g. not on list) */ + je badsw /* not possible */ +#endif + + movl P_LINK(%eax),%ecx /* unlink from front of process q */ + movl P_LINK(%ecx),%edx + movl %edx,P_LINK(%eax) + movl P_RLINK(%ecx),%eax + movl %eax,P_RLINK(%edx) + + cmpl P_LINK(%ecx),%esi /* q empty */ + je rt3 + btsl %ebx,%edi /* nope, set to indicate full */ +rt3: + movl %edi,_whichrtqs /* update q status */ + jmp swtch_com + + /* old sw1a */ +nortqr: movl _whichqs,%edi 2: /* XXX - bsf is sloow */ @@ -246,6 +327,7 @@ sw1a: 3: movl %edi,_whichqs /* update q status */ +swtch_com: movl $0,%eax movl %eax,_want_resched diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index a75d1f1a8557..41426ed6dce1 100644 --- a/sys/amd64/amd64/genassym.c +++ b/sys/amd64/amd64/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id: genassym.c,v 1.6 1993/11/13 02:24:59 davidg Exp $ + * $Id: genassym.c,v 1.8 1994/05/25 08:53:32 rgrimes Exp $ */ #include @@ -74,6 +74,7 @@ main() printf("#define\tVM_PMAP %d\n", &vms->vm_pmap); printf("#define\tP_ADDR %d\n", &p->p_addr); printf("#define\tP_PRI %d\n", &p->p_priority); + printf("#define\tP_RTPRIO %d\n", &p->p_rtprio); printf("#define\tP_STAT %d\n", &p->p_stat); printf("#define\tP_WCHAN %d\n", &p->p_wchan); printf("#define\tP_FLAG %d\n", &p->p_flag); diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s index 99338653a6f6..96bc4724d0b5 100644 --- a/sys/amd64/amd64/swtch.s +++ b/sys/amd64/amd64/swtch.s @@ -33,15 +33,16 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.10 1994/08/19 22:49:42 davidg Exp $ + * $Id: swtch.s,v 1.11 1994/08/30 17:19:10 bde Exp $ */ #include "npx.h" /* for NNPX */ #include "assym.s" /* for preprocessor defines */ -#include "errno.h" /* for error codes */ +#include /* for error codes */ -#include "machine/asmacros.h" /* for miscellaneous assembly macros */ -#include "machine/spl.h" /* for SWI_AST_MASK ... */ +#include /* for miscellaneous assembly macros */ +#include /* for SWI_AST_MASK ... */ +#include /*****************************************************************************/ @@ -58,9 +59,10 @@ * queues. */ .data - .globl _curpcb, _whichqs + .globl _curpcb, _whichqs, _whichrtqs _curpcb: .long 0 /* pointer to curproc's PCB area */ _whichqs: .long 0 /* which run queues have data */ +_whichrtqs: .long 0 /* which realtime run queues have data */ .globl _qs,_cnt,_panic .comm _noproc,4 @@ -82,6 +84,20 @@ ENTRY(setrunqueue) pushl $set2 call _panic set1: + cmpl $RTPRIO_RTOFF,P_RTPRIO(%eax) /* Realtime process ? */ + je set1_nort + + movl P_RTPRIO(%eax),%edx + btsl %edx,_whichrtqs /* set q full bit */ + shll $3,%edx + addl $_rtqs,%edx /* locate q hdr */ + movl %edx,P_LINK(%eax) /* link process on tail of q */ + movl P_RLINK(%edx),%ecx + movl %ecx,P_RLINK(%eax) + movl %eax,P_RLINK(%edx) + movl %eax,P_LINK(%ecx) + ret +set1_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btsl %edx,_whichqs /* set q full bit */ @@ -103,6 +119,34 @@ set2: .asciz "setrunqueue" */ ENTRY(remrq) movl 4(%esp),%eax + cmpl $RTPRIO_RTOFF,P_RTPRIO(%eax) /* Realtime process ? */ + je rem_nort + + movl P_RTPRIO(%eax),%edx + btrl %edx,_whichrtqs /* clear full bit, panic if clear already */ + jb rem1rt + pushl $rem3 + call _panic +rem1rt: + pushl %edx + movl P_LINK(%eax),%ecx /* unlink process */ + movl P_RLINK(%eax),%edx + movl %edx,P_RLINK(%ecx) + movl P_RLINK(%eax),%ecx + movl P_LINK(%eax),%edx + movl %edx,P_LINK(%ecx) + popl %edx + movl $_rtqs,%ecx + shll $3,%edx + addl %edx,%ecx + cmpl P_LINK(%ecx),%ecx /* q still has something? */ + je rem2rt + shrl $3,%edx /* yes, set bit as still full */ + btsl %edx,_whichrtqs +rem2rt: + movl $0,P_RLINK(%eax) /* zap reverse link to indicate off list */ + ret +rem_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btrl %edx,_whichqs /* clear full bit, panic if clear already */ @@ -156,8 +200,10 @@ _idle: ALIGN_TEXT idle_loop: cli - cmpl $0,_whichqs + cmpl $0,_whichrtqs jne sw1a + cmpl $0,_whichqs + jne nortqr sti hlt /* wait for interrupt */ jmp idle_loop @@ -214,6 +260,41 @@ ENTRY(cpu_switch) sw1: cli sw1a: + movl _whichrtqs,%edi /* pick next p. from rtqs */ + +rt2: + /* XXX - bsf is sloow */ + bsfl %edi,%eax /* find a full q */ + je nortqr /* no proc on rt q - try normal ... */ + + /* XX update whichqs? */ + btrl %eax,%edi /* clear q full status */ + jnb rt2 /* if it was clear, look for another */ + movl %eax,%ebx /* save which one we are using */ + shll $3,%eax + addl $_rtqs,%eax /* select q */ + movl %eax,%esi + +#ifdef DIAGNOSTIC + cmpl P_LINK(%eax),%eax /* linked to self? (e.g. not on list) */ + je badsw /* not possible */ +#endif + + movl P_LINK(%eax),%ecx /* unlink from front of process q */ + movl P_LINK(%ecx),%edx + movl %edx,P_LINK(%eax) + movl P_RLINK(%ecx),%eax + movl %eax,P_RLINK(%edx) + + cmpl P_LINK(%ecx),%esi /* q empty */ + je rt3 + btsl %ebx,%edi /* nope, set to indicate full */ +rt3: + movl %edi,_whichrtqs /* update q status */ + jmp swtch_com + + /* old sw1a */ +nortqr: movl _whichqs,%edi 2: /* XXX - bsf is sloow */ @@ -246,6 +327,7 @@ sw1a: 3: movl %edi,_whichqs /* update q status */ +swtch_com: movl $0,%eax movl %eax,_want_resched diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index a75d1f1a8557..41426ed6dce1 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id: genassym.c,v 1.6 1993/11/13 02:24:59 davidg Exp $ + * $Id: genassym.c,v 1.8 1994/05/25 08:53:32 rgrimes Exp $ */ #include @@ -74,6 +74,7 @@ main() printf("#define\tVM_PMAP %d\n", &vms->vm_pmap); printf("#define\tP_ADDR %d\n", &p->p_addr); printf("#define\tP_PRI %d\n", &p->p_priority); + printf("#define\tP_RTPRIO %d\n", &p->p_rtprio); printf("#define\tP_STAT %d\n", &p->p_stat); printf("#define\tP_WCHAN %d\n", &p->p_wchan); printf("#define\tP_FLAG %d\n", &p->p_flag); diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index 99338653a6f6..96bc4724d0b5 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -33,15 +33,16 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.10 1994/08/19 22:49:42 davidg Exp $ + * $Id: swtch.s,v 1.11 1994/08/30 17:19:10 bde Exp $ */ #include "npx.h" /* for NNPX */ #include "assym.s" /* for preprocessor defines */ -#include "errno.h" /* for error codes */ +#include /* for error codes */ -#include "machine/asmacros.h" /* for miscellaneous assembly macros */ -#include "machine/spl.h" /* for SWI_AST_MASK ... */ +#include /* for miscellaneous assembly macros */ +#include /* for SWI_AST_MASK ... */ +#include /*****************************************************************************/ @@ -58,9 +59,10 @@ * queues. */ .data - .globl _curpcb, _whichqs + .globl _curpcb, _whichqs, _whichrtqs _curpcb: .long 0 /* pointer to curproc's PCB area */ _whichqs: .long 0 /* which run queues have data */ +_whichrtqs: .long 0 /* which realtime run queues have data */ .globl _qs,_cnt,_panic .comm _noproc,4 @@ -82,6 +84,20 @@ ENTRY(setrunqueue) pushl $set2 call _panic set1: + cmpl $RTPRIO_RTOFF,P_RTPRIO(%eax) /* Realtime process ? */ + je set1_nort + + movl P_RTPRIO(%eax),%edx + btsl %edx,_whichrtqs /* set q full bit */ + shll $3,%edx + addl $_rtqs,%edx /* locate q hdr */ + movl %edx,P_LINK(%eax) /* link process on tail of q */ + movl P_RLINK(%edx),%ecx + movl %ecx,P_RLINK(%eax) + movl %eax,P_RLINK(%edx) + movl %eax,P_LINK(%ecx) + ret +set1_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btsl %edx,_whichqs /* set q full bit */ @@ -103,6 +119,34 @@ set2: .asciz "setrunqueue" */ ENTRY(remrq) movl 4(%esp),%eax + cmpl $RTPRIO_RTOFF,P_RTPRIO(%eax) /* Realtime process ? */ + je rem_nort + + movl P_RTPRIO(%eax),%edx + btrl %edx,_whichrtqs /* clear full bit, panic if clear already */ + jb rem1rt + pushl $rem3 + call _panic +rem1rt: + pushl %edx + movl P_LINK(%eax),%ecx /* unlink process */ + movl P_RLINK(%eax),%edx + movl %edx,P_RLINK(%ecx) + movl P_RLINK(%eax),%ecx + movl P_LINK(%eax),%edx + movl %edx,P_LINK(%ecx) + popl %edx + movl $_rtqs,%ecx + shll $3,%edx + addl %edx,%ecx + cmpl P_LINK(%ecx),%ecx /* q still has something? */ + je rem2rt + shrl $3,%edx /* yes, set bit as still full */ + btsl %edx,_whichrtqs +rem2rt: + movl $0,P_RLINK(%eax) /* zap reverse link to indicate off list */ + ret +rem_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btrl %edx,_whichqs /* clear full bit, panic if clear already */ @@ -156,8 +200,10 @@ _idle: ALIGN_TEXT idle_loop: cli - cmpl $0,_whichqs + cmpl $0,_whichrtqs jne sw1a + cmpl $0,_whichqs + jne nortqr sti hlt /* wait for interrupt */ jmp idle_loop @@ -214,6 +260,41 @@ ENTRY(cpu_switch) sw1: cli sw1a: + movl _whichrtqs,%edi /* pick next p. from rtqs */ + +rt2: + /* XXX - bsf is sloow */ + bsfl %edi,%eax /* find a full q */ + je nortqr /* no proc on rt q - try normal ... */ + + /* XX update whichqs? */ + btrl %eax,%edi /* clear q full status */ + jnb rt2 /* if it was clear, look for another */ + movl %eax,%ebx /* save which one we are using */ + shll $3,%eax + addl $_rtqs,%eax /* select q */ + movl %eax,%esi + +#ifdef DIAGNOSTIC + cmpl P_LINK(%eax),%eax /* linked to self? (e.g. not on list) */ + je badsw /* not possible */ +#endif + + movl P_LINK(%eax),%ecx /* unlink from front of process q */ + movl P_LINK(%ecx),%edx + movl %edx,P_LINK(%eax) + movl P_RLINK(%ecx),%eax + movl %eax,P_RLINK(%edx) + + cmpl P_LINK(%ecx),%esi /* q empty */ + je rt3 + btsl %ebx,%edi /* nope, set to indicate full */ +rt3: + movl %edi,_whichrtqs /* update q status */ + jmp swtch_com + + /* old sw1a */ +nortqr: movl _whichqs,%edi 2: /* XXX - bsf is sloow */ @@ -246,6 +327,7 @@ sw1a: 3: movl %edi,_whichqs /* update q status */ +swtch_com: movl $0,%eax movl %eax,_want_resched diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index d5043450ffba..80fc5953b20f 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 - * $Id: init_main.c,v 1.6 1994/08/24 11:50:37 sos Exp $ + * $Id: init_main.c,v 1.7 1994/08/27 16:14:25 davidg Exp $ */ #include @@ -363,6 +363,9 @@ start_init(p, framep) */ cpu_set_init_frame(p, framep); + /* XXX */ + p->p_rtprio = RTPRIO_RTOFF; + /* * Need just enough stack to hold the faked-up "execve()" arguments. */ diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index ce5d6aa5ef20..61e2f50d7a0f 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94 - * $Id: kern_fork.c,v 1.4 1994/08/06 07:15:04 davidg Exp $ + * $Id: kern_fork.c,v 1.5 1994/08/18 22:35:00 wollman Exp $ */ #include @@ -268,6 +268,11 @@ again: */ p2->p_estcpu = p1->p_estcpu; + /* + * copy the realtime attibute + */ + p2->p_rtprio = p1->p_rtprio; + /* * This begins the section where we must prevent the parent * from being swapped. diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index c4b34c90e24e..e130b64906e5 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_proc.c 8.4 (Berkeley) 1/4/94 - * $Id: kern_proc.c,v 1.3 1994/08/02 07:42:07 davidg Exp $ + * $Id: kern_proc.c,v 1.4 1994/08/18 22:35:03 wollman Exp $ */ #include @@ -50,6 +50,9 @@ #include #include +struct prochd qs[NQS]; /* as good a place as any... */ +struct prochd rtqs[NQS]; /* Space for REALTIME queues too */ + volatile struct proc *allproc; /* all processes */ struct proc *zombproc; /* just zombies */ diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index a6b11c0431e6..06d749cd7c1f 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 - * $Id$ + * $Id: kern_resource.c,v 1.3 1994/08/02 07:42:10 davidg Exp $ */ #include @@ -193,6 +193,64 @@ donice(curp, chgp, n) return (0); } +/* rtprio system call */ +struct rtprio_args { + int who; + pid_t rtprio; +}; + +/* + * Set realtime priority + */ + +/* ARGSUSED */ +int +rtprio(curp, uap, retval) + struct proc *curp; + register struct rtprio_args *uap; + int *retval; +{ + register struct proc *p; + register int n = uap->rtprio; + register struct pcred *pcred = curp->p_cred; + + if (uap->who == 0) + p = curp; + else + p = pfind(uap->who); + + if (p == 0) + return (ESRCH); + + if (n == RTPRIO_NOCHG) { + *retval = (int)p->p_rtprio; + return(0); } + + if (pcred->pc_ucred->cr_uid && pcred->p_ruid && + pcred->pc_ucred->cr_uid != p->p_ucred->cr_uid && + pcred->p_ruid != p->p_ucred->cr_uid) + return (EPERM); + + if (n == RTPRIO_RTOFF) { + if(suser(pcred->pc_ucred, &curp->p_acflag)&& !uap->who) + return (EPERM); + p->p_rtprio = RTPRIO_RTOFF; + *retval = RTPRIO_RTOFF; + return (0); } + + if (n > RTPRIO_MAX) + return (EINVAL); + if (n < RTPRIO_MIN) + return (EINVAL); + if (suser(pcred->pc_ucred, &curp->p_acflag)) + return (EPERM); + + p->p_rtprio = n; + + *retval = (int)p->p_rtprio; + return (0); +}; + #if defined(COMPAT_43) || defined(COMPAT_SUNOS) struct setrlimit_args { u_int which; diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index f9d43a6ca3ce..f667c87b135d 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_synch.c 8.6 (Berkeley) 1/21/94 - * $Id$ + * $Id: kern_synch.c,v 1.3 1994/08/02 07:42:17 davidg Exp $ */ #include @@ -606,8 +606,10 @@ rqinit() { register int i; - for (i = 0; i < NQS; i++) + for (i = 0; i < NQS; i++) { qs[i].ph_link = qs[i].ph_rlink = (struct proc *)&qs[i]; + rtqs[i].ph_link = rtqs[i].ph_rlink = (struct proc *)&rtqs[i]; + } } /* @@ -660,9 +662,13 @@ resetpriority(p) { register unsigned int newpriority; - newpriority = PUSER + p->p_estcpu / 4 + 2 * p->p_nice; - newpriority = min(newpriority, MAXPRI); - p->p_usrpri = newpriority; - if (newpriority < curpriority) + if (p->p_rtprio == RTPRIO_RTOFF) { + newpriority = PUSER + p->p_estcpu / 4 + 2 * p->p_nice; + newpriority = min(newpriority, MAXPRI); + p->p_usrpri = newpriority; + if (newpriority < curpriority) + need_resched(); + } else { need_resched(); + } } diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 9611daf2aabe..fc579e83a279 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ - $Id: syscalls.master,v 1.4 1994/08/19 11:45:23 davidg Exp $ + $Id: syscalls.master,v 1.5 1994/08/26 18:15:15 wollman Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; ; System call name/number master file. @@ -218,7 +218,7 @@ 163 STD 2 setdomainname 164 STD 1 uname 165 STD 2 sysarch -166 UNIMPL 0 nosys +166 STD 2 rtprio 167 UNIMPL 0 nosys 168 UNIMPL 0 nosys 169 UNIMPL 0 nosys diff --git a/sys/sys/param.h b/sys/sys/param.h index 50d8c2f7e8d4..bf190de7b11e 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.h 8.2 (Berkeley) 1/21/94 - * $Id: param.h,v 1.3 1994/08/02 07:53:19 davidg Exp $ + * $Id: param.h,v 1.4 1994/08/21 04:41:55 paul Exp $ */ #ifndef _SYS_PARAM_H_ @@ -81,6 +81,7 @@ #include #include #include +#include #endif /* Signals. */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 18e01a32e99f..6155408a15bf 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.8 (Berkeley) 1/21/94 - * $Id: proc.h,v 1.6 1994/08/25 22:59:35 wollman Exp $ + * $Id: proc.h,v 1.7 1994/08/28 16:53:35 bde Exp $ */ #ifndef _SYS_PROC_H_ @@ -135,7 +135,7 @@ struct proc { struct vnode *p_textvp; /* Vnode of executable. */ - long p_spare[4]; /* Pad to 256, avoid shifting eproc. */ + long p_spare[3]; /* Pad to 256, avoid shifting eproc. */ /* End area that is zeroed on creation. */ #define p_endzero p_startcopy @@ -165,7 +165,7 @@ struct proc { u_short p_xstat; /* Exit status for wait; also stop signal. */ u_short p_acflag; /* Accounting flags. */ struct rusage *p_ru; /* Exit information. XXX */ - + u_long p_rtprio; /* realtime priority */ }; #define p_session p_pgrp->pg_session @@ -246,11 +246,13 @@ extern struct proc *zombproc; /* List of zombie procs. */ extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */ #define NQS 32 /* 32 run queues. */ +extern struct prochd qs[]; +extern struct prochd rtqs[]; extern int whichqs; /* Bit mask summary of non-empty Q's. */ struct prochd { struct proc *ph_link; /* Linked list of running processes. */ struct proc *ph_rlink; -} qs[NQS]; +}; int chgproccnt __P((uid_t, int)); struct proc *pfind __P((pid_t)); /* Find process by id. */ diff --git a/sys/sys/rtprio.h b/sys/sys/rtprio.h new file mode 100644 index 000000000000..7638f9bb4454 --- /dev/null +++ b/sys/sys/rtprio.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1994, Henrik Vestergaard Draboel + * 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 (name). + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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. + * + * $Id$ + */ + +#ifndef _SYS_RTPRIO_H_ +#define _SYS_RTPRIO_H_ + +/* + * Process realtime-priority specifications to rtprio. + */ +#define RTPRIO_MIN 0 /* relativ-FASTEST */ +#define RTPRIO_MAX 31 /* relativ-SLOWEST */ +#define RTPRIO_NOCHG 100 /* look only */ +#define RTPRIO_RTOFF 101 /* NON-realtime */ + +#ifndef KERNEL +#include + +__BEGIN_DECLS +int rtprio __P((int, int)); +__END_DECLS +#endif /* !KERNEL */ +#endif /* !_SYS_RTPRIO_H_ */