posix4.h revision 55140
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 *
3455140Sbde * $FreeBSD: head/sys/sys/posix4.h 55140 1999-12-27 10:22:09Z bde $
3534030Sdufault */
3634030Sdufault
3734925Sdufault#include "opt_posix.h"
3834319Sdufault
3934030Sdufault#include <sys/param.h>
4034030Sdufault#include <sys/ioccom.h>
4134925Sdufault#include <sys/malloc.h>
4234925Sdufault#include <posix4/sched.h>
4334030Sdufault
4434925Sdufault/* Generate syscall stubs for when something is optionally
4545739Speter * loadable as a module.  References "syscall_not_present".
4634925Sdufault * XXX Good candidate for sys/syscall.h
4734030Sdufault */
4834925Sdufaultstruct proc;
4934925Sdufaultstruct nosys_args;
5034925Sdufaultextern int syscall_not_present(struct proc *, const char *, struct nosys_args *);
5134030Sdufault
5234925Sdufault#define SYSCALL_NOT_PRESENT_GEN(SC) \
5334925Sdufaultint SC (struct proc *p, struct SC##_args *uap) \
5434925Sdufault{ \
5534925Sdufault	return syscall_not_present(p, #SC , (struct nosys_args *)uap); \
5634925Sdufault}
5734030Sdufault
5834030Sdufault
5934925SdufaultMALLOC_DECLARE(M_P31B);
6034030Sdufault
6134925Sdufault#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK)
6234925Sdufault#define p31b_free(P) free((P), M_P31B)
6334925Sdufault
6434925Sdufaultint p31b_proc __P((struct proc *, pid_t, struct proc **));
6534925Sdufault
6634925Sdufaultvoid p31b_setcfg __P((int, int));
6734925Sdufault
6834925Sdufault#ifdef _KPOSIX_PRIORITY_SCHEDULING
6934925Sdufault
7034030Sdufault/*
7134030Sdufault * KSCHED_OP_RW is a vector of read/write flags for each entry indexed
7234030Sdufault * by the enum ksched_op.
7334030Sdufault *
7434030Sdufault * 1 means you need write access, 0 means read is sufficient.
7534030Sdufault */
7634030Sdufault
7734030Sdufaultenum ksched_op {
7834030Sdufault
7934030Sdufault#define KSCHED_OP_RW { 1, 0, 1, 0, 0, 0, 0, 0 }
8034030Sdufault
8134030Sdufault	SCHED_SETPARAM,
8234030Sdufault	SCHED_GETPARAM,
8334030Sdufault	SCHED_SETSCHEDULER,
8434030Sdufault	SCHED_GETSCHEDULER,
8534030Sdufault	SCHED_YIELD,
8634030Sdufault	SCHED_GET_PRIORITY_MAX,
8734030Sdufault	SCHED_GET_PRIORITY_MIN,
8834030Sdufault	SCHED_RR_GET_INTERVAL,
8934030Sdufault	SCHED_OP_MAX
9034030Sdufault};
9134030Sdufault
9234925Sdufaultstruct ksched;
9334030Sdufault
9434925Sdufaultint ksched_attach(struct ksched **);
9534925Sdufaultint ksched_detach(struct ksched *);
9634030Sdufault
9755140Sbdeint ksched_setparam(register_t *, struct ksched *,
9834030Sdufault	struct proc *, const struct sched_param *);
9955140Sbdeint ksched_getparam(register_t *, struct ksched *,
10034030Sdufault	struct proc *, struct sched_param *);
10134030Sdufault
10255140Sbdeint ksched_setscheduler(register_t *, struct ksched *,
10334030Sdufault	struct proc *, int, const struct sched_param *);
10455140Sbdeint ksched_getscheduler(register_t *, struct ksched *, struct proc *);
10534030Sdufault
10655140Sbdeint ksched_yield(register_t *, struct ksched *);
10734030Sdufault
10855140Sbdeint ksched_get_priority_max(register_t *, struct ksched *, int);
10955140Sbdeint ksched_get_priority_min(register_t *, struct ksched *, int);
11034030Sdufault
11155140Sbdeint ksched_rr_get_interval(register_t *, struct ksched *,
11255140Sbde	struct proc *, struct timespec *);
11334030Sdufault
11434925Sdufault#endif /* _KPOSIX_PRIORITY_SCHEDULING */
11534030Sdufault
11634925Sdufault#endif /* _P1003_1B_P1003_1B_H_ */
117