posix4.h revision 45739
134925Sdufault#ifndef _P1003_1B_P1003_1B_H_
234925Sdufault#define _P1003_1B_P1003_1B_H_
334030Sdufault/*-
434030Sdufault * Copyright (c) 1996, 1997, 1998
534030Sdufault *	HD Associates, Inc.  All rights reserved.
634030Sdufault *
734030Sdufault * Redistribution and use in source and binary forms, with or without
834030Sdufault * modification, are permitted provided that the following conditions
934030Sdufault * are met:
1034030Sdufault * 1. Redistributions of source code must retain the above copyright
1134030Sdufault *    notice, this list of conditions and the following disclaimer.
1234030Sdufault * 2. Redistributions in binary form must reproduce the above copyright
1334030Sdufault *    notice, this list of conditions and the following disclaimer in the
1434030Sdufault *    documentation and/or other materials provided with the distribution.
1534030Sdufault * 3. All advertising materials mentioning features or use of this software
1634030Sdufault *    must display the following acknowledgement:
1734030Sdufault *	This product includes software developed by HD Associates, Inc
1834030Sdufault * 4. Neither the name of the author nor the names of any co-contributors
1934030Sdufault *    may be used to endorse or promote products derived from this software
2034030Sdufault *    without specific prior written permission.
2134030Sdufault *
2234030Sdufault * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
2334030Sdufault * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2434030Sdufault * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2534030Sdufault * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
2634030Sdufault * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2734030Sdufault * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2834030Sdufault * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2934030Sdufault * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3034030Sdufault * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3134030Sdufault * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3234030Sdufault * SUCH DAMAGE.
3334030Sdufault *
3434030Sdufault */
3534030Sdufault
3634925Sdufault#include "opt_posix.h"
3734319Sdufault
3834030Sdufault#include <sys/param.h>
3934030Sdufault#include <sys/ioccom.h>
4034925Sdufault#include <sys/malloc.h>
4134925Sdufault#include <posix4/sched.h>
4234030Sdufault
4334925Sdufault/* Generate syscall stubs for when something is optionally
4445739Speter * loadable as a module.  References "syscall_not_present".
4534925Sdufault * XXX Good candidate for sys/syscall.h
4634030Sdufault */
4734925Sdufaultstruct proc;
4834925Sdufaultstruct nosys_args;
4934925Sdufaultextern int syscall_not_present(struct proc *, const char *, struct nosys_args *);
5034030Sdufault
5134925Sdufault#define SYSCALL_NOT_PRESENT_GEN(SC) \
5234925Sdufaultint SC (struct proc *p, struct SC##_args *uap) \
5334925Sdufault{ \
5434925Sdufault	return syscall_not_present(p, #SC , (struct nosys_args *)uap); \
5534925Sdufault}
5634030Sdufault
5734030Sdufault
5834925SdufaultMALLOC_DECLARE(M_P31B);
5934030Sdufault
6034925Sdufault#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK)
6134925Sdufault#define p31b_free(P) free((P), M_P31B)
6234925Sdufault
6334925Sdufaultint p31b_proc __P((struct proc *, pid_t, struct proc **));
6434925Sdufault
6534925Sdufaultvoid p31b_setcfg __P((int, int));
6634925Sdufault
6734925Sdufault#ifdef _KPOSIX_PRIORITY_SCHEDULING
6834925Sdufault
6934030Sdufault/*
7034030Sdufault * KSCHED_OP_RW is a vector of read/write flags for each entry indexed
7134030Sdufault * by the enum ksched_op.
7234030Sdufault *
7334030Sdufault * 1 means you need write access, 0 means read is sufficient.
7434030Sdufault */
7534030Sdufault
7634030Sdufaultenum ksched_op {
7734030Sdufault
7834030Sdufault#define KSCHED_OP_RW { 1, 0, 1, 0, 0, 0, 0, 0 }
7934030Sdufault
8034030Sdufault	SCHED_SETPARAM,
8134030Sdufault	SCHED_GETPARAM,
8234030Sdufault	SCHED_SETSCHEDULER,
8334030Sdufault	SCHED_GETSCHEDULER,
8434030Sdufault	SCHED_YIELD,
8534030Sdufault	SCHED_GET_PRIORITY_MAX,
8634030Sdufault	SCHED_GET_PRIORITY_MIN,
8734030Sdufault	SCHED_RR_GET_INTERVAL,
8834030Sdufault	SCHED_OP_MAX
8934030Sdufault};
9034030Sdufault
9134925Sdufaultstruct ksched;
9234030Sdufault
9334925Sdufaultint ksched_attach(struct ksched **);
9434925Sdufaultint ksched_detach(struct ksched *);
9534030Sdufault
9634925Sdufaultint ksched_setparam(int *, struct ksched *,
9734030Sdufault	struct proc *, const struct sched_param *);
9834925Sdufaultint ksched_getparam(int *, struct ksched *,
9934030Sdufault	struct proc *, struct sched_param *);
10034030Sdufault
10134925Sdufaultint ksched_setscheduler(int *, struct ksched *,
10234030Sdufault	struct proc *, int, const struct sched_param *);
10334925Sdufaultint ksched_getscheduler(int *, struct ksched *, struct proc *);
10434030Sdufault
10534925Sdufaultint ksched_yield(int *, struct ksched *);
10634030Sdufault
10734925Sdufaultint ksched_get_priority_max(int *, struct ksched *, int);
10834925Sdufaultint ksched_get_priority_min(int *, struct ksched *, int);
10934030Sdufault
11034925Sdufaultint ksched_rr_get_interval(int *, struct ksched *, struct proc *, struct timespec *);
11134030Sdufault
11234925Sdufault#endif /* _KPOSIX_PRIORITY_SCHEDULING */
11334030Sdufault
11434925Sdufault#endif /* _P1003_1B_P1003_1B_H_ */
115