posix4.h revision 103574
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 103574 2002-09-19 00:43:32Z alfred $
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;
5083366Sjulianextern int syscall_not_present(struct thread *, const char *, struct nosys_args *);
5134030Sdufault
5234925Sdufault#define SYSCALL_NOT_PRESENT_GEN(SC) \
5383366Sjulianint SC (struct thread *td, struct SC##_args *uap) \
5434925Sdufault{ \
5583366Sjulian	return syscall_not_present(td, #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
6492727Salfredint p31b_proc(struct proc *, pid_t, struct proc **);
6534925Sdufault
6692727Salfredvoid p31b_setcfg(int, int);
67103574Salfredint p31b_getcfg(int);
6834925Sdufault
6934925Sdufault#ifdef _KPOSIX_PRIORITY_SCHEDULING
7034925Sdufault
7134030Sdufault/*
7234030Sdufault * KSCHED_OP_RW is a vector of read/write flags for each entry indexed
7334030Sdufault * by the enum ksched_op.
7434030Sdufault *
7534030Sdufault * 1 means you need write access, 0 means read is sufficient.
7634030Sdufault */
7734030Sdufault
7834030Sdufaultenum ksched_op {
7934030Sdufault
8034030Sdufault#define KSCHED_OP_RW { 1, 0, 1, 0, 0, 0, 0, 0 }
8134030Sdufault
8234030Sdufault	SCHED_SETPARAM,
8334030Sdufault	SCHED_GETPARAM,
8434030Sdufault	SCHED_SETSCHEDULER,
8534030Sdufault	SCHED_GETSCHEDULER,
8634030Sdufault	SCHED_YIELD,
8734030Sdufault	SCHED_GET_PRIORITY_MAX,
8834030Sdufault	SCHED_GET_PRIORITY_MIN,
8934030Sdufault	SCHED_RR_GET_INTERVAL,
9034030Sdufault	SCHED_OP_MAX
9134030Sdufault};
9234030Sdufault
9334925Sdufaultstruct ksched;
9434030Sdufault
9534925Sdufaultint ksched_attach(struct ksched **);
9634925Sdufaultint ksched_detach(struct ksched *);
9734030Sdufault
9855140Sbdeint ksched_setparam(register_t *, struct ksched *,
9983366Sjulian	struct thread *, const struct sched_param *);
10055140Sbdeint ksched_getparam(register_t *, struct ksched *,
10183366Sjulian	struct thread *, struct sched_param *);
10234030Sdufault
10355140Sbdeint ksched_setscheduler(register_t *, struct ksched *,
10483366Sjulian	struct thread *, int, const struct sched_param *);
10583366Sjulianint ksched_getscheduler(register_t *, struct ksched *, struct thread *);
10634030Sdufault
10755140Sbdeint ksched_yield(register_t *, struct ksched *);
10834030Sdufault
10955140Sbdeint ksched_get_priority_max(register_t *, struct ksched *, int);
11055140Sbdeint ksched_get_priority_min(register_t *, struct ksched *, int);
11134030Sdufault
11255140Sbdeint ksched_rr_get_interval(register_t *, struct ksched *,
11383366Sjulian	struct thread *, struct timespec *);
11434030Sdufault
11534925Sdufault#endif /* _KPOSIX_PRIORITY_SCHEDULING */
11634030Sdufault
11734925Sdufault#endif /* _P1003_1B_P1003_1B_H_ */
118