diff --git a/include/Makefile b/include/Makefile index 21c92a2a38e4..63021b6026d2 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,130 +1,130 @@ # From: @(#)Makefile 8.2 (Berkeley) 1/4/94 -# $Id: Makefile,v 1.74 1998/03/08 02:17:25 jb Exp $ +# $Id: Makefile,v 1.75 1998/03/08 21:35:29 jb Exp $ # # Doing a make install builds /usr/include # # The ``rm -rf''s used below are safe because rm doesn't follow symbolic # links. # depend lint tags: CLEANFILES= osreldate.h version vers.c SUBDIR= rpcsvc FILES= a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \ dlfcn.h elf.h err.h fnmatch.h fstab.h \ fts.h glob.h grp.h strhash.h histedit.h \ kvm.h limits.h link.h locale.h malloc.h memory.h mpool.h \ ndbm.h netdb.h nl_types.h nlist.h \ paths.h pthread.h pthread_np.h pwd.h \ ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \ signal.h stab.h stddef.h stdio.h stdlib.h string.h stringlist.h \ strings.h struct.h sysexits.h tar.h time.h timers.h ttyent.h unistd.h \ utime.h utmp.h vis.h .if defined(WANT_CSRG_LIBM) FILES+= math.h .endif ARPAFILES= ftp.h inet.h nameser.h telnet.h tftp.h PROTOFILES= dumprestore.h routed.h rwhod.h talkd.h timed.h RPCFILES= auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \ rpc.h rpc_com.h rpc_msg.h svc.h svc_auth.h types.h xdr.h \ auth_des.h des.h des_crypt.h MFILES= float.h floatingpoint.h stdarg.h varargs.h # posix4/aio.h conflicts with dysons and isn't installed: -PFILES= mqueue.h posix4.h sched.h semaphore.h \ +PFILES= mqueue.h sched.h semaphore.h \ # aio.h LFILES= errno.h fcntl.h poll.h syslog.h termios.h LDIRS= msdosfs net netns netatalk netinet netipx netkey nfs \ pccard posix4 sys vm \ # netccitt netiso LNOHEADERDIRS= isofs ufs LSUBDIRS= isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs # Define SHARED to indicate whether you want symbolic links to the system # source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is # probably only useful for developers and should be avoided if you do not # wish to tie your /usr/include and /usr/src together. #SHARED= symlinks SHARED?= copies .if exists (${.CURDIR}/../sys/conf/newvers.sh) all: osreldate.h osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh @${ECHO} creating osreldate.h from newvers.sh . ${.CURDIR}/../sys/conf/newvers.sh; \ echo "$$COPYRIGHT" > osreldate.h; \ echo \#'undef __FreeBSD_version' >> osreldate.h; \ echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h .else all: @${ECHO} creating osreldate.h from sysctl info echo \#'undef __FreeBSD_version' > osreldate.h echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \ >> osreldate.h .endif beforeinstall: ${SHARED} cd ${.CURDIR}; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ ${FILES} ${DESTDIR}/usr/include cd ${.CURDIR}/arpa; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ ${ARPAFILES} ${DESTDIR}/usr/include/arpa cd ${.CURDIR}/protocols; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ ${PROTOFILES} ${DESTDIR}/usr/include/protocols cd ${.CURDIR}/rpc; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ ${RPCFILES} ${DESTDIR}/usr/include/rpc ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ ${.OBJDIR}/osreldate.h \ ${DESTDIR}/usr/include .for i in ${LFILES} ln -sf sys/$i ${DESTDIR}/usr/include/$i .endfor .for i in ${MFILES} ln -sf machine/$i ${DESTDIR}/usr/include/$i .endfor .for i in ${PFILES} ln -sf posix4/$i ${DESTDIR}/usr/include/$i .endfor copies: .for i in ${LDIRS} ${LNOHEADERDIRS} machine if [ -h ${DESTDIR}/usr/include/$i ]; then \ rm -f ${DESTDIR}/usr/include/$i; \ fi .endfor mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ -p ${DESTDIR}/usr/include .for i in ${LDIRS} ${LSUBDIRS} cd ${.CURDIR}/../sys; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${DESTDIR}/usr/include/$i .endfor .if exists(${.CURDIR}/../sys/${MACHINE}/include) cd ${.CURDIR}/../sys/${MACHINE}/include; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${DESTDIR}/usr/include/machine .endif symlinks: @${ECHO} "Setting up symlinks to kernel source tree..." .for i in ${LDIRS} ${LNOHEADERDIRS} rm -rf ${DESTDIR}/usr/include/$i ln -s ../../sys/$i ${DESTDIR}/usr/include/$i .endfor rm -rf ${DESTDIR}/usr/include/machine ln -s ../../sys/${MACHINE}/include ${DESTDIR}/usr/include/machine .include diff --git a/include/limits.h b/include/limits.h index 251010bca916..2d4012fcfff7 100644 --- a/include/limits.h +++ b/include/limits.h @@ -1,99 +1,99 @@ /*- * Copyright (c) 1988, 1993 * The Regents of the University of California. 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)limits.h 8.2 (Berkeley) 1/4/94 - * $Id: limits.h,v 1.7 1998/03/08 17:24:31 dufault Exp $ + * $Id: limits.h,v 1.8 1998/03/08 22:29:56 dufault Exp $ */ #ifndef _LIMITS_H_ #define _LIMITS_H_ #include #ifndef _ANSI_SOURCE #define _POSIX_ARG_MAX 4096 #define _POSIX_CHILD_MAX 6 #define _POSIX_LINK_MAX 8 #define _POSIX_MAX_CANON 255 #define _POSIX_MAX_INPUT 255 #define _POSIX_NAME_MAX 14 #define _POSIX_NGROUPS_MAX 0 #define _POSIX_OPEN_MAX 16 #define _POSIX_PATH_MAX 255 #define _POSIX_PIPE_BUF 512 #define _POSIX_SSIZE_MAX 32767 #define _POSIX_STREAM_MAX 8 #define _POSIX_TZNAME_MAX 3 #define _POSIX2_BC_BASE_MAX 99 #define _POSIX2_BC_DIM_MAX 2048 #define _POSIX2_BC_SCALE_MAX 99 #define _POSIX2_BC_STRING_MAX 1000 #define _POSIX2_EQUIV_CLASS_MAX 2 #define _POSIX2_EXPR_NEST_MAX 32 #define _POSIX2_LINE_MAX 2048 #define _POSIX2_RE_DUP_MAX 255 -#ifdef _POSIX4_VISIBLE +#ifdef _P1003_1B_VISIBLE #define _POSIX_AIO_LISTIO_MAX 16 #define _POSIX_AIO_MAX 1 #define _POSIX_DELAYTIMER_MAX 32 #define _POSIX_MQ_OPEN_MAX 8 #define _POSIX_MQ_PRIO_MAX 32 #define _POSIX_RTSIG_MAX 0 #define _POSIX_SEM_NSEMS_MAX 256 #define _POSIX_SEM_VALUE_MAX 32767 #define _POSIX_SIGQUEUE_MAX 32 #define _POSIX_TIMER_MAX 32 #endif #endif /* !_ANSI_SOURCE */ #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) #define PASS_MAX 128 /* _PASSWORD_LEN from */ #define NL_ARGMAX 99 /* max # of position args for printf */ #define NL_LANGMAX 31 /* max LANG name length */ #define NL_MSGMAX 32767 #define NL_NMAX 1 #define NL_SETMAX 255 #define NL_TEXTMAX 2048 #endif #include #if !defined(_ANSI_SOURCE) #include #endif #endif /* !_LIMITS_H_ */ diff --git a/include/signal.h b/include/signal.h index f17820be0854..0fb33e820b06 100644 --- a/include/signal.h +++ b/include/signal.h @@ -1,108 +1,102 @@ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)signal.h 8.3 (Berkeley) 3/30/94 */ #ifndef _SIGNAL_H_ #define _SIGNAL_H_ #include +#include #include #include -#include #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) extern __const char *__const sys_signame[NSIG]; extern __const char *__const sys_siglist[NSIG]; #endif __BEGIN_DECLS int raise __P((int)); #ifndef _ANSI_SOURCE int kill __P((_BSD_PID_T_, int)); int sigaction __P((int, const struct sigaction *, struct sigaction *)); int sigaddset __P((sigset_t *, int)); int sigdelset __P((sigset_t *, int)); int sigemptyset __P((sigset_t *)); int sigfillset __P((sigset_t *)); int sigismember __P((const sigset_t *, int)); #ifndef _POSIX_SOURCE struct timespec; int signanosleep __P((const struct timespec *, struct timespec *, sigset_t *)); #endif int sigpending __P((sigset_t *)); int sigprocmask __P((int, const sigset_t *, sigset_t *)); int sigsuspend __P((const sigset_t *)); -#ifdef _POSIX4_VISIBLE - -typedef struct siginfo { - int si_signo; /* Signal number */ - int si_code; /* Cause of the signal */ - union sigval si_value; /* Signal value */ -} siginfo_t; +#ifdef _P1003_1B_VISIBLE __BEGIN_DECLS int sigqueue __P((_BSD_PID_T_, int, const union sigval)); int sigtimedwait __P((const sigset_t *, siginfo_t *)); int sigwaitinfo __P((const sigset_t *, siginfo_t *)); __END_DECLS #endif #ifndef _POSIX_SOURCE int killpg __P((_BSD_PID_T_, int)); int sigaltstack __P((const struct sigaltstack *, struct sigaltstack *)); int sigblock __P((int)); int siginterrupt __P((int, int)); int sigpause __P((int)); int sigreturn __P((struct sigcontext *)); int sigsetmask __P((int)); int sigstack __P((const struct sigstack *, struct sigstack *)); int sigvec __P((int, struct sigvec *, struct sigvec *)); void psignal __P((unsigned int, const char *)); #endif /* !_POSIX_SOURCE */ #endif /* !_ANSI_SOURCE */ __END_DECLS #ifndef _ANSI_SOURCE /* List definitions after function declarations, or Reiser cpp gets upset. */ #define sigaddset(set, signo) (*(set) |= 1 << ((signo) - 1), 0) #define sigdelset(set, signo) (*(set) &= ~(1 << ((signo) - 1)), 0) #define sigemptyset(set) (*(set) = 0, 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) #define sigismember(set, signo) ((*(set) & (1 << ((signo) - 1))) != 0) #endif /* !_ANSI_SOURCE */ #endif /* !_SIGNAL_H_ */ diff --git a/include/time.h b/include/time.h index 29cae4cd975d..3ef83609f672 100644 --- a/include/time.h +++ b/include/time.h @@ -1,152 +1,158 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)time.h 8.3 (Berkeley) 1/21/94 */ #ifndef _TIME_H_ #define _TIME_H_ #include +#include #ifndef _ANSI_SOURCE /* * Frequency of the clock ticks reported by times(). Deprecated - use * sysconf(_SC_CLK_TCK) instead. */ #define CLK_TCK _BSD_CLK_TCK_ #endif /* Frequency of the clock ticks reported by clock(). */ #define CLOCKS_PER_SEC _BSD_CLOCKS_PER_SEC_ #ifndef NULL #define NULL 0 #endif #ifdef _BSD_CLOCK_T_ typedef _BSD_CLOCK_T_ clock_t; #undef _BSD_CLOCK_T_ #endif #ifdef _BSD_TIME_T_ typedef _BSD_TIME_T_ time_t; #undef _BSD_TIME_T_ #endif #ifdef _BSD_SIZE_T_ typedef _BSD_SIZE_T_ size_t; #undef _BSD_SIZE_T_ #endif -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +/* XXX I'm not sure if _ANSI_SOURCE is playing properly + * with the setups in _posix.h: + */ +#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY) /* * New in POSIX 1003.1b-1993. */ #ifdef _BSD_CLOCKID_T_ typedef _BSD_CLOCKID_T_ clockid_t; #undef _BSD_CLOCKID_T_ #endif #ifdef _BSD_TIMER_T_ typedef _BSD_TIMER_T_ timer_t; #undef _BSD_TIMER_T_ #endif #ifndef _TIMESPEC_DECLARED #define _TIMESPEC_DECLARED struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* and nanoseconds */ }; #endif #endif /* Neither ANSI nor POSIX */ struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ int tm_hour; /* hours since midnight [0-23] */ int tm_mday; /* day of the month [1-31] */ int tm_mon; /* months since January [0-11] */ int tm_year; /* years since 1900 */ int tm_wday; /* days since Sunday [0-6] */ int tm_yday; /* days since January 1 [0-365] */ int tm_isdst; /* Daylight Savings Time flag */ long tm_gmtoff; /* offset from CUT in seconds */ char *tm_zone; /* timezone abbreviation */ }; #include __BEGIN_DECLS char *asctime __P((const struct tm *)); clock_t clock __P((void)); char *ctime __P((const time_t *)); double difftime __P((time_t, time_t)); struct tm *gmtime __P((const time_t *)); struct tm *localtime __P((const time_t *)); time_t mktime __P((struct tm *)); size_t strftime __P((char *, size_t, const char *, const struct tm *)); time_t time __P((time_t *)); #ifdef _THREAD_SAFE int asctime_r __P((const struct tm *, char *, int)); int ctime_r __P((const time_t *, char *, int)); struct tm *gmtime_r __P((const time_t *, struct tm *)); struct tm *localtime_r __P((const time_t *, struct tm *)); #endif #ifndef _ANSI_SOURCE void tzset __P((void)); #endif /* not ANSI */ #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) const char *strptime __P((const char *, const char *, struct tm *)); char *timezone __P((int, int)); void tzsetwall __P((void)); time_t timelocal __P((struct tm * const)); time_t timegm __P((struct tm * const)); +#endif /* neither ANSI nor POSIX */ +#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY) /* Introduced in POSIX 1003.1b-1993, not part of 1003.1-1990. */ int clock_getres __P((clockid_t, struct timespec *)); int clock_gettime __P((clockid_t, struct timespec *)); int clock_settime __P((clockid_t, const struct timespec *)); int nanosleep __P((const struct timespec *, struct timespec *)); #endif /* neither ANSI nor POSIX */ __END_DECLS #endif /* !_TIME_H_ */ diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index 2d9c2eda2bd2..7f142541c26a 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -1,295 +1,296 @@ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Sean Eric Fagan of Cygnus Support. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94"; #endif /* LIBC_SCCS and not lint */ +#include #include #include #include #include #include #include #include /* * sysconf -- * get configurable system variables. * * XXX * POSIX 1003.1 (ISO/IEC 9945-1, 4.8.1.3) states that the variable values * not change during the lifetime of the calling process. This would seem * to require that any change to system limits kill all running processes. * A workaround might be to cache the values when they are first retrieved * and then simply return the cached value on subsequent calls. This is * less useful than returning up-to-date values, however. */ long sysconf(name) int name; { struct rlimit rl; size_t len; int mib[2], value; len = sizeof(value); switch (name) { /* 1003.1 */ case _SC_ARG_MAX: mib[0] = CTL_KERN; mib[1] = KERN_ARGMAX; break; case _SC_CHILD_MAX: return (getrlimit(RLIMIT_NPROC, &rl) ? -1 : rl.rlim_cur); case _SC_CLK_TCK: return (CLK_TCK); case _SC_JOB_CONTROL: mib[0] = CTL_KERN; mib[1] = KERN_JOB_CONTROL; goto yesno; case _SC_NGROUPS_MAX: mib[0] = CTL_KERN; mib[1] = KERN_NGROUPS; break; case _SC_OPEN_MAX: return (getrlimit(RLIMIT_NOFILE, &rl) ? -1 : rl.rlim_cur); case _SC_STREAM_MAX: mib[0] = CTL_USER; mib[1] = USER_STREAM_MAX; break; case _SC_TZNAME_MAX: mib[0] = CTL_USER; mib[1] = USER_TZNAME_MAX; break; case _SC_SAVED_IDS: mib[0] = CTL_KERN; mib[1] = KERN_SAVED_IDS; goto yesno; case _SC_VERSION: mib[0] = CTL_KERN; mib[1] = KERN_POSIX1; break; /* 1003.2 */ case _SC_BC_BASE_MAX: mib[0] = CTL_USER; mib[1] = USER_BC_BASE_MAX; break; case _SC_BC_DIM_MAX: mib[0] = CTL_USER; mib[1] = USER_BC_DIM_MAX; break; case _SC_BC_SCALE_MAX: mib[0] = CTL_USER; mib[1] = USER_BC_SCALE_MAX; break; case _SC_BC_STRING_MAX: mib[0] = CTL_USER; mib[1] = USER_BC_STRING_MAX; break; case _SC_COLL_WEIGHTS_MAX: mib[0] = CTL_USER; mib[1] = USER_COLL_WEIGHTS_MAX; break; case _SC_EXPR_NEST_MAX: mib[0] = CTL_USER; mib[1] = USER_EXPR_NEST_MAX; break; case _SC_LINE_MAX: mib[0] = CTL_USER; mib[1] = USER_LINE_MAX; break; case _SC_RE_DUP_MAX: mib[0] = CTL_USER; mib[1] = USER_RE_DUP_MAX; break; case _SC_2_VERSION: mib[0] = CTL_USER; mib[1] = USER_POSIX2_VERSION; break; case _SC_2_C_BIND: mib[0] = CTL_USER; mib[1] = USER_POSIX2_C_BIND; goto yesno; case _SC_2_C_DEV: mib[0] = CTL_USER; mib[1] = USER_POSIX2_C_DEV; goto yesno; case _SC_2_CHAR_TERM: mib[0] = CTL_USER; mib[1] = USER_POSIX2_CHAR_TERM; goto yesno; case _SC_2_FORT_DEV: mib[0] = CTL_USER; mib[1] = USER_POSIX2_FORT_DEV; goto yesno; case _SC_2_FORT_RUN: mib[0] = CTL_USER; mib[1] = USER_POSIX2_FORT_RUN; goto yesno; case _SC_2_LOCALEDEF: mib[0] = CTL_USER; mib[1] = USER_POSIX2_LOCALEDEF; goto yesno; case _SC_2_SW_DEV: mib[0] = CTL_USER; mib[1] = USER_POSIX2_SW_DEV; goto yesno; case _SC_2_UPE: mib[0] = CTL_USER; mib[1] = USER_POSIX2_UPE; goto yesno; -#if _POSIX_VERSION >= 199309L - /* POSIX.4 */ +#ifdef _P1003_1B_VISIBLE + /* POSIX.1B */ case _SC_ASYNCHRONOUS_IO: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_ASYNCHRONOUS_IO; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_ASYNCHRONOUS_IO; goto yesno; case _SC_MAPPED_FILES: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_MAPPED_FILES; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_MAPPED_FILES; goto yesno; case _SC_MEMLOCK: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_MEMLOCK; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_MEMLOCK; goto yesno; case _SC_MEMLOCK_RANGE: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_MEMLOCK_RANGE; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_MEMLOCK_RANGE; goto yesno; case _SC_MEMORY_PROTECTION: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_MEMORY_PROTECTION; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_MEMORY_PROTECTION; goto yesno; case _SC_MESSAGE_PASSING: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_MESSAGE_PASSING; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_MESSAGE_PASSING; goto yesno; case _SC_PRIORITIZED_IO: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_PRIORITIZED_IO; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_PRIORITIZED_IO; goto yesno; case _SC_PRIORITY_SCHEDULING: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_PRIORITY_SCHEDULING; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_PRIORITY_SCHEDULING; goto yesno; case _SC_REALTIME_SIGNALS: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_REALTIME_SIGNALS; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_REALTIME_SIGNALS; goto yesno; case _SC_SEMAPHORES: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_SEMAPHORES; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_SEMAPHORES; goto yesno; case _SC_FSYNC: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_FSYNC; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_FSYNC; goto yesno; case _SC_SHARED_MEMORY_OBJECTS: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_SHARED_MEMORY_OBJECTS; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_SHARED_MEMORY_OBJECTS; goto yesno; case _SC_SYNCHRONIZED_IO: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_SYNCHRONIZED_IO; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_SYNCHRONIZED_IO; goto yesno; case _SC_TIMERS: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_TIMERS; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_TIMERS; goto yesno; case _SC_AIO_LISTIO_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_AIO_LISTIO_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_AIO_LISTIO_MAX; goto yesno; case _SC_AIO_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_AIO_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_AIO_MAX; goto yesno; case _SC_AIO_PRIO_DELTA_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_AIO_PRIO_DELTA_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_AIO_PRIO_DELTA_MAX; goto yesno; case _SC_DELAYTIMER_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_DELAYTIMER_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_DELAYTIMER_MAX; goto yesno; case _SC_MQ_OPEN_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_MQ_OPEN_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_MQ_OPEN_MAX; goto yesno; case _SC_PAGESIZE: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_PAGESIZE; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_PAGESIZE; goto yesno; case _SC_RTSIG_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_RTSIG_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_RTSIG_MAX; goto yesno; case _SC_SEM_NSEMS_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_SEM_NSEMS_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_SEM_NSEMS_MAX; goto yesno; case _SC_SEM_VALUE_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_SEM_VALUE_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_SEM_VALUE_MAX; goto yesno; case _SC_SIGQUEUE_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_SIGQUEUE_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_SIGQUEUE_MAX; goto yesno; case _SC_TIMER_MAX: - mib[0] = CTL_POSIX4; - mib[1] = CTL_POSIX4_TIMER_MAX; + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_TIMER_MAX; goto yesno; -#endif /* _POSIX_VERSION >= 199309L */ +#endif /* _P1003_1B_VISIBLE */ yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1) return (-1); if (value == 0) return (-1); return (value); break; default: errno = EINVAL; return (-1); } return (sysctl(mib, 2, &value, &len, NULL, 0) == -1 ? -1 : value); } diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 630b025fa336..d36a7a257e07 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,138 +1,150 @@ # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 -# $Id: Makefile.inc,v 1.48 1998/03/23 06:58:06 jb Exp $ +# $Id: Makefile.inc,v 1.49 1998/03/23 21:04:06 jb Exp $ # sys sources .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/sys ${.CURDIR}/../libc/sys # Include the generated makefile containing the *complete* list # of syscall names in MIASM. .if defined(NETBSD_SYSCALLS) .include "${.CURDIR}/../../sys/sys/netbsd_syscall.mk" .else .include "${.CURDIR}/../../sys/sys/syscall.mk" .endif # Include machine dependent definitions. # # MDASM names override the default syscall names in MIASM. # NOASM will prevent the default syscall code from being generated. # .include "${.CURDIR}/../libc/${MACHINE_ARCH}/sys/Makefile.inc" # If using the NetBSD syscall interface add sources that convert # the NetBSD interface to the one FreeBSD expects: .if defined(NETBSD_SYSCALLS) SRCS+= netbsd_getdirentries.c netbsd_msync.c netbsd_stat.c netbsd_swapon.c .endif # Sources common to both syscall interfaces: SRCS+= __error.c ftruncate.c lseek.c mmap.c truncate.c # Add machine dependent asm sources: SRCS+=${MDASM} # Look though the complete list of syscalls (MIASM) for names that are # not defined with machine dependent implementations (MDASM) and are # not declared for no generation of default code (NOASM). If the # syscall is not hidden, add it to the ASM list, otherwise add it # to the ASMR list. .for _asm in ${MIASM} .if (${MDASM:R:M${_asm:R}} == "") .if (${NOASM:R:M${_asm:R}} == "") .if (${HIDDEN_SYSCALLS:R:M${_asm:R}} == "") ASM+=$(_asm) .else ASMR+=$(_asm) .endif .endif .endif .endfor OBJS+= ${ASM} ${ASMR} ${PSEUDO} ${PSEUDOR} SASM= ${ASM:S/.o/.S/} SASMR= ${ASMR:S/.o/.S/} SPSEUDO= ${PSEUDO:S/.o/.S/} SPSEUDOR= ${PSEUDOR:S/.o/.S/} SRCS+= ${SASM} ${SASMR} ${SPSEUDO} ${SPSEUDOR} # Generated files CLEANFILES+= ${SASM} ${SASMR} ${SPSEUDO} ${SPSEUDOR} ${SASM}: printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' > ${.TARGET} ${SASMR}: printf '#include "SYS.h"\nPRSYSCALL(${.PREFIX})\n' > ${.TARGET} ${SPSEUDO}: printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' \ > ${.TARGET} ${SPSEUDOR}: printf '#include "SYS.h"\nPPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' \ > ${.TARGET} .if ${LIB} == "c" MAN2+= _exit.2 accept.2 access.2 acct.2 adjtime.2 \ bind.2 brk.2 chdir.2 chflags.2 \ chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 \ connect.2 dup.2 execve.2 \ fcntl.2 flock.2 fork.2 fsync.2 getdirentries.2 getdtablesize.2 \ getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \ getpeername.2 getpgrp.2 getpid.2 getpriority.2 getrlimit.2 \ getrusage.2 getsid.2 getsockname.2 \ getsockopt.2 gettimeofday.2 getuid.2 \ intro.2 ioctl.2 issetugid.2 kill.2 ktrace.2 link.2 listen.2 lseek.2 \ madvise.2 mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 mmap.2 \ mount.2 mprotect.2 msync.2 munmap.2 nanosleep.2 \ nfssvc.2 open.2 pathconf.2 pipe.2 poll.2 profil.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ rtprio.2 select.2 semctl.2 semget.2 semop.2 send.2 \ setgroups.2 setpgid.2 setregid.2 setreuid.2 setsid.2 setuid.2 \ shmat.2 shmctl.2 shmget.2 shutdown.2 \ sigaction.2 sigaltstack.2 sigpending.2 sigprocmask.2 sigreturn.2 \ sigstack.2 sigsuspend.2 socket.2 socketpair.2 stat.2 statfs.2 \ swapon.2 symlink.2 sync.2 syscall.2 truncate.2 umask.2 undelete.2 \ unlink.2 utimes.2 vfork.2 wait.2 write.2 +.if !defined(NO_P1003_1B) +MAN2+= sched_get_priority_max.2 sched_setscheduler.2 \ + sched_setparam.2 sched_yield.2 +.endif + + MLINKS+=brk.2 sbrk.2 MLINKS+=dup.2 dup2.2 MLINKS+=chdir.2 fchdir.2 MLINKS+=chflags.2 fchflags.2 MLINKS+=chmod.2 fchmod.2 MLINKS+=chown.2 fchown.2 chown.2 lchown.2 MLINKS+=clock_gettime.2 clock_getres.2 clock_gettime.2 clock_settime.2 MLINKS+=getgid.2 getegid.2 MLINKS+=getitimer.2 setitimer.2 MLINKS+=getlogin.2 setlogin.2 MLINKS+=getpgrp.2 getpgid.2 MLINKS+=getpid.2 getppid.2 MLINKS+=getpriority.2 setpriority.2 MLINKS+=getrlimit.2 setrlimit.2 MLINKS+=getsockopt.2 setsockopt.2 MLINKS+=gettimeofday.2 settimeofday.2 MLINKS+=getuid.2 geteuid.2 MLINKS+=intro.2 errno.2 MLINKS+=lseek.2 seek.2 MLINKS+=mlock.2 munlock.2 MLINKS+=mount.2 unmount.2 MLINKS+=nanosleep.2 signanosleep.2 MLINKS+=pathconf.2 fpathconf.2 MLINKS+=read.2 readv.2 MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2 MLINKS+=send.2 sendmsg.2 send.2 sendto.2 MLINKS+=setpgid.2 setpgrp.2 MLINKS+=setuid.2 setegid.2 setuid.2 seteuid.2 setuid.2 setgid.2 MLINKS+=shmat.2 shmdt.2 MLINKS+=stat.2 fstat.2 stat.2 lstat.2 MLINKS+=statfs.2 fstatfs.2 MLINKS+=syscall.2 __syscall.2 MLINKS+=truncate.2 ftruncate.2 MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2 MLINKS+=write.2 writev.2 +.if !defined(NO_P1003_1B) +MLINKS+=sched_get_priority_max.2 sched_get_priority_min.2 \ + sched_get_priority_max.2 sched_rr_get_interval.2 +MLINKS+=sched_setscheduler.2 sched_getscheduler.2 +MLINKS+=sched_setparam.2 sched_getparam.2 +.endif .endif diff --git a/lib/libc/sys/sched_get_priority_max.2 b/lib/libc/sys/sched_get_priority_max.2 new file mode 100644 index 000000000000..2b9fa594c9d8 --- /dev/null +++ b/lib/libc/sys/sched_get_priority_max.2 @@ -0,0 +1,121 @@ +.\" $Id:$ +.\" Copyright (c) 1998 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. +.\" +.\" 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. +.\" +.Dd Mar 12, 1998 +.Dt SCHED_GET_PRIORITY_MAX 2 +.Os BSD 4 +.Sh NAME +.Nm sched_get_priority_max , +.Nm sched_get_priority_min , +.Nm sched_rr_get_interval +.Nd Get scheduling parameter limits +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn sched_get_priority_max "int policy" +.Ft int +.Fn sched_get_priority_min "int policy" +.Ft int +.Fn sched_rr_get_interval "pid_t pid" "struct timespec *interval" +.Sh DESCRIPTION +The +.Fn sched_get_priority_max +and +.Fn sched_get_priority_min +functions return the appropriate maximum or minimum, respectfully, +for the scheduling policy specified by policy. The +.Fn sched_rr_get_interval +function updates the +.Fa timespec +structure referenced by the +.Fa interval +argument to contain the current execution time limit (i.e., time +quantum) for the process specified by +.Fa pid . +If +.Fa pid +is zero, the current execution time limit for the calling process is +returned. +.Pp +The value of +.Fa policy +should be one of the scheduling policy values defined in +.Fa : +.Bl -tag -width [SCHED_OTHER] +.It Bq Er SCHED_FIFO +First-in-first-out fixed priority scheduling with no round robin scheduling; +.It Bq Er SCHED_OTHER +The standard time sharing scheduler; +.It Bq Er SCHED_RR +Round-robin scheduling across same priority processes. +.El +.Sh RETURN +If successful, the +.Fn sched_get_priority_max +and +.Fn sched_get_priority_min +functions shall return the appropriate maximum or minimum values, +respectively. If unsuccessful, the shall return a value of -1 and set +.Fa errno +to indicate the error. +.Pp +If successful, the +.Fn sched_rr_get_interval +function will return 0. Otherwise, it will +return a value of -1 and set +.Fa errno +to indicate the error. +.Sh ERRORS +On failure +.Va errno +will be set to the corresponding value: +.Bl -tag -width [EFAULT] +.It Bq Er EINVAL +The value of the +.Fa policy +parameter does not represent a defined scheduling policy. +.It Bq Er ENOSYS +The +.Fn sched_get_priority_max , +.Fn sched_get_priority_min , +and +.Fn sched_rr_get_interval +functions are not supported by the implementation. +.It Bq Er ESRCH +No process can be found corresponding to that specified by +.Fa pid . +.El +.Sh SEE ALSO +.Xr sched_getparam 2 , +.Xr sched_setparam 2 , +.Xr sched_get_scheduler 2 , +.Xr sched_set_scheduler 2 +.Sh STANDARDS +The +.Fn sched_setscheduler +and +.Fn sched_getscheduler +functions conform to +.St -p1003.1b-93 . diff --git a/lib/libc/sys/sched_setparam.2 b/lib/libc/sys/sched_setparam.2 new file mode 100644 index 000000000000..5bbd76061eb9 --- /dev/null +++ b/lib/libc/sys/sched_setparam.2 @@ -0,0 +1,172 @@ +.\" $Id:$ +.\" Copyright (c) 1998 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. +.\" +.\" 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. +.\" +.Dd Mar 12, 1998 +.Dt SCHED_SETPARAM 2 +.Os BSD 4 +.Sh NAME +.Nm sched_setparam , +.Nm sched_getparam +.Nd set/get scheduling paramaters +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn sched_setparam "pid_t pid" "const struct sched_param *param" +.Ft int +.Fn sched_getparam "pid_t pid" "struct sched_param *param" +.Sh DESCRIPTION +The +.Fn sched_setparam +function sets the scheduling parameters of the process specified by +.Fa pid +to the values specified by the +.Fa sched_param +structure pointed to by +.Fa param . +The value of the +.Fa sched_priority +member in the +.Fa param +structure must be any integer within the inclusive priority range for +the current scheduling policy of the process specified by +.Fa pid . +Higher numerical values for the priority represent higher priorities. +.Pp +In this implementation, if the value of +.Fa pid +is negative the function will fail. +.Pp +If a process specified by +.Fa pid +exists and if the calling process has permission, the scheduling +parameters are set for the process whose process ID is equal to +.Fa pid . +.Pp +If +.Fa pid +is zero, the scheduling parameters are set for the calling process. +.Pp +In this implementation, the policy of when a process can affect +the scheduling parameters of another process is specified in +.Xr p1003_1b +as a write-style operation. +.Pp +The target process, whether it is running or not running, will resume +execution after all other runnable processes of equal or greater +priority have been scheduled to run. +.Pp +If the priority of the process specified by the +.Fa pid +argument is set higher than that of the lowest priority running process +and if the specified process is ready to run, the process specified by +the +.Fa pid +argument will preempt a lowest priority running process. Similarly, if +the process calling +.Fn sched_setparam +sets its own priority lower than that of one or more other nonempty +process lists, then the process that is the head of the highest priority +list will also preempt the calling process. Thus, in either case, the +originating process might not receive notification of the completion of +the requested priority change until the higher priority process has +executed. +.Pp +In this implementation, when the current scheduling policy for the +process specified by +.Fa pid +is normal timesharing (SCHED_OTHER, aka SCHED_NORMAL when not POSIX-source) +or the idle policy (SCHED_IDLE when not POSIX-source) then the behavior +is as if the process had been running under SCHED_RR with a priority +lower than any actual realtime priority. +.Pp +The +.Fn sched_getparam +function will return the scheduling parameters of a process specified +by +.Fa pid +in the +.Fa sched_param +structure pointed to by +.Fa param . +.Pp +If a process specified by +.Fa pid +exists and if the calling process has permission, +the scheduling parameters for the process whose process ID is equal to +.Fa pid +are returned. +.Pp +In this implementation, the policy of when a process can obtain the +scheduling parameters of another process are detailed in +.Xr p1003_1b +as a read-style operation. +.Pp +If +.Fa pid +is zero, the scheduling parameters for the calling process will be +returned. In this implementation, the +.Fa sched_getparam +function will fail if +.Fa pid +is negative. +.Sh RETURN +The function will return zero if it completes successfully, or it +will return a value of -1 and set +.Va errno +to indicate the error. +.Sh ERRORS +On failure +.Va errno +will be set to the corresponding value: +.Bl -tag -width [EFAULT] +.It Bq Er ENOSYS +The system is not configured to support this functionality. +.It Bq Er EPERM +The requesting process doesn not have permission as detailed in +.Xr p1003_1b . +.It Bq Er ESRCH +No process can be found corresponding to that specified by +.Fa pid . +.It Bq Er EINVAL +For +.Fn sched_setparam : +one or more of the requested scheduling parameters +is outside the range defined for the scheduling policy of the specified +.Fa pid . +.El +.Sh SEE ALSO +.Xr sched_getscheduler 2 , +.Xr sched_setscheduler 2 , +.Xr sched_get_priority_max 2 , +.Xr sched_get_priority_min 2 , +.Xr sched_rr_get_interval 2 , +.Xr sched_yield 2 +.Sh STANDARDS +The +.Fn sched_setparam +and +.Fn sched_getparam +functions conform to +.St -p1003.1b-93 . diff --git a/lib/libc/sys/sched_setscheduler.2 b/lib/libc/sys/sched_setscheduler.2 new file mode 100644 index 000000000000..7635bfe5b72a --- /dev/null +++ b/lib/libc/sys/sched_setscheduler.2 @@ -0,0 +1,167 @@ +.\" $Id:$ +.\" Copyright (c) 1998 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. +.\" +.\" 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. +.\" +.Dd Mar 12, 1998 +.Dt SCHED_SETSCHEDULER 2 +.Os BSD 4 +.Sh NAME +.Nm sched_setscheduler , +.Nm sched_getscheduler +.Nd set/get scheduling policy and scheduler parameters +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn sched_setscheduler "pid_t pid" "int policy" "const struct sched_param *param" +.Ft int +.Fn sched_getscheduler "pid_t pid" +.Sh DESCRIPTION +The +.Fn sched_setscheduler +function sets the scheduling policy and scheduling parameters +of the process specified by +.Fa pid +to +.Fa policy +and the parameters specified in the +.Fa sched_param +structure pointed to by +.Fa param , +respectively. +The value of the +.Fa sched_priority +member in the +.Fa param +structure must be any integer within the inclusive priority range for +the scheduling policy specified by +.Fa policy . +.Pp +In this implementation, if the value of +.Fa pid +is negative the function will fail. +.Pp +If a process specified by +.Fa pid +exists and if the calling process has permission, the scheduling +policy and scheduling parameters will be set for the process +whose process ID is equal to +.Fa pid . +.Pp +If +.Fa pid +is zero, the scheduling policy and scheduling +parameters are set for the calling process. +.Pp +In this implementation, the policy of when a process can affect +the scheduling parameters of another process is specified in +.Xr p1003_1b +as a write-style operation. +.Pp +The scheduling policies are in +.Fa : +.Bl -tag -width [SCHED_OTHER] +.It Bq Er SCHED_FIFO +First-in-first-out fixed priority scheduling with no round robin scheduling; +.It Bq Er SCHED_OTHER +The standard time sharing scheduler; +.It Bq Er SCHED_RR +Round-robin scheduling across same priority processes. +.El +.Pp +The +.Fa sched_param +structure is defined in +.Fa : + +.Bd -literal -offset indent +struct sched_param { + int sched_priority; /* scheduling priority */ +}; +.Ed +.Pp +The +.Fn sched_getscheduler +function returns the scheduling policy of the process specified +by +.Fa pid . +.Pp +If a process specified by +.Fa pid +exists and if the calling process has permission, +the scheduling parameters for the process whose process ID is equal to +.Fa pid +are returned. +.Pp +In this implementation, the policy of when a process can obtain the +scheduling parameters of another process are detailed in +.Xr p1003_1b +as a read-style operation. +.Pp +If +.Fa pid +is zero, the scheduling parameters for the calling process will be +returned. In this implementation, the +.Fa sched_getscheduler +function will fail if +.Fa pid +is negative. +.Sh RETURN +The function will return zero if it completes successfully, or it +will return a value of -1 and set +.Va errno +to indicate the error. +.Sh ERRORS +On failure +.Va errno +will be set to the corresponding value: +.Bl -tag -width [EFAULT] +.It Bq Er ENOSYS +The system is not configured to support this functionality. +.It Bq Er EPERM +The requesting process doesn not have permission as detailed in +.Xr p1003_1b . +.It Bq Er ESRCH +No process can be found corresponding to that specified by +.Fa pid . +.It Bq Er EINVAL +The value of the +.Fa policy +parameter is invalid, or one or more of the parameters contained in +.Fa param +is outside the valid range for the specified scheduling policy. +.El +.Sh SEE ALSO +.Xr sched_getparam 2 , +.Xr sched_setparam 2 , +.Xr sched_get_priority_max 2 , +.Xr sched_get_priority_min 2 , +.Xr sched_rr_get_interval 2 , +.Xr sched_yield 2 +.Sh STANDARDS +The +.Fn sched_setscheduler +and +.Fn sched_getscheduler +functions conform to +.St -p1003.1b-93 . diff --git a/lib/libc/sys/sched_yield.2 b/lib/libc/sys/sched_yield.2 new file mode 100644 index 000000000000..b4ea28c3a356 --- /dev/null +++ b/lib/libc/sys/sched_yield.2 @@ -0,0 +1,59 @@ +.\" $Id:$ +.\" Copyright (c) 1998 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. +.\" +.\" 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. +.\" +.Dd Mar 12, 1998 +.Dt SCHED_YIELD 2 +.Os BSD 4 +.Sh NAME +.Nm sched_yield +.Nd yield processor +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn sched_yield void +.Sh DESCRIPTION +The +.Fn sched_yield +function forces the running process to relinquish the processor until it +again becomes the head of its process list. It takes no arguments. +.Sh RETURN +The +.Fn sched_yield +function will return zero if it completes successfully, or it +will return a value of -1 and set +.Va errno +to indicate the error. +.Sh ERRORS +On failure +.Va errno +will be set to the corresponding value: +.Bl -tag -width [EFAULT] +.It Bq Er ENOSYS +The system is not configured to support this functionality. +.Sh STANDARDS +The +.Fn sched_yield +function conforms to +.St -p1003.1b-93 . diff --git a/lib/libc_r/Makefile b/lib/libc_r/Makefile index f1467a0ec9b8..f6dc55fdf4cb 100644 --- a/lib/libc_r/Makefile +++ b/lib/libc_r/Makefile @@ -1,34 +1,34 @@ -# $Id: Makefile,v 1.6 1997/05/03 03:57:21 jb Exp $ +# $Id: Makefile,v 1.7 1998/03/09 05:09:43 jb Exp $ # # All library objects contain rcsid strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, delete -DLIBC_RCS and -DSYSLIBC_RCS # from CFLAGS below. To remove these strings from just the system call # stubs, remove just -DSYSLIBC_RCS from CFLAGS. LIB=c_r SHLIB_MAJOR= 3 SHLIB_MINOR= 0 CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/../libc/include CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread AINC= -I${.CURDIR}/../libc/${MACHINE_ARCH} -I${.CURDIR}/uthread PRECIOUSLIB= yes # # This is a list of syscalls that are renamed as _thread_sys_{syscall} # so that libc_r can provide replacement functions. # HIDDEN_SYSCALLS= accept.o bind.o close.o connect.o dup.o dup2.o \ execve.o fchdir.o fchflags.o fchmod.o fchown.o fcntl.o \ flock.o fpathconf.o fstat.o fstatfs.o fsync.o getdirentries.o \ getpeername.o getsockname.o getsockopt.o ioctl.o listen.o \ mkfifo.o mknod.o nanosleep.o nfssvc.o open.o read.o readv.o \ - recvfrom.o recvmsg.o select.o sendmsg.o sendto.o setsockopt.o \ - shutdown.o sigaction.o sigaltstack.o signanosleep.o socket.o \ - socketpair.o wait4.o write.o writev.o + recvfrom.o recvmsg.o sched_yield.o select.o sendmsg.o sendto.o \ + setsockopt.o shutdown.o sigaction.o sigaltstack.o signanosleep.o \ + socket.o socketpair.o wait4.o write.o writev.o .include "${.CURDIR}/../libc/Makefile.inc" .include "${.CURDIR}/man/Makefile.inc" .include "${.CURDIR}/uthread/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include diff --git a/lib/libkse/Makefile b/lib/libkse/Makefile index f1467a0ec9b8..f6dc55fdf4cb 100644 --- a/lib/libkse/Makefile +++ b/lib/libkse/Makefile @@ -1,34 +1,34 @@ -# $Id: Makefile,v 1.6 1997/05/03 03:57:21 jb Exp $ +# $Id: Makefile,v 1.7 1998/03/09 05:09:43 jb Exp $ # # All library objects contain rcsid strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, delete -DLIBC_RCS and -DSYSLIBC_RCS # from CFLAGS below. To remove these strings from just the system call # stubs, remove just -DSYSLIBC_RCS from CFLAGS. LIB=c_r SHLIB_MAJOR= 3 SHLIB_MINOR= 0 CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/../libc/include CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread AINC= -I${.CURDIR}/../libc/${MACHINE_ARCH} -I${.CURDIR}/uthread PRECIOUSLIB= yes # # This is a list of syscalls that are renamed as _thread_sys_{syscall} # so that libc_r can provide replacement functions. # HIDDEN_SYSCALLS= accept.o bind.o close.o connect.o dup.o dup2.o \ execve.o fchdir.o fchflags.o fchmod.o fchown.o fcntl.o \ flock.o fpathconf.o fstat.o fstatfs.o fsync.o getdirentries.o \ getpeername.o getsockname.o getsockopt.o ioctl.o listen.o \ mkfifo.o mknod.o nanosleep.o nfssvc.o open.o read.o readv.o \ - recvfrom.o recvmsg.o select.o sendmsg.o sendto.o setsockopt.o \ - shutdown.o sigaction.o sigaltstack.o signanosleep.o socket.o \ - socketpair.o wait4.o write.o writev.o + recvfrom.o recvmsg.o sched_yield.o select.o sendmsg.o sendto.o \ + setsockopt.o shutdown.o sigaction.o sigaltstack.o signanosleep.o \ + socket.o socketpair.o wait4.o write.o writev.o .include "${.CURDIR}/../libc/Makefile.inc" .include "${.CURDIR}/man/Makefile.inc" .include "${.CURDIR}/uthread/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index f1467a0ec9b8..f6dc55fdf4cb 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -1,34 +1,34 @@ -# $Id: Makefile,v 1.6 1997/05/03 03:57:21 jb Exp $ +# $Id: Makefile,v 1.7 1998/03/09 05:09:43 jb Exp $ # # All library objects contain rcsid strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, delete -DLIBC_RCS and -DSYSLIBC_RCS # from CFLAGS below. To remove these strings from just the system call # stubs, remove just -DSYSLIBC_RCS from CFLAGS. LIB=c_r SHLIB_MAJOR= 3 SHLIB_MINOR= 0 CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/../libc/include CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread AINC= -I${.CURDIR}/../libc/${MACHINE_ARCH} -I${.CURDIR}/uthread PRECIOUSLIB= yes # # This is a list of syscalls that are renamed as _thread_sys_{syscall} # so that libc_r can provide replacement functions. # HIDDEN_SYSCALLS= accept.o bind.o close.o connect.o dup.o dup2.o \ execve.o fchdir.o fchflags.o fchmod.o fchown.o fcntl.o \ flock.o fpathconf.o fstat.o fstatfs.o fsync.o getdirentries.o \ getpeername.o getsockname.o getsockopt.o ioctl.o listen.o \ mkfifo.o mknod.o nanosleep.o nfssvc.o open.o read.o readv.o \ - recvfrom.o recvmsg.o select.o sendmsg.o sendto.o setsockopt.o \ - shutdown.o sigaction.o sigaltstack.o signanosleep.o socket.o \ - socketpair.o wait4.o write.o writev.o + recvfrom.o recvmsg.o sched_yield.o select.o sendmsg.o sendto.o \ + setsockopt.o shutdown.o sigaction.o sigaltstack.o signanosleep.o \ + socket.o socketpair.o wait4.o write.o writev.o .include "${.CURDIR}/../libc/Makefile.inc" .include "${.CURDIR}/man/Makefile.inc" .include "${.CURDIR}/uthread/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 5f42ff6bef90..6e474f7eeb87 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,59 +1,60 @@ -# $Id: Makefile,v 1.34 1998/01/16 18:49:42 bde Exp $ +# $Id: Makefile,v 1.35 1998/03/04 10:23:48 dufault Exp $ MAN9= MD5.9 \ VFS.9 VFS_FHTOVP.9 VFS_INIT.9 VFS_MOUNT.9 VFS_QUOTACTL.9 \ VFS_ROOT.9 VFS_START.9 VFS_STATFS.9 VFS_SYNC.9 VFS_UNMOUNT.9 \ VFS_VGET.9 VFS_VPTOFH.9 \ VOP_ABORTOP.9 VOP_ACCESS.9 VOP_ADVLOCK.9 VOP_ATTRIB.9 \ VOP_BWRITE.9 VOP_CREATE.9 VOP_FSYNC.9 \ VOP_GETPAGES.9 VOP_INACTIVE.9 VOP_IOCTL.9 VOP_LINK.9 \ VOP_LOCK.9 VOP_LOOKUP.9 VOP_MMAP.9 VOP_OPENCLOSE.9 \ VOP_PATHCONF.9 VOP_PRINT.9 VOP_RDWR.9 VOP_READDIR.9 \ VOP_READLINK.9 VOP_REALLOCBLKS.9 VOP_REMOVE.9 VOP_RENAME.9 \ VOP_STRATEGY.9 \ at_exit.9 at_fork.9 at_shutdown.9 bios.9 boot.9 cd.9 copy.9 \ devfs_add_devswf.9 devfs_link.9 devfs_remove_dev.9 \ fetch.9 ifnet.9 inittodr.9 intro.9 kernacc.9 malloc.9 \ mi_switch.9 panic.9 physio.9 posix4.9 psignal.9 \ resettodr.9 rtalloc.9 rtentry.9 scsiconf.9 sd.9 sleep.9 spl.9 st.9 \ store.9 style.9 suser.9 time.9 timeout.9 uio.9 \ vget.9 vnode.9 vput.9 vref.9 vrele.9 vslock.9 MLINKS+=MD5.9 MD5Init.9 MD5.9 MD5Transform.9 MLINKS+=VOP_ATTRIB.9 VOP_GETATTR.9 MLINKS+=VOP_ATTRIB.9 VOP_SETATTR.9 MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 MLINKS+=VOP_CREATE.9 VOP_MKNOD.9 MLINKS+=VOP_CREATE.9 VOP_SYMLINK.9 MLINKS+=VOP_GETPAGES.9 VOP_PUTPAGES.9 MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9 MLINKS+=VOP_LOCK.9 VOP_ISLOCKED.9 MLINKS+=VOP_LOCK.9 VOP_UNLOCK.9 MLINKS+=VOP_OPENCLOSE.9 VOP_CLOSE.9 MLINKS+=VOP_OPENCLOSE.9 VOP_OPEN.9 MLINKS+=VOP_RDWR.9 VOP_READ.9 MLINKS+=VOP_RDWR.9 VOP_WRITE.9 MLINKS+=VOP_REMOVE.9 VOP_RMDIR.9 MLINKS+=at_exit.9 rm_at_exit.9 MLINKS+=at_fork.9 rm_at_fork.9 MLINKS+=at_shutdown.9 rm_at_shutdown.9 MLINKS+=copy.9 copyin.9 copy.9 copyinstr.9 copy.9 copyout.9 copy.9 copystr.9 MLINKS+=fetch.9 fubyte.9 fetch.9 fuswintr.9 fetch.9 fusword.9 fetch.9 fuword.9 MLINKS+=ifnet.9 if_data.9 ifnet.9 ifaddr.9 ifnet.9 ifqueue.9 MLINKS+=kernacc.9 useracc.9 MLINKS+=malloc.9 FREE.9 malloc.9 MALLOC.9 malloc.9 free.9 MLINKS+=mi_switch.9 cpu_switch.9 +MLINKS+=posix4.9 p1003_1b.9 MLINKS+=psignal.9 gsignal.9 psignal.9 pgsignal.9 MLINKS+=rtalloc.9 rtalloc1.9 rtalloc.9 rtalloc_ign.9 MLINKS+=sleep.9 tsleep.9 sleep.9 wakeup.9 sleep.9 wakeup_one.9 MLINKS+=spl.9 spl0.9 MLINKS+=spl.9 splbio.9 spl.9 splclock.9 spl.9 splhigh.9 spl.9 splimp.9 MLINKS+=spl.9 splnet.9 spl.9 splsoftclock.9 spl.9 splsofttty.9 MLINKS+=spl.9 splstatclock.9 spl.9 spltty.9 spl.9 splvm.9 spl.9 splx.9 MLINKS+=store.9 subyte.9 store.9 suswintr.9 store.9 susword.9 store.9 suword.9 MLINKS+=time.9 boottime.9 time.9 mono_time.9 time.9 runtime.9 MLINKS+=timeout.9 untimeout.9 MLINKS+=vref.9 VREF.9 MLINKS+=vslock.9 vsunlock.9 .include diff --git a/share/man/man9/posix4.9 b/share/man/man9/posix4.9 index ed07afa32142..de1769ce476c 100644 --- a/share/man/man9/posix4.9 +++ b/share/man/man9/posix4.9 @@ -1,132 +1,128 @@ .\" Copyright (c) 1998 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. .\" .\" 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: posix4.9,v 1.1 1998/03/04 10:23:50 dufault Exp $ +.\" $Id: posix1b.9,v 1.2 1998/03/08 17:25:01 dufault Exp $ .Dd March 1, 1998 -.Dt POSIX.4 9 +.Dt POSIX.1B 9 .Os FreeBSD 3.0 .Sh NAME -.Nm posix4 -.Nd "POSIX.4 extensions" +.Nm posix1b +.Nd "Posix P1003-1B extensions" .Sh DESCRIPTION -POSIX.4 adds real time extensions and some commonly used +POSIX.1B adds real time extensions and some commonly used Berkeley extensions to POSIX.1 This section contains preliminary information about avoiding conflicts and adding support for the required ability to specify the interface version. .Sh STATUS -March 7, 1998: adding header file changes to 3.0. There should be no -visible differences as long as _POSIX_VERSION is left undefined. -Defining _POSIX_VERSION, even to the current value of 199009L, will -change the behavior of the system per the POSIX spec: if you define -_POSIX_VERSION to be 199009L then any extensions -already added to the system (for example, -John Dyson's aio work) may no longer be visible - this is happening -slowly. -.Pp -In spite of what I said at first, don't set _POSIX_VERSION into the -future until I say it is working. -.Pp -Since this only brings in the headers I'm only explaining the feature -test options. +March 28, 1998: _POSIX_PRIORITY_SCHEDULING works with these kernel +options in your configuration: +.Bd -literal -offset 0i +options "P1003_1B" +options "_KPOSIX_PRIORITY_SCHEDULING" +.Ed .Sh SPECIFYING THE VERSION There are three manifest constants that set the version and programming interface -for POSIX.4. +for POSIX.1B. .Bd -literal -offset 0i _POSIX_VERSION .Ed specifies the system for which the system is built. The default -is POSIX.1 and is 199009L. POSIX.4 is 199309L. This defines +is POSIX.1 and is 199009L. POSIX.1B is 199309L. This defines the base features of the operating system. .Bd -literal -offset 0i _POSIX_SOURCE .Ed is a macro from POSIX.1 that can be defined to specify that only POSIX and ANSI functionality should occur in the name space. .Bd -literal -offset 0i _POSIX_C_SOURCE .Ed -is a macro from POSIX.4 that can be defined to specify that only +is a macro from POSIX.1B that can be defined to specify that only POSIX and ANSI functionality from a specific POSIX version should occur -in the name space, i.e., if _POSIX_VERSION is 199309L (POSIX.4) but +in the name space, i.e., if _POSIX_VERSION is 199309L (POSIX.1B) but _POSIX_C_SOURCE is 199009L (POSIX.1) then only POSIX.1 features should appear. .Sh PROPERLY HIDING EXTENSIONS The following test macros are set up in . They should used by system header files to avoid the kind of tests you see in . Source programs should not use these FreeBSD specific -implementation details and should test _POSIX_VERSION. -These should not be used in the kernel either - the kernel should be -immune to the user land setting of _POSIX_VERSION. The POSIX4 option can +implementation details and should test _POSIX_VERSION, _POSIX_SOURCE +and _POSIX_C_SOURCE. +These should not be used in the kernel though - the kernel should be +immune to the user land setting of _POSIX_VERSION. The P1003_1B option can be used in the kernel to limit inclusion of new code, but make sure -things work properly when a POSIX.4 program is run on a kernel without -the POSIX4 option. +things work properly when a POSIX.1B program is run on a kernel without +the P1003_1B option. .Bd -literal -offset 0i -_POSIX4_VISIBLE +_P1003_1B_VISIBLE .Ed is a test macro that sorts out when extensions should be visible. It is defined in . .Pp In normal C program development only _POSIX_VERSION is set, permitting BSD extensions to appear to the programs. However, when adding new functionality mandated -by POSIX.4, it +by POSIX.1B, it is important to satisfy the requirements added by the -new _POSIX_C_SOURCE macro. _POSIX4_VISIBLE (not a standard feature test macro) +new _POSIX_C_SOURCE macro. _P1003_1B_VISIBLE (not a standard feature test macro) is defined in sys/unistd.h when the combination of _POSIX_VERSION, _POSIX_SOURCE, and _POSIX_C_SOURCE indicate that the extensions are in scope. .Bd -literal -offset 0i -_POSIX4_VISIBLE_HISTORICALLY -is present to conditionalize POSIX.4 extensions that were historically +_P1003_1B_VISIBLE_HISTORICALLY +is present to conditionalize POSIX.1B extensions that were historically in the system. These are visible when _POSIX_SOURCE and _POSIX_C_SOURCE -are not set at all or when _POSIX_C_SOURCE enables POSIX.4 features. +are not set at all or when _POSIX_C_SOURCE enables POSIX.1B features. +The intent of this feature test is to permit hiding the new extensions +while still letting BSD extensions show up to avoid breaking existing +programs without trying to use the "big hammer" of _POSIX_C_SOURCE. .Pp -Some of these are new enough that they should be changed to -be dependent on _POSIX4_VISIBLE instead. +Some recent additions to header files +are new enough that they should be changed to +be dependent on _P1003_1B_VISIBLE instead of _HISTORICALLY. .Pp -Traditional BSD headers (e.g., mmap.h) that are now specified -in POSIX.4 should include and conditionalize -BSD extensions on _POSIX4_VISIBLE_HISTORICALLY. +Traditional BSD headers (e.g., mmap.h) now specified +in POSIX.1B can include and conditionalize +BSD extensions on _P1003_1B_VISIBLE_HISTORICALLY. .Sh NON STANDARD TEST MACROS .Bd -literal -offset 0i -_POSIX4_INCLUDE_MAYBES +_P1003_1B_INCLUDE_MAYBES .Ed when set before the inclusion of any other header file -requests that all header files that the POSIX.4 spec says a standard +requests that all header files that the POSIX.1B spec says a standard header may include should be included. Normally no non-required headers are included. Setting this pre-processor definition should make any compliant program compile without issues of header file inclusion. .Bd -literal -offset 0i -POSIX4 +P1003_1B .Ed -is a config option and (currently) a request to build POSIX.4 by -setting the _POSIX_VERSION to 199309L in sys/unistd.h. +is a config option to build in POSIX.1B support in the kernel. .Sh SEE ALSO .Sh HISTORY The -.Nm posix4 +.Nm posix1b section manual page appeared in .Fx 3.0 . diff --git a/sys/alpha/linux/syscalls.master b/sys/alpha/linux/syscalls.master index 910710a4c78c..b1ae549e8838 100644 --- a/sys/alpha/linux/syscalls.master +++ b/sys/alpha/linux/syscalls.master @@ -1,209 +1,235 @@ - $Id: syscalls.master,v 1.5 1997/04/09 15:34:09 bde Exp $ + $Id: syscalls.master,v 1.6 1997/12/17 03:12:35 kato Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). ; Processed to created linux_sysent.c, linux_syscalls.c and linux_syscall.h. ; Columns: number type nargs namespc name alt{name,tag,rtyp}/comments ; number system call number, must be in order ; type one of STD, OBSOL, UNIMPL, COMPAT ; namespc one of POSIX, BSD, STD, NOHIDE (I dont care :-) -Peter ; name psuedo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" ; altrtyp return type if not int (bogus - syscalls always return int) ; for UNIMPL/OBSOL, name continues with comments ; types: ; STD always included ; COMPAT included on COMPAT #ifdef ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only #include #include #include #include #include ; #ifdef's, etc. may be included, and are copied to the output files. 0 STD LINUX { int linux_setup(void); } 1 NOPROTO LINUX { int exit(int rval); } 2 STD LINUX { int linux_fork(void); } 3 NOPROTO LINUX { int read(int fd, char *buf, u_int nbyte); } 4 NOPROTO LINUX { int write(int fd, char *buf, u_int nbyte); } 5 STD LINUX { int linux_open(char *path, int flags, int mode); } 6 NOPROTO LINUX { int close(int fd); } 7 STD LINUX { int linux_waitpid(int pid, int *status, int options);} 8 STD LINUX { int linux_creat(char *path, int mode); } 9 NOPROTO LINUX { int link(char *path, char *link); } 10 STD LINUX { int linux_unlink(char *path); } 11 STD LINUX { int linux_execve(char *path, char **argp, char **envp); } 12 STD LINUX { int linux_chdir(char *path); } 13 STD LINUX { int linux_time(linux_time_t *tm); } 14 STD LINUX { int linux_mknod(char *path, int mode, int dev); } 15 STD LINUX { int linux_chmod(char *path, int mode); } 16 STD LINUX { int linux_chown(char *path, int uid, int gid); } 17 STD LINUX { int linux_break(char *nsize); } 18 STD LINUX { int linux_stat(char *path, struct ostat *up); } 19 STD LINUX { int linux_lseek(int fdes, long off, int whence); } 20 NOPROTO LINUX { int getpid(void); } 21 STD LINUX { int linux_mount(void); } 22 STD LINUX { int linux_umount(void); } 23 NOPROTO LINUX { int setuid(uid_t uid); } 24 NOPROTO LINUX { int getuid(void); } 25 STD LINUX { int linux_stime(void); } 26 STD LINUX { int linux_ptrace(void); } 27 STD LINUX { int linux_alarm(unsigned int secs); } 28 STD LINUX { int linux_fstat(int fd, struct ostat *up); } 29 STD LINUX { int linux_pause(void); } 30 STD LINUX { int linux_utime(char *fname, struct linux_utimbuf *times); } 31 STD LINUX { int linux_stty(void); } 32 STD LINUX { int linux_gtty(void); } 33 STD LINUX { int linux_access(char *path, int flags); } 34 STD LINUX { int linux_nice(int inc); } 35 STD LINUX { int linux_ftime(void); } 36 NOPROTO LINUX { int sync(void); } 37 STD LINUX { int linux_kill(int pid, int signum); } 38 STD LINUX { int linux_rename(char *from, char *to); } 39 STD LINUX { int linux_mkdir(char *path, int mode); } 40 STD LINUX { int linux_rmdir(char *path); } 41 NOPROTO LINUX { int dup(u_int fd); } 42 STD LINUX { int linux_pipe(int *pipefds); } 43 STD LINUX { int linux_times(struct linux_times_argv *buf); } 44 STD LINUX { int linux_prof(void); } 45 STD LINUX { int linux_brk(char *dsend); } 46 NOPROTO LINUX { int setgid(gid_t gid); } 47 NOPROTO LINUX { int getgid(void); } 48 STD LINUX { int linux_signal(int sig, linux_handler_t handler); } 49 NOPROTO LINUX { int geteuid(void); } 50 NOPROTO LINUX { int getegid(void); } 51 NOPROTO LINUX { int acct(char *path); } 52 STD LINUX { int linux_phys(void); } 53 STD LINUX { int linux_lock(void); } 54 STD LINUX { int linux_ioctl(int fd, u_long cmd, int arg); } 55 STD LINUX { int linux_fcntl(int fd, int cmd, int arg); } 56 STD LINUX { int linux_mpx(void); } 57 NOPROTO LINUX { int setpgid(int pid, int pgid); } 58 STD LINUX { int linux_ulimit(void); } 59 STD LINUX { int linux_olduname(struct linux_oldold_utsname *up); } 60 NOPROTO LINUX { int umask(int newmask); } 61 NOPROTO LINUX { int chroot(char *path); } 62 STD LINUX { int linux_ustat(void); } 63 NOPROTO LINUX { int dup2(u_int from, u_int to); } 64 NOPROTO LINUX { int getppid(void); } 65 NOPROTO LINUX { int getpgrp(void); } 66 NOPROTO LINUX { int setsid(void); } 67 STD LINUX { int linux_sigaction(int sig, \ struct linux_sigaction *nsa, \ struct linux_sigaction *osa); } 68 STD LINUX { int linux_siggetmask(void); } 69 STD LINUX { int linux_sigsetmask(linux_sigset_t mask); } 70 NOPROTO LINUX { int setreuid(int ruid, int euid); } 71 NOPROTO LINUX { int setregid(int rgid, int egid); } 72 STD LINUX { int linux_sigsuspend(int restart, \ linux_sigset_t oldmask, linux_sigset_t mask); } 73 STD LINUX { int linux_sigpending(linux_sigset_t *mask); } 74 NOPROTO LINUX { int osethostname(char *hostname, \ u_int len);} 75 NOPROTO LINUX { int osetrlimit(u_int which, \ struct ogetrlimit *rlp); } 76 NOPROTO LINUX { int ogetrlimit(u_int which, \ struct ogetrlimit *rlp); } 77 NOPROTO LINUX { int getrusage(int who, struct rusage *rusage); } 78 NOPROTO LINUX { int gettimeofday(struct timeval *tp, \ struct timezone *tzp); } 79 NOPROTO LINUX { int settimeofday(struct timeval *tp, \ struct timezone *tzp); } 80 NOPROTO LINUX { int getgroups(u_int gidsetsize, gid_t *gidset); } 81 NOPROTO LINUX { int setgroups(u_int gidsetsize, gid_t *gidset); } 82 STD LINUX { int linux_select(struct linux_select_argv *ptr); } 83 STD LINUX { int linux_symlink(char *path, char *to); } 84 NOPROTO LINUX { int ostat(char *path, struct ostat *up); } 85 STD LINUX { int linux_readlink(char *name, char *buf, \ int count); } 86 STD LINUX { int linux_uselib(char *library); } 87 NOPROTO LINUX { int swapon(char *name); } 88 NOPROTO LINUX { int reboot(int opt); } 89 STD LINUX { int linux_readdir(int fd, struct linux_dirent *dent, \ unsigned int count); } 90 STD LINUX { int linux_mmap(struct linux_mmap_argv *ptr); } 91 NOPROTO LINUX { int munmap(caddr_t addr, int len); } 92 STD LINUX { int linux_truncate(char *path, long length); } 93 NOPROTO LINUX { int oftruncate(int fd, long length); } 94 NOPROTO LINUX { int fchmod(int fd, int mode); } 95 NOPROTO LINUX { int fchown(int fd, int uid, int gid); } 96 NOPROTO LINUX { int getpriority(int which, int who); } 97 NOPROTO LINUX { int setpriority(int which, int who, int prio); } 98 NOPROTO LINUX { int profil(caddr_t samples, u_int size, \ u_int offset, u_int scale); } 99 STD LINUX { int linux_statfs(char *path, \ struct linux_statfs_buf *buf); } 100 STD LINUX { int linux_fstatfs(int fd, \ struct linux_statfs_buf *buf); } 101 STD LINUX { int linux_ioperm(unsigned int lo, \ unsigned int hi, int val); } 102 STD LINUX { int linux_socketcall(int what, void *args); } 103 STD LINUX { int linux_ksyslog(int what); } 104 STD LINUX { int linux_setitimer(u_int which, \ struct itimerval *itv, struct itimerval *oitv); } 105 STD LINUX { int linux_getitimer(u_int which, \ struct itimerval *itv); } 106 STD LINUX { int linux_newstat(char *path, \ struct linux_newstat *buf); } 107 STD LINUX { int linux_newlstat(char *path, \ struct linux_newstat *buf); } 108 STD LINUX { int linux_newfstat(int fd, struct linux_newstat *buf); } 109 STD LINUX { int linux_uname(struct linux_old_utsname *up); } 110 STD LINUX { int linux_iopl(int level); } 111 STD LINUX { int linux_vhangup(void); } 112 STD LINUX { int linux_idle(void); } 113 STD LINUX { int linux_vm86(void); } 114 STD LINUX { int linux_wait4(int pid, int *status, \ int options, struct rusage *rusage); } 115 STD LINUX { int linux_swapoff(void); } 116 STD LINUX { int linux_sysinfo(void); } 117 STD LINUX { int linux_ipc(int what, int arg1, int arg2, int arg3, \ caddr_t ptr); } 118 NOPROTO LINUX { int fsync(int fd); } 119 STD LINUX { int linux_sigreturn(struct linux_sigcontext *scp); } 120 STD LINUX { int linux_clone(void); } 121 NOPROTO LINUX { int setdomainname(char *name, \ int len); } 122 STD LINUX { int linux_newuname(struct linux_newuname_t *buf); } 123 STD LINUX { int linux_modify_ldt(int func, void *ptr, \ size_t bytecount); } 124 STD LINUX { int linux_adjtimex(void); } 125 NOPROTO LINUX { int mprotect(caddr_t addr, int len, int prot); } 126 STD LINUX { int linux_sigprocmask(int how, \ linux_sigset_t *mask, linux_sigset_t *omask); } 127 STD LINUX { int linux_create_module(void); } 128 STD LINUX { int linux_init_module(void); } 129 STD LINUX { int linux_delete_module(void); } 130 STD LINUX { int linux_get_kernel_syms(void); } 131 STD LINUX { int linux_quotactl(void); } 132 STD LINUX { int linux_getpgid(int pid); } 133 NOPROTO LINUX { int fchdir(int fd); } 134 STD LINUX { int linux_bdflush(void); } 135 UNIMPL LINUX sysfs 136 STD LINUX { int linux_personality(int per); } 137 UNIMPL LINUX afs_syscall 138 UNIMPL LINUX setfsuid 139 UNIMPL LINUX getfsuid 140 STD LINUX { int linux_llseek(int fd, u_int32_t ohigh, \ u_int32_t olow, caddr_t res, int whence); } 141 STD LINUX { int linux_getdents(int fd, void *dent, \ unsigned count); } 142 STD LINUX { int linux_newselect(int nfds, fd_set *readfds, \ fd_set *writefds, fd_set *exceptfds, \ struct timeval *timeout); } 143 NOPROTO LINUX { int flock(int fd, int how); } 144 STD LINUX { int linux_msync(caddr_t addr, int len, int fl); } 145 NOPROTO LINUX { int readv(int fd, struct iovec *iovp, \ u_int iovcnt); } 146 NOPROTO LINUX { int writev(int fd, struct iovec *iovp, \ u_int iovcnt); } + +; Turn on getsid after checking that it matches. + +147 UNIMPL LINUX getsid +148 UNIMPL LINUX fdatasync +149 UNIMPL LINUX _sysctl + +150 NOPROTO BSD { int mlock(const void *addr, size_t len); } +151 NOPROTO BSD { int munlock(const void *addr, size_t len); } +152 NOPROTO BSD { int mlockall(int how); } +153 NOPROTO BSD { int munlockall(void); } + + +154 NOPROTO POSIX { int sched_setparam (pid_t pid, const struct sched_param *param); } +155 NOPROTO POSIX { int sched_getparam (pid_t pid, struct sched_param *param); } + +156 NOPROTO POSIX { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } +157 NOPROTO POSIX { int sched_getscheduler (pid_t pid); } + +158 NOPROTO POSIX { int sched_yield (void); } +159 NOPROTO POSIX { int sched_get_priority_max (int policy); } +160 NOPROTO POSIX { int sched_get_priority_min (int policy); } +161 NOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } + +162 NOPROTO POSIX { int nanosleep(const struct timespec *rqtp, \ + struct timespec *rmtp); } diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index 7a63d34cec5b..e5f336bc2237 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -1,826 +1,826 @@ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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: swtch.s,v 1.68 1998/02/06 12:13:10 eivind Exp $ + * $Id: swtch.s,v 1.69 1998/03/04 10:25:03 dufault Exp $ */ #include "npx.h" -#include "opt_posix4.h" +#include "opt_posix.h" #include "opt_user_ldt.h" #include "opt_vm86.h" #include #include #ifdef SMP #include #include #include /** GRAB_LOPRIO */ #endif /* SMP */ #include "assym.s" /*****************************************************************************/ /* Scheduling */ /*****************************************************************************/ /* * The following primitives manipulate the run queues. * _whichqs tells which of the 32 queues _qs * have processes in them. setrunqueue puts processes into queues, Remrq * removes them from queues. The running process is on no queue, * other processes are on a queue related to p->p_priority, divided by 4 * actually to shrink the 0-127 range of priorities into the 32 available * queues. */ .data #ifndef SMP .globl _curpcb _curpcb: .long 0 /* pointer to curproc's PCB area */ #endif /* !SMP */ .globl _whichqs, _whichrtqs, _whichidqs _whichqs: .long 0 /* which run queues have data */ _whichrtqs: .long 0 /* which realtime run qs have data */ _whichidqs: .long 0 /* which idletime run qs have data */ .globl _hlt_vector _hlt_vector: .long _default_halt /* pointer to halt routine */ .globl _qs,_cnt,_panic .globl _want_resched _want_resched: .long 0 /* we need to re-run the scheduler */ #if defined(SWTCH_OPTIM_STATS) .globl _swtch_optim_stats, _tlb_flush_count _swtch_optim_stats: .long 0 /* number of _swtch_optims */ _tlb_flush_count: .long 0 #endif .text /* * setrunqueue(p) * * Call should be made at spl6(), and p->p_stat should be SRUN */ ENTRY(setrunqueue) movl 4(%esp),%eax #ifdef DIAGNOSTIC cmpb $SRUN,P_STAT(%eax) je set1 pushl $set2 call _panic set1: #endif cmpw $RTP_PRIO_NORMAL,P_RTPRIO_TYPE(%eax) /* normal priority process? */ je set_nort movzwl P_RTPRIO_PRIO(%eax),%edx cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* RR realtime priority? */ -#ifdef POSIX4 +#ifdef P1003_1B je set_rt /* RT priority */ cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority? */ #endif jne set_id /* must be idle priority */ set_rt: btsl %edx,_whichrtqs /* set q full bit */ shll $3,%edx addl $_rtqs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set_id: btsl %edx,_whichidqs /* set q full bit */ shll $3,%edx addl $_idqs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set_nort: /* Normal (RTOFF) code */ movzbl P_PRI(%eax),%edx shrl $2,%edx btsl %edx,_whichqs /* set q full bit */ shll $3,%edx addl $_qs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set2: .asciz "setrunqueue" /* * Remrq(p) * * Call should be made at spl6(). */ ENTRY(remrq) movl 4(%esp),%eax cmpw $RTP_PRIO_NORMAL,P_RTPRIO_TYPE(%eax) /* normal priority process? */ je rem_nort movzwl P_RTPRIO_PRIO(%eax),%edx cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* realtime priority process? */ -#ifdef POSIX4 +#ifdef P1003_1B je rem0rt cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority process? */ #endif jne rem_id rem0rt: btrl %edx,_whichrtqs /* clear full bit, panic if clear already */ jb rem1rt pushl $rem3rt call _panic rem1rt: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_rtqs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2rt shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichrtqs rem2rt: ret rem_id: btrl %edx,_whichidqs /* clear full bit, panic if clear already */ jb rem1id pushl $rem3id call _panic rem1id: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_idqs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2id shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichidqs rem2id: ret rem_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btrl %edx,_whichqs /* clear full bit, panic if clear already */ jb rem1 pushl $rem3 call _panic rem1: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_qs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2 shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichqs rem2: ret rem3: .asciz "remrq" rem3rt: .asciz "remrq.rt" rem3id: .asciz "remrq.id" /* * When no processes are on the runq, cpu_switch() branches to _idle * to wait for something to come ready. */ ALIGN_TEXT _idle: #ifdef SMP /* when called, we have the mplock, intr disabled */ xorl %ebp,%ebp /* use our idleproc's "context" */ movl _my_idlePTD,%ecx movl %ecx,%cr3 #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif /* Keep space for nonexisting return addr, or profiling bombs */ movl $_idlestack_top-4,%ecx movl %ecx,%esp /* update common_tss.tss_esp0 pointer */ #ifdef VM86 movl _my_tr, %esi #endif /* VM86 */ movl %ecx, _common_tss + TSS_ESP0 #ifdef VM86 btrl %esi, _private_tss je 1f movl $_common_tssd, %edi /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 1: #endif /* VM86 */ sti /* * XXX callers of cpu_switch() do a bogus splclock(). Locking should * be left to cpu_switch(). */ call _spl0 cli /* * _REALLY_ free the lock, no matter how deep the prior nesting. * We will recover the nesting on the way out when we have a new * proc to load. * * XXX: we had damn well better be sure we had it before doing this! */ movl $FREE_LOCK, %eax movl %eax, _mp_lock /* do NOT have lock, intrs disabled */ .globl idle_loop idle_loop: #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif movl %cr3,%eax /* ouch! */ movl %eax,%cr3 cmpl $0,_smp_active jne 1f cmpl $0,_cpuid je 1f jmp 2f 1: cmpl $0,_whichrtqs /* real-time queue */ jne 3f cmpl $0,_whichqs /* normal queue */ jne 3f cmpl $0,_whichidqs /* 'idle' queue */ jne 3f cmpl $0,_do_page_zero_idle je 2f /* XXX appears to cause panics */ /* * Inside zero_idle we enable interrupts and grab the mplock * as needed. It needs to be careful about entry/exit mutexes. */ call _vm_page_zero_idle /* internal locking */ testl %eax, %eax jnz idle_loop 2: /* enable intrs for a halt */ #ifdef SMP movl $0, lapic_tpr /* 1st candidate for an INT */ #endif sti call *_hlt_vector /* wait for interrupt */ cli jmp idle_loop 3: #ifdef SMP movl $LOPRIO_LEVEL, lapic_tpr /* arbitrate for INTs */ #endif call _get_mplock cmpl $0,_whichrtqs /* real-time queue */ CROSSJUMP(jne, sw1a, je) cmpl $0,_whichqs /* normal queue */ CROSSJUMP(jne, nortqr, je) cmpl $0,_whichidqs /* 'idle' queue */ CROSSJUMP(jne, idqr, je) call _rel_mplock jmp idle_loop #else xorl %ebp,%ebp movl $HIDENAME(tmpstk),%esp #if defined(OVERLY_CONSERVATIVE_PTD_MGMT) #if defined(SWTCH_OPTIM_STATS) incl _swtch_optim_stats #endif movl _IdlePTD, %ecx movl %cr3, %eax cmpl %ecx, %eax je 2f #if defined(SWTCH_OPTIM_STATS) decl _swtch_optim_stats incl _tlb_flush_count #endif movl %ecx, %cr3 2: #endif /* update common_tss.tss_esp0 pointer */ #ifdef VM86 movl _my_tr, %esi #endif /* VM86 */ movl %esp, _common_tss + TSS_ESP0 #ifdef VM86 btrl %esi, _private_tss je 1f movl $_common_tssd, %edi /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 1: #endif /* VM86 */ sti /* * XXX callers of cpu_switch() do a bogus splclock(). Locking should * be left to cpu_switch(). */ call _spl0 ALIGN_TEXT idle_loop: cli cmpl $0,_whichrtqs /* real-time queue */ CROSSJUMP(jne, sw1a, je) cmpl $0,_whichqs /* normal queue */ CROSSJUMP(jne, nortqr, je) cmpl $0,_whichidqs /* 'idle' queue */ CROSSJUMP(jne, idqr, je) call _vm_page_zero_idle testl %eax, %eax jnz idle_loop sti call *_hlt_vector /* wait for interrupt */ jmp idle_loop #endif CROSSJUMPTARGET(_idle) ENTRY(default_halt) #ifndef SMP hlt /* XXX: until a wakeup IPI */ #endif ret /* * cpu_switch() */ ENTRY(cpu_switch) /* switch to new process. first, save context as needed */ movl _curproc,%ecx /* if no process to save, don't bother */ testl %ecx,%ecx je sw1 #ifdef SMP movb P_ONCPU(%ecx), %al /* save "last" cpu */ movb %al, P_LASTCPU(%ecx) movb $0xff, P_ONCPU(%ecx) /* "leave" the cpu */ #endif /* SMP */ movl P_ADDR(%ecx),%ecx movl (%esp),%eax /* Hardware registers */ movl %eax,PCB_EIP(%ecx) movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) movl %fs,PCB_FS(%ecx) movl %gs,PCB_GS(%ecx) #ifdef SMP movl _mp_lock, %eax /* XXX FIXME: we should be saving the local APIC TPR */ #ifdef DIAGNOSTIC cmpl $FREE_LOCK, %eax /* is it free? */ je badsw4 /* yes, bad medicine! */ #endif /* DIAGNOSTIC */ andl $COUNT_FIELD, %eax /* clear CPU portion */ movl %eax, PCB_MPNEST(%ecx) /* store it */ #endif /* SMP */ #if NNPX > 0 /* have we used fp, and need a save? */ movl _curproc,%eax cmpl %eax,_npxproc jne 1f addl $PCB_SAVEFPU,%ecx /* h/w bugs make saving complicated */ pushl %ecx call _npxsave /* do it in a big C function */ popl %eax 1: #endif /* NNPX > 0 */ movl $0,_curproc /* out of process */ /* save is done, now choose a new process or idle */ sw1: cli #ifdef SMP /* Stop scheduling if smp_active goes zero and we are not BSP */ cmpl $0,_smp_active jne 1f cmpl $0,_cpuid je 1f CROSSJUMP(je, _idle, jne) /* wind down */ 1: #endif sw1a: movl _whichrtqs,%edi /* pick next p. from rtqs */ testl %edi,%edi jz nortqr /* no realtime procs */ /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ jz nortqr /* no proc on rt q - try normal ... */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _rtqs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je rt3 btsl %ebx,%edi /* nope, set to indicate not empty */ rt3: movl %edi,_whichrtqs /* update q status */ jmp swtch_com /* old sw1a */ /* Normal process priority's */ nortqr: movl _whichqs,%edi 2: /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ jz idqr /* if none, idle */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _qs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je 3f btsl %ebx,%edi /* nope, set to indicate not empty */ 3: movl %edi,_whichqs /* update q status */ jmp swtch_com idqr: /* was sw1a */ movl _whichidqs,%edi /* pick next p. from idqs */ /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ CROSSJUMP(je, _idle, jne) /* if no proc, idle */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _idqs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je id3 btsl %ebx,%edi /* nope, set to indicate not empty */ id3: movl %edi,_whichidqs /* update q status */ swtch_com: movl $0,%eax movl %eax,_want_resched #ifdef DIAGNOSTIC cmpl %eax,P_WCHAN(%ecx) jne badsw1 cmpb $SRUN,P_STAT(%ecx) jne badsw2 #endif movl %eax,P_BACK(%ecx) /* isolate process to run */ movl P_ADDR(%ecx),%edx #ifdef SMP movl PCB_CR3(%edx),%ebx /* Grab the private PT pointer from the outgoing process's PTD */ movl $_PTD, %esi movl 4*MPPTDI(%esi), %eax /* fetch cpu's prv pt */ #else #if defined(SWTCH_OPTIM_STATS) incl _swtch_optim_stats #endif /* switch address space */ movl %cr3,%ebx cmpl PCB_CR3(%edx),%ebx je 4f #if defined(SWTCH_OPTIM_STATS) decl _swtch_optim_stats incl _tlb_flush_count #endif movl PCB_CR3(%edx),%ebx #endif /* SMP */ movl %ebx,%cr3 4: #ifdef SMP /* Copy the private PT to the new process's PTD */ /* XXX yuck, the _PTD changes when we switch, so we have to * reload %cr3 after changing the address space. * We need to fix this by storing a pointer to the virtual * location of the per-process PTD in the PCB or something quick. * Dereferencing proc->vm_map->pmap->p_pdir[] is painful in asm. */ movl %eax, 4*MPPTDI(%esi) /* restore cpu's prv page */ #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif /* XXX: we have just changed the page tables.. reload.. */ movl %ebx, %cr3 #endif /* SMP */ #ifdef VM86 movl _my_tr, %esi cmpl $0, PCB_EXT(%edx) /* has pcb extension? */ je 1f btsl %esi, _private_tss /* mark use of private tss */ movl PCB_EXT(%edx), %edi /* new tss descriptor */ jmp 2f 1: #endif /* update common_tss.tss_esp0 pointer */ movl $_common_tss, %eax movl %edx, %ebx /* pcb */ #ifdef VM86 addl $(UPAGES * PAGE_SIZE - 16), %ebx #else addl $(UPAGES * PAGE_SIZE), %ebx #endif /* VM86 */ movl %ebx, TSS_ESP0(%eax) #ifdef VM86 btrl %esi, _private_tss je 3f movl $_common_tssd, %edi 2: /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 3: #endif /* VM86 */ /* restore context */ movl PCB_EBX(%edx),%ebx movl PCB_ESP(%edx),%esp movl PCB_EBP(%edx),%ebp movl PCB_ESI(%edx),%esi movl PCB_EDI(%edx),%edi movl PCB_EIP(%edx),%eax movl %eax,(%esp) #ifdef SMP #ifdef GRAB_LOPRIO /* hold LOPRIO for INTs */ #ifdef CHEAP_TPR movl $0, lapic_tpr #else andl $~APIC_TPR_PRIO, lapic_tpr #endif /** CHEAP_TPR */ #endif /** GRAB_LOPRIO */ movl _cpuid,%eax movb %al, P_ONCPU(%ecx) #endif /* SMP */ movl %edx, _curpcb movl %ecx, _curproc /* into next process */ #ifdef SMP movl _cpu_lockid, %eax orl PCB_MPNEST(%edx), %eax /* add next count from PROC */ movl %eax, _mp_lock /* load the mp_lock */ /* XXX FIXME: we should be restoring the local APIC TPR */ #endif /* SMP */ #ifdef USER_LDT cmpl $0, PCB_USERLDT(%edx) jnz 1f movl __default_ldt,%eax cmpl _currentldt,%eax je 2f lldt __default_ldt movl %eax,_currentldt jmp 2f 1: pushl %edx call _set_user_ldt popl %edx 2: #endif /* This must be done after loading the user LDT. */ .globl cpu_switch_load_fs cpu_switch_load_fs: movl PCB_FS(%edx),%fs .globl cpu_switch_load_gs cpu_switch_load_gs: movl PCB_GS(%edx),%gs sti ret CROSSJUMPTARGET(idqr) CROSSJUMPTARGET(nortqr) CROSSJUMPTARGET(sw1a) #ifdef DIAGNOSTIC badsw1: pushl $sw0_1 call _panic sw0_1: .asciz "cpu_switch: has wchan" badsw2: pushl $sw0_2 call _panic sw0_2: .asciz "cpu_switch: not SRUN" #endif #if defined(SMP) && defined(DIAGNOSTIC) badsw4: pushl $sw0_4 call _panic sw0_4: .asciz "cpu_switch: do not have lock" #endif /* SMP && DIAGNOSTIC */ /* * savectx(pcb) * Update pcb, saving current processor state. */ ENTRY(savectx) /* fetch PCB */ movl 4(%esp),%ecx /* caller's return address - child won't execute this routine */ movl (%esp),%eax movl %eax,PCB_EIP(%ecx) movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) movl %fs,PCB_FS(%ecx) movl %gs,PCB_GS(%ecx) #if NNPX > 0 /* * If npxproc == NULL, then the npx h/w state is irrelevant and the * state had better already be in the pcb. This is true for forks * but not for dumps (the old book-keeping with FP flags in the pcb * always lost for dumps because the dump pcb has 0 flags). * * If npxproc != NULL, then we have to save the npx h/w state to * npxproc's pcb and copy it to the requested pcb, or save to the * requested pcb and reload. Copying is easier because we would * have to handle h/w bugs for reloading. We used to lose the * parent's npx state for forks by forgetting to reload. */ movl _npxproc,%eax testl %eax,%eax je 1f pushl %ecx movl P_ADDR(%eax),%eax leal PCB_SAVEFPU(%eax),%eax pushl %eax pushl %eax call _npxsave addl $4,%esp popl %eax popl %ecx pushl $PCB_SAVEFPU_SIZE leal PCB_SAVEFPU(%ecx),%ecx pushl %ecx pushl %eax call _bcopy addl $12,%esp #endif /* NNPX > 0 */ 1: ret diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s index 7a63d34cec5b..e5f336bc2237 100644 --- a/sys/amd64/amd64/swtch.s +++ b/sys/amd64/amd64/swtch.s @@ -1,826 +1,826 @@ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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: swtch.s,v 1.68 1998/02/06 12:13:10 eivind Exp $ + * $Id: swtch.s,v 1.69 1998/03/04 10:25:03 dufault Exp $ */ #include "npx.h" -#include "opt_posix4.h" +#include "opt_posix.h" #include "opt_user_ldt.h" #include "opt_vm86.h" #include #include #ifdef SMP #include #include #include /** GRAB_LOPRIO */ #endif /* SMP */ #include "assym.s" /*****************************************************************************/ /* Scheduling */ /*****************************************************************************/ /* * The following primitives manipulate the run queues. * _whichqs tells which of the 32 queues _qs * have processes in them. setrunqueue puts processes into queues, Remrq * removes them from queues. The running process is on no queue, * other processes are on a queue related to p->p_priority, divided by 4 * actually to shrink the 0-127 range of priorities into the 32 available * queues. */ .data #ifndef SMP .globl _curpcb _curpcb: .long 0 /* pointer to curproc's PCB area */ #endif /* !SMP */ .globl _whichqs, _whichrtqs, _whichidqs _whichqs: .long 0 /* which run queues have data */ _whichrtqs: .long 0 /* which realtime run qs have data */ _whichidqs: .long 0 /* which idletime run qs have data */ .globl _hlt_vector _hlt_vector: .long _default_halt /* pointer to halt routine */ .globl _qs,_cnt,_panic .globl _want_resched _want_resched: .long 0 /* we need to re-run the scheduler */ #if defined(SWTCH_OPTIM_STATS) .globl _swtch_optim_stats, _tlb_flush_count _swtch_optim_stats: .long 0 /* number of _swtch_optims */ _tlb_flush_count: .long 0 #endif .text /* * setrunqueue(p) * * Call should be made at spl6(), and p->p_stat should be SRUN */ ENTRY(setrunqueue) movl 4(%esp),%eax #ifdef DIAGNOSTIC cmpb $SRUN,P_STAT(%eax) je set1 pushl $set2 call _panic set1: #endif cmpw $RTP_PRIO_NORMAL,P_RTPRIO_TYPE(%eax) /* normal priority process? */ je set_nort movzwl P_RTPRIO_PRIO(%eax),%edx cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* RR realtime priority? */ -#ifdef POSIX4 +#ifdef P1003_1B je set_rt /* RT priority */ cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority? */ #endif jne set_id /* must be idle priority */ set_rt: btsl %edx,_whichrtqs /* set q full bit */ shll $3,%edx addl $_rtqs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set_id: btsl %edx,_whichidqs /* set q full bit */ shll $3,%edx addl $_idqs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set_nort: /* Normal (RTOFF) code */ movzbl P_PRI(%eax),%edx shrl $2,%edx btsl %edx,_whichqs /* set q full bit */ shll $3,%edx addl $_qs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set2: .asciz "setrunqueue" /* * Remrq(p) * * Call should be made at spl6(). */ ENTRY(remrq) movl 4(%esp),%eax cmpw $RTP_PRIO_NORMAL,P_RTPRIO_TYPE(%eax) /* normal priority process? */ je rem_nort movzwl P_RTPRIO_PRIO(%eax),%edx cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* realtime priority process? */ -#ifdef POSIX4 +#ifdef P1003_1B je rem0rt cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority process? */ #endif jne rem_id rem0rt: btrl %edx,_whichrtqs /* clear full bit, panic if clear already */ jb rem1rt pushl $rem3rt call _panic rem1rt: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_rtqs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2rt shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichrtqs rem2rt: ret rem_id: btrl %edx,_whichidqs /* clear full bit, panic if clear already */ jb rem1id pushl $rem3id call _panic rem1id: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_idqs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2id shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichidqs rem2id: ret rem_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btrl %edx,_whichqs /* clear full bit, panic if clear already */ jb rem1 pushl $rem3 call _panic rem1: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_qs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2 shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichqs rem2: ret rem3: .asciz "remrq" rem3rt: .asciz "remrq.rt" rem3id: .asciz "remrq.id" /* * When no processes are on the runq, cpu_switch() branches to _idle * to wait for something to come ready. */ ALIGN_TEXT _idle: #ifdef SMP /* when called, we have the mplock, intr disabled */ xorl %ebp,%ebp /* use our idleproc's "context" */ movl _my_idlePTD,%ecx movl %ecx,%cr3 #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif /* Keep space for nonexisting return addr, or profiling bombs */ movl $_idlestack_top-4,%ecx movl %ecx,%esp /* update common_tss.tss_esp0 pointer */ #ifdef VM86 movl _my_tr, %esi #endif /* VM86 */ movl %ecx, _common_tss + TSS_ESP0 #ifdef VM86 btrl %esi, _private_tss je 1f movl $_common_tssd, %edi /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 1: #endif /* VM86 */ sti /* * XXX callers of cpu_switch() do a bogus splclock(). Locking should * be left to cpu_switch(). */ call _spl0 cli /* * _REALLY_ free the lock, no matter how deep the prior nesting. * We will recover the nesting on the way out when we have a new * proc to load. * * XXX: we had damn well better be sure we had it before doing this! */ movl $FREE_LOCK, %eax movl %eax, _mp_lock /* do NOT have lock, intrs disabled */ .globl idle_loop idle_loop: #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif movl %cr3,%eax /* ouch! */ movl %eax,%cr3 cmpl $0,_smp_active jne 1f cmpl $0,_cpuid je 1f jmp 2f 1: cmpl $0,_whichrtqs /* real-time queue */ jne 3f cmpl $0,_whichqs /* normal queue */ jne 3f cmpl $0,_whichidqs /* 'idle' queue */ jne 3f cmpl $0,_do_page_zero_idle je 2f /* XXX appears to cause panics */ /* * Inside zero_idle we enable interrupts and grab the mplock * as needed. It needs to be careful about entry/exit mutexes. */ call _vm_page_zero_idle /* internal locking */ testl %eax, %eax jnz idle_loop 2: /* enable intrs for a halt */ #ifdef SMP movl $0, lapic_tpr /* 1st candidate for an INT */ #endif sti call *_hlt_vector /* wait for interrupt */ cli jmp idle_loop 3: #ifdef SMP movl $LOPRIO_LEVEL, lapic_tpr /* arbitrate for INTs */ #endif call _get_mplock cmpl $0,_whichrtqs /* real-time queue */ CROSSJUMP(jne, sw1a, je) cmpl $0,_whichqs /* normal queue */ CROSSJUMP(jne, nortqr, je) cmpl $0,_whichidqs /* 'idle' queue */ CROSSJUMP(jne, idqr, je) call _rel_mplock jmp idle_loop #else xorl %ebp,%ebp movl $HIDENAME(tmpstk),%esp #if defined(OVERLY_CONSERVATIVE_PTD_MGMT) #if defined(SWTCH_OPTIM_STATS) incl _swtch_optim_stats #endif movl _IdlePTD, %ecx movl %cr3, %eax cmpl %ecx, %eax je 2f #if defined(SWTCH_OPTIM_STATS) decl _swtch_optim_stats incl _tlb_flush_count #endif movl %ecx, %cr3 2: #endif /* update common_tss.tss_esp0 pointer */ #ifdef VM86 movl _my_tr, %esi #endif /* VM86 */ movl %esp, _common_tss + TSS_ESP0 #ifdef VM86 btrl %esi, _private_tss je 1f movl $_common_tssd, %edi /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 1: #endif /* VM86 */ sti /* * XXX callers of cpu_switch() do a bogus splclock(). Locking should * be left to cpu_switch(). */ call _spl0 ALIGN_TEXT idle_loop: cli cmpl $0,_whichrtqs /* real-time queue */ CROSSJUMP(jne, sw1a, je) cmpl $0,_whichqs /* normal queue */ CROSSJUMP(jne, nortqr, je) cmpl $0,_whichidqs /* 'idle' queue */ CROSSJUMP(jne, idqr, je) call _vm_page_zero_idle testl %eax, %eax jnz idle_loop sti call *_hlt_vector /* wait for interrupt */ jmp idle_loop #endif CROSSJUMPTARGET(_idle) ENTRY(default_halt) #ifndef SMP hlt /* XXX: until a wakeup IPI */ #endif ret /* * cpu_switch() */ ENTRY(cpu_switch) /* switch to new process. first, save context as needed */ movl _curproc,%ecx /* if no process to save, don't bother */ testl %ecx,%ecx je sw1 #ifdef SMP movb P_ONCPU(%ecx), %al /* save "last" cpu */ movb %al, P_LASTCPU(%ecx) movb $0xff, P_ONCPU(%ecx) /* "leave" the cpu */ #endif /* SMP */ movl P_ADDR(%ecx),%ecx movl (%esp),%eax /* Hardware registers */ movl %eax,PCB_EIP(%ecx) movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) movl %fs,PCB_FS(%ecx) movl %gs,PCB_GS(%ecx) #ifdef SMP movl _mp_lock, %eax /* XXX FIXME: we should be saving the local APIC TPR */ #ifdef DIAGNOSTIC cmpl $FREE_LOCK, %eax /* is it free? */ je badsw4 /* yes, bad medicine! */ #endif /* DIAGNOSTIC */ andl $COUNT_FIELD, %eax /* clear CPU portion */ movl %eax, PCB_MPNEST(%ecx) /* store it */ #endif /* SMP */ #if NNPX > 0 /* have we used fp, and need a save? */ movl _curproc,%eax cmpl %eax,_npxproc jne 1f addl $PCB_SAVEFPU,%ecx /* h/w bugs make saving complicated */ pushl %ecx call _npxsave /* do it in a big C function */ popl %eax 1: #endif /* NNPX > 0 */ movl $0,_curproc /* out of process */ /* save is done, now choose a new process or idle */ sw1: cli #ifdef SMP /* Stop scheduling if smp_active goes zero and we are not BSP */ cmpl $0,_smp_active jne 1f cmpl $0,_cpuid je 1f CROSSJUMP(je, _idle, jne) /* wind down */ 1: #endif sw1a: movl _whichrtqs,%edi /* pick next p. from rtqs */ testl %edi,%edi jz nortqr /* no realtime procs */ /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ jz nortqr /* no proc on rt q - try normal ... */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _rtqs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je rt3 btsl %ebx,%edi /* nope, set to indicate not empty */ rt3: movl %edi,_whichrtqs /* update q status */ jmp swtch_com /* old sw1a */ /* Normal process priority's */ nortqr: movl _whichqs,%edi 2: /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ jz idqr /* if none, idle */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _qs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je 3f btsl %ebx,%edi /* nope, set to indicate not empty */ 3: movl %edi,_whichqs /* update q status */ jmp swtch_com idqr: /* was sw1a */ movl _whichidqs,%edi /* pick next p. from idqs */ /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ CROSSJUMP(je, _idle, jne) /* if no proc, idle */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _idqs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je id3 btsl %ebx,%edi /* nope, set to indicate not empty */ id3: movl %edi,_whichidqs /* update q status */ swtch_com: movl $0,%eax movl %eax,_want_resched #ifdef DIAGNOSTIC cmpl %eax,P_WCHAN(%ecx) jne badsw1 cmpb $SRUN,P_STAT(%ecx) jne badsw2 #endif movl %eax,P_BACK(%ecx) /* isolate process to run */ movl P_ADDR(%ecx),%edx #ifdef SMP movl PCB_CR3(%edx),%ebx /* Grab the private PT pointer from the outgoing process's PTD */ movl $_PTD, %esi movl 4*MPPTDI(%esi), %eax /* fetch cpu's prv pt */ #else #if defined(SWTCH_OPTIM_STATS) incl _swtch_optim_stats #endif /* switch address space */ movl %cr3,%ebx cmpl PCB_CR3(%edx),%ebx je 4f #if defined(SWTCH_OPTIM_STATS) decl _swtch_optim_stats incl _tlb_flush_count #endif movl PCB_CR3(%edx),%ebx #endif /* SMP */ movl %ebx,%cr3 4: #ifdef SMP /* Copy the private PT to the new process's PTD */ /* XXX yuck, the _PTD changes when we switch, so we have to * reload %cr3 after changing the address space. * We need to fix this by storing a pointer to the virtual * location of the per-process PTD in the PCB or something quick. * Dereferencing proc->vm_map->pmap->p_pdir[] is painful in asm. */ movl %eax, 4*MPPTDI(%esi) /* restore cpu's prv page */ #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif /* XXX: we have just changed the page tables.. reload.. */ movl %ebx, %cr3 #endif /* SMP */ #ifdef VM86 movl _my_tr, %esi cmpl $0, PCB_EXT(%edx) /* has pcb extension? */ je 1f btsl %esi, _private_tss /* mark use of private tss */ movl PCB_EXT(%edx), %edi /* new tss descriptor */ jmp 2f 1: #endif /* update common_tss.tss_esp0 pointer */ movl $_common_tss, %eax movl %edx, %ebx /* pcb */ #ifdef VM86 addl $(UPAGES * PAGE_SIZE - 16), %ebx #else addl $(UPAGES * PAGE_SIZE), %ebx #endif /* VM86 */ movl %ebx, TSS_ESP0(%eax) #ifdef VM86 btrl %esi, _private_tss je 3f movl $_common_tssd, %edi 2: /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 3: #endif /* VM86 */ /* restore context */ movl PCB_EBX(%edx),%ebx movl PCB_ESP(%edx),%esp movl PCB_EBP(%edx),%ebp movl PCB_ESI(%edx),%esi movl PCB_EDI(%edx),%edi movl PCB_EIP(%edx),%eax movl %eax,(%esp) #ifdef SMP #ifdef GRAB_LOPRIO /* hold LOPRIO for INTs */ #ifdef CHEAP_TPR movl $0, lapic_tpr #else andl $~APIC_TPR_PRIO, lapic_tpr #endif /** CHEAP_TPR */ #endif /** GRAB_LOPRIO */ movl _cpuid,%eax movb %al, P_ONCPU(%ecx) #endif /* SMP */ movl %edx, _curpcb movl %ecx, _curproc /* into next process */ #ifdef SMP movl _cpu_lockid, %eax orl PCB_MPNEST(%edx), %eax /* add next count from PROC */ movl %eax, _mp_lock /* load the mp_lock */ /* XXX FIXME: we should be restoring the local APIC TPR */ #endif /* SMP */ #ifdef USER_LDT cmpl $0, PCB_USERLDT(%edx) jnz 1f movl __default_ldt,%eax cmpl _currentldt,%eax je 2f lldt __default_ldt movl %eax,_currentldt jmp 2f 1: pushl %edx call _set_user_ldt popl %edx 2: #endif /* This must be done after loading the user LDT. */ .globl cpu_switch_load_fs cpu_switch_load_fs: movl PCB_FS(%edx),%fs .globl cpu_switch_load_gs cpu_switch_load_gs: movl PCB_GS(%edx),%gs sti ret CROSSJUMPTARGET(idqr) CROSSJUMPTARGET(nortqr) CROSSJUMPTARGET(sw1a) #ifdef DIAGNOSTIC badsw1: pushl $sw0_1 call _panic sw0_1: .asciz "cpu_switch: has wchan" badsw2: pushl $sw0_2 call _panic sw0_2: .asciz "cpu_switch: not SRUN" #endif #if defined(SMP) && defined(DIAGNOSTIC) badsw4: pushl $sw0_4 call _panic sw0_4: .asciz "cpu_switch: do not have lock" #endif /* SMP && DIAGNOSTIC */ /* * savectx(pcb) * Update pcb, saving current processor state. */ ENTRY(savectx) /* fetch PCB */ movl 4(%esp),%ecx /* caller's return address - child won't execute this routine */ movl (%esp),%eax movl %eax,PCB_EIP(%ecx) movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) movl %fs,PCB_FS(%ecx) movl %gs,PCB_GS(%ecx) #if NNPX > 0 /* * If npxproc == NULL, then the npx h/w state is irrelevant and the * state had better already be in the pcb. This is true for forks * but not for dumps (the old book-keeping with FP flags in the pcb * always lost for dumps because the dump pcb has 0 flags). * * If npxproc != NULL, then we have to save the npx h/w state to * npxproc's pcb and copy it to the requested pcb, or save to the * requested pcb and reload. Copying is easier because we would * have to handle h/w bugs for reloading. We used to lose the * parent's npx state for forks by forgetting to reload. */ movl _npxproc,%eax testl %eax,%eax je 1f pushl %ecx movl P_ADDR(%eax),%eax leal PCB_SAVEFPU(%eax),%eax pushl %eax pushl %eax call _npxsave addl $4,%esp popl %eax popl %ecx pushl $PCB_SAVEFPU_SIZE leal PCB_SAVEFPU(%ecx),%ecx pushl %ecx pushl %eax call _bcopy addl $12,%esp #endif /* NNPX > 0 */ 1: ret diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 682914cc1104..c72b9d6ad301 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1,1527 +1,1540 @@ # # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.420 1998/03/21 14:13:47 peter Exp $ +# $Id: LINT,v 1.421 1998/03/24 02:55:03 yokota Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from # this file as required. # # # This directive is mandatory; it defines the architecture to be # configured for; in this case, the 386 family based IBM-PC and # compatibles. # machine "i386" # # This is the ``identification'' of the kernel. Usually this should # be the same as the name of your kernel. # ident LINT # # The `maxusers' parameter controls the static sizing of a number of # internal system tables by a complicated formula defined in param.c. # maxusers 10 # # Certain applications can grow to be larger than the 128M limit # that FreeBSD initially imposes. Below are some options to # allow that limit to grow to 256MB, and can be increased further # with changing the parameters. MAXDSIZ is the maximum that the # limit can be set to, and the DFLDSIZ is the default value for # the limit. You might want to set the default lower than the # max, and explicitly set the maximum with a shell command for processes # that regularly exceed the limit like INND. # options "MAXDSIZ=(256*1024*1024)" options "DFLDSIZ=(256*1024*1024)" # When this is set, be extra conservative in various parts of the kernel # and choose functionality over speed (on the widest variety of systems). options FAILSAFE # This allows you to actually store this configuration file into # the kernel binary itself, where it may be later read by saying: # strings /kernel | grep ^___ | sed -e 's/^___//' > MYKERNEL # options INCLUDE_CONFIG_FILE # Include this file in kernel # # This directive defines a number of things: # - The compiled kernel is to be called `kernel' # - The root filesystem might be on partition wd0a # - Crash dumps will be written to wd0b, if possible. Specifying the # dump device here is not recommended. Use dumpon(8). # config kernel root on wd0 dumps on wd0 ##################################################################### # SMP OPTIONS: # # SMP enables building of a Symmetric MultiProcessor Kernel. # APIC_IO enables the use of the IO APIC for Symmetric I/O. # NCPU sets the number of CPUs, defaults to 2. # NBUS sets the number of busses, defaults to 4. # NAPIC sets the number of IO APICs on the motherboard, defaults to 1. # NINTR sets the total number of INTs provided by the motherboard. # # Notes: # # An SMP kernel will ONLY run on an Intel MP spec. qualified motherboard. # # Be sure to disable 'cpu "I386_CPU"' && 'cpu "I486_CPU"' for SMP kernels. # # Check the 'Rogue SMP hardware' section to see if additional options # are required by your hardware. # # Mandatory: options SMP # Symmetric MultiProcessor Kernel options APIC_IO # Symmetric (APIC) I/O # Optional, these are the defaults plus 1: options NCPU=5 # number of CPUs options NBUS=5 # number of busses options NAPIC=2 # number of IO APICs options NINTR=25 # number of INTs # # Rogue SMP hardware: # # Bridged PCI cards: # # The MP tables of most of the current generation MP motherboards # do NOT properly support bridged PCI cards. To use one of these # cards you should refer to ??? ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. This is especially true removing # I386_CPU. # cpu "I386_CPU" cpu "I486_CPU" cpu "I586_CPU" # aka Pentium(tm) cpu "I686_CPU" # aka Pentium Pro(tm) # # Options for CPU features. # # CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM # BlueLightning CPU. It works only with Cyrix FPU, and this option # should not be used with Intel FPU. # # CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning # CPU if CPU supports it. The default is double-clock mode on # BlueLightning CPU box. # # CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). # # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct # mapped mode. Default is 2-way set associative mode. # # CPU_CYRIX_NO_LOCK enables weak locking for the entire address space # of Cyrix 6x86 and 6x86MX CPUs. If this option is not set and # FAILESAFE is defined, NO_LOCK bit of CCR1 is cleared. (NOTE 3) # # CPU_DISABLE_5X86_LSSER disables load store serialize (i.e. enables # reorder). This option should not be used if you use memory mapped # I/O device(s). # # CPU_FASTER_5X86_FPU enables faster FPU exception handler. # # CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products # for i386 machines. # # CPU_IORT defines I/O clock delay time (NOTE 1). Default vaules of # I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively # (no clock delay). # # CPU_LOOP_EN prevents flushing the prefetch buffer if the destination # of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE # 1). # # CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). # # CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU # enters suspend mode following execution of HALT instruction. # # CPU_WT_ALLOC enables write-through allocation. # # CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache # flush at hold state. # # CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs # without cache flush at hold state, and (2) write-back CPU cache on # Cyrix 6x86 whose revision < 2.7 (NOTE 2). # # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is # executed. This should be included for ALL kernels that won't run # on a Pentium. # # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_ENand CPU_RSTK_EN should no be used becasue of CPU bugs. # These options may crash your system. # # NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled # in write-through mode when revision < 2.7. If revision of Cyrix # 6x86 >= 2.7, CPU cache is always enabled in write-back mode. # # NOTE 3: This option may cause failures for software that requires # locked cycles in order to operate correctly. # options "CPU_BLUELIGHTNING_FPU_OP_CACHE" options "CPU_BLUELIGHTNING_3X" options "CPU_BTB_EN" options "CPU_DIRECT_MAPPED_CACHE" options "CPU_DISABLE_5X86_LSSER" options "CPU_FASTER_5X86_FPU" options "CPU_I486_ON_386" options "CPU_IORT" options "CPU_LOOP_EN" options "CPU_RSTK_EN" options "CPU_SUSP_HLT" options "CYRIX_CACHE_WORKS" options "CYRIX_CACHE_REALLY_WORKS" #options "NO_F00F_HACK" # # A math emulator is mandatory if you wish to run on hardware which # does not have a floating-point processor. Pick either the original, # bogus (but freely-distributable) math emulator, or a much more # fully-featured but GPL-licensed emulator taken from Linux. # options MATH_EMULATE #Support for x87 emulation # Don't enable both of these in a real config. options GPL_MATH_EMULATE #Support for x87 emulation via #new math emulator ##################################################################### # COMPATIBILITY OPTIONS # # Implement system calls compatible with 4.3BSD and older versions of # FreeBSD. You probably do NOT want to remove this as much current code # still relies on the 4.3 emulation. # options "COMPAT_43" # # Allow user-mode programs to manipulate their local descriptor tables. # This option is required for the WINE Windows(tm) emulator, and is # not used by anything else (that we know of). # options USER_LDT #allow user-level control of i386 ldt # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared # memory, semaphores, and message queues, respectively. # options SYSVSHM options SYSVSEM options SYSVMSG # # This option includes a MD5 routine in the kernel, this is used for # various authentication and privacy uses. # options "MD5" # # Allow processes to switch to vm86 mode, as well as enabling direct # user-mode access to the I/O port space. This option is necessary for # the doscmd emulator to run. # options "VM86" ##################################################################### # DEBUGGING OPTIONS # # Enable the kernel debugger. # options DDB # # Don't drop into DDB for a panic. Intended for unattended operation # where you may want to drop to DDB from the console, but still want # the machine to recover from a panic # options DDB_UNATTENDED # # If using GDB remote mode to debug the kernel, there's a non-standard # extension to the remote protocol that can be used to use the serial # port as both the debugging port and the system console. It's non- # standard and you're on your own if you enable it. See also the # "remotechat" variables in the FreeBSD specific version of gdb. # options GDB_REMOTE_CHAT # # KTRACE enables the system-call tracing facility ktrace(2). # options KTRACE #kernel tracing # # The DIAGNOSTIC option is used in a number of source files to enable # extra sanity checking of internal structures. This support is not # enabled by default because of the extra time it would take to check # for these conditions, which can only occur as a result of # programming errors. # options DIAGNOSTIC # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # options PERFMON # # This option let some drivers co-exist that can't co-exist in a running # system. This is used to be able to compile all kernel code in one go for # quality assurance purposes (like this file, which the option takes it name # from.) # options COMPILING_LINT # XXX - this doesn't belong here. # Allow ordinary users to take the console - this is useful for X. options UCONSOLE # XXX - this doesn't belong here either options USERCONFIG #boot -c editor options USERCONFIG_BOOT #imply -c and parse info area options VISUAL_USERCONFIG #visual boot -c editor ##################################################################### # NETWORKING OPTIONS # # Protocol families: # Only the INET (Internet) family is officially supported in FreeBSD. # Source code for the NS (Xerox Network Service) is provided for amusement # value. # options INET #Internet communications protocols options IPX #IPX/SPX communications protocols options IPXIP #IPX in IP encapsulation (not available) options IPTUNNEL #IP in IPX encapsulation (not available) options NETATALK #Appletalk communications protocols # These are currently broken but are shipped due to interest. #options NS #Xerox NS protocols # These are currently broken and are no longer shipped due to lack # of interest. #options CCITT #X.25 network layer #options ISO #options TPIP #ISO TP class 4 over IP #options TPCONS #ISO TP class 0 over X.25 #options LLC #X.25 link layer for Ethernets #options HDLC #X.25 link layer for serial lines #options EON #ISO CLNP over IP #options NSIP #XNS over IP # # Network interfaces: # The `loop' pseudo-device is MANDATORY when networking is enabled. # The `ether' pseudo-device provides generic code to handle # Ethernets; it is MANDATORY when a Ethernet device driver is # configured. # The 'fddi' pseudo-device provides generic code to support FDDI. # The `sppp' pseudo-device serves a similar role for certain types # of synchronous PPP links (like `cx', `ar'). # The `sl' pseudo-device implements the Serial Line IP (SLIP) service. # The `ppp' pseudo-device implements the Point-to-Point Protocol. # The `bpfilter' pseudo-device enables the Berkeley Packet Filter. Be # aware of the legal and administrative consequences of enabling this # option. The number of devices determines the maximum number of # simultaneous BPF clients programs runnable. # The `disc' pseudo-device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing purposes. # The `tun' pseudo-device implements the User Process PPP (iijppp) # # The PPP_BSDCOMP option enables support for compress(1) style entire # packet compression, the PPP_DEFLATE is for zlib/gzip style compression. # PPP_FILTER enables code for filtering the ppp data stream and selecting # events for resetting the demand dial activity timer - requires bpfilter. # See pppd(8) for more details. # pseudo-device ether #Generic Ethernet pseudo-device fddi #Generic FDDI pseudo-device sppp #Generic Synchronous PPP pseudo-device loop #Network loopback device pseudo-device bpfilter 4 #Berkeley packet filter pseudo-device disc #Discard device pseudo-device tun 1 #Tunnel driver (user process ppp(8)) pseudo-device sl 2 #Serial Line IP pseudo-device ppp 2 #Point-to-point protocol options PPP_BSDCOMP #PPP BSD-compress support options PPP_DEFLATE #PPP zlib/deflate/gzip support options PPP_FILTER #enable bpf filtering (needs bpfilter) # # Internet family options: # # TCP_COMPAT_42 causes the TCP code to emulate certain bugs present in # 4.2BSD. This option should not be used unless you have a 4.2BSD # machine and TCP connections fail. # # MROUTING enables the kernel multicast packet forwarder, which works # with mrouted(8). # # IPFIREWALL enables support for IP firewall construction, in # conjunction with the `ipfw' program. IPFIREWALL_VERBOSE sends # logged packets to the system logger. IPFIREWALL_VERBOSE_LIMIT # limits the number of times a matching entry can be logged. # # WARNING: IPFIREWALL defaults to a policy of "deny ip from any to any" # and if you do not add other rules during startup to allow access, # YOU WILL LOCK YOURSELF OUT. It is suggested that you set firewall=open # in /etc/rc.conf when first enabling this feature, then refining the # firewall rules in /etc/rc.firewall after you've tested that the new kernel # feature works properly. # # IPFIREWALL_DEFAULT_TO_ACCEPT causes the default rule (at boot) to # allow everything. Use with care, if a cracker can crash your # firewall machine, they can get to your protected machines. However, # if you are using it as an as-needed filter for specific problems as # they arise, then this may be for you. Changing the default to 'allow' # means that you won't get stuck if the kernel and /sbin/ipfw binary get # out of sync. # # IPDIVERT enables the divert IP sockets, used by ``ipfw divert'' # # IPFILTER enables Darren Reed's ipfilter package. # IPFILTER_LOG enables ipfilter's logging. # IPFILTER_LKM enables LKM support for an ipfilter module (untested). # # TCPDEBUG is undocumented. # options "TCP_COMPAT_42" #emulate 4.2BSD TCP bugs options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #print information about # dropped packets options "IPFIREWALL_VERBOSE_LIMIT=100" #limit verbosity options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default options IPDIVERT #divert sockets options IPFILTER #kernel ipfilter support options IPFILTER_LOG #ipfilter logging #options IPFILTER_LKM #kernel support for ip_fil.o LKM options TCPDEBUG ##################################################################### # FILESYSTEM OPTIONS # # Only the root, /usr, and /tmp filesystems need be statically # compiled; everything else will be automatically loaded at mount # time. (Exception: the UFS family---FFS, and MFS --- cannot # currently be demand-loaded.) Some people still prefer to statically # compile other filesystems as well. # # NB: The NULL, PORTAL, UMAP and UNION filesystems are known to be # buggy, and WILL panic your system if you attempt to do anything with # them. They are included here as an incentive for some enterprising # soul to sit down and fix them. # # One of these is mandatory: options FFS #Fast filesystem options NFS #Network File System # The rest are optional: # options NFS_NOSERVER #Disable the NFS-server code. options "CD9660" #ISO 9660 filesystem options FDESC #File descriptor filesystem options KERNFS #Kernel filesystem options MFS #Memory File System options MSDOSFS #MS DOS File System options NULLFS #NULL filesystem options PORTAL #Portal filesystem options PROCFS #Process filesystem options UMAPFS #UID map filesystem options UNION #Union filesystem options "CD9660_ROOT" #CD-ROM usable as root device options FFS_ROOT #FFS usable as root device options NFS_ROOT #NFS usable as root device # This DEVFS is experimental but seems to work options DEVFS #devices filesystem # Allow the FFS to use Softupdates technology. # To do this you need to fetch the two files # /sys/ufs/ffs/softdep.h and /sys/ufs/ffs/ffs_softdep.c # from freebsd.org and understand the licensing restrictions. #options SOFTUPDATES # (we can't actually enable it because the files may not be present) # Make space in the kernel for a MFS root filesystem. Define to the number # of kilobytes to reserve for the filesystem. options MFS_ROOT=10 # Allow the MFS_ROOT code to load the MFS image from floppy if it is missing. options MFS_AUTOLOAD # Allow this many swap-devices. options NSWAPDEV=20 # Disk quotas are supported when this option is enabled. If you # change the value of this option, you must do a `make clean' in your # kernel compile directory in order to get a working kernel. # options QUOTA #enable disk quotas # Add more checking code to various filesystems #options NULLFS_DIAGNOSTIC #options KERNFS_DIAGNOSTIC #options UMAPFS_DIAGNOSTIC #options UNION_DIAGNOSTIC # In particular multi-session CD-Rs might require a huge amount of # time in order to "settle". If we are about mounting them as the # root f/s, we gotta wait a little. # # The number is supposed to be in seconds. options "CD9660_ROOTDELAY=20" # If you are running a machine just as a fileserver for PC and MAC users. # (using SAMBA or Netatalk), then you may consider setting this option # and keeping all those user's directories on a partition that is mounted # with the suiddir option. This gives new files the same ownership as # the directory (similiar to group). It's a security hole if you let # these users run programs so confine it to file-servers, (but it'll save you # lots of headaches in that case). Root owned directories are excempt and X bits # are cleared. the suid bit must be set on the directory as well. see chmod(1) # PC owners can't see/set ownerships so they keep getting their toes # trodden on. This saves you all the support calls as the filesystem # it's used on will act as they expect. ("It's my dir so it must be my file"). # options SUIDDIR # Add some error checking code to the null_bypass routine # in the NULL filesystem #options SAFETY ##################################################################### # SCSI DEVICES # SCSI DEVICE CONFIGURATION # The SCSI subsystem consists of the `base' SCSI code, a number of # high-level SCSI device `type' drivers, and the low-level host-adapter # device drivers. The host adapters are listed in the ISA and PCI # device configuration sections below. # # Beginning with FreeBSD 2.0.5 you can wire down your SCSI devices so # that a given bus, target, and LUN always come on line as the same # device unit. In earlier versions the unit numbers were assigned # in the order that the devices were probed on the SCSI bus. This # means that if you removed a disk drive, you may have had to rewrite # your /etc/fstab file, and also that you had to be careful when adding # a new disk as it may have been probed earlier and moved your device # configuration around. # This old behavior is maintained as the default behavior. The unit # assignment begins with the first non-wired down unit for a device # type. For example, if you wire a disk as "sd3" then the first # non-wired disk will be assigned sd4. # The syntax for wiring down devices is: # controller scbus0 at ahc0 # Single bus device # controller scbus1 at ahc1 bus 0 # Single bus device # controller scbus3 at ahc2 bus 0 # Twin bus device # controller scbus2 at ahc2 bus 1 # Twin bus device # disk sd0 at scbus0 target 0 unit 0 # disk sd1 at scbus3 target 1 # disk sd2 at scbus2 target 3 # tape st1 at scbus1 target 6 # device cd0 at scbus? # "units" (SCSI logical unit number) that are not specified are # treated as if specified as LUN 0. # All SCSI devices allocate as many units as are required. # The "unknown" device (uk? in pre-2.0.5) is now part of the base SCSI # configuration and doesn't have to be explicitly configured. controller scbus0 #base SCSI code device ch0 #SCSI media changers device sd0 #SCSI disks device st0 #SCSI tapes device cd0 #SCSI CD-ROMs device od0 #SCSI optical disk # The previous devices (ch, sd, st, cd) are recognized by config. # config doesn't (and shouldn't) know about these newer ones, # so we have to specify that they are on a SCSI bus with the "at scbus?" # clause. device worm0 at scbus? # SCSI worm device pt0 at scbus? # SCSI processor type device sctarg0 at scbus? # SCSI target # SCSI OPTIONS: # SCSIDEBUG: When defined enables debugging macros # NO_SCSI_SENSE: When defined disables sense descriptions (about 4k) # SCSI_REPORT_GEOMETRY: Always report disk geometry at boot up instead # of only when booting verbosely. options SCSIDEBUG #options NO_SCSI_SENSE options SCSI_REPORT_GEOMETRY # Options for the `od' optical disk driver: # # If drive returns sense key as 0x02 with vendor specific additional # sense code (ASC) and additional sense code qualifier (ASCQ), or # illegal ASC and ASCQ. This cause an error (NOT READY) and retrying. # To suppress this, use the following option. # options OD_BOGUS_NOT_READY # # For an automatic spindown, try this. Again, preferably as an # option in your config file. # WARNING! Use at your own risk. Joerg's ancient SONY SMO drive # groks it fine, while Shunsuke's Fujitsu chokes on it and times # out. # options OD_AUTO_TURNOFF + +##################################################################### +# POSIX P1003.1B + +# Real time extensions added int the 1993 Posix +# P1003_1B: Infrastructure +# _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING +# _KPOSIX_VERSION: Version kernel is built for + +options "P1003_1B" +options "_KPOSIX_PRIORITY_SCHEDULING" +options "_KPOSIX_VERSION=199309L" + ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS # The `pty' device usually turns out to be ``effectively mandatory'', # as it is required for `telnetd', `rlogind', `screen', `emacs', and # `xterm', among others. pseudo-device pty 16 #Pseudo ttys - can go as high as 256 pseudo-device speaker #Play IBM BASIC-style noises out your speaker pseudo-device gzip #Exec gzipped a.out's pseudo-device vn #Vnode driver (turns a file into a device) pseudo-device snp 3 #Snoop device - to look at pty/vty/etc.. pseudo-device ccd 4 #Concatenated disk driver # These are only for watching for bitrot in old tty code. # broken #pseudo-device tb # These are only for watching for bitrot in old SCSI code. pseudo-device su #scsi user pseudo-device ssc #super scsi ##################################################################### # HARDWARE DEVICE CONFIGURATION # ISA and EISA devices: # EISA support is available for some device, so they can be auto-probed. # Micro Channel is not supported at all. # # Mandatory ISA devices: isa, npx # controller isa0 # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # Automatic EOI is documented not to work for for the slave with the # original i8259A, but it works for some clones and some integrated # versions. # # BOUNCE_BUFFERS provides support for ISA DMA on machines with more # than 16 megabytes of memory. It doesn't hurt on other machines. # Some broken EISA and VLB hardware may need this, too. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # TUNE_1542 enables the automatic ISA bus speed selection for the # Adaptec 1542 boards. Does not work for all boards, use it with caution. # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. # # PAS_JOYSTICK_ENABLE enables the gameport on the ProAudio Spectrum options "AUTO_EOI_1" #options "AUTO_EOI_2" options BOUNCE_BUFFERS options "MAXMEM=(128*1024)" options "TUNE_1542" #options BROKEN_KEYBOARD_RESET #options PAS_JOYSTICK_ENABLE # Enable support for the kernel PLL to use an external PPS signal, # under supervision of [x]ntpd(8) # More info in ftp://ftp.udel.edu/pub/ntp/kernel.tar.Z options PPS_SYNC # Enable PnP support in the kernel. This allows you to automaticly # attach to PnP cards for drivers that support it and allows you to # configure cards from USERCONFIG. See pnp(4) for more info. controller pnp0 # The pcvt console driver (vt220 compatible). device vt0 at isa? port "IO_KBD" tty irq 1 vector pcrint options XSERVER # support for running an X server. options FAT_CURSOR # start with block cursor # This PCVT option is for keyboards such as those used on IBM ThinkPad laptops options PCVT_SCANSET=2 # IBM keyboards are non-std # The syscons console driver (sco color console compatible). device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr options MAXCONS=16 # number of virtual consoles options SLOW_VGA # do byte-wide i/o's to TS and GDC regs options "STD8X16FONT" # Compile font in makeoptions "STD8X16FONT"="cp850" options SC_HISTORY_SIZE=200 # number of history buffer lines options SC_DISABLE_REBOOT # disable reboot key sequence # # `flags' for sc0: # 0x01 Use a 'visual' bell # 0x02 Use a 'blink' cursor # 0x04 Use a 'underline' cursor # 0x06 Use a 'blinking underline' (destructive) cursor # 0x08 Force detection of keyboard, else we always assume a keyboard # 0x10 Old-style (XT) keyboard support, useful for older ThinkPads # 0x20 Don't reset keyboard, useful for some newer ThinkPads # # The Numeric Processing eXtension driver. This should be configured if # your machine has a math co-processor, unless the coprocessor is very # buggy. If it is not configured then you *must* configure math emulation # (see above). If both npx0 and emulation are configured, then only npx0 # is used (provided it works). device npx0 at isa? port "IO_NPX" iosiz 0x0 flags 0x0 irq 13 vector npxintr # # `flags' for npx0: # 0x01 don't use the npx registers to optimize bcopy # 0x02 don't use the npx registers to optimize bzero # 0x04 don't use the npx registers to optimize copyin or copyout. # The npx registers are normally used to optimize copying and zeroing when # all of the following conditions are satisfied: # "I586_CPU" is an option # the cpu is an i586 (perhaps not a Pentium) # the probe for npx0 succeeds # INT 16 exception handling works. # Then copying and zeroing using the npx registers is normally 30-100% faster. # The flags can be used to control cases where it doesn't work or is slower. # Setting them at boot time using userconfig works right (the optimizations # are not used until later in the bootstrap when npx0 is attached). # # # `iosiz' for npx0: # This can be used instead of the MAXMEM option to set the memory size. If # it is nonzero, then it overrides both the MAXMEM option and the memory # size reported by the BIOS. Setting it at boot time using userconfig takes # effect on the next reboot after the change has been recorded in the kernel # binary (the size is used early in the boot before userconfig has a chance # to change it). # # # Optional ISA and EISA devices: # # # SCSI host adapters: `aha', `aic', `bt', `nca' # # aha: Adaptec 154x # ahc: Adaptec 274x/284x/294x # aic: Adaptec 152x and sound cards using the Adaptec AIC-6360 (slow!) # bt: Most Buslogic controllers # nca: ProAudioSpectrum cards using the NCR 5380 or Trantor T130 # uha: UltraStore 14F and 34F # sea: Seagate ST01/02 8 bit controller (slow!) # wds: Western Digital WD7000 controller (no scatter/gather!). # # Note that the order is important in order for Buslogic cards to be # probed correctly. # controller bt0 at isa? port "IO_BT0" bio irq ? vector bt_isa_intr controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr controller aic0 at isa? port 0x340 bio irq 11 vector aicintr controller nca0 at isa? port 0x1f88 bio irq 10 vector ncaintr controller nca1 at isa? port 0x1f84 controller nca2 at isa? port 0x1f8c controller nca3 at isa? port 0x1e88 controller nca4 at isa? port 0x350 bio irq 5 vector ncaintr controller sea0 at isa? bio irq 5 iomem 0xdc000 iosiz 0x2000 vector seaintr controller wds0 at isa? port 0x350 bio irq 15 drq 6 vector wdsintr # # ST-506, ESDI, and IDE hard disks: `wdc' and `wd' # # The flags fields are used to enable the multi-sector I/O and # the 32BIT I/O modes. The flags may be used in either the controller # definition or in the individual disk definitions. The controller # definition is supported for the boot configuration stuff. # # Each drive has a 16 bit flags value defined: # The low 8 bits are the maximum value for the multi-sector I/O, # where 0xff defaults to the maximum that the drive can handle. # The high bit of the 16 bit flags (0x8000) allows probing for # 32 bit transfers. Bit 14 (0x4000) enables a hack to wake # up powered-down laptop drives. Bit 13 (0x2000) allows # probing for PCI IDE DMA controllers, such as Intel's PIIX # south bridges. See the wd.4 man page. # # The flags field for the drives can be specified in the controller # specification with the low 16 bits for drive 0, and the high 16 bits # for drive 1. # e.g.: #controller wdc0 at isa? port "IO_WD1" bio irq 14 flags 0x00ff8004 vector wdintr # # specifies that drive 0 will be allowed to probe for 32 bit transfers and # a maximum multi-sector transfer of 4 sectors, and drive 1 will not be # allowed to probe for 32 bit transfers, but will allow multi-sector # transfers up to the maximum that the drive supports. # # If you are using a PCI controller that is not running in compatibility # mode (for example, it is a 2nd IDE PCI interface), then use config line(s) # such as: # #controller wdc2 at isa? port "0" bio irq ? flags 0xa0ffa0ff vector wdintr #disk wd4 at wdc2 drive 0 #disk wd5 at wdc2 drive 1 # #controller wdc3 at isa? port "0" bio irq ? flags 0xa0ffa0ff vector wdintr #disk wd6 at wdc3 drive 0 #disk wd7 at wdc3 drive 1 # # Note that the above config would be useful for a Promise card, when used # on a MB that already has a PIIX controller. Note the bogus irq and port # entries. These are automatically filled in by the IDE/PCI support. # controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr disk wd0 at wdc0 drive 0 disk wd1 at wdc0 drive 1 controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr disk wd2 at wdc1 drive 0 disk wd3 at wdc1 drive 1 # # Options for `wdc': # # CMD640 enables serializing access to primary and secondary channel # of the CMD640B IDE Chip. The serializing will only take place # if this option is set *and* the chip is probed by the pci-system. # options "CMD640" #Enable work around for CMD640 h/w bug # # ATAPI enables the support for ATAPI-compatible IDE devices # options ATAPI #Enable ATAPI support for IDE bus options ATAPI_STATIC #Don't do it as an LKM # IDE CD-ROM driver - requires wdc controller and ATAPI option device wcd0 # IDE floppy driver - requires wdc controller and ATAPI option device wfd0 # # Standard floppy disk controllers and floppy tapes: `fdc', `fd', and `ft' # controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr # # FDC_DEBUG enables floppy debugging. Since the debug output is huge, you # gotta turn it actually on by setting the variable fd_debug with DDB, # however. options FDC_DEBUG # This option is undocumented on purpose. options FDC_PRINT_BOGUS_CHIPTYPE # # Activate this line instead of the fdc0 line above if you happen to # have an Insight floppy tape. Probing them proved to be dangerous # for people with floppy disks only, so it's "hidden" behind a flag: #controller fdc0 at isa? port "IO_FD1" bio flags 1 irq 6 drq 2 vector fdintr disk fd0 at fdc0 drive 0 disk fd1 at fdc0 drive 1 tape ft0 at fdc0 drive 2 # # Other standard PC hardware: `lpt', `mse', `psm', `sio', etc. # # lpt: printer port # lpt specials: # port can be specified as ?, this will cause the driver to scan # the BIOS port list; # the irq and vector clauses may be omitted, this # will force the port into polling mode. # mse: Logitech and ATI InPort bus mouse ports # psm: PS/2 mouse port [note: conflicts with sc0/vt0, thus "conflicts" keywd] # sio: serial ports (see sio(4)) device lpt0 at isa? port? tty irq 7 vector lptintr device lpt1 at isa? port "IO_LPT3" tty irq 5 vector lptintr device mse0 at isa? port 0x23c tty irq 5 vector mseintr device psm0 at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr # Options for psm: options PSM_HOOKAPM #hook the APM resume event, useful #for some laptops options PSM_RESETAFTERSUSPEND #reset the device at the resume event device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 vector siointr # # `flags' for serial drivers that support consoles (only for sio now): # 0x10 enable console support for this unit. The other console flags # are ignored unless this is set. Enabling console support does # not make the unit the preferred console - boot with -h or set # the 0x20 flag for that. Currently, at most one unit can have # console support; the first one (in config file order) with # this flag set is preferred. Setting this flag for sio0 gives # the old behaviour. # 0x20 force this unit to be the console (unless there is another # higher priority console). This replaces the COMCONSOLE option. # 0x40 reserve this unit for low level console operations. Do not # # PnP `flags' (set via userconfig using pnp x flags y) # 0x1 disable probing of this device. Used to prevent your modem # from being attached as a PnP modem. # # Options for serial drivers that support consoles (only for sio now): options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to #DDB, if available. options CONSPEED=9600 #default speed for serial console (default 9600) # Options for sio: options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs options DSI_SOFT_MODEM #code for DSI Softmodems options "EXTRA_SIO=2" #number of extra sio ports to allocate # Other flags for sio that aren't documented in the man page. # 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for # ST16650A-compatible UARTs. # # Network interfaces: `cx', `ed', `el', `ep', `ie', `is', `le', `lnc' # # ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver (requires sppp) # cx: Cronyx/Sigma multiport sync/async (with Cisco or PPP framing) # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # el: 3Com 3C501 (slow!) # ep: 3Com 3C509 (buggy) # fe: Fujitsu MB86960A/MB86965A Ethernet # ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; Intel EtherExpress # le: Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100, # DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422) # lnc: Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL) # sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp) # wl: Lucent Wavelan (ISA card only). # ze: IBM/National Semiconductor PCMCIA ethernet controller. # zp: 3Com PCMCIA Etherlink III (It does not require shared memory for # send/receive operation, but it needs 'iomem' to read/write the # attribute memory) # device ar0 at isa? port 0x300 net irq 10 iomem 0xd0000 vector arintr device cx0 at isa? port 0x240 net irq 15 drq 7 vector cxintr device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr device eg0 at isa? port 0x310 net irq 5 vector egintr device el0 at isa? port 0x300 net irq 9 vector elintr device ep0 at isa? port 0x300 net irq 10 vector epintr device ex0 at isa? port? net irq? vector exintr device fe0 at isa? port 0x300 net irq ? vector feintr device ie0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector ieintr device ie1 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr device lnc0 at isa? port 0x300 net irq 10 drq 0 vector lncintr device sr0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector srintr options WLCACHE # enables the signal-strength cache options WLDEBUG # enables verbose debugging output device wl0 at isa? port 0x300 net irq ? vector wlintr # We can (bogusly) include both the dedicated PCCARD drivers and the generic # support when COMPILING_LINT. device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000 vector zpintr # # ATM related options # # The `en' device provides support for Efficient Networks (ENI) # ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). # # atm pseudo-device provides generic atm functions and is required for # atm devices. # NATM enables the netnatm protocol family that can be used to # bypass TCP/IP. # # the current driver supports only PVC operations (no atm-arp, no multicast). # for more details, please read the original documents at # http://www.ccrc.wustl.edu/pub/chuck/bsdatm/wucs.html # pseudo-device atm device en0 device en1 options NATM #native ATM # # Audio drivers: `snd', `sb', `pas', `gus', `pca' # # snd: Voxware sound support code # sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum # sbxvi: SoundBlaster 16 # sbmidi: SoundBlaster 16 MIDI interface # pas: ProAudioSpectrum PCM and MIDI # gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX # gusxvi: Gravis Ultrasound 16-bit PCM (do not use) # mss: Microsoft Sound System # css: Crystal Sound System (CSS 423x PnP) # sscape: Ensoniq Soundscape MIDI interface # sscape_mss: Ensoniq Soundscape PCM (requires sscape) # opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum # uart: stand-alone 6850 UART for MIDI # mpu: Roland MPU-401 stand-alone card # # Beware! The addresses specified below are also hard-coded in # i386/isa/sound/sound_config.h. If you change the values here, you # must also change the values in the include file. # # pcm: PCM audio through various sound cards. # # This is the work in progress from Luigi Rizzo. This has support for # CS423x based cards, OPTi931, SB16 PnP, GusPnP. For more information # about this driver, take a look at sys/i386/isa/snd/README. # # The flags of the device tells the device a bit more info about the # device that normally is obtained through the PnP interface. # bit 2..0 secondary DMA channel; # bit 4 set if the board uses two dma channels; # bit 15..8 board type, overrides autodetection; leave it # zero if don't know what to put in (and you don't, # since this is unsupported at the moment...). # # This driver will use the new PnP code if it's available. # # pca: PCM audio through your PC speaker # # If you have a GUS-MAX card and want to use the CS4231 codec on the # card the drqs for the gus max must be 8 bit (1, 2, or 3). # # If you would like to use the full duplex option on the gus, then define # flags to be the ``read dma channel''. # # options BROKEN_BUS_CLOCK #PAS-16 isn't working and OPTI chipset # options SYMPHONY_PAS #PAS-16 isn't working and SYMPHONY chipset # options EXCLUDE_SBPRO #PAS-16 # options SBC_IRQ=5 #PAS-16. Must match irq on sb0 line. # PAS16: The order of the pas0/sb0/opl0 is important since the # sb emulation is enabled in the pas-16 attach. # # The i386/isa/sound/sound.doc has more information. # Controls all "VOXWARE" driver sound devices. See Luigi's driver # below for an alternate which may work better for some cards. # controller snd0 device pas0 at isa? port 0x388 irq 10 drq 6 vector pasintr device sb0 at isa? port 0x220 irq 5 drq 1 vector sbintr device sbxvi0 at isa? drq 5 device sbmidi0 at isa? port 0x330 device awe0 at isa? port 0x620 device gus0 at isa? port 0x220 irq 12 drq 1 vector gusintr #device gus0 at isa? port 0x220 irq 12 drq 1 flags 0x3 vector gusintr device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr device css0 at isa? port 0x534 irq 5 drq 1 flags 0x08 vector adintr device sscape0 at isa? port 0x330 irq 9 drq 0 vector sscapeintr device trix0 at isa? port 0x330 irq 6 drq 0 vector sscapeintr device sscape_mss0 at isa? port 0x534 irq 5 drq 1 vector sndintr device opl0 at isa? port 0x388 device mpu0 at isa? port 0x330 irq 6 drq 0 device uart0 at isa? port 0x330 irq 5 vector "m6850intr" # Luigi's snd code (use INSTEAD of snd0 and all VOXWARE drivers!). # You may also wish to enable the pnp controller with this, for pnp # sound cards. # #device pcm0 at isa? port ? tty irq 10 drq 1 flags 0x0 vector pcmintr # Not controlled by `snd' device pca0 at isa? port IO_TIMER1 tty # # Miscellaneous hardware: # # mcd: Mitsumi CD-ROM # scd: Sony CD-ROM # matcd: Matsushita/Panasonic CD-ROM # wt: Wangtek and Archive QIC-02/QIC-36 tape drives # ctx: Cortex-I frame grabber # apm: Laptop Advanced Power Management (experimental) # spigot: The Creative Labs Video Spigot video-acquisition board # meteor: Matrox Meteor video capture board # alog: Industrial Computer Source AIO8-P driver # bktr: Bt848 capture boards (http://www.freebsd.org/~fsmp/HomeAuto/Bt848.html) # cy: Cyclades serial driver # dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!) # gp: National Instruments AT-GPIB and AT-GPIB/TNT board # asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey # gsc: Genius GS-4500 hand scanner. # joy: joystick # labpc: National Instrument's Lab-PC and Lab-PC+ # rc: RISCom/8 multiport card # rp: Comtrol Rocketport(ISA) - single card # tw: TW-523 power line interface for use with X-10 home control products # si: Specialix SI/XIO 4-32 port terminal multiplexor # stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based) # stli: Stallion EasyConnection 8/64, ONboard, Brumby (intelligent) # # Notes on APM # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. # 0x0011 Limit APM protocol to 1.1 or 1.0 # 0x0010 Limit APM protocol to 1.0 # # # Notes on the spigot: # The video spigot is at 0xad6. This port address can not be changed. # The irq values may only be 10, 11, or 15 # I/O memory is an 8kb region. Possible values are: # 0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff # The start address must be on an even boundary. # Add the following option if you want to allow non-root users to be able # to access the spigot. This option is not secure because it allows users # direct access to the I/O page. # options SPIGOT_UNSECURE # # Notes on the Comtrol Rocketport driver: # # The exact values used for rp0 depend on how many boards you have # in the system. The manufacturer's sample configs are listed as: # # Comtrol Rocketport ISA single card # device rp0 at isa? port 0x280 tty # # If instead you have two ISA cards, one installed at 0x100 and the # second installed at 0x180, then you should add the following to # your kernel configuration file: # # device rp0 at isa? port 0x100 tty # device rp1 at isa? port 0x180 tty # # For 4 ISA cards, it might be something like this: # # device rp0 at isa? port 0x180 tty # device rp1 at isa? port 0x100 tty # device rp2 at isa? port 0x340 tty # device rp3 at isa? port 0x240 tty # # And for PCI cards, you only need say: # # device rp0 # device rp1 # ... # Note: Make sure that any Rocketport PCI devices are specified BEFORE the # ISA Rocketport devices. # Notes on the Digiboard driver: # # The following flag values have special meanings: # 0x01 - alternate layout of pins # 0x02 - use the windowed PC/Xe in 64K mode # Notes on the Specialix SI/XIO driver: # **This is NOT a Specialix supported Driver!** # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. # Notes on the Stallion stl and stli drivers: # See src/i386/isa/README.stl for complete instructions. # This is version 0.0.5alpha, unsupported by Stallion. # The stl driver has a secondary IO port hard coded at 0x280. You need # to change src/i386/isa/stallion.c if you reconfigure this on the boards. # The "flags" and "iosiz" settings on the stli driver depend on the board: # EasyConnection 8/64 ISA: flags 23 iosiz 0x1000 # EasyConnection 8/64 EISA: flags 24 iosiz 0x10000 # EasyConnection 8/64 MCA: flags 25 iosiz 0x1000 # ONboard ISA: flags 4 iosiz 0x10000 # ONboard EISA: flags 7 iosiz 0x10000 # ONboard MCA: flags 3 iosiz 0x10000 # Brumby: flags 2 iosiz 0x4000 # Stallion: flags 1 iosiz 0x10000 device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr # for the Sony CDU31/33A CDROM device scd0 at isa? port 0x230 bio # for the SoundBlaster 16 multicd - up to 4 devices controller matcd0 at isa? port 0x230 bio device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr device ctx0 at isa? port 0x230 iomem 0xd0000 device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr device apm0 at isa? device gp0 at isa? port 0x2c0 tty device gsc0 at isa? port "IO_GSC1" tty drq 3 device joy0 at isa? port "IO_GAME" device alog0 at isa? port 0x260 tty irq 5 vector alogintr device cy0 at isa? tty irq 10 iomem 0xd4000 iosiz 0x2000 vector cyintr device dgb0 at isa? port 0x220 iomem 0xfc0000 iosiz ? tty device labpc0 at isa? port 0x260 tty irq 5 vector labpcintr device rc0 at isa? port 0x220 tty irq 12 vector rcintr device rp0 at isa? port 0x280 tty # the port and irq for tw0 are fictitious device tw0 at isa? port 0x380 tty irq 11 vector twintr device si0 at isa? iomem 0xd0000 tty irq 12 device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr device bqu0 at isa? port 0x150 device stl0 at isa? port 0x2a0 tty irq 10 vector stlintr device stli0 at isa? port 0x2a0 tty iomem 0xcc000 flags 23 iosiz 0x1000 device loran0 at isa? port ? tty irq 5 vector loranintr # # EISA devices: # # The EISA bus device is eisa0. It provides auto-detection and # configuration support for all devices on the EISA bus. # # The `ahb' device provides support for the Adaptec 174X adapter. # # The `ahc' device provides support for the Adaptec 274X and 284X # adapters. The 284X, although a VLB card responds to EISA probes. # # fea: DEC DEFEA EISA FDDI adapter # controller eisa0 controller ahb0 controller ahc0 device fea0 # enable tagged command queuing, which is a major performance win on # devices that support it (and controllers with enough SCB's) options AHC_TAGENABLE # enable SCB paging - See the ahc.4 man page options AHC_SCBPAGING_ENABLE # The aic7xxx driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. Unfortunately, # this doesn't work on some motherboards, which prevents it from being the # default. options AHC_ALLOW_MEMIO # By default, only 10 EISA slots are probed, since the slot numbers # above clash with the configuration address space of the PCI subsystem, # and the EISA probe is not very smart about this. This is sufficient # for most machines, but in particular the HP NetServer LC series comes # with an onboard AIC7770 dual-channel SCSI controller on EISA slot #11, # thus you need to bump this figure to 12 for them. options "EISA_SLOTS=12" # # PCI devices: # # The main PCI bus device is `pci'. It provides auto-detection and # configuration support for all devices on the PCI bus, using either # configuration mode defined in the PCI specification. # # The `ahc' device provides support for the Adaptec 29/3940(U)(W) # and motherboard based AIC7870/AIC7880 adapters. # # The `ncr' device provides support for the NCR 53C810 and 53C825 # self-contained SCSI host adapters. # # The `amd' device provides support for the Tekram DC-390 and 390T # SCSI host adapters, but is expected to work with any AMD 53c974 # PCI SCSI chip and the AMD Ethernet+SCSI Combo chip, after some # local patches were applied to the sources (that had originally # been written by Tekram and limited to work with their SCSI cards). # # The `de' device provides support for the Digital Equipment DC21040 # self-contained Ethernet adapter. # # The `fxp' device provides support for the Intel EtherExpress Pro/100B # PCI Fast Ethernet adapters. # # The `tx' device provides support for the SMC 9432TX cards. # # The `vx' device provides support for the 3Com 3C590 and 3C595 # early support # # The `fpa' device provides support for the Digital DEFPA PCI FDDI # adapter. pseudo-device fddi is also needed. # # The `meteor' device is a PCI video capture board. It can also have the # following options: # options METEOR_ALLOC_PAGES=xxx preallocate kernel pages for data entry # figure (ROWS*COLUMN*BYTES_PER_PIXEL*FRAME+PAGE_SIZE-1)/PAGE_SIZE # options METEOR_DEALLOC_PAGES remove all allocated pages on close(2) # options METEOR_DEALLOC_ABOVE=xxx remove all allocated pages above the # specified amount. If this value is below the allocated amount no action # taken # option METEOR_SYSTEM_DEFAULT={METEOR_PAL|METEOR_NTSC|METEOR_SECAM}, used # for initialization of fps routine when a signal is not present. # # The 'bktr' device is a PCI video capture board. It also has a TV tuner # on board. # controller pci0 controller ahc1 controller ncr0 controller amd0 device de0 device fxp0 device tx0 device vx0 device fpa0 device meteor0 device bktr0 # # PCCARD/PCMCIA # # card: slot controller # pcic: slots controller card0 controller pcic0 at card? controller pcic1 at card? # # Laptop/Notebook options: # # See also: # apm under `Miscellaneous hardware' # above. # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: options POWERFAIL_NMI # make it beep instead of panicing # # Parallel-Port Bus # # Parallel port bus support is provided by the `ppbus' device. # Multiple devices may be attached to the parallel port, devices # are automatically probed and attached when found. # # Supported devices: # vpo Iomega Zip Drive # Requires SCSI disk support ('scbus' and 'sd'), best # performance is achieved with ports in EPP 1.9 mode. # nlpt Parallel Printer # ppi General-purpose I/O ("Geek Port") # # Supported interfaces: # ppc ISA-bus parallel port interfaces. # controller ppbus0 controller vpo0 at ppbus? device nlpt0 at ppbus? device ppi0 at ppbus? device pps0 at ppbus? controller ppc0 at isa? disable port ? irq 7 vector ppcintr # Kernel BOOTP support options BOOTP # Use BOOTP to obtain IP address/hostname options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options "BOOTP_NFSV3" # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options "BOOTP_WIRED_TO=fxp0" # Use interface fxp0 for BOOTP # # An obsolete option to test kern_opt.c. # options GATEWAY # If you want to disable loadable kernel modules (LKM), you # might want to use this option. #options NO_LKM # # Add tie-ins for a hardware watchdog. This only enable the hooks; # the user must still supply the actual driver. # options HW_WDOG # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options "PMAP_SHPGPERPROC=201" # More undocumented options for linting. options CLK_CALIBRATION_LOOP options "CLK_USE_I8254_CALIBRATION" options CLK_USE_TSC_CALIBRATION options CLUSTERDEBUG options COMPAT_LINUX options CPU_UPGRADE_HW_CACHE options DEBUG options "DEBUG_1284" options DEVFS_ROOT #options DISABLE_PSE options "EXT2FS" options "I586_PMC_GUPROF=0x70000" options "IBCS2" # broken: #options IPFILTER options KEY options KEY_DEBUG options LOCKF_DEBUG options LOUTB options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 options KBDIO_DEBUG=2 options MSGMNB=2049 options MSGMNI=41 options MSGSEG=2049 options MSGSSZ=16 options MSGTQL=41 options NBUF=512 options NETATALKDEBUG options NMBCLUSTERS=1024 options NPX_DEBUG options NULLFS_DIAGNOSTIC options PANIC_REBOOT_WAIT_TIME=16 options "PCVT_24LINESDEF" options PCVT_CTRL_ALT_DEL options PCVT_EMU_MOUSE options PCVT_FREEBSD=211 options PCVT_META_ESC options PCVT_NSCREENS=9 options PCVT_PRETTYSCRNS options PCVT_SCANSET=2 options PCVT_SCREENSAVER options PCVT_USEKBDSEC options "PCVT_VT220KEYB" options PSM_DEBUG=1 options "SCSI_2_DEF" options SCSI_DELAY=8 # Be pessimistic about Joe SCSI device options SCSI_NCR_DEBUG options SCSI_NCR_DFLT_TAGS=4 options SCSI_NCR_MAX_SYNC=10000 options SCSI_NCR_MAX_WIDE=1 options SCSI_NCR_MYADDR=7 options SEMMAP=31 options SEMMNI=11 options SEMMNS=61 options SEMMNU=31 options SEMMSL=61 options SEMOPM=101 options SEMUME=11 options SHOW_BUSYBUFS # List buffers that prevent root unmount options SHMALL=1025 options "SHMMAX=(SHMMAXPGS*PAGE_SIZE+1)" options SHMMAXPGS=1025 options SHMMIN=2 options SHMMNI=33 options SHMSEG=9 options SI_DEBUG options SIMPLELOCK_DEBUG options SPX_HACK # The 'dpt' driver provides support for DPT controllers (http://www.dpt.com/). # These have hardware RAID-{0,1,5} support, and do multi-initiator I/O. # See sys/dev/dpt for debugging and other subtle options. # DPT_VERIFY_HINTR Performs some strict hardware interrupts testing. # Only use if you suspect PCI bus corruption problems # DPT_RESTRICTED_FREELIST Normally, the freelisat used by the DPT for queue # will grow to accomodate increased use. This growth # will NOT shrink. To restrict the number of queue # slots to exactly what the DPT can hold at one time, # enable this option. # DPT_MEASURE_PERFORMANCE Enables a set of (semi)invasive metrics. Various # instruments are enabled. Assumed to be enabled by # /usr/sbin/dpt_* tools. # DPT_FREELIST_IS_STACK For optimat L{1,2} CPU cache utilization, enable # this option. Otherwise, the transaction queue is # a LIFO. I cannot measure the performance gain. # DPT_HANDLE_TIMEOUTS Normally device timeouts are handled by the DPT. # If you ant the driver to handle timeouts, enable # this option. If your system is very busy, this # option will create more trouble than solve. # DPT_TIMEOUT_FACTOR Used to compute the excessive amount of time to # wait when timing out with the above option. # DPT_DEBUG_xxxx These are controllable from sys/dev/dpt/dpt.h # DPT_LOST_IRQ When enabled, will try, once per second, to catch # any interrupt that got lost. Seems to help in some # DPT-firmware/Motherboard combinations. Minimal # cost, great benefit. controller dpt0 # DPT options options DPT_VERIFY_HINTR options DPT_RESTRICTED_FREELIST options DPT_MEASURE_PERFORMANCE options DPT_FREELIST_IS_STACK options DPT_HANDLE_TIMEOUTS options DPT_TIMEOUT_FACTOR=4 options DPT_INTR_DELAY=200 # Some motherboards need that options DPT_LOST_IRQ diff --git a/sys/conf/files b/sys/conf/files index a7eea281d18c..83bf0fed39f6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,461 +1,462 @@ aicasm optional ahc device-driver \ dependency "$S/dev/aic7xxx/*.[chyl]" \ compile-with "make -f $S/dev/aic7xxx/Makefile MAKESRCPATH=$S/dev/aic7xxx" \ no-obj no-implicit-rule \ clean "aicasm" # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # aic7xxx_{seq,reg}.h optional ahc device-driver \ compile-with "./aicasm ${INCLUDES} -o aic7xxx_seq.h -r aic7xxx_reg.h $S/dev/aic7xxx/aic7xxx.seq" \ no-obj no-implicit-rule before-depend \ clean "aic7xxx_seq.h aic7xxx_reg.h" \ dependency "$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/scsi/scsi_message.h aicasm" cfs/cfs_namecache.c optional vcfs cfs/cfs_nbsd.c optional vcfs cfs/cfs_fbsd.c optional vcfs cfs/cfs_psdev.c optional vcfs cfs/cfs_subr.c optional vcfs cfs/cfs_venus.c optional vcfs cfs/cfs_vfsops.c optional vcfs cfs/cfs_vnodeops.c optional vcfs ddb/db_access.c optional ddb ddb/db_aout.c optional ddb ddb/db_break.c optional ddb ddb/db_command.c optional ddb ddb/db_examine.c optional ddb ddb/db_expr.c optional ddb ddb/db_input.c optional ddb ddb/db_lex.c optional ddb ddb/db_output.c optional ddb ddb/db_print.c optional ddb ddb/db_ps.c optional ddb ddb/db_run.c optional ddb ddb/db_sym.c optional ddb ddb/db_trap.c optional ddb ddb/db_variables.c optional ddb ddb/db_watch.c optional ddb ddb/db_write_cmd.c optional ddb dev/ccd/ccd.c optional ccd device-driver dev/dpt/dpt_control.c optional dpt device-driver dev/dpt/dpt_scsi.c optional dpt device-driver dev/en/midway.c optional en device-driver dev/pdq/pdq.c optional fea device-driver dev/pdq/pdq_ifsubr.c optional fea device-driver dev/pdq/pdq.c optional fpa device-driver dev/pdq/pdq_ifsubr.c optional fpa device-driver dev/ppbus/nlpt.c optional nlpt dev/ppbus/ppb_base.c optional ppbus dev/ppbus/ppb_1284.c optional ppbus dev/ppbus/ppbconf.c optional ppbus dev/ppbus/ppi.c optional ppi dev/ppbus/pps.c optional pps dev/ppbus/vpo.c optional vpo dev/vn/vn.c optional vn dev/vx/if_vx.c optional vx device-driver gnu/ext2fs/ext2_alloc.c optional ext2fs gnu/ext2fs/ext2_balloc.c optional ext2fs gnu/ext2fs/ext2_inode.c optional ext2fs gnu/ext2fs/ext2_inode_cnv.c optional ext2fs gnu/ext2fs/ext2_linux_balloc.c optional ext2fs gnu/ext2fs/ext2_linux_ialloc.c optional ext2fs gnu/ext2fs/ext2_lookup.c optional ext2fs gnu/ext2fs/ext2_subr.c optional ext2fs gnu/ext2fs/ext2_vfsops.c optional ext2fs gnu/ext2fs/ext2_vnops.c optional ext2fs isofs/cd9660/cd9660_bmap.c optional cd9660 isofs/cd9660/cd9660_lookup.c optional cd9660 isofs/cd9660/cd9660_node.c optional cd9660 isofs/cd9660/cd9660_rrip.c optional cd9660 isofs/cd9660/cd9660_util.c optional cd9660 isofs/cd9660/cd9660_vfsops.c optional cd9660 isofs/cd9660/cd9660_vnops.c optional cd9660 kern/imgact_aout.c standard kern/imgact_elf.c standard kern/imgact_gzip.c optional gzip kern/imgact_shell.c standard kern/inflate.c optional gzip kern/init_main.c standard kern/init_sysent.c standard kern/init_sysvec.c standard kern/kern_intr.c standard kern/kern_module.c standard kern/kern_linker.c standard kern/link_aout.c standard kern/kern_acct.c standard kern/kern_clock.c standard kern/kern_conf.c standard kern/kern_descrip.c standard kern/kern_exec.c standard kern/kern_exit.c standard kern/kern_fork.c standard kern/kern_ktrace.c standard kern/kern_lkm.c standard kern/kern_lock.c standard kern/kern_lockf.c standard kern/kern_malloc.c standard kern/kern_mib.c standard kern/kern_ntptime.c standard kern/kern_opt.c standard kern/kern_physio.c standard kern/kern_proc.c standard kern/kern_prot.c standard kern/kern_resource.c standard kern/kern_shutdown.c standard kern/kern_sig.c standard kern/kern_subr.c standard kern/kern_synch.c standard kern/kern_sysctl.c standard kern/kern_time.c standard kern/kern_timeout.c standard kern/kern_xxx.c standard kern/md5c.c optional md5 kern/md5c.c optional sppp kern/subr_diskslice.c standard kern/subr_autoconf.c standard kern/subr_dkbad.c standard kern/subr_log.c standard kern/subr_prf.c standard kern/subr_prof.c standard kern/subr_rlist.c standard kern/subr_xxx.c standard kern/sys_generic.c standard kern/sys_pipe.c standard kern/sys_process.c standard kern/sys_socket.c standard kern/sysv_ipc.c standard kern/sysv_msg.c optional sysvmsg kern/sysv_sem.c optional sysvsem kern/sysv_shm.c optional sysvshm kern/tty.c standard kern/tty_compat.c standard kern/tty_conf.c standard kern/tty_pty.c optional pty kern/tty_snoop.c optional snp kern/tty_subr.c standard kern/tty_tb.c optional tb kern/tty_tty.c standard kern/uipc_domain.c standard kern/uipc_mbuf.c standard kern/uipc_proto.c standard kern/uipc_socket.c standard kern/uipc_socket2.c standard kern/uipc_syscalls.c standard kern/uipc_usrreq.c standard kern/vfs_bio.c standard kern/vfs_cache.c standard kern/vfs_cluster.c standard kern/vfs_conf.c standard kern/vfs_default.c standard kern/vfs_init.c standard kern/vfs_lookup.c standard kern/vfs_subr.c standard kern/vfs_syscalls.c standard kern/vfs_vnops.c standard kern/kern_threads.c standard kern/vfs_aio.c standard miscfs/deadfs/dead_vnops.c standard miscfs/devfs/devfs_tree.c optional devfs miscfs/devfs/devfs_vfsops.c optional devfs miscfs/devfs/devfs_vnops.c optional devfs miscfs/fdesc/fdesc_vfsops.c optional fdesc miscfs/fdesc/fdesc_vnops.c optional fdesc miscfs/fifofs/fifo_vnops.c standard miscfs/kernfs/kernfs_vfsops.c optional kernfs miscfs/kernfs/kernfs_vnops.c optional kernfs miscfs/nullfs/null_subr.c optional nullfs miscfs/nullfs/null_vfsops.c optional nullfs miscfs/nullfs/null_vnops.c optional nullfs miscfs/portal/portal_vfsops.c optional portal miscfs/portal/portal_vnops.c optional portal miscfs/procfs/procfs_ctl.c optional procfs miscfs/procfs/procfs_fpregs.c standard miscfs/procfs/procfs_map.c optional procfs miscfs/procfs/procfs_mem.c standard miscfs/procfs/procfs_note.c optional procfs miscfs/procfs/procfs_regs.c standard miscfs/procfs/procfs_status.c optional procfs miscfs/procfs/procfs_subr.c optional procfs miscfs/procfs/procfs_type.c optional procfs miscfs/procfs/procfs_vfsops.c optional procfs miscfs/procfs/procfs_vnops.c optional procfs miscfs/specfs/spec_vnops.c standard miscfs/umapfs/umap_subr.c optional umapfs miscfs/umapfs/umap_vfsops.c optional umapfs miscfs/umapfs/umap_vnops.c optional umapfs miscfs/union/union_subr.c optional union miscfs/union/union_vfsops.c optional union miscfs/union/union_vnops.c optional union msdosfs/msdosfs_conv.c optional msdosfs msdosfs/msdosfs_denode.c optional msdosfs msdosfs/msdosfs_fat.c optional msdosfs msdosfs/msdosfs_lookup.c optional msdosfs msdosfs/msdosfs_vfsops.c optional msdosfs msdosfs/msdosfs_vnops.c optional msdosfs net/bpf.c optional bpfilter net/bpf_filter.c optional bpfilter net/bsd_comp.c optional ppp_bsdcomp #net/hostcache.c standard net/if.c standard net/if_atmsubr.c optional atm net/if_disc.c optional disc net/if_ethersubr.c optional ether net/if_fddisubr.c optional fddi net/if_loop.c optional loop net/if_media.c standard net/if_mib.c standard net/if_ppp.c optional ppp net/if_sl.c optional sl net/if_spppsubr.c optional sppp net/if_tun.c optional tun net/if_vlan.c optional vlan net/ppp_deflate.c optional ppp_deflate net/ppp_tty.c optional ppp net/radix.c standard net/raw_cb.c standard net/raw_usrreq.c standard net/route.c standard net/rtsock.c standard net/slcompress.c optional ppp net/slcompress.c optional sl net/zlib.c optional ppp_deflate netatalk/aarp.c optional netatalk netatalk/at_control.c optional netatalk netatalk/at_proto.c optional netatalk netatalk/at_rmx.c optional netatalkdebug netatalk/ddp_input.c optional netatalk netatalk/ddp_output.c optional netatalk netatalk/ddp_usrreq.c optional netatalk #netccitt/ccitt_proto.c optional ccitt #netccitt/hd_debug.c optional hdlc #netccitt/hd_input.c optional hdlc #netccitt/hd_output.c optional hdlc #netccitt/hd_subr.c optional hdlc #netccitt/hd_timer.c optional hdlc #netccitt/if_x25subr.c optional ccitt #netccitt/llc_input.c optional llc #netccitt/llc_output.c optional llc #netccitt/llc_subr.c optional llc #netccitt/llc_timer.c optional llc #netccitt/pk_acct.c optional ccitt #netccitt/pk_debug.c optional ccitt #netccitt/pk_input.c optional ccitt #netccitt/pk_llcsubr.c optional hdlc #netccitt/pk_llcsubr.c optional llc #netccitt/pk_output.c optional ccitt #netccitt/pk_subr.c optional ccitt #netccitt/pk_timer.c optional ccitt #netccitt/pk_usrreq.c optional ccitt #netimp/if_imp.c optional imp #netimp/if_imphost.c optional imp #netimp/raw_imp.c optional imp netinet/fil.c optional ipfilter inet netinet/if_atm.c optional atm netinet/if_ether.c optional ether netinet/igmp.c optional inet netinet/in.c optional inet #netinet/in_hostcache.c optional inet netinet/in_pcb.c optional inet netinet/in_proto.c optional inet netinet/in_rmx.c optional inet netinet/ip_auth.c optional ipfilter inet netinet/ip_divert.c optional ipdivert netinet/ip_fil.c optional ipfilter inet netinet/ip_frag.c optional ipfilter inet netinet/ip_fw.c optional ipfirewall netinet/ip_icmp.c optional inet netinet/ip_input.c optional inet netinet/ip_log.c optional ipfilter inet netinet/ip_mroute.c optional inet netinet/ip_nat.c optional ipfilter inet netinet/ip_output.c optional inet netinet/ip_proxy.c optional ipfilter inet netinet/ip_state.c optional ipfilter inet netinet/mlf_ipl.c optional ipfilter inet netinet/raw_ip.c optional inet netinet/tcp_debug.c optional tcpdebug netinet/tcp_input.c optional inet netinet/tcp_output.c optional inet netinet/tcp_subr.c optional inet netinet/tcp_timer.c optional inet netinet/tcp_usrreq.c optional inet netinet/udp_usrreq.c optional inet netipx/ipx.c optional ipx netipx/ipx_cksum.c optional ipx netipx/ipx_input.c optional ipx netipx/ipx_ip.c optional ipx netipx/ipx_outputfl.c optional ipx netipx/ipx_pcb.c optional ipx netipx/ipx_proto.c optional ipx netipx/ipx_tun.c optional ipx netipx/ipx_usrreq.c optional ipx netipx/spx_debug.c optional ipx netipx/spx_usrreq.c optional ipx #netiso/clnp_debug.c optional iso #netiso/clnp_er.c optional iso #netiso/clnp_frag.c optional iso #netiso/clnp_input.c optional iso #netiso/clnp_options.c optional iso #netiso/clnp_output.c optional iso #netiso/clnp_raw.c optional iso #netiso/clnp_subr.c optional iso #netiso/clnp_timer.c optional iso #netiso/cltp_usrreq.c optional iso #netiso/esis.c optional iso #netiso/idrp_usrreq.c optional iso #netiso/if_eon.c optional eon #netiso/iso.c optional iso #netiso/iso_chksum.c optional iso #netiso/iso_pcb.c optional iso #netiso/iso_proto.c optional iso #netiso/iso_snpac.c optional iso #netiso/tp_astring.c optional iso #netiso/tp_astring.c optional tpip #netiso/tp_cons.c optional iso #netiso/tp_driver.c optional iso #netiso/tp_driver.c optional tpip #netiso/tp_emit.c optional iso #netiso/tp_emit.c optional tpip #netiso/tp_inet.c optional iso #netiso/tp_inet.c optional tpip #netiso/tp_input.c optional iso #netiso/tp_input.c optional tpip #netiso/tp_iso.c optional iso #netiso/tp_meas.c optional iso #netiso/tp_meas.c optional tpip #netiso/tp_output.c optional iso #netiso/tp_output.c optional tpip #netiso/tp_pcb.c optional iso #netiso/tp_pcb.c optional tpip #netiso/tp_subr.c optional iso #netiso/tp_subr.c optional tpip #netiso/tp_subr2.c optional iso #netiso/tp_subr2.c optional tpip #netiso/tp_timer.c optional iso #netiso/tp_timer.c optional tpip #netiso/tp_trace.c optional iso #netiso/tp_trace.c optional tpip #netiso/tp_usrreq.c optional iso #netiso/tp_usrreq.c optional tpip #netiso/tuba_subr.c optional iso tuba #netiso/tuba_table.c optional iso tuba #netiso/tuba_usrreq.c optional iso tuba netkey/key.c optional key netkey/key_debug.c optional key_debug netnatm/natm.c optional natm netnatm/natm_pcb.c optional natm netnatm/natm_proto.c optional natm #netns/idp_usrreq.c optional ns #netns/ns.c optional ns #netns/ns_error.c optional ns #netns/ns_input.c optional ns #netns/ns_ip.c optional ns #netns/ns_output.c optional ns #netns/ns_pcb.c optional ns #netns/ns_proto.c optional ns #netns/spp_debug.c optional ns #netns/spp_usrreq.c optional ns nfs/nfs_bio.c optional nfs nfs/nfs_node.c optional nfs nfs/nfs_nqlease.c optional nfs nfs/nfs_serv.c optional nfs nfs/nfs_socket.c optional nfs nfs/nfs_srvcache.c optional nfs nfs/nfs_subs.c optional nfs nfs/nfs_syscalls.c optional nfs nfs/nfs_vfsops.c optional nfs nfs/nfs_vnops.c optional nfs nfs/bootp_subr.c optional bootp nfs/krpc_subr.c optional bootp pccard/pccard.c optional card pccard/pccard_beep.c optional card pccard/pcic.c optional pcic device-driver pci/pcic_p.c optional pcic device-driver pci/aic7870.c optional ahc device-driver \ dependency "aic7xxx_reg.h $S/pci/aic7870.c" pci/brooktree848.c optional bktr device-driver pci/bt9xx.c optional bt device-driver pci/dpt_pci.c optional pci dpt device-driver pci/cy_pci.c optional cy device-driver pci/if_de.c optional de device-driver pci/if_ed_p.c optional ed device-driver pci/if_en_pci.c optional en device-driver pci/if_fxp.c optional fxp device-driver pci/if_lnc_p.c optional lnc device-driver pci/if_fpa.c optional fpa device-driver pci/if_sr_p.c optional sr device-driver pci/if_tx.c optional tx device-driver pci/if_vx_pci.c optional vx device-driver pci/meteor.c optional meteor device-driver pci/ncr.c optional ncr device-driver pci/pci.c optional pci device-driver pci/pci_compat.c optional pci pci/pcisupport.c optional pci pci/tek390.c optional amd device-driver pci/wdc_p.c optional wdc device-driver -posix4/posix4_mib.c optional posix4 -posix4/ksched.c optional posix4 +posix4/posix4_mib.c optional p1003_1b +posix4/p1003_1b.c optional p1003_1b +posix4/ksched.c optional _kposix_priority_scheduling scsi/cd.c optional cd scsi/ch.c optional ch scsi/od.c optional od scsi/pt.c optional pt scsi/scsi_base.c optional scbus scsi/scsi_driver.c optional scbus scsi/scsi_ioctl.c optional scbus scsi/scsi_sense.c optional scbus scsi/scsiconf.c optional scbus scsi/sctarg.c optional sctarg scsi/sd.c optional sd scsi/ssc.c optional ssc scsi/st.c optional st scsi/su.c optional su scsi/uk.c optional scbus scsi/worm.c optional worm ufs/ffs/ffs_alloc.c optional ffs ufs/ffs/ffs_alloc.c optional mfs ufs/ffs/ffs_balloc.c optional ffs ufs/ffs/ffs_balloc.c optional mfs ufs/ffs/ffs_inode.c optional ffs ufs/ffs/ffs_inode.c optional mfs ufs/ffs/ffs_softdep_stub.c standard ufs/ffs/ffs_softdep.c optional softupdates ufs/ffs/ffs_subr.c optional ffs ufs/ffs/ffs_subr.c optional mfs ufs/ffs/ffs_tables.c optional ffs ufs/ffs/ffs_tables.c optional mfs ufs/ffs/ffs_vfsops.c optional ffs ufs/ffs/ffs_vfsops.c optional mfs ufs/ffs/ffs_vnops.c optional ffs ufs/ffs/ffs_vnops.c optional mfs ufs/ifs/ifs_isyscalls.c optional vcfs ufs/ifs/ifs_subr.c optional vcfs ufs/mfs/mfs_vfsops.c optional mfs ufs/mfs/mfs_vnops.c optional mfs ufs/ufs/ufs_bmap.c standard ufs/ufs/ufs_disksubr.c standard ufs/ufs/ufs_ihash.c standard ufs/ufs/ufs_inode.c standard ufs/ufs/ufs_lookup.c standard ufs/ufs/ufs_quota.c standard ufs/ufs/ufs_vfsops.c standard ufs/ufs/ufs_vnops.c standard vm/default_pager.c standard vm/device_pager.c standard vm/swap_pager.c standard vm/vm_fault.c standard vm/vm_glue.c standard vm/vm_init.c standard vm/vm_kern.c standard vm/vm_map.c standard vm/vm_meter.c standard vm/vm_mmap.c standard vm/vm_object.c standard vm/vm_page.c standard vm/vm_pageout.c standard vm/vm_pager.c standard vm/vm_swap.c standard vm/vm_unix.c standard vm/vnode_pager.c standard vm/vm_zone.c standard diff --git a/sys/conf/options b/sys/conf/options index 1d4d85236ad1..996f1b5f77fe 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1,227 +1,229 @@ -# $Id: options,v 1.68 1998/03/19 22:37:37 dyson Exp $ +# $Id: options,v 1.69 1998/03/21 11:33:49 peter Exp $ # # On the handling of kernel options # # All kernel options should be listed in LINT, with suitable # descriptions. Negative options (options that make some code not # compile) should be commented out; LINT should compile as much code # as possible. Try to structure option-using code so that a single # option only switch code on, or only switch code off, to make it # possible to have a full compile-test. If necessary, you can include # "opt_lint.h" and check for COMPILING_LINT to get maximum code # coverage. # # All new options shall also be listed in either "conf/options" or # "/conf/options.". Options that affect a single # source-file .[c|s] should be directed into "opt_.h", while # options that affect multiple files should either go in # "opt_global.h" if this is a kernel-wide option (used just about # everywhere), or in "opt_.h" if it affect # only some files. Note that the effect of listing only an option # without a header-file-name in conf/options (and cousins) is that the # last convention is followed. # # This handling scheme is not yet fully implemented. # # # Format of this file: # Option name filename # # If filename is missing, the default is # opt_.h # Miscellaneous options. BOUNCE_BUFFERS opt_bounce.h COMPAT_43 opt_compat.h COMPAT_SUNOS opt_compat.h COMPILING_LINT opt_lint.h DDB DDB_UNATTENDED opt_ddb.h GDB_REMOTE_CHAT opt_ddb.h DEVFS DEVFS_ROOT opt_devfs.h FAILSAFE HW_WDOG KTRACE MD5 MFS_AUTOLOAD opt_mfs.h MFS_ROOT opt_mfs.h NO_LKM NSWAPDEV opt_swap.h PPS_SYNC opt_ntp.h QUOTA SPX_HACK SUIDDIR opt_suiddir.h SYSVMSG opt_sysvipc.h SYSVSEM opt_sysvipc.h SYSVSHM opt_sysvipc.h UCONSOLE -# POSIX 4. -POSIX4 opt_posix4.h +# POSIX kernel options +P1003_1B opt_posix.h +_KPOSIX_PRIORITY_SCHEDULING opt_posix.h +_KPOSIX_VERSION opt_posix.h # Do we want the config file compiled into the kernel? INCLUDE_CONFIG_FILE opt_config.h # Options for static file systems. These should only be used at config # time, since the corresponding lkms cannot work if there are any static # dependencies. Unusability is enforced by hiding the defines for the # options in a never-included header. EXT2FS opt_dontuse.h FDESC opt_dontuse.h KERNFS opt_dontuse.h MFS opt_dontuse.h MSDOSFS opt_dontuse.h NULLFS opt_dontuse.h PORTAL opt_dontuse.h PROCFS opt_dontuse.h UMAPFS opt_dontuse.h # These static filesystems has one slightly bogus static dependency in # sys/i386/i386/autoconf.c. If any of these filesystems are # statically compiled into the kernel, code for mounting them as root # filesystems will be enabled - but look below. Boot-code is purposely # unavailable for the LKM-based versions. CD9660 FFS NFS # If you are following the conditions in the copyright, # you can enable soft-updates which will speed up a lot of thigs # and make the system safer from crashes at the same time. # otherwise a STUB module will be compiled in. SOFTUPDATES opt_ffs.h # The above static dependencies are planned removed, with a # _ROOT option to control if it usable as root. This list # allows these options to be present in config files already (though # they won't make any difference yet). CD9660_ROOT opt_cd9660.h FFS_ROOT opt_ffs.h NFS_ROOT opt_nfs.h # Multi-session CD-Rs might require a huge amount of time in order to # "settle". If we are about mounting them as the root f/s, we gotta # wait a little. CD9660_ROOTDELAY opt_cd9660.h # The union static file system has bogus static dependencies, so it isn't # hidden yet. UNION # Options used only in param.c. EXTRAVNODES opt_defunct.h MSGMNB opt_param.h MSGMNI opt_param.h MSGSEG opt_param.h MSGSSZ opt_param.h MSGTQL opt_param.h NBUF opt_param.h NMBCLUSTERS opt_param.h SEMMAP opt_param.h SEMMNI opt_param.h SEMMNS opt_param.h SEMMNU opt_param.h SEMMSL opt_param.h SEMOPM opt_param.h SEMUME opt_param.h SHMALL opt_param.h SHMMAX opt_param.h SHMMAXPGS opt_param.h SHMMIN opt_param.h SHMMNI opt_param.h SHMSEG opt_param.h # Generic SCSI options. SCSIDEBUG opt_scsi.h SCSI_DELAY opt_scsi.h SCSI_REPORT_GEOMETRY opt_scsi.h SCSI_2_DEF opt_scsi.h # Options used only in scsi/od.c. OD_AUTO_TURNOFF opt_od.h OD_BOGUS_NOT_READY opt_od.h # Options used only in pci/ncr.c SCSI_NCR_DEBUG opt_ncr.h SCSI_NCR_DFLT_TAGS opt_ncr.h SCSI_NCR_MAX_SYNC opt_ncr.h SCSI_NCR_MAX_WIDE opt_ncr.h SCSI_NCR_MYADDR opt_ncr.h # Resource limits. CHILD_MAX opt_defunct.h DFLDSIZ opt_rlimit.h MAXDSIZ opt_rlimit.h OPEN_MAX opt_defunct.h # Net stuff. ARP_PROXYALL opt_defunct.h BOOTP opt_bootp.h BOOTP_COMPAT opt_bootp.h BOOTP_NFSROOT opt_bootp.h BOOTP_NFSV3 opt_bootp.h BOOTP_WIRED_TO opt_bootp.h GATEWAY opt_defunct.h MROUTING opt_mrouting.h INET opt_inet.h IPDIVERT IPFIREWALL opt_ipfw.h IPFIREWALL_VERBOSE opt_ipfw.h IPFIREWALL_VERBOSE_LIMIT opt_ipfw.h IPFIREWALL_DEFAULT_TO_ACCEPT opt_ipfw.h IPX opt_ipx.h IPXIP opt_ipx.h IPTUNNEL opt_ipx.h NETATALK opt_atalk.h PPP_BSDCOMP opt_ppp.h PPP_DEFLATE opt_ppp.h PPP_FILTER opt_ppp.h TCP_COMPAT_42 opt_compat.h TCPDEBUG IPFILTER opt_ipfilter.h IPFILTER_LOG opt_ipfilter.h IPFILTER_LKM opt_ipfilter.h # XXX Conflict: # of devices vs network protocol (Native ATM). # This makes "atm.h" unusable. NATM opt_natm.h # DPT driver debug flags DPT_VERIFY_HINTR opt_dpt.h DPT_USE_SINTR opt_dpt.h DPT_RESTRICTED_FREELIST opt_dpt.h DPT_MEASURE_PERFORMANCE opt_dpt.h DPT_FREELIST_IS_STACK opt_dpt.h DPT_HANDLE_TIMEOUTS opt_dpt.h DPT_TIMEOUT_FACTOR opt_dpt.h DPT_INTR_DELAY opt_dpt.h DPT_LOST_IRQ opt_dpt.h # Misc debug flags. Most of these should probably be replaced with # 'DEBUG', and then let people recompile just the interesting modules # with 'make CC="cc -DDEBUG'. CLUSTERDEBUG opt_debug_cluster.h DEBUG_1284 opt_debug_1284.h LOCKF_DEBUG opt_debug_lockf.h LOUTB opt_debug_outb.h NPX_DEBUG opt_debug_npx.h NETATALKDEBUG opt_atalk.h NULLFS_DIAGNOSTIC opt_debug_nullfs.h SI_DEBUG opt_debug_si.h # These cause changes all over the kernel DEBUG opt_global.h DIAGNOSTIC opt_global.h SIMPLELOCK_DEBUG opt_global.h ENABLE_VFS_IOOPT opt_global.h # These are VM related options VM_KMEM_SIZE opt_vm.h VM_KMEM_SIZE_SCALE opt_vm.h VM_KMEM_SIZE_MAX opt_vm.h # sys/netkey KEY KEY_DEBUG opt_key.h diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index 682914cc1104..c72b9d6ad301 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -1,1527 +1,1540 @@ # # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.420 1998/03/21 14:13:47 peter Exp $ +# $Id: LINT,v 1.421 1998/03/24 02:55:03 yokota Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from # this file as required. # # # This directive is mandatory; it defines the architecture to be # configured for; in this case, the 386 family based IBM-PC and # compatibles. # machine "i386" # # This is the ``identification'' of the kernel. Usually this should # be the same as the name of your kernel. # ident LINT # # The `maxusers' parameter controls the static sizing of a number of # internal system tables by a complicated formula defined in param.c. # maxusers 10 # # Certain applications can grow to be larger than the 128M limit # that FreeBSD initially imposes. Below are some options to # allow that limit to grow to 256MB, and can be increased further # with changing the parameters. MAXDSIZ is the maximum that the # limit can be set to, and the DFLDSIZ is the default value for # the limit. You might want to set the default lower than the # max, and explicitly set the maximum with a shell command for processes # that regularly exceed the limit like INND. # options "MAXDSIZ=(256*1024*1024)" options "DFLDSIZ=(256*1024*1024)" # When this is set, be extra conservative in various parts of the kernel # and choose functionality over speed (on the widest variety of systems). options FAILSAFE # This allows you to actually store this configuration file into # the kernel binary itself, where it may be later read by saying: # strings /kernel | grep ^___ | sed -e 's/^___//' > MYKERNEL # options INCLUDE_CONFIG_FILE # Include this file in kernel # # This directive defines a number of things: # - The compiled kernel is to be called `kernel' # - The root filesystem might be on partition wd0a # - Crash dumps will be written to wd0b, if possible. Specifying the # dump device here is not recommended. Use dumpon(8). # config kernel root on wd0 dumps on wd0 ##################################################################### # SMP OPTIONS: # # SMP enables building of a Symmetric MultiProcessor Kernel. # APIC_IO enables the use of the IO APIC for Symmetric I/O. # NCPU sets the number of CPUs, defaults to 2. # NBUS sets the number of busses, defaults to 4. # NAPIC sets the number of IO APICs on the motherboard, defaults to 1. # NINTR sets the total number of INTs provided by the motherboard. # # Notes: # # An SMP kernel will ONLY run on an Intel MP spec. qualified motherboard. # # Be sure to disable 'cpu "I386_CPU"' && 'cpu "I486_CPU"' for SMP kernels. # # Check the 'Rogue SMP hardware' section to see if additional options # are required by your hardware. # # Mandatory: options SMP # Symmetric MultiProcessor Kernel options APIC_IO # Symmetric (APIC) I/O # Optional, these are the defaults plus 1: options NCPU=5 # number of CPUs options NBUS=5 # number of busses options NAPIC=2 # number of IO APICs options NINTR=25 # number of INTs # # Rogue SMP hardware: # # Bridged PCI cards: # # The MP tables of most of the current generation MP motherboards # do NOT properly support bridged PCI cards. To use one of these # cards you should refer to ??? ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. This is especially true removing # I386_CPU. # cpu "I386_CPU" cpu "I486_CPU" cpu "I586_CPU" # aka Pentium(tm) cpu "I686_CPU" # aka Pentium Pro(tm) # # Options for CPU features. # # CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM # BlueLightning CPU. It works only with Cyrix FPU, and this option # should not be used with Intel FPU. # # CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning # CPU if CPU supports it. The default is double-clock mode on # BlueLightning CPU box. # # CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). # # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct # mapped mode. Default is 2-way set associative mode. # # CPU_CYRIX_NO_LOCK enables weak locking for the entire address space # of Cyrix 6x86 and 6x86MX CPUs. If this option is not set and # FAILESAFE is defined, NO_LOCK bit of CCR1 is cleared. (NOTE 3) # # CPU_DISABLE_5X86_LSSER disables load store serialize (i.e. enables # reorder). This option should not be used if you use memory mapped # I/O device(s). # # CPU_FASTER_5X86_FPU enables faster FPU exception handler. # # CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products # for i386 machines. # # CPU_IORT defines I/O clock delay time (NOTE 1). Default vaules of # I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively # (no clock delay). # # CPU_LOOP_EN prevents flushing the prefetch buffer if the destination # of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE # 1). # # CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). # # CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU # enters suspend mode following execution of HALT instruction. # # CPU_WT_ALLOC enables write-through allocation. # # CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache # flush at hold state. # # CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs # without cache flush at hold state, and (2) write-back CPU cache on # Cyrix 6x86 whose revision < 2.7 (NOTE 2). # # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is # executed. This should be included for ALL kernels that won't run # on a Pentium. # # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_ENand CPU_RSTK_EN should no be used becasue of CPU bugs. # These options may crash your system. # # NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled # in write-through mode when revision < 2.7. If revision of Cyrix # 6x86 >= 2.7, CPU cache is always enabled in write-back mode. # # NOTE 3: This option may cause failures for software that requires # locked cycles in order to operate correctly. # options "CPU_BLUELIGHTNING_FPU_OP_CACHE" options "CPU_BLUELIGHTNING_3X" options "CPU_BTB_EN" options "CPU_DIRECT_MAPPED_CACHE" options "CPU_DISABLE_5X86_LSSER" options "CPU_FASTER_5X86_FPU" options "CPU_I486_ON_386" options "CPU_IORT" options "CPU_LOOP_EN" options "CPU_RSTK_EN" options "CPU_SUSP_HLT" options "CYRIX_CACHE_WORKS" options "CYRIX_CACHE_REALLY_WORKS" #options "NO_F00F_HACK" # # A math emulator is mandatory if you wish to run on hardware which # does not have a floating-point processor. Pick either the original, # bogus (but freely-distributable) math emulator, or a much more # fully-featured but GPL-licensed emulator taken from Linux. # options MATH_EMULATE #Support for x87 emulation # Don't enable both of these in a real config. options GPL_MATH_EMULATE #Support for x87 emulation via #new math emulator ##################################################################### # COMPATIBILITY OPTIONS # # Implement system calls compatible with 4.3BSD and older versions of # FreeBSD. You probably do NOT want to remove this as much current code # still relies on the 4.3 emulation. # options "COMPAT_43" # # Allow user-mode programs to manipulate their local descriptor tables. # This option is required for the WINE Windows(tm) emulator, and is # not used by anything else (that we know of). # options USER_LDT #allow user-level control of i386 ldt # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared # memory, semaphores, and message queues, respectively. # options SYSVSHM options SYSVSEM options SYSVMSG # # This option includes a MD5 routine in the kernel, this is used for # various authentication and privacy uses. # options "MD5" # # Allow processes to switch to vm86 mode, as well as enabling direct # user-mode access to the I/O port space. This option is necessary for # the doscmd emulator to run. # options "VM86" ##################################################################### # DEBUGGING OPTIONS # # Enable the kernel debugger. # options DDB # # Don't drop into DDB for a panic. Intended for unattended operation # where you may want to drop to DDB from the console, but still want # the machine to recover from a panic # options DDB_UNATTENDED # # If using GDB remote mode to debug the kernel, there's a non-standard # extension to the remote protocol that can be used to use the serial # port as both the debugging port and the system console. It's non- # standard and you're on your own if you enable it. See also the # "remotechat" variables in the FreeBSD specific version of gdb. # options GDB_REMOTE_CHAT # # KTRACE enables the system-call tracing facility ktrace(2). # options KTRACE #kernel tracing # # The DIAGNOSTIC option is used in a number of source files to enable # extra sanity checking of internal structures. This support is not # enabled by default because of the extra time it would take to check # for these conditions, which can only occur as a result of # programming errors. # options DIAGNOSTIC # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # options PERFMON # # This option let some drivers co-exist that can't co-exist in a running # system. This is used to be able to compile all kernel code in one go for # quality assurance purposes (like this file, which the option takes it name # from.) # options COMPILING_LINT # XXX - this doesn't belong here. # Allow ordinary users to take the console - this is useful for X. options UCONSOLE # XXX - this doesn't belong here either options USERCONFIG #boot -c editor options USERCONFIG_BOOT #imply -c and parse info area options VISUAL_USERCONFIG #visual boot -c editor ##################################################################### # NETWORKING OPTIONS # # Protocol families: # Only the INET (Internet) family is officially supported in FreeBSD. # Source code for the NS (Xerox Network Service) is provided for amusement # value. # options INET #Internet communications protocols options IPX #IPX/SPX communications protocols options IPXIP #IPX in IP encapsulation (not available) options IPTUNNEL #IP in IPX encapsulation (not available) options NETATALK #Appletalk communications protocols # These are currently broken but are shipped due to interest. #options NS #Xerox NS protocols # These are currently broken and are no longer shipped due to lack # of interest. #options CCITT #X.25 network layer #options ISO #options TPIP #ISO TP class 4 over IP #options TPCONS #ISO TP class 0 over X.25 #options LLC #X.25 link layer for Ethernets #options HDLC #X.25 link layer for serial lines #options EON #ISO CLNP over IP #options NSIP #XNS over IP # # Network interfaces: # The `loop' pseudo-device is MANDATORY when networking is enabled. # The `ether' pseudo-device provides generic code to handle # Ethernets; it is MANDATORY when a Ethernet device driver is # configured. # The 'fddi' pseudo-device provides generic code to support FDDI. # The `sppp' pseudo-device serves a similar role for certain types # of synchronous PPP links (like `cx', `ar'). # The `sl' pseudo-device implements the Serial Line IP (SLIP) service. # The `ppp' pseudo-device implements the Point-to-Point Protocol. # The `bpfilter' pseudo-device enables the Berkeley Packet Filter. Be # aware of the legal and administrative consequences of enabling this # option. The number of devices determines the maximum number of # simultaneous BPF clients programs runnable. # The `disc' pseudo-device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing purposes. # The `tun' pseudo-device implements the User Process PPP (iijppp) # # The PPP_BSDCOMP option enables support for compress(1) style entire # packet compression, the PPP_DEFLATE is for zlib/gzip style compression. # PPP_FILTER enables code for filtering the ppp data stream and selecting # events for resetting the demand dial activity timer - requires bpfilter. # See pppd(8) for more details. # pseudo-device ether #Generic Ethernet pseudo-device fddi #Generic FDDI pseudo-device sppp #Generic Synchronous PPP pseudo-device loop #Network loopback device pseudo-device bpfilter 4 #Berkeley packet filter pseudo-device disc #Discard device pseudo-device tun 1 #Tunnel driver (user process ppp(8)) pseudo-device sl 2 #Serial Line IP pseudo-device ppp 2 #Point-to-point protocol options PPP_BSDCOMP #PPP BSD-compress support options PPP_DEFLATE #PPP zlib/deflate/gzip support options PPP_FILTER #enable bpf filtering (needs bpfilter) # # Internet family options: # # TCP_COMPAT_42 causes the TCP code to emulate certain bugs present in # 4.2BSD. This option should not be used unless you have a 4.2BSD # machine and TCP connections fail. # # MROUTING enables the kernel multicast packet forwarder, which works # with mrouted(8). # # IPFIREWALL enables support for IP firewall construction, in # conjunction with the `ipfw' program. IPFIREWALL_VERBOSE sends # logged packets to the system logger. IPFIREWALL_VERBOSE_LIMIT # limits the number of times a matching entry can be logged. # # WARNING: IPFIREWALL defaults to a policy of "deny ip from any to any" # and if you do not add other rules during startup to allow access, # YOU WILL LOCK YOURSELF OUT. It is suggested that you set firewall=open # in /etc/rc.conf when first enabling this feature, then refining the # firewall rules in /etc/rc.firewall after you've tested that the new kernel # feature works properly. # # IPFIREWALL_DEFAULT_TO_ACCEPT causes the default rule (at boot) to # allow everything. Use with care, if a cracker can crash your # firewall machine, they can get to your protected machines. However, # if you are using it as an as-needed filter for specific problems as # they arise, then this may be for you. Changing the default to 'allow' # means that you won't get stuck if the kernel and /sbin/ipfw binary get # out of sync. # # IPDIVERT enables the divert IP sockets, used by ``ipfw divert'' # # IPFILTER enables Darren Reed's ipfilter package. # IPFILTER_LOG enables ipfilter's logging. # IPFILTER_LKM enables LKM support for an ipfilter module (untested). # # TCPDEBUG is undocumented. # options "TCP_COMPAT_42" #emulate 4.2BSD TCP bugs options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #print information about # dropped packets options "IPFIREWALL_VERBOSE_LIMIT=100" #limit verbosity options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default options IPDIVERT #divert sockets options IPFILTER #kernel ipfilter support options IPFILTER_LOG #ipfilter logging #options IPFILTER_LKM #kernel support for ip_fil.o LKM options TCPDEBUG ##################################################################### # FILESYSTEM OPTIONS # # Only the root, /usr, and /tmp filesystems need be statically # compiled; everything else will be automatically loaded at mount # time. (Exception: the UFS family---FFS, and MFS --- cannot # currently be demand-loaded.) Some people still prefer to statically # compile other filesystems as well. # # NB: The NULL, PORTAL, UMAP and UNION filesystems are known to be # buggy, and WILL panic your system if you attempt to do anything with # them. They are included here as an incentive for some enterprising # soul to sit down and fix them. # # One of these is mandatory: options FFS #Fast filesystem options NFS #Network File System # The rest are optional: # options NFS_NOSERVER #Disable the NFS-server code. options "CD9660" #ISO 9660 filesystem options FDESC #File descriptor filesystem options KERNFS #Kernel filesystem options MFS #Memory File System options MSDOSFS #MS DOS File System options NULLFS #NULL filesystem options PORTAL #Portal filesystem options PROCFS #Process filesystem options UMAPFS #UID map filesystem options UNION #Union filesystem options "CD9660_ROOT" #CD-ROM usable as root device options FFS_ROOT #FFS usable as root device options NFS_ROOT #NFS usable as root device # This DEVFS is experimental but seems to work options DEVFS #devices filesystem # Allow the FFS to use Softupdates technology. # To do this you need to fetch the two files # /sys/ufs/ffs/softdep.h and /sys/ufs/ffs/ffs_softdep.c # from freebsd.org and understand the licensing restrictions. #options SOFTUPDATES # (we can't actually enable it because the files may not be present) # Make space in the kernel for a MFS root filesystem. Define to the number # of kilobytes to reserve for the filesystem. options MFS_ROOT=10 # Allow the MFS_ROOT code to load the MFS image from floppy if it is missing. options MFS_AUTOLOAD # Allow this many swap-devices. options NSWAPDEV=20 # Disk quotas are supported when this option is enabled. If you # change the value of this option, you must do a `make clean' in your # kernel compile directory in order to get a working kernel. # options QUOTA #enable disk quotas # Add more checking code to various filesystems #options NULLFS_DIAGNOSTIC #options KERNFS_DIAGNOSTIC #options UMAPFS_DIAGNOSTIC #options UNION_DIAGNOSTIC # In particular multi-session CD-Rs might require a huge amount of # time in order to "settle". If we are about mounting them as the # root f/s, we gotta wait a little. # # The number is supposed to be in seconds. options "CD9660_ROOTDELAY=20" # If you are running a machine just as a fileserver for PC and MAC users. # (using SAMBA or Netatalk), then you may consider setting this option # and keeping all those user's directories on a partition that is mounted # with the suiddir option. This gives new files the same ownership as # the directory (similiar to group). It's a security hole if you let # these users run programs so confine it to file-servers, (but it'll save you # lots of headaches in that case). Root owned directories are excempt and X bits # are cleared. the suid bit must be set on the directory as well. see chmod(1) # PC owners can't see/set ownerships so they keep getting their toes # trodden on. This saves you all the support calls as the filesystem # it's used on will act as they expect. ("It's my dir so it must be my file"). # options SUIDDIR # Add some error checking code to the null_bypass routine # in the NULL filesystem #options SAFETY ##################################################################### # SCSI DEVICES # SCSI DEVICE CONFIGURATION # The SCSI subsystem consists of the `base' SCSI code, a number of # high-level SCSI device `type' drivers, and the low-level host-adapter # device drivers. The host adapters are listed in the ISA and PCI # device configuration sections below. # # Beginning with FreeBSD 2.0.5 you can wire down your SCSI devices so # that a given bus, target, and LUN always come on line as the same # device unit. In earlier versions the unit numbers were assigned # in the order that the devices were probed on the SCSI bus. This # means that if you removed a disk drive, you may have had to rewrite # your /etc/fstab file, and also that you had to be careful when adding # a new disk as it may have been probed earlier and moved your device # configuration around. # This old behavior is maintained as the default behavior. The unit # assignment begins with the first non-wired down unit for a device # type. For example, if you wire a disk as "sd3" then the first # non-wired disk will be assigned sd4. # The syntax for wiring down devices is: # controller scbus0 at ahc0 # Single bus device # controller scbus1 at ahc1 bus 0 # Single bus device # controller scbus3 at ahc2 bus 0 # Twin bus device # controller scbus2 at ahc2 bus 1 # Twin bus device # disk sd0 at scbus0 target 0 unit 0 # disk sd1 at scbus3 target 1 # disk sd2 at scbus2 target 3 # tape st1 at scbus1 target 6 # device cd0 at scbus? # "units" (SCSI logical unit number) that are not specified are # treated as if specified as LUN 0. # All SCSI devices allocate as many units as are required. # The "unknown" device (uk? in pre-2.0.5) is now part of the base SCSI # configuration and doesn't have to be explicitly configured. controller scbus0 #base SCSI code device ch0 #SCSI media changers device sd0 #SCSI disks device st0 #SCSI tapes device cd0 #SCSI CD-ROMs device od0 #SCSI optical disk # The previous devices (ch, sd, st, cd) are recognized by config. # config doesn't (and shouldn't) know about these newer ones, # so we have to specify that they are on a SCSI bus with the "at scbus?" # clause. device worm0 at scbus? # SCSI worm device pt0 at scbus? # SCSI processor type device sctarg0 at scbus? # SCSI target # SCSI OPTIONS: # SCSIDEBUG: When defined enables debugging macros # NO_SCSI_SENSE: When defined disables sense descriptions (about 4k) # SCSI_REPORT_GEOMETRY: Always report disk geometry at boot up instead # of only when booting verbosely. options SCSIDEBUG #options NO_SCSI_SENSE options SCSI_REPORT_GEOMETRY # Options for the `od' optical disk driver: # # If drive returns sense key as 0x02 with vendor specific additional # sense code (ASC) and additional sense code qualifier (ASCQ), or # illegal ASC and ASCQ. This cause an error (NOT READY) and retrying. # To suppress this, use the following option. # options OD_BOGUS_NOT_READY # # For an automatic spindown, try this. Again, preferably as an # option in your config file. # WARNING! Use at your own risk. Joerg's ancient SONY SMO drive # groks it fine, while Shunsuke's Fujitsu chokes on it and times # out. # options OD_AUTO_TURNOFF + +##################################################################### +# POSIX P1003.1B + +# Real time extensions added int the 1993 Posix +# P1003_1B: Infrastructure +# _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING +# _KPOSIX_VERSION: Version kernel is built for + +options "P1003_1B" +options "_KPOSIX_PRIORITY_SCHEDULING" +options "_KPOSIX_VERSION=199309L" + ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS # The `pty' device usually turns out to be ``effectively mandatory'', # as it is required for `telnetd', `rlogind', `screen', `emacs', and # `xterm', among others. pseudo-device pty 16 #Pseudo ttys - can go as high as 256 pseudo-device speaker #Play IBM BASIC-style noises out your speaker pseudo-device gzip #Exec gzipped a.out's pseudo-device vn #Vnode driver (turns a file into a device) pseudo-device snp 3 #Snoop device - to look at pty/vty/etc.. pseudo-device ccd 4 #Concatenated disk driver # These are only for watching for bitrot in old tty code. # broken #pseudo-device tb # These are only for watching for bitrot in old SCSI code. pseudo-device su #scsi user pseudo-device ssc #super scsi ##################################################################### # HARDWARE DEVICE CONFIGURATION # ISA and EISA devices: # EISA support is available for some device, so they can be auto-probed. # Micro Channel is not supported at all. # # Mandatory ISA devices: isa, npx # controller isa0 # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # Automatic EOI is documented not to work for for the slave with the # original i8259A, but it works for some clones and some integrated # versions. # # BOUNCE_BUFFERS provides support for ISA DMA on machines with more # than 16 megabytes of memory. It doesn't hurt on other machines. # Some broken EISA and VLB hardware may need this, too. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # TUNE_1542 enables the automatic ISA bus speed selection for the # Adaptec 1542 boards. Does not work for all boards, use it with caution. # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. # # PAS_JOYSTICK_ENABLE enables the gameport on the ProAudio Spectrum options "AUTO_EOI_1" #options "AUTO_EOI_2" options BOUNCE_BUFFERS options "MAXMEM=(128*1024)" options "TUNE_1542" #options BROKEN_KEYBOARD_RESET #options PAS_JOYSTICK_ENABLE # Enable support for the kernel PLL to use an external PPS signal, # under supervision of [x]ntpd(8) # More info in ftp://ftp.udel.edu/pub/ntp/kernel.tar.Z options PPS_SYNC # Enable PnP support in the kernel. This allows you to automaticly # attach to PnP cards for drivers that support it and allows you to # configure cards from USERCONFIG. See pnp(4) for more info. controller pnp0 # The pcvt console driver (vt220 compatible). device vt0 at isa? port "IO_KBD" tty irq 1 vector pcrint options XSERVER # support for running an X server. options FAT_CURSOR # start with block cursor # This PCVT option is for keyboards such as those used on IBM ThinkPad laptops options PCVT_SCANSET=2 # IBM keyboards are non-std # The syscons console driver (sco color console compatible). device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr options MAXCONS=16 # number of virtual consoles options SLOW_VGA # do byte-wide i/o's to TS and GDC regs options "STD8X16FONT" # Compile font in makeoptions "STD8X16FONT"="cp850" options SC_HISTORY_SIZE=200 # number of history buffer lines options SC_DISABLE_REBOOT # disable reboot key sequence # # `flags' for sc0: # 0x01 Use a 'visual' bell # 0x02 Use a 'blink' cursor # 0x04 Use a 'underline' cursor # 0x06 Use a 'blinking underline' (destructive) cursor # 0x08 Force detection of keyboard, else we always assume a keyboard # 0x10 Old-style (XT) keyboard support, useful for older ThinkPads # 0x20 Don't reset keyboard, useful for some newer ThinkPads # # The Numeric Processing eXtension driver. This should be configured if # your machine has a math co-processor, unless the coprocessor is very # buggy. If it is not configured then you *must* configure math emulation # (see above). If both npx0 and emulation are configured, then only npx0 # is used (provided it works). device npx0 at isa? port "IO_NPX" iosiz 0x0 flags 0x0 irq 13 vector npxintr # # `flags' for npx0: # 0x01 don't use the npx registers to optimize bcopy # 0x02 don't use the npx registers to optimize bzero # 0x04 don't use the npx registers to optimize copyin or copyout. # The npx registers are normally used to optimize copying and zeroing when # all of the following conditions are satisfied: # "I586_CPU" is an option # the cpu is an i586 (perhaps not a Pentium) # the probe for npx0 succeeds # INT 16 exception handling works. # Then copying and zeroing using the npx registers is normally 30-100% faster. # The flags can be used to control cases where it doesn't work or is slower. # Setting them at boot time using userconfig works right (the optimizations # are not used until later in the bootstrap when npx0 is attached). # # # `iosiz' for npx0: # This can be used instead of the MAXMEM option to set the memory size. If # it is nonzero, then it overrides both the MAXMEM option and the memory # size reported by the BIOS. Setting it at boot time using userconfig takes # effect on the next reboot after the change has been recorded in the kernel # binary (the size is used early in the boot before userconfig has a chance # to change it). # # # Optional ISA and EISA devices: # # # SCSI host adapters: `aha', `aic', `bt', `nca' # # aha: Adaptec 154x # ahc: Adaptec 274x/284x/294x # aic: Adaptec 152x and sound cards using the Adaptec AIC-6360 (slow!) # bt: Most Buslogic controllers # nca: ProAudioSpectrum cards using the NCR 5380 or Trantor T130 # uha: UltraStore 14F and 34F # sea: Seagate ST01/02 8 bit controller (slow!) # wds: Western Digital WD7000 controller (no scatter/gather!). # # Note that the order is important in order for Buslogic cards to be # probed correctly. # controller bt0 at isa? port "IO_BT0" bio irq ? vector bt_isa_intr controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr controller aic0 at isa? port 0x340 bio irq 11 vector aicintr controller nca0 at isa? port 0x1f88 bio irq 10 vector ncaintr controller nca1 at isa? port 0x1f84 controller nca2 at isa? port 0x1f8c controller nca3 at isa? port 0x1e88 controller nca4 at isa? port 0x350 bio irq 5 vector ncaintr controller sea0 at isa? bio irq 5 iomem 0xdc000 iosiz 0x2000 vector seaintr controller wds0 at isa? port 0x350 bio irq 15 drq 6 vector wdsintr # # ST-506, ESDI, and IDE hard disks: `wdc' and `wd' # # The flags fields are used to enable the multi-sector I/O and # the 32BIT I/O modes. The flags may be used in either the controller # definition or in the individual disk definitions. The controller # definition is supported for the boot configuration stuff. # # Each drive has a 16 bit flags value defined: # The low 8 bits are the maximum value for the multi-sector I/O, # where 0xff defaults to the maximum that the drive can handle. # The high bit of the 16 bit flags (0x8000) allows probing for # 32 bit transfers. Bit 14 (0x4000) enables a hack to wake # up powered-down laptop drives. Bit 13 (0x2000) allows # probing for PCI IDE DMA controllers, such as Intel's PIIX # south bridges. See the wd.4 man page. # # The flags field for the drives can be specified in the controller # specification with the low 16 bits for drive 0, and the high 16 bits # for drive 1. # e.g.: #controller wdc0 at isa? port "IO_WD1" bio irq 14 flags 0x00ff8004 vector wdintr # # specifies that drive 0 will be allowed to probe for 32 bit transfers and # a maximum multi-sector transfer of 4 sectors, and drive 1 will not be # allowed to probe for 32 bit transfers, but will allow multi-sector # transfers up to the maximum that the drive supports. # # If you are using a PCI controller that is not running in compatibility # mode (for example, it is a 2nd IDE PCI interface), then use config line(s) # such as: # #controller wdc2 at isa? port "0" bio irq ? flags 0xa0ffa0ff vector wdintr #disk wd4 at wdc2 drive 0 #disk wd5 at wdc2 drive 1 # #controller wdc3 at isa? port "0" bio irq ? flags 0xa0ffa0ff vector wdintr #disk wd6 at wdc3 drive 0 #disk wd7 at wdc3 drive 1 # # Note that the above config would be useful for a Promise card, when used # on a MB that already has a PIIX controller. Note the bogus irq and port # entries. These are automatically filled in by the IDE/PCI support. # controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr disk wd0 at wdc0 drive 0 disk wd1 at wdc0 drive 1 controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr disk wd2 at wdc1 drive 0 disk wd3 at wdc1 drive 1 # # Options for `wdc': # # CMD640 enables serializing access to primary and secondary channel # of the CMD640B IDE Chip. The serializing will only take place # if this option is set *and* the chip is probed by the pci-system. # options "CMD640" #Enable work around for CMD640 h/w bug # # ATAPI enables the support for ATAPI-compatible IDE devices # options ATAPI #Enable ATAPI support for IDE bus options ATAPI_STATIC #Don't do it as an LKM # IDE CD-ROM driver - requires wdc controller and ATAPI option device wcd0 # IDE floppy driver - requires wdc controller and ATAPI option device wfd0 # # Standard floppy disk controllers and floppy tapes: `fdc', `fd', and `ft' # controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr # # FDC_DEBUG enables floppy debugging. Since the debug output is huge, you # gotta turn it actually on by setting the variable fd_debug with DDB, # however. options FDC_DEBUG # This option is undocumented on purpose. options FDC_PRINT_BOGUS_CHIPTYPE # # Activate this line instead of the fdc0 line above if you happen to # have an Insight floppy tape. Probing them proved to be dangerous # for people with floppy disks only, so it's "hidden" behind a flag: #controller fdc0 at isa? port "IO_FD1" bio flags 1 irq 6 drq 2 vector fdintr disk fd0 at fdc0 drive 0 disk fd1 at fdc0 drive 1 tape ft0 at fdc0 drive 2 # # Other standard PC hardware: `lpt', `mse', `psm', `sio', etc. # # lpt: printer port # lpt specials: # port can be specified as ?, this will cause the driver to scan # the BIOS port list; # the irq and vector clauses may be omitted, this # will force the port into polling mode. # mse: Logitech and ATI InPort bus mouse ports # psm: PS/2 mouse port [note: conflicts with sc0/vt0, thus "conflicts" keywd] # sio: serial ports (see sio(4)) device lpt0 at isa? port? tty irq 7 vector lptintr device lpt1 at isa? port "IO_LPT3" tty irq 5 vector lptintr device mse0 at isa? port 0x23c tty irq 5 vector mseintr device psm0 at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr # Options for psm: options PSM_HOOKAPM #hook the APM resume event, useful #for some laptops options PSM_RESETAFTERSUSPEND #reset the device at the resume event device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 vector siointr # # `flags' for serial drivers that support consoles (only for sio now): # 0x10 enable console support for this unit. The other console flags # are ignored unless this is set. Enabling console support does # not make the unit the preferred console - boot with -h or set # the 0x20 flag for that. Currently, at most one unit can have # console support; the first one (in config file order) with # this flag set is preferred. Setting this flag for sio0 gives # the old behaviour. # 0x20 force this unit to be the console (unless there is another # higher priority console). This replaces the COMCONSOLE option. # 0x40 reserve this unit for low level console operations. Do not # # PnP `flags' (set via userconfig using pnp x flags y) # 0x1 disable probing of this device. Used to prevent your modem # from being attached as a PnP modem. # # Options for serial drivers that support consoles (only for sio now): options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to #DDB, if available. options CONSPEED=9600 #default speed for serial console (default 9600) # Options for sio: options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs options DSI_SOFT_MODEM #code for DSI Softmodems options "EXTRA_SIO=2" #number of extra sio ports to allocate # Other flags for sio that aren't documented in the man page. # 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for # ST16650A-compatible UARTs. # # Network interfaces: `cx', `ed', `el', `ep', `ie', `is', `le', `lnc' # # ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver (requires sppp) # cx: Cronyx/Sigma multiport sync/async (with Cisco or PPP framing) # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # el: 3Com 3C501 (slow!) # ep: 3Com 3C509 (buggy) # fe: Fujitsu MB86960A/MB86965A Ethernet # ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; Intel EtherExpress # le: Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100, # DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422) # lnc: Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL) # sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp) # wl: Lucent Wavelan (ISA card only). # ze: IBM/National Semiconductor PCMCIA ethernet controller. # zp: 3Com PCMCIA Etherlink III (It does not require shared memory for # send/receive operation, but it needs 'iomem' to read/write the # attribute memory) # device ar0 at isa? port 0x300 net irq 10 iomem 0xd0000 vector arintr device cx0 at isa? port 0x240 net irq 15 drq 7 vector cxintr device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr device eg0 at isa? port 0x310 net irq 5 vector egintr device el0 at isa? port 0x300 net irq 9 vector elintr device ep0 at isa? port 0x300 net irq 10 vector epintr device ex0 at isa? port? net irq? vector exintr device fe0 at isa? port 0x300 net irq ? vector feintr device ie0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector ieintr device ie1 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr device lnc0 at isa? port 0x300 net irq 10 drq 0 vector lncintr device sr0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector srintr options WLCACHE # enables the signal-strength cache options WLDEBUG # enables verbose debugging output device wl0 at isa? port 0x300 net irq ? vector wlintr # We can (bogusly) include both the dedicated PCCARD drivers and the generic # support when COMPILING_LINT. device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000 vector zpintr # # ATM related options # # The `en' device provides support for Efficient Networks (ENI) # ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). # # atm pseudo-device provides generic atm functions and is required for # atm devices. # NATM enables the netnatm protocol family that can be used to # bypass TCP/IP. # # the current driver supports only PVC operations (no atm-arp, no multicast). # for more details, please read the original documents at # http://www.ccrc.wustl.edu/pub/chuck/bsdatm/wucs.html # pseudo-device atm device en0 device en1 options NATM #native ATM # # Audio drivers: `snd', `sb', `pas', `gus', `pca' # # snd: Voxware sound support code # sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum # sbxvi: SoundBlaster 16 # sbmidi: SoundBlaster 16 MIDI interface # pas: ProAudioSpectrum PCM and MIDI # gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX # gusxvi: Gravis Ultrasound 16-bit PCM (do not use) # mss: Microsoft Sound System # css: Crystal Sound System (CSS 423x PnP) # sscape: Ensoniq Soundscape MIDI interface # sscape_mss: Ensoniq Soundscape PCM (requires sscape) # opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum # uart: stand-alone 6850 UART for MIDI # mpu: Roland MPU-401 stand-alone card # # Beware! The addresses specified below are also hard-coded in # i386/isa/sound/sound_config.h. If you change the values here, you # must also change the values in the include file. # # pcm: PCM audio through various sound cards. # # This is the work in progress from Luigi Rizzo. This has support for # CS423x based cards, OPTi931, SB16 PnP, GusPnP. For more information # about this driver, take a look at sys/i386/isa/snd/README. # # The flags of the device tells the device a bit more info about the # device that normally is obtained through the PnP interface. # bit 2..0 secondary DMA channel; # bit 4 set if the board uses two dma channels; # bit 15..8 board type, overrides autodetection; leave it # zero if don't know what to put in (and you don't, # since this is unsupported at the moment...). # # This driver will use the new PnP code if it's available. # # pca: PCM audio through your PC speaker # # If you have a GUS-MAX card and want to use the CS4231 codec on the # card the drqs for the gus max must be 8 bit (1, 2, or 3). # # If you would like to use the full duplex option on the gus, then define # flags to be the ``read dma channel''. # # options BROKEN_BUS_CLOCK #PAS-16 isn't working and OPTI chipset # options SYMPHONY_PAS #PAS-16 isn't working and SYMPHONY chipset # options EXCLUDE_SBPRO #PAS-16 # options SBC_IRQ=5 #PAS-16. Must match irq on sb0 line. # PAS16: The order of the pas0/sb0/opl0 is important since the # sb emulation is enabled in the pas-16 attach. # # The i386/isa/sound/sound.doc has more information. # Controls all "VOXWARE" driver sound devices. See Luigi's driver # below for an alternate which may work better for some cards. # controller snd0 device pas0 at isa? port 0x388 irq 10 drq 6 vector pasintr device sb0 at isa? port 0x220 irq 5 drq 1 vector sbintr device sbxvi0 at isa? drq 5 device sbmidi0 at isa? port 0x330 device awe0 at isa? port 0x620 device gus0 at isa? port 0x220 irq 12 drq 1 vector gusintr #device gus0 at isa? port 0x220 irq 12 drq 1 flags 0x3 vector gusintr device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr device css0 at isa? port 0x534 irq 5 drq 1 flags 0x08 vector adintr device sscape0 at isa? port 0x330 irq 9 drq 0 vector sscapeintr device trix0 at isa? port 0x330 irq 6 drq 0 vector sscapeintr device sscape_mss0 at isa? port 0x534 irq 5 drq 1 vector sndintr device opl0 at isa? port 0x388 device mpu0 at isa? port 0x330 irq 6 drq 0 device uart0 at isa? port 0x330 irq 5 vector "m6850intr" # Luigi's snd code (use INSTEAD of snd0 and all VOXWARE drivers!). # You may also wish to enable the pnp controller with this, for pnp # sound cards. # #device pcm0 at isa? port ? tty irq 10 drq 1 flags 0x0 vector pcmintr # Not controlled by `snd' device pca0 at isa? port IO_TIMER1 tty # # Miscellaneous hardware: # # mcd: Mitsumi CD-ROM # scd: Sony CD-ROM # matcd: Matsushita/Panasonic CD-ROM # wt: Wangtek and Archive QIC-02/QIC-36 tape drives # ctx: Cortex-I frame grabber # apm: Laptop Advanced Power Management (experimental) # spigot: The Creative Labs Video Spigot video-acquisition board # meteor: Matrox Meteor video capture board # alog: Industrial Computer Source AIO8-P driver # bktr: Bt848 capture boards (http://www.freebsd.org/~fsmp/HomeAuto/Bt848.html) # cy: Cyclades serial driver # dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!) # gp: National Instruments AT-GPIB and AT-GPIB/TNT board # asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey # gsc: Genius GS-4500 hand scanner. # joy: joystick # labpc: National Instrument's Lab-PC and Lab-PC+ # rc: RISCom/8 multiport card # rp: Comtrol Rocketport(ISA) - single card # tw: TW-523 power line interface for use with X-10 home control products # si: Specialix SI/XIO 4-32 port terminal multiplexor # stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based) # stli: Stallion EasyConnection 8/64, ONboard, Brumby (intelligent) # # Notes on APM # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. # 0x0011 Limit APM protocol to 1.1 or 1.0 # 0x0010 Limit APM protocol to 1.0 # # # Notes on the spigot: # The video spigot is at 0xad6. This port address can not be changed. # The irq values may only be 10, 11, or 15 # I/O memory is an 8kb region. Possible values are: # 0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff # The start address must be on an even boundary. # Add the following option if you want to allow non-root users to be able # to access the spigot. This option is not secure because it allows users # direct access to the I/O page. # options SPIGOT_UNSECURE # # Notes on the Comtrol Rocketport driver: # # The exact values used for rp0 depend on how many boards you have # in the system. The manufacturer's sample configs are listed as: # # Comtrol Rocketport ISA single card # device rp0 at isa? port 0x280 tty # # If instead you have two ISA cards, one installed at 0x100 and the # second installed at 0x180, then you should add the following to # your kernel configuration file: # # device rp0 at isa? port 0x100 tty # device rp1 at isa? port 0x180 tty # # For 4 ISA cards, it might be something like this: # # device rp0 at isa? port 0x180 tty # device rp1 at isa? port 0x100 tty # device rp2 at isa? port 0x340 tty # device rp3 at isa? port 0x240 tty # # And for PCI cards, you only need say: # # device rp0 # device rp1 # ... # Note: Make sure that any Rocketport PCI devices are specified BEFORE the # ISA Rocketport devices. # Notes on the Digiboard driver: # # The following flag values have special meanings: # 0x01 - alternate layout of pins # 0x02 - use the windowed PC/Xe in 64K mode # Notes on the Specialix SI/XIO driver: # **This is NOT a Specialix supported Driver!** # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. # Notes on the Stallion stl and stli drivers: # See src/i386/isa/README.stl for complete instructions. # This is version 0.0.5alpha, unsupported by Stallion. # The stl driver has a secondary IO port hard coded at 0x280. You need # to change src/i386/isa/stallion.c if you reconfigure this on the boards. # The "flags" and "iosiz" settings on the stli driver depend on the board: # EasyConnection 8/64 ISA: flags 23 iosiz 0x1000 # EasyConnection 8/64 EISA: flags 24 iosiz 0x10000 # EasyConnection 8/64 MCA: flags 25 iosiz 0x1000 # ONboard ISA: flags 4 iosiz 0x10000 # ONboard EISA: flags 7 iosiz 0x10000 # ONboard MCA: flags 3 iosiz 0x10000 # Brumby: flags 2 iosiz 0x4000 # Stallion: flags 1 iosiz 0x10000 device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr # for the Sony CDU31/33A CDROM device scd0 at isa? port 0x230 bio # for the SoundBlaster 16 multicd - up to 4 devices controller matcd0 at isa? port 0x230 bio device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr device ctx0 at isa? port 0x230 iomem 0xd0000 device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr device apm0 at isa? device gp0 at isa? port 0x2c0 tty device gsc0 at isa? port "IO_GSC1" tty drq 3 device joy0 at isa? port "IO_GAME" device alog0 at isa? port 0x260 tty irq 5 vector alogintr device cy0 at isa? tty irq 10 iomem 0xd4000 iosiz 0x2000 vector cyintr device dgb0 at isa? port 0x220 iomem 0xfc0000 iosiz ? tty device labpc0 at isa? port 0x260 tty irq 5 vector labpcintr device rc0 at isa? port 0x220 tty irq 12 vector rcintr device rp0 at isa? port 0x280 tty # the port and irq for tw0 are fictitious device tw0 at isa? port 0x380 tty irq 11 vector twintr device si0 at isa? iomem 0xd0000 tty irq 12 device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr device bqu0 at isa? port 0x150 device stl0 at isa? port 0x2a0 tty irq 10 vector stlintr device stli0 at isa? port 0x2a0 tty iomem 0xcc000 flags 23 iosiz 0x1000 device loran0 at isa? port ? tty irq 5 vector loranintr # # EISA devices: # # The EISA bus device is eisa0. It provides auto-detection and # configuration support for all devices on the EISA bus. # # The `ahb' device provides support for the Adaptec 174X adapter. # # The `ahc' device provides support for the Adaptec 274X and 284X # adapters. The 284X, although a VLB card responds to EISA probes. # # fea: DEC DEFEA EISA FDDI adapter # controller eisa0 controller ahb0 controller ahc0 device fea0 # enable tagged command queuing, which is a major performance win on # devices that support it (and controllers with enough SCB's) options AHC_TAGENABLE # enable SCB paging - See the ahc.4 man page options AHC_SCBPAGING_ENABLE # The aic7xxx driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. Unfortunately, # this doesn't work on some motherboards, which prevents it from being the # default. options AHC_ALLOW_MEMIO # By default, only 10 EISA slots are probed, since the slot numbers # above clash with the configuration address space of the PCI subsystem, # and the EISA probe is not very smart about this. This is sufficient # for most machines, but in particular the HP NetServer LC series comes # with an onboard AIC7770 dual-channel SCSI controller on EISA slot #11, # thus you need to bump this figure to 12 for them. options "EISA_SLOTS=12" # # PCI devices: # # The main PCI bus device is `pci'. It provides auto-detection and # configuration support for all devices on the PCI bus, using either # configuration mode defined in the PCI specification. # # The `ahc' device provides support for the Adaptec 29/3940(U)(W) # and motherboard based AIC7870/AIC7880 adapters. # # The `ncr' device provides support for the NCR 53C810 and 53C825 # self-contained SCSI host adapters. # # The `amd' device provides support for the Tekram DC-390 and 390T # SCSI host adapters, but is expected to work with any AMD 53c974 # PCI SCSI chip and the AMD Ethernet+SCSI Combo chip, after some # local patches were applied to the sources (that had originally # been written by Tekram and limited to work with their SCSI cards). # # The `de' device provides support for the Digital Equipment DC21040 # self-contained Ethernet adapter. # # The `fxp' device provides support for the Intel EtherExpress Pro/100B # PCI Fast Ethernet adapters. # # The `tx' device provides support for the SMC 9432TX cards. # # The `vx' device provides support for the 3Com 3C590 and 3C595 # early support # # The `fpa' device provides support for the Digital DEFPA PCI FDDI # adapter. pseudo-device fddi is also needed. # # The `meteor' device is a PCI video capture board. It can also have the # following options: # options METEOR_ALLOC_PAGES=xxx preallocate kernel pages for data entry # figure (ROWS*COLUMN*BYTES_PER_PIXEL*FRAME+PAGE_SIZE-1)/PAGE_SIZE # options METEOR_DEALLOC_PAGES remove all allocated pages on close(2) # options METEOR_DEALLOC_ABOVE=xxx remove all allocated pages above the # specified amount. If this value is below the allocated amount no action # taken # option METEOR_SYSTEM_DEFAULT={METEOR_PAL|METEOR_NTSC|METEOR_SECAM}, used # for initialization of fps routine when a signal is not present. # # The 'bktr' device is a PCI video capture board. It also has a TV tuner # on board. # controller pci0 controller ahc1 controller ncr0 controller amd0 device de0 device fxp0 device tx0 device vx0 device fpa0 device meteor0 device bktr0 # # PCCARD/PCMCIA # # card: slot controller # pcic: slots controller card0 controller pcic0 at card? controller pcic1 at card? # # Laptop/Notebook options: # # See also: # apm under `Miscellaneous hardware' # above. # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: options POWERFAIL_NMI # make it beep instead of panicing # # Parallel-Port Bus # # Parallel port bus support is provided by the `ppbus' device. # Multiple devices may be attached to the parallel port, devices # are automatically probed and attached when found. # # Supported devices: # vpo Iomega Zip Drive # Requires SCSI disk support ('scbus' and 'sd'), best # performance is achieved with ports in EPP 1.9 mode. # nlpt Parallel Printer # ppi General-purpose I/O ("Geek Port") # # Supported interfaces: # ppc ISA-bus parallel port interfaces. # controller ppbus0 controller vpo0 at ppbus? device nlpt0 at ppbus? device ppi0 at ppbus? device pps0 at ppbus? controller ppc0 at isa? disable port ? irq 7 vector ppcintr # Kernel BOOTP support options BOOTP # Use BOOTP to obtain IP address/hostname options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options "BOOTP_NFSV3" # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options "BOOTP_WIRED_TO=fxp0" # Use interface fxp0 for BOOTP # # An obsolete option to test kern_opt.c. # options GATEWAY # If you want to disable loadable kernel modules (LKM), you # might want to use this option. #options NO_LKM # # Add tie-ins for a hardware watchdog. This only enable the hooks; # the user must still supply the actual driver. # options HW_WDOG # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options "PMAP_SHPGPERPROC=201" # More undocumented options for linting. options CLK_CALIBRATION_LOOP options "CLK_USE_I8254_CALIBRATION" options CLK_USE_TSC_CALIBRATION options CLUSTERDEBUG options COMPAT_LINUX options CPU_UPGRADE_HW_CACHE options DEBUG options "DEBUG_1284" options DEVFS_ROOT #options DISABLE_PSE options "EXT2FS" options "I586_PMC_GUPROF=0x70000" options "IBCS2" # broken: #options IPFILTER options KEY options KEY_DEBUG options LOCKF_DEBUG options LOUTB options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 options KBDIO_DEBUG=2 options MSGMNB=2049 options MSGMNI=41 options MSGSEG=2049 options MSGSSZ=16 options MSGTQL=41 options NBUF=512 options NETATALKDEBUG options NMBCLUSTERS=1024 options NPX_DEBUG options NULLFS_DIAGNOSTIC options PANIC_REBOOT_WAIT_TIME=16 options "PCVT_24LINESDEF" options PCVT_CTRL_ALT_DEL options PCVT_EMU_MOUSE options PCVT_FREEBSD=211 options PCVT_META_ESC options PCVT_NSCREENS=9 options PCVT_PRETTYSCRNS options PCVT_SCANSET=2 options PCVT_SCREENSAVER options PCVT_USEKBDSEC options "PCVT_VT220KEYB" options PSM_DEBUG=1 options "SCSI_2_DEF" options SCSI_DELAY=8 # Be pessimistic about Joe SCSI device options SCSI_NCR_DEBUG options SCSI_NCR_DFLT_TAGS=4 options SCSI_NCR_MAX_SYNC=10000 options SCSI_NCR_MAX_WIDE=1 options SCSI_NCR_MYADDR=7 options SEMMAP=31 options SEMMNI=11 options SEMMNS=61 options SEMMNU=31 options SEMMSL=61 options SEMOPM=101 options SEMUME=11 options SHOW_BUSYBUFS # List buffers that prevent root unmount options SHMALL=1025 options "SHMMAX=(SHMMAXPGS*PAGE_SIZE+1)" options SHMMAXPGS=1025 options SHMMIN=2 options SHMMNI=33 options SHMSEG=9 options SI_DEBUG options SIMPLELOCK_DEBUG options SPX_HACK # The 'dpt' driver provides support for DPT controllers (http://www.dpt.com/). # These have hardware RAID-{0,1,5} support, and do multi-initiator I/O. # See sys/dev/dpt for debugging and other subtle options. # DPT_VERIFY_HINTR Performs some strict hardware interrupts testing. # Only use if you suspect PCI bus corruption problems # DPT_RESTRICTED_FREELIST Normally, the freelisat used by the DPT for queue # will grow to accomodate increased use. This growth # will NOT shrink. To restrict the number of queue # slots to exactly what the DPT can hold at one time, # enable this option. # DPT_MEASURE_PERFORMANCE Enables a set of (semi)invasive metrics. Various # instruments are enabled. Assumed to be enabled by # /usr/sbin/dpt_* tools. # DPT_FREELIST_IS_STACK For optimat L{1,2} CPU cache utilization, enable # this option. Otherwise, the transaction queue is # a LIFO. I cannot measure the performance gain. # DPT_HANDLE_TIMEOUTS Normally device timeouts are handled by the DPT. # If you ant the driver to handle timeouts, enable # this option. If your system is very busy, this # option will create more trouble than solve. # DPT_TIMEOUT_FACTOR Used to compute the excessive amount of time to # wait when timing out with the above option. # DPT_DEBUG_xxxx These are controllable from sys/dev/dpt/dpt.h # DPT_LOST_IRQ When enabled, will try, once per second, to catch # any interrupt that got lost. Seems to help in some # DPT-firmware/Motherboard combinations. Minimal # cost, great benefit. controller dpt0 # DPT options options DPT_VERIFY_HINTR options DPT_RESTRICTED_FREELIST options DPT_MEASURE_PERFORMANCE options DPT_FREELIST_IS_STACK options DPT_HANDLE_TIMEOUTS options DPT_TIMEOUT_FACTOR=4 options DPT_INTR_DELAY=200 # Some motherboards need that options DPT_LOST_IRQ diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 682914cc1104..c72b9d6ad301 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -1,1527 +1,1540 @@ # # LINT -- config file for checking all the sources, tries to pull in # as much of the source tree as it can. # -# $Id: LINT,v 1.420 1998/03/21 14:13:47 peter Exp $ +# $Id: LINT,v 1.421 1998/03/24 02:55:03 yokota Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from # this file as required. # # # This directive is mandatory; it defines the architecture to be # configured for; in this case, the 386 family based IBM-PC and # compatibles. # machine "i386" # # This is the ``identification'' of the kernel. Usually this should # be the same as the name of your kernel. # ident LINT # # The `maxusers' parameter controls the static sizing of a number of # internal system tables by a complicated formula defined in param.c. # maxusers 10 # # Certain applications can grow to be larger than the 128M limit # that FreeBSD initially imposes. Below are some options to # allow that limit to grow to 256MB, and can be increased further # with changing the parameters. MAXDSIZ is the maximum that the # limit can be set to, and the DFLDSIZ is the default value for # the limit. You might want to set the default lower than the # max, and explicitly set the maximum with a shell command for processes # that regularly exceed the limit like INND. # options "MAXDSIZ=(256*1024*1024)" options "DFLDSIZ=(256*1024*1024)" # When this is set, be extra conservative in various parts of the kernel # and choose functionality over speed (on the widest variety of systems). options FAILSAFE # This allows you to actually store this configuration file into # the kernel binary itself, where it may be later read by saying: # strings /kernel | grep ^___ | sed -e 's/^___//' > MYKERNEL # options INCLUDE_CONFIG_FILE # Include this file in kernel # # This directive defines a number of things: # - The compiled kernel is to be called `kernel' # - The root filesystem might be on partition wd0a # - Crash dumps will be written to wd0b, if possible. Specifying the # dump device here is not recommended. Use dumpon(8). # config kernel root on wd0 dumps on wd0 ##################################################################### # SMP OPTIONS: # # SMP enables building of a Symmetric MultiProcessor Kernel. # APIC_IO enables the use of the IO APIC for Symmetric I/O. # NCPU sets the number of CPUs, defaults to 2. # NBUS sets the number of busses, defaults to 4. # NAPIC sets the number of IO APICs on the motherboard, defaults to 1. # NINTR sets the total number of INTs provided by the motherboard. # # Notes: # # An SMP kernel will ONLY run on an Intel MP spec. qualified motherboard. # # Be sure to disable 'cpu "I386_CPU"' && 'cpu "I486_CPU"' for SMP kernels. # # Check the 'Rogue SMP hardware' section to see if additional options # are required by your hardware. # # Mandatory: options SMP # Symmetric MultiProcessor Kernel options APIC_IO # Symmetric (APIC) I/O # Optional, these are the defaults plus 1: options NCPU=5 # number of CPUs options NBUS=5 # number of busses options NAPIC=2 # number of IO APICs options NINTR=25 # number of INTs # # Rogue SMP hardware: # # Bridged PCI cards: # # The MP tables of most of the current generation MP motherboards # do NOT properly support bridged PCI cards. To use one of these # cards you should refer to ??? ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. This is especially true removing # I386_CPU. # cpu "I386_CPU" cpu "I486_CPU" cpu "I586_CPU" # aka Pentium(tm) cpu "I686_CPU" # aka Pentium Pro(tm) # # Options for CPU features. # # CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM # BlueLightning CPU. It works only with Cyrix FPU, and this option # should not be used with Intel FPU. # # CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning # CPU if CPU supports it. The default is double-clock mode on # BlueLightning CPU box. # # CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). # # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct # mapped mode. Default is 2-way set associative mode. # # CPU_CYRIX_NO_LOCK enables weak locking for the entire address space # of Cyrix 6x86 and 6x86MX CPUs. If this option is not set and # FAILESAFE is defined, NO_LOCK bit of CCR1 is cleared. (NOTE 3) # # CPU_DISABLE_5X86_LSSER disables load store serialize (i.e. enables # reorder). This option should not be used if you use memory mapped # I/O device(s). # # CPU_FASTER_5X86_FPU enables faster FPU exception handler. # # CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products # for i386 machines. # # CPU_IORT defines I/O clock delay time (NOTE 1). Default vaules of # I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively # (no clock delay). # # CPU_LOOP_EN prevents flushing the prefetch buffer if the destination # of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE # 1). # # CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). # # CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU # enters suspend mode following execution of HALT instruction. # # CPU_WT_ALLOC enables write-through allocation. # # CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache # flush at hold state. # # CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs # without cache flush at hold state, and (2) write-back CPU cache on # Cyrix 6x86 whose revision < 2.7 (NOTE 2). # # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is # executed. This should be included for ALL kernels that won't run # on a Pentium. # # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_ENand CPU_RSTK_EN should no be used becasue of CPU bugs. # These options may crash your system. # # NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled # in write-through mode when revision < 2.7. If revision of Cyrix # 6x86 >= 2.7, CPU cache is always enabled in write-back mode. # # NOTE 3: This option may cause failures for software that requires # locked cycles in order to operate correctly. # options "CPU_BLUELIGHTNING_FPU_OP_CACHE" options "CPU_BLUELIGHTNING_3X" options "CPU_BTB_EN" options "CPU_DIRECT_MAPPED_CACHE" options "CPU_DISABLE_5X86_LSSER" options "CPU_FASTER_5X86_FPU" options "CPU_I486_ON_386" options "CPU_IORT" options "CPU_LOOP_EN" options "CPU_RSTK_EN" options "CPU_SUSP_HLT" options "CYRIX_CACHE_WORKS" options "CYRIX_CACHE_REALLY_WORKS" #options "NO_F00F_HACK" # # A math emulator is mandatory if you wish to run on hardware which # does not have a floating-point processor. Pick either the original, # bogus (but freely-distributable) math emulator, or a much more # fully-featured but GPL-licensed emulator taken from Linux. # options MATH_EMULATE #Support for x87 emulation # Don't enable both of these in a real config. options GPL_MATH_EMULATE #Support for x87 emulation via #new math emulator ##################################################################### # COMPATIBILITY OPTIONS # # Implement system calls compatible with 4.3BSD and older versions of # FreeBSD. You probably do NOT want to remove this as much current code # still relies on the 4.3 emulation. # options "COMPAT_43" # # Allow user-mode programs to manipulate their local descriptor tables. # This option is required for the WINE Windows(tm) emulator, and is # not used by anything else (that we know of). # options USER_LDT #allow user-level control of i386 ldt # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared # memory, semaphores, and message queues, respectively. # options SYSVSHM options SYSVSEM options SYSVMSG # # This option includes a MD5 routine in the kernel, this is used for # various authentication and privacy uses. # options "MD5" # # Allow processes to switch to vm86 mode, as well as enabling direct # user-mode access to the I/O port space. This option is necessary for # the doscmd emulator to run. # options "VM86" ##################################################################### # DEBUGGING OPTIONS # # Enable the kernel debugger. # options DDB # # Don't drop into DDB for a panic. Intended for unattended operation # where you may want to drop to DDB from the console, but still want # the machine to recover from a panic # options DDB_UNATTENDED # # If using GDB remote mode to debug the kernel, there's a non-standard # extension to the remote protocol that can be used to use the serial # port as both the debugging port and the system console. It's non- # standard and you're on your own if you enable it. See also the # "remotechat" variables in the FreeBSD specific version of gdb. # options GDB_REMOTE_CHAT # # KTRACE enables the system-call tracing facility ktrace(2). # options KTRACE #kernel tracing # # The DIAGNOSTIC option is used in a number of source files to enable # extra sanity checking of internal structures. This support is not # enabled by default because of the extra time it would take to check # for these conditions, which can only occur as a result of # programming errors. # options DIAGNOSTIC # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # options PERFMON # # This option let some drivers co-exist that can't co-exist in a running # system. This is used to be able to compile all kernel code in one go for # quality assurance purposes (like this file, which the option takes it name # from.) # options COMPILING_LINT # XXX - this doesn't belong here. # Allow ordinary users to take the console - this is useful for X. options UCONSOLE # XXX - this doesn't belong here either options USERCONFIG #boot -c editor options USERCONFIG_BOOT #imply -c and parse info area options VISUAL_USERCONFIG #visual boot -c editor ##################################################################### # NETWORKING OPTIONS # # Protocol families: # Only the INET (Internet) family is officially supported in FreeBSD. # Source code for the NS (Xerox Network Service) is provided for amusement # value. # options INET #Internet communications protocols options IPX #IPX/SPX communications protocols options IPXIP #IPX in IP encapsulation (not available) options IPTUNNEL #IP in IPX encapsulation (not available) options NETATALK #Appletalk communications protocols # These are currently broken but are shipped due to interest. #options NS #Xerox NS protocols # These are currently broken and are no longer shipped due to lack # of interest. #options CCITT #X.25 network layer #options ISO #options TPIP #ISO TP class 4 over IP #options TPCONS #ISO TP class 0 over X.25 #options LLC #X.25 link layer for Ethernets #options HDLC #X.25 link layer for serial lines #options EON #ISO CLNP over IP #options NSIP #XNS over IP # # Network interfaces: # The `loop' pseudo-device is MANDATORY when networking is enabled. # The `ether' pseudo-device provides generic code to handle # Ethernets; it is MANDATORY when a Ethernet device driver is # configured. # The 'fddi' pseudo-device provides generic code to support FDDI. # The `sppp' pseudo-device serves a similar role for certain types # of synchronous PPP links (like `cx', `ar'). # The `sl' pseudo-device implements the Serial Line IP (SLIP) service. # The `ppp' pseudo-device implements the Point-to-Point Protocol. # The `bpfilter' pseudo-device enables the Berkeley Packet Filter. Be # aware of the legal and administrative consequences of enabling this # option. The number of devices determines the maximum number of # simultaneous BPF clients programs runnable. # The `disc' pseudo-device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing purposes. # The `tun' pseudo-device implements the User Process PPP (iijppp) # # The PPP_BSDCOMP option enables support for compress(1) style entire # packet compression, the PPP_DEFLATE is for zlib/gzip style compression. # PPP_FILTER enables code for filtering the ppp data stream and selecting # events for resetting the demand dial activity timer - requires bpfilter. # See pppd(8) for more details. # pseudo-device ether #Generic Ethernet pseudo-device fddi #Generic FDDI pseudo-device sppp #Generic Synchronous PPP pseudo-device loop #Network loopback device pseudo-device bpfilter 4 #Berkeley packet filter pseudo-device disc #Discard device pseudo-device tun 1 #Tunnel driver (user process ppp(8)) pseudo-device sl 2 #Serial Line IP pseudo-device ppp 2 #Point-to-point protocol options PPP_BSDCOMP #PPP BSD-compress support options PPP_DEFLATE #PPP zlib/deflate/gzip support options PPP_FILTER #enable bpf filtering (needs bpfilter) # # Internet family options: # # TCP_COMPAT_42 causes the TCP code to emulate certain bugs present in # 4.2BSD. This option should not be used unless you have a 4.2BSD # machine and TCP connections fail. # # MROUTING enables the kernel multicast packet forwarder, which works # with mrouted(8). # # IPFIREWALL enables support for IP firewall construction, in # conjunction with the `ipfw' program. IPFIREWALL_VERBOSE sends # logged packets to the system logger. IPFIREWALL_VERBOSE_LIMIT # limits the number of times a matching entry can be logged. # # WARNING: IPFIREWALL defaults to a policy of "deny ip from any to any" # and if you do not add other rules during startup to allow access, # YOU WILL LOCK YOURSELF OUT. It is suggested that you set firewall=open # in /etc/rc.conf when first enabling this feature, then refining the # firewall rules in /etc/rc.firewall after you've tested that the new kernel # feature works properly. # # IPFIREWALL_DEFAULT_TO_ACCEPT causes the default rule (at boot) to # allow everything. Use with care, if a cracker can crash your # firewall machine, they can get to your protected machines. However, # if you are using it as an as-needed filter for specific problems as # they arise, then this may be for you. Changing the default to 'allow' # means that you won't get stuck if the kernel and /sbin/ipfw binary get # out of sync. # # IPDIVERT enables the divert IP sockets, used by ``ipfw divert'' # # IPFILTER enables Darren Reed's ipfilter package. # IPFILTER_LOG enables ipfilter's logging. # IPFILTER_LKM enables LKM support for an ipfilter module (untested). # # TCPDEBUG is undocumented. # options "TCP_COMPAT_42" #emulate 4.2BSD TCP bugs options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #print information about # dropped packets options "IPFIREWALL_VERBOSE_LIMIT=100" #limit verbosity options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default options IPDIVERT #divert sockets options IPFILTER #kernel ipfilter support options IPFILTER_LOG #ipfilter logging #options IPFILTER_LKM #kernel support for ip_fil.o LKM options TCPDEBUG ##################################################################### # FILESYSTEM OPTIONS # # Only the root, /usr, and /tmp filesystems need be statically # compiled; everything else will be automatically loaded at mount # time. (Exception: the UFS family---FFS, and MFS --- cannot # currently be demand-loaded.) Some people still prefer to statically # compile other filesystems as well. # # NB: The NULL, PORTAL, UMAP and UNION filesystems are known to be # buggy, and WILL panic your system if you attempt to do anything with # them. They are included here as an incentive for some enterprising # soul to sit down and fix them. # # One of these is mandatory: options FFS #Fast filesystem options NFS #Network File System # The rest are optional: # options NFS_NOSERVER #Disable the NFS-server code. options "CD9660" #ISO 9660 filesystem options FDESC #File descriptor filesystem options KERNFS #Kernel filesystem options MFS #Memory File System options MSDOSFS #MS DOS File System options NULLFS #NULL filesystem options PORTAL #Portal filesystem options PROCFS #Process filesystem options UMAPFS #UID map filesystem options UNION #Union filesystem options "CD9660_ROOT" #CD-ROM usable as root device options FFS_ROOT #FFS usable as root device options NFS_ROOT #NFS usable as root device # This DEVFS is experimental but seems to work options DEVFS #devices filesystem # Allow the FFS to use Softupdates technology. # To do this you need to fetch the two files # /sys/ufs/ffs/softdep.h and /sys/ufs/ffs/ffs_softdep.c # from freebsd.org and understand the licensing restrictions. #options SOFTUPDATES # (we can't actually enable it because the files may not be present) # Make space in the kernel for a MFS root filesystem. Define to the number # of kilobytes to reserve for the filesystem. options MFS_ROOT=10 # Allow the MFS_ROOT code to load the MFS image from floppy if it is missing. options MFS_AUTOLOAD # Allow this many swap-devices. options NSWAPDEV=20 # Disk quotas are supported when this option is enabled. If you # change the value of this option, you must do a `make clean' in your # kernel compile directory in order to get a working kernel. # options QUOTA #enable disk quotas # Add more checking code to various filesystems #options NULLFS_DIAGNOSTIC #options KERNFS_DIAGNOSTIC #options UMAPFS_DIAGNOSTIC #options UNION_DIAGNOSTIC # In particular multi-session CD-Rs might require a huge amount of # time in order to "settle". If we are about mounting them as the # root f/s, we gotta wait a little. # # The number is supposed to be in seconds. options "CD9660_ROOTDELAY=20" # If you are running a machine just as a fileserver for PC and MAC users. # (using SAMBA or Netatalk), then you may consider setting this option # and keeping all those user's directories on a partition that is mounted # with the suiddir option. This gives new files the same ownership as # the directory (similiar to group). It's a security hole if you let # these users run programs so confine it to file-servers, (but it'll save you # lots of headaches in that case). Root owned directories are excempt and X bits # are cleared. the suid bit must be set on the directory as well. see chmod(1) # PC owners can't see/set ownerships so they keep getting their toes # trodden on. This saves you all the support calls as the filesystem # it's used on will act as they expect. ("It's my dir so it must be my file"). # options SUIDDIR # Add some error checking code to the null_bypass routine # in the NULL filesystem #options SAFETY ##################################################################### # SCSI DEVICES # SCSI DEVICE CONFIGURATION # The SCSI subsystem consists of the `base' SCSI code, a number of # high-level SCSI device `type' drivers, and the low-level host-adapter # device drivers. The host adapters are listed in the ISA and PCI # device configuration sections below. # # Beginning with FreeBSD 2.0.5 you can wire down your SCSI devices so # that a given bus, target, and LUN always come on line as the same # device unit. In earlier versions the unit numbers were assigned # in the order that the devices were probed on the SCSI bus. This # means that if you removed a disk drive, you may have had to rewrite # your /etc/fstab file, and also that you had to be careful when adding # a new disk as it may have been probed earlier and moved your device # configuration around. # This old behavior is maintained as the default behavior. The unit # assignment begins with the first non-wired down unit for a device # type. For example, if you wire a disk as "sd3" then the first # non-wired disk will be assigned sd4. # The syntax for wiring down devices is: # controller scbus0 at ahc0 # Single bus device # controller scbus1 at ahc1 bus 0 # Single bus device # controller scbus3 at ahc2 bus 0 # Twin bus device # controller scbus2 at ahc2 bus 1 # Twin bus device # disk sd0 at scbus0 target 0 unit 0 # disk sd1 at scbus3 target 1 # disk sd2 at scbus2 target 3 # tape st1 at scbus1 target 6 # device cd0 at scbus? # "units" (SCSI logical unit number) that are not specified are # treated as if specified as LUN 0. # All SCSI devices allocate as many units as are required. # The "unknown" device (uk? in pre-2.0.5) is now part of the base SCSI # configuration and doesn't have to be explicitly configured. controller scbus0 #base SCSI code device ch0 #SCSI media changers device sd0 #SCSI disks device st0 #SCSI tapes device cd0 #SCSI CD-ROMs device od0 #SCSI optical disk # The previous devices (ch, sd, st, cd) are recognized by config. # config doesn't (and shouldn't) know about these newer ones, # so we have to specify that they are on a SCSI bus with the "at scbus?" # clause. device worm0 at scbus? # SCSI worm device pt0 at scbus? # SCSI processor type device sctarg0 at scbus? # SCSI target # SCSI OPTIONS: # SCSIDEBUG: When defined enables debugging macros # NO_SCSI_SENSE: When defined disables sense descriptions (about 4k) # SCSI_REPORT_GEOMETRY: Always report disk geometry at boot up instead # of only when booting verbosely. options SCSIDEBUG #options NO_SCSI_SENSE options SCSI_REPORT_GEOMETRY # Options for the `od' optical disk driver: # # If drive returns sense key as 0x02 with vendor specific additional # sense code (ASC) and additional sense code qualifier (ASCQ), or # illegal ASC and ASCQ. This cause an error (NOT READY) and retrying. # To suppress this, use the following option. # options OD_BOGUS_NOT_READY # # For an automatic spindown, try this. Again, preferably as an # option in your config file. # WARNING! Use at your own risk. Joerg's ancient SONY SMO drive # groks it fine, while Shunsuke's Fujitsu chokes on it and times # out. # options OD_AUTO_TURNOFF + +##################################################################### +# POSIX P1003.1B + +# Real time extensions added int the 1993 Posix +# P1003_1B: Infrastructure +# _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING +# _KPOSIX_VERSION: Version kernel is built for + +options "P1003_1B" +options "_KPOSIX_PRIORITY_SCHEDULING" +options "_KPOSIX_VERSION=199309L" + ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS # The `pty' device usually turns out to be ``effectively mandatory'', # as it is required for `telnetd', `rlogind', `screen', `emacs', and # `xterm', among others. pseudo-device pty 16 #Pseudo ttys - can go as high as 256 pseudo-device speaker #Play IBM BASIC-style noises out your speaker pseudo-device gzip #Exec gzipped a.out's pseudo-device vn #Vnode driver (turns a file into a device) pseudo-device snp 3 #Snoop device - to look at pty/vty/etc.. pseudo-device ccd 4 #Concatenated disk driver # These are only for watching for bitrot in old tty code. # broken #pseudo-device tb # These are only for watching for bitrot in old SCSI code. pseudo-device su #scsi user pseudo-device ssc #super scsi ##################################################################### # HARDWARE DEVICE CONFIGURATION # ISA and EISA devices: # EISA support is available for some device, so they can be auto-probed. # Micro Channel is not supported at all. # # Mandatory ISA devices: isa, npx # controller isa0 # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # Automatic EOI is documented not to work for for the slave with the # original i8259A, but it works for some clones and some integrated # versions. # # BOUNCE_BUFFERS provides support for ISA DMA on machines with more # than 16 megabytes of memory. It doesn't hurt on other machines. # Some broken EISA and VLB hardware may need this, too. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # TUNE_1542 enables the automatic ISA bus speed selection for the # Adaptec 1542 boards. Does not work for all boards, use it with caution. # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. # # PAS_JOYSTICK_ENABLE enables the gameport on the ProAudio Spectrum options "AUTO_EOI_1" #options "AUTO_EOI_2" options BOUNCE_BUFFERS options "MAXMEM=(128*1024)" options "TUNE_1542" #options BROKEN_KEYBOARD_RESET #options PAS_JOYSTICK_ENABLE # Enable support for the kernel PLL to use an external PPS signal, # under supervision of [x]ntpd(8) # More info in ftp://ftp.udel.edu/pub/ntp/kernel.tar.Z options PPS_SYNC # Enable PnP support in the kernel. This allows you to automaticly # attach to PnP cards for drivers that support it and allows you to # configure cards from USERCONFIG. See pnp(4) for more info. controller pnp0 # The pcvt console driver (vt220 compatible). device vt0 at isa? port "IO_KBD" tty irq 1 vector pcrint options XSERVER # support for running an X server. options FAT_CURSOR # start with block cursor # This PCVT option is for keyboards such as those used on IBM ThinkPad laptops options PCVT_SCANSET=2 # IBM keyboards are non-std # The syscons console driver (sco color console compatible). device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr options MAXCONS=16 # number of virtual consoles options SLOW_VGA # do byte-wide i/o's to TS and GDC regs options "STD8X16FONT" # Compile font in makeoptions "STD8X16FONT"="cp850" options SC_HISTORY_SIZE=200 # number of history buffer lines options SC_DISABLE_REBOOT # disable reboot key sequence # # `flags' for sc0: # 0x01 Use a 'visual' bell # 0x02 Use a 'blink' cursor # 0x04 Use a 'underline' cursor # 0x06 Use a 'blinking underline' (destructive) cursor # 0x08 Force detection of keyboard, else we always assume a keyboard # 0x10 Old-style (XT) keyboard support, useful for older ThinkPads # 0x20 Don't reset keyboard, useful for some newer ThinkPads # # The Numeric Processing eXtension driver. This should be configured if # your machine has a math co-processor, unless the coprocessor is very # buggy. If it is not configured then you *must* configure math emulation # (see above). If both npx0 and emulation are configured, then only npx0 # is used (provided it works). device npx0 at isa? port "IO_NPX" iosiz 0x0 flags 0x0 irq 13 vector npxintr # # `flags' for npx0: # 0x01 don't use the npx registers to optimize bcopy # 0x02 don't use the npx registers to optimize bzero # 0x04 don't use the npx registers to optimize copyin or copyout. # The npx registers are normally used to optimize copying and zeroing when # all of the following conditions are satisfied: # "I586_CPU" is an option # the cpu is an i586 (perhaps not a Pentium) # the probe for npx0 succeeds # INT 16 exception handling works. # Then copying and zeroing using the npx registers is normally 30-100% faster. # The flags can be used to control cases where it doesn't work or is slower. # Setting them at boot time using userconfig works right (the optimizations # are not used until later in the bootstrap when npx0 is attached). # # # `iosiz' for npx0: # This can be used instead of the MAXMEM option to set the memory size. If # it is nonzero, then it overrides both the MAXMEM option and the memory # size reported by the BIOS. Setting it at boot time using userconfig takes # effect on the next reboot after the change has been recorded in the kernel # binary (the size is used early in the boot before userconfig has a chance # to change it). # # # Optional ISA and EISA devices: # # # SCSI host adapters: `aha', `aic', `bt', `nca' # # aha: Adaptec 154x # ahc: Adaptec 274x/284x/294x # aic: Adaptec 152x and sound cards using the Adaptec AIC-6360 (slow!) # bt: Most Buslogic controllers # nca: ProAudioSpectrum cards using the NCR 5380 or Trantor T130 # uha: UltraStore 14F and 34F # sea: Seagate ST01/02 8 bit controller (slow!) # wds: Western Digital WD7000 controller (no scatter/gather!). # # Note that the order is important in order for Buslogic cards to be # probed correctly. # controller bt0 at isa? port "IO_BT0" bio irq ? vector bt_isa_intr controller aha0 at isa? port "IO_AHA0" bio irq ? drq 5 vector ahaintr controller uha0 at isa? port "IO_UHA0" bio irq ? drq 5 vector uhaintr controller aic0 at isa? port 0x340 bio irq 11 vector aicintr controller nca0 at isa? port 0x1f88 bio irq 10 vector ncaintr controller nca1 at isa? port 0x1f84 controller nca2 at isa? port 0x1f8c controller nca3 at isa? port 0x1e88 controller nca4 at isa? port 0x350 bio irq 5 vector ncaintr controller sea0 at isa? bio irq 5 iomem 0xdc000 iosiz 0x2000 vector seaintr controller wds0 at isa? port 0x350 bio irq 15 drq 6 vector wdsintr # # ST-506, ESDI, and IDE hard disks: `wdc' and `wd' # # The flags fields are used to enable the multi-sector I/O and # the 32BIT I/O modes. The flags may be used in either the controller # definition or in the individual disk definitions. The controller # definition is supported for the boot configuration stuff. # # Each drive has a 16 bit flags value defined: # The low 8 bits are the maximum value for the multi-sector I/O, # where 0xff defaults to the maximum that the drive can handle. # The high bit of the 16 bit flags (0x8000) allows probing for # 32 bit transfers. Bit 14 (0x4000) enables a hack to wake # up powered-down laptop drives. Bit 13 (0x2000) allows # probing for PCI IDE DMA controllers, such as Intel's PIIX # south bridges. See the wd.4 man page. # # The flags field for the drives can be specified in the controller # specification with the low 16 bits for drive 0, and the high 16 bits # for drive 1. # e.g.: #controller wdc0 at isa? port "IO_WD1" bio irq 14 flags 0x00ff8004 vector wdintr # # specifies that drive 0 will be allowed to probe for 32 bit transfers and # a maximum multi-sector transfer of 4 sectors, and drive 1 will not be # allowed to probe for 32 bit transfers, but will allow multi-sector # transfers up to the maximum that the drive supports. # # If you are using a PCI controller that is not running in compatibility # mode (for example, it is a 2nd IDE PCI interface), then use config line(s) # such as: # #controller wdc2 at isa? port "0" bio irq ? flags 0xa0ffa0ff vector wdintr #disk wd4 at wdc2 drive 0 #disk wd5 at wdc2 drive 1 # #controller wdc3 at isa? port "0" bio irq ? flags 0xa0ffa0ff vector wdintr #disk wd6 at wdc3 drive 0 #disk wd7 at wdc3 drive 1 # # Note that the above config would be useful for a Promise card, when used # on a MB that already has a PIIX controller. Note the bogus irq and port # entries. These are automatically filled in by the IDE/PCI support. # controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr disk wd0 at wdc0 drive 0 disk wd1 at wdc0 drive 1 controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr disk wd2 at wdc1 drive 0 disk wd3 at wdc1 drive 1 # # Options for `wdc': # # CMD640 enables serializing access to primary and secondary channel # of the CMD640B IDE Chip. The serializing will only take place # if this option is set *and* the chip is probed by the pci-system. # options "CMD640" #Enable work around for CMD640 h/w bug # # ATAPI enables the support for ATAPI-compatible IDE devices # options ATAPI #Enable ATAPI support for IDE bus options ATAPI_STATIC #Don't do it as an LKM # IDE CD-ROM driver - requires wdc controller and ATAPI option device wcd0 # IDE floppy driver - requires wdc controller and ATAPI option device wfd0 # # Standard floppy disk controllers and floppy tapes: `fdc', `fd', and `ft' # controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr # # FDC_DEBUG enables floppy debugging. Since the debug output is huge, you # gotta turn it actually on by setting the variable fd_debug with DDB, # however. options FDC_DEBUG # This option is undocumented on purpose. options FDC_PRINT_BOGUS_CHIPTYPE # # Activate this line instead of the fdc0 line above if you happen to # have an Insight floppy tape. Probing them proved to be dangerous # for people with floppy disks only, so it's "hidden" behind a flag: #controller fdc0 at isa? port "IO_FD1" bio flags 1 irq 6 drq 2 vector fdintr disk fd0 at fdc0 drive 0 disk fd1 at fdc0 drive 1 tape ft0 at fdc0 drive 2 # # Other standard PC hardware: `lpt', `mse', `psm', `sio', etc. # # lpt: printer port # lpt specials: # port can be specified as ?, this will cause the driver to scan # the BIOS port list; # the irq and vector clauses may be omitted, this # will force the port into polling mode. # mse: Logitech and ATI InPort bus mouse ports # psm: PS/2 mouse port [note: conflicts with sc0/vt0, thus "conflicts" keywd] # sio: serial ports (see sio(4)) device lpt0 at isa? port? tty irq 7 vector lptintr device lpt1 at isa? port "IO_LPT3" tty irq 5 vector lptintr device mse0 at isa? port 0x23c tty irq 5 vector mseintr device psm0 at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr # Options for psm: options PSM_HOOKAPM #hook the APM resume event, useful #for some laptops options PSM_RESETAFTERSUSPEND #reset the device at the resume event device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 vector siointr # # `flags' for serial drivers that support consoles (only for sio now): # 0x10 enable console support for this unit. The other console flags # are ignored unless this is set. Enabling console support does # not make the unit the preferred console - boot with -h or set # the 0x20 flag for that. Currently, at most one unit can have # console support; the first one (in config file order) with # this flag set is preferred. Setting this flag for sio0 gives # the old behaviour. # 0x20 force this unit to be the console (unless there is another # higher priority console). This replaces the COMCONSOLE option. # 0x40 reserve this unit for low level console operations. Do not # # PnP `flags' (set via userconfig using pnp x flags y) # 0x1 disable probing of this device. Used to prevent your modem # from being attached as a PnP modem. # # Options for serial drivers that support consoles (only for sio now): options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to #DDB, if available. options CONSPEED=9600 #default speed for serial console (default 9600) # Options for sio: options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs options DSI_SOFT_MODEM #code for DSI Softmodems options "EXTRA_SIO=2" #number of extra sio ports to allocate # Other flags for sio that aren't documented in the man page. # 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for # ST16650A-compatible UARTs. # # Network interfaces: `cx', `ed', `el', `ep', `ie', `is', `le', `lnc' # # ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver (requires sppp) # cx: Cronyx/Sigma multiport sync/async (with Cisco or PPP framing) # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # el: 3Com 3C501 (slow!) # ep: 3Com 3C509 (buggy) # fe: Fujitsu MB86960A/MB86965A Ethernet # ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; Intel EtherExpress # le: Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100, # DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422) # lnc: Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL) # sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp) # wl: Lucent Wavelan (ISA card only). # ze: IBM/National Semiconductor PCMCIA ethernet controller. # zp: 3Com PCMCIA Etherlink III (It does not require shared memory for # send/receive operation, but it needs 'iomem' to read/write the # attribute memory) # device ar0 at isa? port 0x300 net irq 10 iomem 0xd0000 vector arintr device cx0 at isa? port 0x240 net irq 15 drq 7 vector cxintr device ed0 at isa? port 0x280 net irq 5 iomem 0xd8000 vector edintr device eg0 at isa? port 0x310 net irq 5 vector egintr device el0 at isa? port 0x300 net irq 9 vector elintr device ep0 at isa? port 0x300 net irq 10 vector epintr device ex0 at isa? port? net irq? vector exintr device fe0 at isa? port 0x300 net irq ? vector feintr device ie0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector ieintr device ie1 at isa? port 0x360 net irq 7 iomem 0xd0000 vector ieintr device le0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector le_intr device lnc0 at isa? port 0x300 net irq 10 drq 0 vector lncintr device sr0 at isa? port 0x300 net irq 5 iomem 0xd0000 vector srintr options WLCACHE # enables the signal-strength cache options WLDEBUG # enables verbose debugging output device wl0 at isa? port 0x300 net irq ? vector wlintr # We can (bogusly) include both the dedicated PCCARD drivers and the generic # support when COMPILING_LINT. device ze0 at isa? port 0x300 net irq 5 iomem 0xd8000 vector zeintr device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000 vector zpintr # # ATM related options # # The `en' device provides support for Efficient Networks (ENI) # ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). # # atm pseudo-device provides generic atm functions and is required for # atm devices. # NATM enables the netnatm protocol family that can be used to # bypass TCP/IP. # # the current driver supports only PVC operations (no atm-arp, no multicast). # for more details, please read the original documents at # http://www.ccrc.wustl.edu/pub/chuck/bsdatm/wucs.html # pseudo-device atm device en0 device en1 options NATM #native ATM # # Audio drivers: `snd', `sb', `pas', `gus', `pca' # # snd: Voxware sound support code # sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum # sbxvi: SoundBlaster 16 # sbmidi: SoundBlaster 16 MIDI interface # pas: ProAudioSpectrum PCM and MIDI # gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX # gusxvi: Gravis Ultrasound 16-bit PCM (do not use) # mss: Microsoft Sound System # css: Crystal Sound System (CSS 423x PnP) # sscape: Ensoniq Soundscape MIDI interface # sscape_mss: Ensoniq Soundscape PCM (requires sscape) # opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum # uart: stand-alone 6850 UART for MIDI # mpu: Roland MPU-401 stand-alone card # # Beware! The addresses specified below are also hard-coded in # i386/isa/sound/sound_config.h. If you change the values here, you # must also change the values in the include file. # # pcm: PCM audio through various sound cards. # # This is the work in progress from Luigi Rizzo. This has support for # CS423x based cards, OPTi931, SB16 PnP, GusPnP. For more information # about this driver, take a look at sys/i386/isa/snd/README. # # The flags of the device tells the device a bit more info about the # device that normally is obtained through the PnP interface. # bit 2..0 secondary DMA channel; # bit 4 set if the board uses two dma channels; # bit 15..8 board type, overrides autodetection; leave it # zero if don't know what to put in (and you don't, # since this is unsupported at the moment...). # # This driver will use the new PnP code if it's available. # # pca: PCM audio through your PC speaker # # If you have a GUS-MAX card and want to use the CS4231 codec on the # card the drqs for the gus max must be 8 bit (1, 2, or 3). # # If you would like to use the full duplex option on the gus, then define # flags to be the ``read dma channel''. # # options BROKEN_BUS_CLOCK #PAS-16 isn't working and OPTI chipset # options SYMPHONY_PAS #PAS-16 isn't working and SYMPHONY chipset # options EXCLUDE_SBPRO #PAS-16 # options SBC_IRQ=5 #PAS-16. Must match irq on sb0 line. # PAS16: The order of the pas0/sb0/opl0 is important since the # sb emulation is enabled in the pas-16 attach. # # The i386/isa/sound/sound.doc has more information. # Controls all "VOXWARE" driver sound devices. See Luigi's driver # below for an alternate which may work better for some cards. # controller snd0 device pas0 at isa? port 0x388 irq 10 drq 6 vector pasintr device sb0 at isa? port 0x220 irq 5 drq 1 vector sbintr device sbxvi0 at isa? drq 5 device sbmidi0 at isa? port 0x330 device awe0 at isa? port 0x620 device gus0 at isa? port 0x220 irq 12 drq 1 vector gusintr #device gus0 at isa? port 0x220 irq 12 drq 1 flags 0x3 vector gusintr device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr device css0 at isa? port 0x534 irq 5 drq 1 flags 0x08 vector adintr device sscape0 at isa? port 0x330 irq 9 drq 0 vector sscapeintr device trix0 at isa? port 0x330 irq 6 drq 0 vector sscapeintr device sscape_mss0 at isa? port 0x534 irq 5 drq 1 vector sndintr device opl0 at isa? port 0x388 device mpu0 at isa? port 0x330 irq 6 drq 0 device uart0 at isa? port 0x330 irq 5 vector "m6850intr" # Luigi's snd code (use INSTEAD of snd0 and all VOXWARE drivers!). # You may also wish to enable the pnp controller with this, for pnp # sound cards. # #device pcm0 at isa? port ? tty irq 10 drq 1 flags 0x0 vector pcmintr # Not controlled by `snd' device pca0 at isa? port IO_TIMER1 tty # # Miscellaneous hardware: # # mcd: Mitsumi CD-ROM # scd: Sony CD-ROM # matcd: Matsushita/Panasonic CD-ROM # wt: Wangtek and Archive QIC-02/QIC-36 tape drives # ctx: Cortex-I frame grabber # apm: Laptop Advanced Power Management (experimental) # spigot: The Creative Labs Video Spigot video-acquisition board # meteor: Matrox Meteor video capture board # alog: Industrial Computer Source AIO8-P driver # bktr: Bt848 capture boards (http://www.freebsd.org/~fsmp/HomeAuto/Bt848.html) # cy: Cyclades serial driver # dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!) # gp: National Instruments AT-GPIB and AT-GPIB/TNT board # asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey # gsc: Genius GS-4500 hand scanner. # joy: joystick # labpc: National Instrument's Lab-PC and Lab-PC+ # rc: RISCom/8 multiport card # rp: Comtrol Rocketport(ISA) - single card # tw: TW-523 power line interface for use with X-10 home control products # si: Specialix SI/XIO 4-32 port terminal multiplexor # stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based) # stli: Stallion EasyConnection 8/64, ONboard, Brumby (intelligent) # # Notes on APM # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. # 0x0011 Limit APM protocol to 1.1 or 1.0 # 0x0010 Limit APM protocol to 1.0 # # # Notes on the spigot: # The video spigot is at 0xad6. This port address can not be changed. # The irq values may only be 10, 11, or 15 # I/O memory is an 8kb region. Possible values are: # 0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff # The start address must be on an even boundary. # Add the following option if you want to allow non-root users to be able # to access the spigot. This option is not secure because it allows users # direct access to the I/O page. # options SPIGOT_UNSECURE # # Notes on the Comtrol Rocketport driver: # # The exact values used for rp0 depend on how many boards you have # in the system. The manufacturer's sample configs are listed as: # # Comtrol Rocketport ISA single card # device rp0 at isa? port 0x280 tty # # If instead you have two ISA cards, one installed at 0x100 and the # second installed at 0x180, then you should add the following to # your kernel configuration file: # # device rp0 at isa? port 0x100 tty # device rp1 at isa? port 0x180 tty # # For 4 ISA cards, it might be something like this: # # device rp0 at isa? port 0x180 tty # device rp1 at isa? port 0x100 tty # device rp2 at isa? port 0x340 tty # device rp3 at isa? port 0x240 tty # # And for PCI cards, you only need say: # # device rp0 # device rp1 # ... # Note: Make sure that any Rocketport PCI devices are specified BEFORE the # ISA Rocketport devices. # Notes on the Digiboard driver: # # The following flag values have special meanings: # 0x01 - alternate layout of pins # 0x02 - use the windowed PC/Xe in 64K mode # Notes on the Specialix SI/XIO driver: # **This is NOT a Specialix supported Driver!** # The host card is memory, not IO mapped. # The Rev 1 host cards use a 64K chunk, on a 32K boundary. # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. # Notes on the Stallion stl and stli drivers: # See src/i386/isa/README.stl for complete instructions. # This is version 0.0.5alpha, unsupported by Stallion. # The stl driver has a secondary IO port hard coded at 0x280. You need # to change src/i386/isa/stallion.c if you reconfigure this on the boards. # The "flags" and "iosiz" settings on the stli driver depend on the board: # EasyConnection 8/64 ISA: flags 23 iosiz 0x1000 # EasyConnection 8/64 EISA: flags 24 iosiz 0x10000 # EasyConnection 8/64 MCA: flags 25 iosiz 0x1000 # ONboard ISA: flags 4 iosiz 0x10000 # ONboard EISA: flags 7 iosiz 0x10000 # ONboard MCA: flags 3 iosiz 0x10000 # Brumby: flags 2 iosiz 0x4000 # Stallion: flags 1 iosiz 0x10000 device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr # for the Sony CDU31/33A CDROM device scd0 at isa? port 0x230 bio # for the SoundBlaster 16 multicd - up to 4 devices controller matcd0 at isa? port 0x230 bio device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr device ctx0 at isa? port 0x230 iomem 0xd0000 device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr device apm0 at isa? device gp0 at isa? port 0x2c0 tty device gsc0 at isa? port "IO_GSC1" tty drq 3 device joy0 at isa? port "IO_GAME" device alog0 at isa? port 0x260 tty irq 5 vector alogintr device cy0 at isa? tty irq 10 iomem 0xd4000 iosiz 0x2000 vector cyintr device dgb0 at isa? port 0x220 iomem 0xfc0000 iosiz ? tty device labpc0 at isa? port 0x260 tty irq 5 vector labpcintr device rc0 at isa? port 0x220 tty irq 12 vector rcintr device rp0 at isa? port 0x280 tty # the port and irq for tw0 are fictitious device tw0 at isa? port 0x380 tty irq 11 vector twintr device si0 at isa? iomem 0xd0000 tty irq 12 device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr device bqu0 at isa? port 0x150 device stl0 at isa? port 0x2a0 tty irq 10 vector stlintr device stli0 at isa? port 0x2a0 tty iomem 0xcc000 flags 23 iosiz 0x1000 device loran0 at isa? port ? tty irq 5 vector loranintr # # EISA devices: # # The EISA bus device is eisa0. It provides auto-detection and # configuration support for all devices on the EISA bus. # # The `ahb' device provides support for the Adaptec 174X adapter. # # The `ahc' device provides support for the Adaptec 274X and 284X # adapters. The 284X, although a VLB card responds to EISA probes. # # fea: DEC DEFEA EISA FDDI adapter # controller eisa0 controller ahb0 controller ahc0 device fea0 # enable tagged command queuing, which is a major performance win on # devices that support it (and controllers with enough SCB's) options AHC_TAGENABLE # enable SCB paging - See the ahc.4 man page options AHC_SCBPAGING_ENABLE # The aic7xxx driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. Unfortunately, # this doesn't work on some motherboards, which prevents it from being the # default. options AHC_ALLOW_MEMIO # By default, only 10 EISA slots are probed, since the slot numbers # above clash with the configuration address space of the PCI subsystem, # and the EISA probe is not very smart about this. This is sufficient # for most machines, but in particular the HP NetServer LC series comes # with an onboard AIC7770 dual-channel SCSI controller on EISA slot #11, # thus you need to bump this figure to 12 for them. options "EISA_SLOTS=12" # # PCI devices: # # The main PCI bus device is `pci'. It provides auto-detection and # configuration support for all devices on the PCI bus, using either # configuration mode defined in the PCI specification. # # The `ahc' device provides support for the Adaptec 29/3940(U)(W) # and motherboard based AIC7870/AIC7880 adapters. # # The `ncr' device provides support for the NCR 53C810 and 53C825 # self-contained SCSI host adapters. # # The `amd' device provides support for the Tekram DC-390 and 390T # SCSI host adapters, but is expected to work with any AMD 53c974 # PCI SCSI chip and the AMD Ethernet+SCSI Combo chip, after some # local patches were applied to the sources (that had originally # been written by Tekram and limited to work with their SCSI cards). # # The `de' device provides support for the Digital Equipment DC21040 # self-contained Ethernet adapter. # # The `fxp' device provides support for the Intel EtherExpress Pro/100B # PCI Fast Ethernet adapters. # # The `tx' device provides support for the SMC 9432TX cards. # # The `vx' device provides support for the 3Com 3C590 and 3C595 # early support # # The `fpa' device provides support for the Digital DEFPA PCI FDDI # adapter. pseudo-device fddi is also needed. # # The `meteor' device is a PCI video capture board. It can also have the # following options: # options METEOR_ALLOC_PAGES=xxx preallocate kernel pages for data entry # figure (ROWS*COLUMN*BYTES_PER_PIXEL*FRAME+PAGE_SIZE-1)/PAGE_SIZE # options METEOR_DEALLOC_PAGES remove all allocated pages on close(2) # options METEOR_DEALLOC_ABOVE=xxx remove all allocated pages above the # specified amount. If this value is below the allocated amount no action # taken # option METEOR_SYSTEM_DEFAULT={METEOR_PAL|METEOR_NTSC|METEOR_SECAM}, used # for initialization of fps routine when a signal is not present. # # The 'bktr' device is a PCI video capture board. It also has a TV tuner # on board. # controller pci0 controller ahc1 controller ncr0 controller amd0 device de0 device fxp0 device tx0 device vx0 device fpa0 device meteor0 device bktr0 # # PCCARD/PCMCIA # # card: slot controller # pcic: slots controller card0 controller pcic0 at card? controller pcic1 at card? # # Laptop/Notebook options: # # See also: # apm under `Miscellaneous hardware' # above. # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: options POWERFAIL_NMI # make it beep instead of panicing # # Parallel-Port Bus # # Parallel port bus support is provided by the `ppbus' device. # Multiple devices may be attached to the parallel port, devices # are automatically probed and attached when found. # # Supported devices: # vpo Iomega Zip Drive # Requires SCSI disk support ('scbus' and 'sd'), best # performance is achieved with ports in EPP 1.9 mode. # nlpt Parallel Printer # ppi General-purpose I/O ("Geek Port") # # Supported interfaces: # ppc ISA-bus parallel port interfaces. # controller ppbus0 controller vpo0 at ppbus? device nlpt0 at ppbus? device ppi0 at ppbus? device pps0 at ppbus? controller ppc0 at isa? disable port ? irq 7 vector ppcintr # Kernel BOOTP support options BOOTP # Use BOOTP to obtain IP address/hostname options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options "BOOTP_NFSV3" # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options "BOOTP_WIRED_TO=fxp0" # Use interface fxp0 for BOOTP # # An obsolete option to test kern_opt.c. # options GATEWAY # If you want to disable loadable kernel modules (LKM), you # might want to use this option. #options NO_LKM # # Add tie-ins for a hardware watchdog. This only enable the hooks; # the user must still supply the actual driver. # options HW_WDOG # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options "PMAP_SHPGPERPROC=201" # More undocumented options for linting. options CLK_CALIBRATION_LOOP options "CLK_USE_I8254_CALIBRATION" options CLK_USE_TSC_CALIBRATION options CLUSTERDEBUG options COMPAT_LINUX options CPU_UPGRADE_HW_CACHE options DEBUG options "DEBUG_1284" options DEVFS_ROOT #options DISABLE_PSE options "EXT2FS" options "I586_PMC_GUPROF=0x70000" options "IBCS2" # broken: #options IPFILTER options KEY options KEY_DEBUG options LOCKF_DEBUG options LOUTB options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 options KBDIO_DEBUG=2 options MSGMNB=2049 options MSGMNI=41 options MSGSEG=2049 options MSGSSZ=16 options MSGTQL=41 options NBUF=512 options NETATALKDEBUG options NMBCLUSTERS=1024 options NPX_DEBUG options NULLFS_DIAGNOSTIC options PANIC_REBOOT_WAIT_TIME=16 options "PCVT_24LINESDEF" options PCVT_CTRL_ALT_DEL options PCVT_EMU_MOUSE options PCVT_FREEBSD=211 options PCVT_META_ESC options PCVT_NSCREENS=9 options PCVT_PRETTYSCRNS options PCVT_SCANSET=2 options PCVT_SCREENSAVER options PCVT_USEKBDSEC options "PCVT_VT220KEYB" options PSM_DEBUG=1 options "SCSI_2_DEF" options SCSI_DELAY=8 # Be pessimistic about Joe SCSI device options SCSI_NCR_DEBUG options SCSI_NCR_DFLT_TAGS=4 options SCSI_NCR_MAX_SYNC=10000 options SCSI_NCR_MAX_WIDE=1 options SCSI_NCR_MYADDR=7 options SEMMAP=31 options SEMMNI=11 options SEMMNS=61 options SEMMNU=31 options SEMMSL=61 options SEMOPM=101 options SEMUME=11 options SHOW_BUSYBUFS # List buffers that prevent root unmount options SHMALL=1025 options "SHMMAX=(SHMMAXPGS*PAGE_SIZE+1)" options SHMMAXPGS=1025 options SHMMIN=2 options SHMMNI=33 options SHMSEG=9 options SI_DEBUG options SIMPLELOCK_DEBUG options SPX_HACK # The 'dpt' driver provides support for DPT controllers (http://www.dpt.com/). # These have hardware RAID-{0,1,5} support, and do multi-initiator I/O. # See sys/dev/dpt for debugging and other subtle options. # DPT_VERIFY_HINTR Performs some strict hardware interrupts testing. # Only use if you suspect PCI bus corruption problems # DPT_RESTRICTED_FREELIST Normally, the freelisat used by the DPT for queue # will grow to accomodate increased use. This growth # will NOT shrink. To restrict the number of queue # slots to exactly what the DPT can hold at one time, # enable this option. # DPT_MEASURE_PERFORMANCE Enables a set of (semi)invasive metrics. Various # instruments are enabled. Assumed to be enabled by # /usr/sbin/dpt_* tools. # DPT_FREELIST_IS_STACK For optimat L{1,2} CPU cache utilization, enable # this option. Otherwise, the transaction queue is # a LIFO. I cannot measure the performance gain. # DPT_HANDLE_TIMEOUTS Normally device timeouts are handled by the DPT. # If you ant the driver to handle timeouts, enable # this option. If your system is very busy, this # option will create more trouble than solve. # DPT_TIMEOUT_FACTOR Used to compute the excessive amount of time to # wait when timing out with the above option. # DPT_DEBUG_xxxx These are controllable from sys/dev/dpt/dpt.h # DPT_LOST_IRQ When enabled, will try, once per second, to catch # any interrupt that got lost. Seems to help in some # DPT-firmware/Motherboard combinations. Minimal # cost, great benefit. controller dpt0 # DPT options options DPT_VERIFY_HINTR options DPT_RESTRICTED_FREELIST options DPT_MEASURE_PERFORMANCE options DPT_FREELIST_IS_STACK options DPT_HANDLE_TIMEOUTS options DPT_TIMEOUT_FACTOR=4 options DPT_INTR_DELAY=200 # Some motherboards need that options DPT_LOST_IRQ diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index 7a63d34cec5b..e5f336bc2237 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -1,826 +1,826 @@ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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: swtch.s,v 1.68 1998/02/06 12:13:10 eivind Exp $ + * $Id: swtch.s,v 1.69 1998/03/04 10:25:03 dufault Exp $ */ #include "npx.h" -#include "opt_posix4.h" +#include "opt_posix.h" #include "opt_user_ldt.h" #include "opt_vm86.h" #include #include #ifdef SMP #include #include #include /** GRAB_LOPRIO */ #endif /* SMP */ #include "assym.s" /*****************************************************************************/ /* Scheduling */ /*****************************************************************************/ /* * The following primitives manipulate the run queues. * _whichqs tells which of the 32 queues _qs * have processes in them. setrunqueue puts processes into queues, Remrq * removes them from queues. The running process is on no queue, * other processes are on a queue related to p->p_priority, divided by 4 * actually to shrink the 0-127 range of priorities into the 32 available * queues. */ .data #ifndef SMP .globl _curpcb _curpcb: .long 0 /* pointer to curproc's PCB area */ #endif /* !SMP */ .globl _whichqs, _whichrtqs, _whichidqs _whichqs: .long 0 /* which run queues have data */ _whichrtqs: .long 0 /* which realtime run qs have data */ _whichidqs: .long 0 /* which idletime run qs have data */ .globl _hlt_vector _hlt_vector: .long _default_halt /* pointer to halt routine */ .globl _qs,_cnt,_panic .globl _want_resched _want_resched: .long 0 /* we need to re-run the scheduler */ #if defined(SWTCH_OPTIM_STATS) .globl _swtch_optim_stats, _tlb_flush_count _swtch_optim_stats: .long 0 /* number of _swtch_optims */ _tlb_flush_count: .long 0 #endif .text /* * setrunqueue(p) * * Call should be made at spl6(), and p->p_stat should be SRUN */ ENTRY(setrunqueue) movl 4(%esp),%eax #ifdef DIAGNOSTIC cmpb $SRUN,P_STAT(%eax) je set1 pushl $set2 call _panic set1: #endif cmpw $RTP_PRIO_NORMAL,P_RTPRIO_TYPE(%eax) /* normal priority process? */ je set_nort movzwl P_RTPRIO_PRIO(%eax),%edx cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* RR realtime priority? */ -#ifdef POSIX4 +#ifdef P1003_1B je set_rt /* RT priority */ cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority? */ #endif jne set_id /* must be idle priority */ set_rt: btsl %edx,_whichrtqs /* set q full bit */ shll $3,%edx addl $_rtqs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set_id: btsl %edx,_whichidqs /* set q full bit */ shll $3,%edx addl $_idqs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set_nort: /* Normal (RTOFF) code */ movzbl P_PRI(%eax),%edx shrl $2,%edx btsl %edx,_whichqs /* set q full bit */ shll $3,%edx addl $_qs,%edx /* locate q hdr */ movl %edx,P_FORW(%eax) /* link process on tail of q */ movl P_BACK(%edx),%ecx movl %ecx,P_BACK(%eax) movl %eax,P_BACK(%edx) movl %eax,P_FORW(%ecx) ret set2: .asciz "setrunqueue" /* * Remrq(p) * * Call should be made at spl6(). */ ENTRY(remrq) movl 4(%esp),%eax cmpw $RTP_PRIO_NORMAL,P_RTPRIO_TYPE(%eax) /* normal priority process? */ je rem_nort movzwl P_RTPRIO_PRIO(%eax),%edx cmpw $RTP_PRIO_REALTIME,P_RTPRIO_TYPE(%eax) /* realtime priority process? */ -#ifdef POSIX4 +#ifdef P1003_1B je rem0rt cmpw $RTP_PRIO_FIFO,P_RTPRIO_TYPE(%eax) /* FIFO realtime priority process? */ #endif jne rem_id rem0rt: btrl %edx,_whichrtqs /* clear full bit, panic if clear already */ jb rem1rt pushl $rem3rt call _panic rem1rt: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_rtqs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2rt shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichrtqs rem2rt: ret rem_id: btrl %edx,_whichidqs /* clear full bit, panic if clear already */ jb rem1id pushl $rem3id call _panic rem1id: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_idqs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2id shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichidqs rem2id: ret rem_nort: movzbl P_PRI(%eax),%edx shrl $2,%edx btrl %edx,_whichqs /* clear full bit, panic if clear already */ jb rem1 pushl $rem3 call _panic rem1: pushl %edx movl P_FORW(%eax),%ecx /* unlink process */ movl P_BACK(%eax),%edx movl %edx,P_BACK(%ecx) movl P_BACK(%eax),%ecx movl P_FORW(%eax),%edx movl %edx,P_FORW(%ecx) popl %edx movl $_qs,%ecx shll $3,%edx addl %edx,%ecx cmpl P_FORW(%ecx),%ecx /* q still has something? */ je rem2 shrl $3,%edx /* yes, set bit as still full */ btsl %edx,_whichqs rem2: ret rem3: .asciz "remrq" rem3rt: .asciz "remrq.rt" rem3id: .asciz "remrq.id" /* * When no processes are on the runq, cpu_switch() branches to _idle * to wait for something to come ready. */ ALIGN_TEXT _idle: #ifdef SMP /* when called, we have the mplock, intr disabled */ xorl %ebp,%ebp /* use our idleproc's "context" */ movl _my_idlePTD,%ecx movl %ecx,%cr3 #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif /* Keep space for nonexisting return addr, or profiling bombs */ movl $_idlestack_top-4,%ecx movl %ecx,%esp /* update common_tss.tss_esp0 pointer */ #ifdef VM86 movl _my_tr, %esi #endif /* VM86 */ movl %ecx, _common_tss + TSS_ESP0 #ifdef VM86 btrl %esi, _private_tss je 1f movl $_common_tssd, %edi /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 1: #endif /* VM86 */ sti /* * XXX callers of cpu_switch() do a bogus splclock(). Locking should * be left to cpu_switch(). */ call _spl0 cli /* * _REALLY_ free the lock, no matter how deep the prior nesting. * We will recover the nesting on the way out when we have a new * proc to load. * * XXX: we had damn well better be sure we had it before doing this! */ movl $FREE_LOCK, %eax movl %eax, _mp_lock /* do NOT have lock, intrs disabled */ .globl idle_loop idle_loop: #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif movl %cr3,%eax /* ouch! */ movl %eax,%cr3 cmpl $0,_smp_active jne 1f cmpl $0,_cpuid je 1f jmp 2f 1: cmpl $0,_whichrtqs /* real-time queue */ jne 3f cmpl $0,_whichqs /* normal queue */ jne 3f cmpl $0,_whichidqs /* 'idle' queue */ jne 3f cmpl $0,_do_page_zero_idle je 2f /* XXX appears to cause panics */ /* * Inside zero_idle we enable interrupts and grab the mplock * as needed. It needs to be careful about entry/exit mutexes. */ call _vm_page_zero_idle /* internal locking */ testl %eax, %eax jnz idle_loop 2: /* enable intrs for a halt */ #ifdef SMP movl $0, lapic_tpr /* 1st candidate for an INT */ #endif sti call *_hlt_vector /* wait for interrupt */ cli jmp idle_loop 3: #ifdef SMP movl $LOPRIO_LEVEL, lapic_tpr /* arbitrate for INTs */ #endif call _get_mplock cmpl $0,_whichrtqs /* real-time queue */ CROSSJUMP(jne, sw1a, je) cmpl $0,_whichqs /* normal queue */ CROSSJUMP(jne, nortqr, je) cmpl $0,_whichidqs /* 'idle' queue */ CROSSJUMP(jne, idqr, je) call _rel_mplock jmp idle_loop #else xorl %ebp,%ebp movl $HIDENAME(tmpstk),%esp #if defined(OVERLY_CONSERVATIVE_PTD_MGMT) #if defined(SWTCH_OPTIM_STATS) incl _swtch_optim_stats #endif movl _IdlePTD, %ecx movl %cr3, %eax cmpl %ecx, %eax je 2f #if defined(SWTCH_OPTIM_STATS) decl _swtch_optim_stats incl _tlb_flush_count #endif movl %ecx, %cr3 2: #endif /* update common_tss.tss_esp0 pointer */ #ifdef VM86 movl _my_tr, %esi #endif /* VM86 */ movl %esp, _common_tss + TSS_ESP0 #ifdef VM86 btrl %esi, _private_tss je 1f movl $_common_tssd, %edi /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 1: #endif /* VM86 */ sti /* * XXX callers of cpu_switch() do a bogus splclock(). Locking should * be left to cpu_switch(). */ call _spl0 ALIGN_TEXT idle_loop: cli cmpl $0,_whichrtqs /* real-time queue */ CROSSJUMP(jne, sw1a, je) cmpl $0,_whichqs /* normal queue */ CROSSJUMP(jne, nortqr, je) cmpl $0,_whichidqs /* 'idle' queue */ CROSSJUMP(jne, idqr, je) call _vm_page_zero_idle testl %eax, %eax jnz idle_loop sti call *_hlt_vector /* wait for interrupt */ jmp idle_loop #endif CROSSJUMPTARGET(_idle) ENTRY(default_halt) #ifndef SMP hlt /* XXX: until a wakeup IPI */ #endif ret /* * cpu_switch() */ ENTRY(cpu_switch) /* switch to new process. first, save context as needed */ movl _curproc,%ecx /* if no process to save, don't bother */ testl %ecx,%ecx je sw1 #ifdef SMP movb P_ONCPU(%ecx), %al /* save "last" cpu */ movb %al, P_LASTCPU(%ecx) movb $0xff, P_ONCPU(%ecx) /* "leave" the cpu */ #endif /* SMP */ movl P_ADDR(%ecx),%ecx movl (%esp),%eax /* Hardware registers */ movl %eax,PCB_EIP(%ecx) movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) movl %fs,PCB_FS(%ecx) movl %gs,PCB_GS(%ecx) #ifdef SMP movl _mp_lock, %eax /* XXX FIXME: we should be saving the local APIC TPR */ #ifdef DIAGNOSTIC cmpl $FREE_LOCK, %eax /* is it free? */ je badsw4 /* yes, bad medicine! */ #endif /* DIAGNOSTIC */ andl $COUNT_FIELD, %eax /* clear CPU portion */ movl %eax, PCB_MPNEST(%ecx) /* store it */ #endif /* SMP */ #if NNPX > 0 /* have we used fp, and need a save? */ movl _curproc,%eax cmpl %eax,_npxproc jne 1f addl $PCB_SAVEFPU,%ecx /* h/w bugs make saving complicated */ pushl %ecx call _npxsave /* do it in a big C function */ popl %eax 1: #endif /* NNPX > 0 */ movl $0,_curproc /* out of process */ /* save is done, now choose a new process or idle */ sw1: cli #ifdef SMP /* Stop scheduling if smp_active goes zero and we are not BSP */ cmpl $0,_smp_active jne 1f cmpl $0,_cpuid je 1f CROSSJUMP(je, _idle, jne) /* wind down */ 1: #endif sw1a: movl _whichrtqs,%edi /* pick next p. from rtqs */ testl %edi,%edi jz nortqr /* no realtime procs */ /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ jz nortqr /* no proc on rt q - try normal ... */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _rtqs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je rt3 btsl %ebx,%edi /* nope, set to indicate not empty */ rt3: movl %edi,_whichrtqs /* update q status */ jmp swtch_com /* old sw1a */ /* Normal process priority's */ nortqr: movl _whichqs,%edi 2: /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ jz idqr /* if none, idle */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _qs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je 3f btsl %ebx,%edi /* nope, set to indicate not empty */ 3: movl %edi,_whichqs /* update q status */ jmp swtch_com idqr: /* was sw1a */ movl _whichidqs,%edi /* pick next p. from idqs */ /* XXX - bsf is sloow */ bsfl %edi,%ebx /* find a full q */ CROSSJUMP(je, _idle, jne) /* if no proc, idle */ /* XX update whichqs? */ btrl %ebx,%edi /* clear q full status */ leal _idqs(,%ebx,8),%eax /* select q */ movl %eax,%esi movl P_FORW(%eax),%ecx /* unlink from front of process q */ movl P_FORW(%ecx),%edx movl %edx,P_FORW(%eax) movl P_BACK(%ecx),%eax movl %eax,P_BACK(%edx) cmpl P_FORW(%ecx),%esi /* q empty */ je id3 btsl %ebx,%edi /* nope, set to indicate not empty */ id3: movl %edi,_whichidqs /* update q status */ swtch_com: movl $0,%eax movl %eax,_want_resched #ifdef DIAGNOSTIC cmpl %eax,P_WCHAN(%ecx) jne badsw1 cmpb $SRUN,P_STAT(%ecx) jne badsw2 #endif movl %eax,P_BACK(%ecx) /* isolate process to run */ movl P_ADDR(%ecx),%edx #ifdef SMP movl PCB_CR3(%edx),%ebx /* Grab the private PT pointer from the outgoing process's PTD */ movl $_PTD, %esi movl 4*MPPTDI(%esi), %eax /* fetch cpu's prv pt */ #else #if defined(SWTCH_OPTIM_STATS) incl _swtch_optim_stats #endif /* switch address space */ movl %cr3,%ebx cmpl PCB_CR3(%edx),%ebx je 4f #if defined(SWTCH_OPTIM_STATS) decl _swtch_optim_stats incl _tlb_flush_count #endif movl PCB_CR3(%edx),%ebx #endif /* SMP */ movl %ebx,%cr3 4: #ifdef SMP /* Copy the private PT to the new process's PTD */ /* XXX yuck, the _PTD changes when we switch, so we have to * reload %cr3 after changing the address space. * We need to fix this by storing a pointer to the virtual * location of the per-process PTD in the PCB or something quick. * Dereferencing proc->vm_map->pmap->p_pdir[] is painful in asm. */ movl %eax, 4*MPPTDI(%esi) /* restore cpu's prv page */ #if defined(SWTCH_OPTIM_STATS) incl _tlb_flush_count #endif /* XXX: we have just changed the page tables.. reload.. */ movl %ebx, %cr3 #endif /* SMP */ #ifdef VM86 movl _my_tr, %esi cmpl $0, PCB_EXT(%edx) /* has pcb extension? */ je 1f btsl %esi, _private_tss /* mark use of private tss */ movl PCB_EXT(%edx), %edi /* new tss descriptor */ jmp 2f 1: #endif /* update common_tss.tss_esp0 pointer */ movl $_common_tss, %eax movl %edx, %ebx /* pcb */ #ifdef VM86 addl $(UPAGES * PAGE_SIZE - 16), %ebx #else addl $(UPAGES * PAGE_SIZE), %ebx #endif /* VM86 */ movl %ebx, TSS_ESP0(%eax) #ifdef VM86 btrl %esi, _private_tss je 3f movl $_common_tssd, %edi 2: /* move correct tss descriptor into GDT slot, then reload tr */ leal _gdt(,%esi,8), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) shll $3, %esi /* GSEL(entry, SEL_KPL) */ ltr %si 3: #endif /* VM86 */ /* restore context */ movl PCB_EBX(%edx),%ebx movl PCB_ESP(%edx),%esp movl PCB_EBP(%edx),%ebp movl PCB_ESI(%edx),%esi movl PCB_EDI(%edx),%edi movl PCB_EIP(%edx),%eax movl %eax,(%esp) #ifdef SMP #ifdef GRAB_LOPRIO /* hold LOPRIO for INTs */ #ifdef CHEAP_TPR movl $0, lapic_tpr #else andl $~APIC_TPR_PRIO, lapic_tpr #endif /** CHEAP_TPR */ #endif /** GRAB_LOPRIO */ movl _cpuid,%eax movb %al, P_ONCPU(%ecx) #endif /* SMP */ movl %edx, _curpcb movl %ecx, _curproc /* into next process */ #ifdef SMP movl _cpu_lockid, %eax orl PCB_MPNEST(%edx), %eax /* add next count from PROC */ movl %eax, _mp_lock /* load the mp_lock */ /* XXX FIXME: we should be restoring the local APIC TPR */ #endif /* SMP */ #ifdef USER_LDT cmpl $0, PCB_USERLDT(%edx) jnz 1f movl __default_ldt,%eax cmpl _currentldt,%eax je 2f lldt __default_ldt movl %eax,_currentldt jmp 2f 1: pushl %edx call _set_user_ldt popl %edx 2: #endif /* This must be done after loading the user LDT. */ .globl cpu_switch_load_fs cpu_switch_load_fs: movl PCB_FS(%edx),%fs .globl cpu_switch_load_gs cpu_switch_load_gs: movl PCB_GS(%edx),%gs sti ret CROSSJUMPTARGET(idqr) CROSSJUMPTARGET(nortqr) CROSSJUMPTARGET(sw1a) #ifdef DIAGNOSTIC badsw1: pushl $sw0_1 call _panic sw0_1: .asciz "cpu_switch: has wchan" badsw2: pushl $sw0_2 call _panic sw0_2: .asciz "cpu_switch: not SRUN" #endif #if defined(SMP) && defined(DIAGNOSTIC) badsw4: pushl $sw0_4 call _panic sw0_4: .asciz "cpu_switch: do not have lock" #endif /* SMP && DIAGNOSTIC */ /* * savectx(pcb) * Update pcb, saving current processor state. */ ENTRY(savectx) /* fetch PCB */ movl 4(%esp),%ecx /* caller's return address - child won't execute this routine */ movl (%esp),%eax movl %eax,PCB_EIP(%ecx) movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) movl %fs,PCB_FS(%ecx) movl %gs,PCB_GS(%ecx) #if NNPX > 0 /* * If npxproc == NULL, then the npx h/w state is irrelevant and the * state had better already be in the pcb. This is true for forks * but not for dumps (the old book-keeping with FP flags in the pcb * always lost for dumps because the dump pcb has 0 flags). * * If npxproc != NULL, then we have to save the npx h/w state to * npxproc's pcb and copy it to the requested pcb, or save to the * requested pcb and reload. Copying is easier because we would * have to handle h/w bugs for reloading. We used to lose the * parent's npx state for forks by forgetting to reload. */ movl _npxproc,%eax testl %eax,%eax je 1f pushl %ecx movl P_ADDR(%eax),%eax leal PCB_SAVEFPU(%eax),%eax pushl %eax pushl %eax call _npxsave addl $4,%esp popl %eax popl %ecx pushl $PCB_SAVEFPU_SIZE leal PCB_SAVEFPU(%ecx),%ecx pushl %ecx pushl %eax call _bcopy addl $12,%esp #endif /* NNPX > 0 */ 1: ret diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 698cc7f815a8..4383dcf30cda 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -1,465 +1,467 @@ /* * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.6 1997/12/17 03:12:35 kato Exp */ #ifndef _LINUX_SYSPROTO_H_ #define _LINUX_SYSPROTO_H_ #include +struct proc; + struct linux_setup_args { int dummy; }; struct linux_fork_args { int dummy; }; struct linux_open_args { char * path; int flags; int mode; }; struct linux_waitpid_args { int pid; int * status; int options; }; struct linux_creat_args { char * path; int mode; }; struct linux_unlink_args { char * path; }; struct linux_execve_args { char * path; char ** argp; char ** envp; }; struct linux_chdir_args { char * path; }; struct linux_time_args { linux_time_t * tm; }; struct linux_mknod_args { char * path; int mode; int dev; }; struct linux_chmod_args { char * path; int mode; }; struct linux_chown_args { char * path; int uid; int gid; }; struct linux_break_args { char * nsize; }; struct linux_stat_args { char * path; struct ostat * up; }; struct linux_lseek_args { int fdes; long off; int whence; }; struct linux_mount_args { int dummy; }; struct linux_umount_args { int dummy; }; struct linux_stime_args { int dummy; }; struct linux_ptrace_args { int dummy; }; struct linux_alarm_args { unsigned int secs; }; struct linux_fstat_args { int fd; struct ostat * up; }; struct linux_pause_args { int dummy; }; struct linux_utime_args { char * fname; struct linux_utimbuf * times; }; struct linux_stty_args { int dummy; }; struct linux_gtty_args { int dummy; }; struct linux_access_args { char * path; int flags; }; struct linux_nice_args { int inc; }; struct linux_ftime_args { int dummy; }; struct linux_kill_args { int pid; int signum; }; struct linux_rename_args { char * from; char * to; }; struct linux_mkdir_args { char * path; int mode; }; struct linux_rmdir_args { char * path; }; struct linux_pipe_args { int * pipefds; }; struct linux_times_args { struct linux_times_argv * buf; }; struct linux_prof_args { int dummy; }; struct linux_brk_args { char * dsend; }; struct linux_signal_args { int sig; linux_handler_t handler; }; struct linux_phys_args { int dummy; }; struct linux_lock_args { int dummy; }; struct linux_ioctl_args { int fd; u_long cmd; int arg; }; struct linux_fcntl_args { int fd; int cmd; int arg; }; struct linux_mpx_args { int dummy; }; struct linux_ulimit_args { int dummy; }; struct linux_olduname_args { struct linux_oldold_utsname * up; }; struct linux_ustat_args { int dummy; }; struct linux_sigaction_args { int sig; struct linux_sigaction * nsa; struct linux_sigaction * osa; }; struct linux_siggetmask_args { int dummy; }; struct linux_sigsetmask_args { linux_sigset_t mask; }; struct linux_sigsuspend_args { int restart; linux_sigset_t oldmask; linux_sigset_t mask; }; struct linux_sigpending_args { linux_sigset_t * mask; }; struct linux_select_args { struct linux_select_argv * ptr; }; struct linux_symlink_args { char * path; char * to; }; struct linux_readlink_args { char * name; char * buf; int count; }; struct linux_uselib_args { char * library; }; struct linux_readdir_args { int fd; struct linux_dirent * dent; unsigned int count; }; struct linux_mmap_args { struct linux_mmap_argv * ptr; }; struct linux_truncate_args { char * path; long length; }; struct linux_statfs_args { char * path; struct linux_statfs_buf * buf; }; struct linux_fstatfs_args { int fd; struct linux_statfs_buf * buf; }; struct linux_ioperm_args { unsigned int lo; unsigned int hi; int val; }; struct linux_socketcall_args { int what; void * args; }; struct linux_ksyslog_args { int what; }; struct linux_setitimer_args { u_int which; struct itimerval * itv; struct itimerval * oitv; }; struct linux_getitimer_args { u_int which; struct itimerval * itv; }; struct linux_newstat_args { char * path; struct linux_newstat * buf; }; struct linux_newlstat_args { char * path; struct linux_newstat * buf; }; struct linux_newfstat_args { int fd; struct linux_newstat * buf; }; struct linux_uname_args { struct linux_old_utsname * up; }; struct linux_iopl_args { int level; }; struct linux_vhangup_args { int dummy; }; struct linux_idle_args { int dummy; }; struct linux_vm86_args { int dummy; }; struct linux_wait4_args { int pid; int * status; int options; struct rusage * rusage; }; struct linux_swapoff_args { int dummy; }; struct linux_sysinfo_args { int dummy; }; struct linux_ipc_args { int what; int arg1; int arg2; int arg3; caddr_t ptr; }; struct linux_sigreturn_args { struct linux_sigcontext * scp; }; struct linux_clone_args { int dummy; }; struct linux_newuname_args { struct linux_newuname_t * buf; }; struct linux_modify_ldt_args { int func; void * ptr; size_t bytecount; }; struct linux_adjtimex_args { int dummy; }; struct linux_sigprocmask_args { int how; linux_sigset_t * mask; linux_sigset_t * omask; }; struct linux_create_module_args { int dummy; }; struct linux_init_module_args { int dummy; }; struct linux_delete_module_args { int dummy; }; struct linux_get_kernel_syms_args { int dummy; }; struct linux_quotactl_args { int dummy; }; struct linux_getpgid_args { int pid; }; struct linux_bdflush_args { int dummy; }; struct linux_personality_args { int per; }; struct linux_llseek_args { int fd; u_int32_t ohigh; u_int32_t olow; caddr_t res; int whence; }; struct linux_getdents_args { int fd; void * dent; unsigned count; }; struct linux_newselect_args { int nfds; fd_set * readfds; fd_set * writefds; fd_set * exceptfds; struct timeval * timeout; }; struct linux_msync_args { caddr_t addr; int len; int fl; }; int linux_setup __P((struct proc *, struct linux_setup_args *)); int linux_fork __P((struct proc *, struct linux_fork_args *)); int linux_open __P((struct proc *, struct linux_open_args *)); int linux_waitpid __P((struct proc *, struct linux_waitpid_args *)); int linux_creat __P((struct proc *, struct linux_creat_args *)); int linux_unlink __P((struct proc *, struct linux_unlink_args *)); int linux_execve __P((struct proc *, struct linux_execve_args *)); int linux_chdir __P((struct proc *, struct linux_chdir_args *)); int linux_time __P((struct proc *, struct linux_time_args *)); int linux_mknod __P((struct proc *, struct linux_mknod_args *)); int linux_chmod __P((struct proc *, struct linux_chmod_args *)); int linux_chown __P((struct proc *, struct linux_chown_args *)); int linux_break __P((struct proc *, struct linux_break_args *)); int linux_stat __P((struct proc *, struct linux_stat_args *)); int linux_lseek __P((struct proc *, struct linux_lseek_args *)); int linux_mount __P((struct proc *, struct linux_mount_args *)); int linux_umount __P((struct proc *, struct linux_umount_args *)); int linux_stime __P((struct proc *, struct linux_stime_args *)); int linux_ptrace __P((struct proc *, struct linux_ptrace_args *)); int linux_alarm __P((struct proc *, struct linux_alarm_args *)); int linux_fstat __P((struct proc *, struct linux_fstat_args *)); int linux_pause __P((struct proc *, struct linux_pause_args *)); int linux_utime __P((struct proc *, struct linux_utime_args *)); int linux_stty __P((struct proc *, struct linux_stty_args *)); int linux_gtty __P((struct proc *, struct linux_gtty_args *)); int linux_access __P((struct proc *, struct linux_access_args *)); int linux_nice __P((struct proc *, struct linux_nice_args *)); int linux_ftime __P((struct proc *, struct linux_ftime_args *)); int linux_kill __P((struct proc *, struct linux_kill_args *)); int linux_rename __P((struct proc *, struct linux_rename_args *)); int linux_mkdir __P((struct proc *, struct linux_mkdir_args *)); int linux_rmdir __P((struct proc *, struct linux_rmdir_args *)); int linux_pipe __P((struct proc *, struct linux_pipe_args *)); int linux_times __P((struct proc *, struct linux_times_args *)); int linux_prof __P((struct proc *, struct linux_prof_args *)); int linux_brk __P((struct proc *, struct linux_brk_args *)); int linux_signal __P((struct proc *, struct linux_signal_args *)); int linux_phys __P((struct proc *, struct linux_phys_args *)); int linux_lock __P((struct proc *, struct linux_lock_args *)); int linux_ioctl __P((struct proc *, struct linux_ioctl_args *)); int linux_fcntl __P((struct proc *, struct linux_fcntl_args *)); int linux_mpx __P((struct proc *, struct linux_mpx_args *)); int linux_ulimit __P((struct proc *, struct linux_ulimit_args *)); int linux_olduname __P((struct proc *, struct linux_olduname_args *)); int linux_ustat __P((struct proc *, struct linux_ustat_args *)); int linux_sigaction __P((struct proc *, struct linux_sigaction_args *)); int linux_siggetmask __P((struct proc *, struct linux_siggetmask_args *)); int linux_sigsetmask __P((struct proc *, struct linux_sigsetmask_args *)); int linux_sigsuspend __P((struct proc *, struct linux_sigsuspend_args *)); int linux_sigpending __P((struct proc *, struct linux_sigpending_args *)); int linux_select __P((struct proc *, struct linux_select_args *)); int linux_symlink __P((struct proc *, struct linux_symlink_args *)); int linux_readlink __P((struct proc *, struct linux_readlink_args *)); int linux_uselib __P((struct proc *, struct linux_uselib_args *)); int linux_readdir __P((struct proc *, struct linux_readdir_args *)); int linux_mmap __P((struct proc *, struct linux_mmap_args *)); int linux_truncate __P((struct proc *, struct linux_truncate_args *)); int linux_statfs __P((struct proc *, struct linux_statfs_args *)); int linux_fstatfs __P((struct proc *, struct linux_fstatfs_args *)); int linux_ioperm __P((struct proc *, struct linux_ioperm_args *)); int linux_socketcall __P((struct proc *, struct linux_socketcall_args *)); int linux_ksyslog __P((struct proc *, struct linux_ksyslog_args *)); int linux_setitimer __P((struct proc *, struct linux_setitimer_args *)); int linux_getitimer __P((struct proc *, struct linux_getitimer_args *)); int linux_newstat __P((struct proc *, struct linux_newstat_args *)); int linux_newlstat __P((struct proc *, struct linux_newlstat_args *)); int linux_newfstat __P((struct proc *, struct linux_newfstat_args *)); int linux_uname __P((struct proc *, struct linux_uname_args *)); int linux_iopl __P((struct proc *, struct linux_iopl_args *)); int linux_vhangup __P((struct proc *, struct linux_vhangup_args *)); int linux_idle __P((struct proc *, struct linux_idle_args *)); int linux_vm86 __P((struct proc *, struct linux_vm86_args *)); int linux_wait4 __P((struct proc *, struct linux_wait4_args *)); int linux_swapoff __P((struct proc *, struct linux_swapoff_args *)); int linux_sysinfo __P((struct proc *, struct linux_sysinfo_args *)); int linux_ipc __P((struct proc *, struct linux_ipc_args *)); int linux_sigreturn __P((struct proc *, struct linux_sigreturn_args *)); int linux_clone __P((struct proc *, struct linux_clone_args *)); int linux_newuname __P((struct proc *, struct linux_newuname_args *)); int linux_modify_ldt __P((struct proc *, struct linux_modify_ldt_args *)); int linux_adjtimex __P((struct proc *, struct linux_adjtimex_args *)); int linux_sigprocmask __P((struct proc *, struct linux_sigprocmask_args *)); int linux_create_module __P((struct proc *, struct linux_create_module_args *)); int linux_init_module __P((struct proc *, struct linux_init_module_args *)); int linux_delete_module __P((struct proc *, struct linux_delete_module_args *)); int linux_get_kernel_syms __P((struct proc *, struct linux_get_kernel_syms_args *)); int linux_quotactl __P((struct proc *, struct linux_quotactl_args *)); int linux_getpgid __P((struct proc *, struct linux_getpgid_args *)); int linux_bdflush __P((struct proc *, struct linux_bdflush_args *)); int linux_personality __P((struct proc *, struct linux_personality_args *)); int linux_llseek __P((struct proc *, struct linux_llseek_args *)); int linux_getdents __P((struct proc *, struct linux_getdents_args *)); int linux_newselect __P((struct proc *, struct linux_newselect_args *)); int linux_msync __P((struct proc *, struct linux_msync_args *)); #ifdef COMPAT_43 #endif /* COMPAT_43 */ #endif /* !_LINUX_SYSPROTO_H_ */ diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h index a54706f1dbb0..7d8404c63cb5 100644 --- a/sys/i386/linux/linux_syscall.h +++ b/sys/i386/linux/linux_syscall.h @@ -1,151 +1,164 @@ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.6 1997/12/17 03:12:35 kato Exp */ #define LINUX_SYS_linux_setup 0 #define LINUX_SYS_exit 1 #define LINUX_SYS_linux_fork 2 #define LINUX_SYS_read 3 #define LINUX_SYS_write 4 #define LINUX_SYS_linux_open 5 #define LINUX_SYS_close 6 #define LINUX_SYS_linux_waitpid 7 #define LINUX_SYS_linux_creat 8 #define LINUX_SYS_link 9 #define LINUX_SYS_linux_unlink 10 #define LINUX_SYS_linux_execve 11 #define LINUX_SYS_linux_chdir 12 #define LINUX_SYS_linux_time 13 #define LINUX_SYS_linux_mknod 14 #define LINUX_SYS_linux_chmod 15 #define LINUX_SYS_linux_chown 16 #define LINUX_SYS_linux_break 17 #define LINUX_SYS_linux_stat 18 #define LINUX_SYS_linux_lseek 19 #define LINUX_SYS_getpid 20 #define LINUX_SYS_linux_mount 21 #define LINUX_SYS_linux_umount 22 #define LINUX_SYS_setuid 23 #define LINUX_SYS_getuid 24 #define LINUX_SYS_linux_stime 25 #define LINUX_SYS_linux_ptrace 26 #define LINUX_SYS_linux_alarm 27 #define LINUX_SYS_linux_fstat 28 #define LINUX_SYS_linux_pause 29 #define LINUX_SYS_linux_utime 30 #define LINUX_SYS_linux_stty 31 #define LINUX_SYS_linux_gtty 32 #define LINUX_SYS_linux_access 33 #define LINUX_SYS_linux_nice 34 #define LINUX_SYS_linux_ftime 35 #define LINUX_SYS_sync 36 #define LINUX_SYS_linux_kill 37 #define LINUX_SYS_linux_rename 38 #define LINUX_SYS_linux_mkdir 39 #define LINUX_SYS_linux_rmdir 40 #define LINUX_SYS_dup 41 #define LINUX_SYS_linux_pipe 42 #define LINUX_SYS_linux_times 43 #define LINUX_SYS_linux_prof 44 #define LINUX_SYS_linux_brk 45 #define LINUX_SYS_setgid 46 #define LINUX_SYS_getgid 47 #define LINUX_SYS_linux_signal 48 #define LINUX_SYS_geteuid 49 #define LINUX_SYS_getegid 50 #define LINUX_SYS_acct 51 #define LINUX_SYS_linux_phys 52 #define LINUX_SYS_linux_lock 53 #define LINUX_SYS_linux_ioctl 54 #define LINUX_SYS_linux_fcntl 55 #define LINUX_SYS_linux_mpx 56 #define LINUX_SYS_setpgid 57 #define LINUX_SYS_linux_ulimit 58 #define LINUX_SYS_linux_olduname 59 #define LINUX_SYS_umask 60 #define LINUX_SYS_chroot 61 #define LINUX_SYS_linux_ustat 62 #define LINUX_SYS_dup2 63 #define LINUX_SYS_getppid 64 #define LINUX_SYS_getpgrp 65 #define LINUX_SYS_setsid 66 #define LINUX_SYS_linux_sigaction 67 #define LINUX_SYS_linux_siggetmask 68 #define LINUX_SYS_linux_sigsetmask 69 #define LINUX_SYS_setreuid 70 #define LINUX_SYS_setregid 71 #define LINUX_SYS_linux_sigsuspend 72 #define LINUX_SYS_linux_sigpending 73 #define LINUX_SYS_osethostname 74 #define LINUX_SYS_osetrlimit 75 #define LINUX_SYS_ogetrlimit 76 #define LINUX_SYS_getrusage 77 #define LINUX_SYS_gettimeofday 78 #define LINUX_SYS_settimeofday 79 #define LINUX_SYS_getgroups 80 #define LINUX_SYS_setgroups 81 #define LINUX_SYS_linux_select 82 #define LINUX_SYS_linux_symlink 83 #define LINUX_SYS_ostat 84 #define LINUX_SYS_linux_readlink 85 #define LINUX_SYS_linux_uselib 86 #define LINUX_SYS_swapon 87 #define LINUX_SYS_reboot 88 #define LINUX_SYS_linux_readdir 89 #define LINUX_SYS_linux_mmap 90 #define LINUX_SYS_munmap 91 #define LINUX_SYS_linux_truncate 92 #define LINUX_SYS_oftruncate 93 #define LINUX_SYS_fchmod 94 #define LINUX_SYS_fchown 95 #define LINUX_SYS_getpriority 96 #define LINUX_SYS_setpriority 97 #define LINUX_SYS_profil 98 #define LINUX_SYS_linux_statfs 99 #define LINUX_SYS_linux_fstatfs 100 #define LINUX_SYS_linux_ioperm 101 #define LINUX_SYS_linux_socketcall 102 #define LINUX_SYS_linux_ksyslog 103 #define LINUX_SYS_linux_setitimer 104 #define LINUX_SYS_linux_getitimer 105 #define LINUX_SYS_linux_newstat 106 #define LINUX_SYS_linux_newlstat 107 #define LINUX_SYS_linux_newfstat 108 #define LINUX_SYS_linux_uname 109 #define LINUX_SYS_linux_iopl 110 #define LINUX_SYS_linux_vhangup 111 #define LINUX_SYS_linux_idle 112 #define LINUX_SYS_linux_vm86 113 #define LINUX_SYS_linux_wait4 114 #define LINUX_SYS_linux_swapoff 115 #define LINUX_SYS_linux_sysinfo 116 #define LINUX_SYS_linux_ipc 117 #define LINUX_SYS_fsync 118 #define LINUX_SYS_linux_sigreturn 119 #define LINUX_SYS_linux_clone 120 #define LINUX_SYS_setdomainname 121 #define LINUX_SYS_linux_newuname 122 #define LINUX_SYS_linux_modify_ldt 123 #define LINUX_SYS_linux_adjtimex 124 #define LINUX_SYS_mprotect 125 #define LINUX_SYS_linux_sigprocmask 126 #define LINUX_SYS_linux_create_module 127 #define LINUX_SYS_linux_init_module 128 #define LINUX_SYS_linux_delete_module 129 #define LINUX_SYS_linux_get_kernel_syms 130 #define LINUX_SYS_linux_quotactl 131 #define LINUX_SYS_linux_getpgid 132 #define LINUX_SYS_fchdir 133 #define LINUX_SYS_linux_bdflush 134 #define LINUX_SYS_linux_personality 136 #define LINUX_SYS_linux_llseek 140 #define LINUX_SYS_linux_getdents 141 #define LINUX_SYS_linux_newselect 142 #define LINUX_SYS_flock 143 #define LINUX_SYS_linux_msync 144 #define LINUX_SYS_readv 145 #define LINUX_SYS_writev 146 -#define LINUX_SYS_MAXSYSCALL 147 +#define LINUX_SYS_mlock 150 +#define LINUX_SYS_munlock 151 +#define LINUX_SYS_mlockall 152 +#define LINUX_SYS_munlockall 153 +#define LINUX_SYS_sched_setparam 154 +#define LINUX_SYS_sched_getparam 155 +#define LINUX_SYS_sched_setscheduler 156 +#define LINUX_SYS_sched_getscheduler 157 +#define LINUX_SYS_sched_yield 158 +#define LINUX_SYS_sched_get_priority_max 159 +#define LINUX_SYS_sched_get_priority_min 160 +#define LINUX_SYS_sched_rr_get_interval 161 +#define LINUX_SYS_nanosleep 162 +#define LINUX_SYS_MAXSYSCALL 163 diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 2f79d4d31c17..512b66aeaa20 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -1,171 +1,187 @@ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.6 1997/12/17 03:12:35 kato Exp */ #include "opt_compat.h" #include #include #include #include #include #ifdef COMPAT_43 #define compat(n, name) n, (sy_call_t *)__CONCAT(o,name) #else #define compat(n, name) 0, (sy_call_t *)nosys #endif /* The casts are bogus but will do for now. */ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_setup }, /* 0 = linux_setup */ { 1, (sy_call_t *)exit }, /* 1 = exit */ { 0, (sy_call_t *)linux_fork }, /* 2 = linux_fork */ { 3, (sy_call_t *)read }, /* 3 = read */ { 3, (sy_call_t *)write }, /* 4 = write */ { 3, (sy_call_t *)linux_open }, /* 5 = linux_open */ { 1, (sy_call_t *)close }, /* 6 = close */ { 3, (sy_call_t *)linux_waitpid }, /* 7 = linux_waitpid */ { 2, (sy_call_t *)linux_creat }, /* 8 = linux_creat */ { 2, (sy_call_t *)link }, /* 9 = link */ { 1, (sy_call_t *)linux_unlink }, /* 10 = linux_unlink */ { 3, (sy_call_t *)linux_execve }, /* 11 = linux_execve */ { 1, (sy_call_t *)linux_chdir }, /* 12 = linux_chdir */ { 1, (sy_call_t *)linux_time }, /* 13 = linux_time */ { 3, (sy_call_t *)linux_mknod }, /* 14 = linux_mknod */ { 2, (sy_call_t *)linux_chmod }, /* 15 = linux_chmod */ { 3, (sy_call_t *)linux_chown }, /* 16 = linux_chown */ { 1, (sy_call_t *)linux_break }, /* 17 = linux_break */ { 2, (sy_call_t *)linux_stat }, /* 18 = linux_stat */ { 3, (sy_call_t *)linux_lseek }, /* 19 = linux_lseek */ { 0, (sy_call_t *)getpid }, /* 20 = getpid */ { 0, (sy_call_t *)linux_mount }, /* 21 = linux_mount */ { 0, (sy_call_t *)linux_umount }, /* 22 = linux_umount */ { 1, (sy_call_t *)setuid }, /* 23 = setuid */ { 0, (sy_call_t *)getuid }, /* 24 = getuid */ { 0, (sy_call_t *)linux_stime }, /* 25 = linux_stime */ { 0, (sy_call_t *)linux_ptrace }, /* 26 = linux_ptrace */ { 1, (sy_call_t *)linux_alarm }, /* 27 = linux_alarm */ { 2, (sy_call_t *)linux_fstat }, /* 28 = linux_fstat */ { 0, (sy_call_t *)linux_pause }, /* 29 = linux_pause */ { 2, (sy_call_t *)linux_utime }, /* 30 = linux_utime */ { 0, (sy_call_t *)linux_stty }, /* 31 = linux_stty */ { 0, (sy_call_t *)linux_gtty }, /* 32 = linux_gtty */ { 2, (sy_call_t *)linux_access }, /* 33 = linux_access */ { 1, (sy_call_t *)linux_nice }, /* 34 = linux_nice */ { 0, (sy_call_t *)linux_ftime }, /* 35 = linux_ftime */ { 0, (sy_call_t *)sync }, /* 36 = sync */ { 2, (sy_call_t *)linux_kill }, /* 37 = linux_kill */ { 2, (sy_call_t *)linux_rename }, /* 38 = linux_rename */ { 2, (sy_call_t *)linux_mkdir }, /* 39 = linux_mkdir */ { 1, (sy_call_t *)linux_rmdir }, /* 40 = linux_rmdir */ { 1, (sy_call_t *)dup }, /* 41 = dup */ { 1, (sy_call_t *)linux_pipe }, /* 42 = linux_pipe */ { 1, (sy_call_t *)linux_times }, /* 43 = linux_times */ { 0, (sy_call_t *)linux_prof }, /* 44 = linux_prof */ { 1, (sy_call_t *)linux_brk }, /* 45 = linux_brk */ { 1, (sy_call_t *)setgid }, /* 46 = setgid */ { 0, (sy_call_t *)getgid }, /* 47 = getgid */ { 2, (sy_call_t *)linux_signal }, /* 48 = linux_signal */ { 0, (sy_call_t *)geteuid }, /* 49 = geteuid */ { 0, (sy_call_t *)getegid }, /* 50 = getegid */ { 1, (sy_call_t *)acct }, /* 51 = acct */ { 0, (sy_call_t *)linux_phys }, /* 52 = linux_phys */ { 0, (sy_call_t *)linux_lock }, /* 53 = linux_lock */ { 3, (sy_call_t *)linux_ioctl }, /* 54 = linux_ioctl */ { 3, (sy_call_t *)linux_fcntl }, /* 55 = linux_fcntl */ { 0, (sy_call_t *)linux_mpx }, /* 56 = linux_mpx */ { 2, (sy_call_t *)setpgid }, /* 57 = setpgid */ { 0, (sy_call_t *)linux_ulimit }, /* 58 = linux_ulimit */ { 1, (sy_call_t *)linux_olduname }, /* 59 = linux_olduname */ { 1, (sy_call_t *)umask }, /* 60 = umask */ { 1, (sy_call_t *)chroot }, /* 61 = chroot */ { 0, (sy_call_t *)linux_ustat }, /* 62 = linux_ustat */ { 2, (sy_call_t *)dup2 }, /* 63 = dup2 */ { 0, (sy_call_t *)getppid }, /* 64 = getppid */ { 0, (sy_call_t *)getpgrp }, /* 65 = getpgrp */ { 0, (sy_call_t *)setsid }, /* 66 = setsid */ { 3, (sy_call_t *)linux_sigaction }, /* 67 = linux_sigaction */ { 0, (sy_call_t *)linux_siggetmask }, /* 68 = linux_siggetmask */ { 1, (sy_call_t *)linux_sigsetmask }, /* 69 = linux_sigsetmask */ { 2, (sy_call_t *)setreuid }, /* 70 = setreuid */ { 2, (sy_call_t *)setregid }, /* 71 = setregid */ { 3, (sy_call_t *)linux_sigsuspend }, /* 72 = linux_sigsuspend */ { 1, (sy_call_t *)linux_sigpending }, /* 73 = linux_sigpending */ { 2, (sy_call_t *)osethostname }, /* 74 = osethostname */ { 2, (sy_call_t *)osetrlimit }, /* 75 = osetrlimit */ { 2, (sy_call_t *)ogetrlimit }, /* 76 = ogetrlimit */ { 2, (sy_call_t *)getrusage }, /* 77 = getrusage */ { 2, (sy_call_t *)gettimeofday }, /* 78 = gettimeofday */ { 2, (sy_call_t *)settimeofday }, /* 79 = settimeofday */ { 2, (sy_call_t *)getgroups }, /* 80 = getgroups */ { 2, (sy_call_t *)setgroups }, /* 81 = setgroups */ { 1, (sy_call_t *)linux_select }, /* 82 = linux_select */ { 2, (sy_call_t *)linux_symlink }, /* 83 = linux_symlink */ { 2, (sy_call_t *)ostat }, /* 84 = ostat */ { 3, (sy_call_t *)linux_readlink }, /* 85 = linux_readlink */ { 1, (sy_call_t *)linux_uselib }, /* 86 = linux_uselib */ { 1, (sy_call_t *)swapon }, /* 87 = swapon */ { 1, (sy_call_t *)reboot }, /* 88 = reboot */ { 3, (sy_call_t *)linux_readdir }, /* 89 = linux_readdir */ { 1, (sy_call_t *)linux_mmap }, /* 90 = linux_mmap */ { 2, (sy_call_t *)munmap }, /* 91 = munmap */ { 2, (sy_call_t *)linux_truncate }, /* 92 = linux_truncate */ { 2, (sy_call_t *)oftruncate }, /* 93 = oftruncate */ { 2, (sy_call_t *)fchmod }, /* 94 = fchmod */ { 3, (sy_call_t *)fchown }, /* 95 = fchown */ { 2, (sy_call_t *)getpriority }, /* 96 = getpriority */ { 3, (sy_call_t *)setpriority }, /* 97 = setpriority */ { 4, (sy_call_t *)profil }, /* 98 = profil */ { 2, (sy_call_t *)linux_statfs }, /* 99 = linux_statfs */ { 2, (sy_call_t *)linux_fstatfs }, /* 100 = linux_fstatfs */ { 3, (sy_call_t *)linux_ioperm }, /* 101 = linux_ioperm */ { 2, (sy_call_t *)linux_socketcall }, /* 102 = linux_socketcall */ { 1, (sy_call_t *)linux_ksyslog }, /* 103 = linux_ksyslog */ { 3, (sy_call_t *)linux_setitimer }, /* 104 = linux_setitimer */ { 2, (sy_call_t *)linux_getitimer }, /* 105 = linux_getitimer */ { 2, (sy_call_t *)linux_newstat }, /* 106 = linux_newstat */ { 2, (sy_call_t *)linux_newlstat }, /* 107 = linux_newlstat */ { 2, (sy_call_t *)linux_newfstat }, /* 108 = linux_newfstat */ { 1, (sy_call_t *)linux_uname }, /* 109 = linux_uname */ { 1, (sy_call_t *)linux_iopl }, /* 110 = linux_iopl */ { 0, (sy_call_t *)linux_vhangup }, /* 111 = linux_vhangup */ { 0, (sy_call_t *)linux_idle }, /* 112 = linux_idle */ { 0, (sy_call_t *)linux_vm86 }, /* 113 = linux_vm86 */ { 4, (sy_call_t *)linux_wait4 }, /* 114 = linux_wait4 */ { 0, (sy_call_t *)linux_swapoff }, /* 115 = linux_swapoff */ { 0, (sy_call_t *)linux_sysinfo }, /* 116 = linux_sysinfo */ { 5, (sy_call_t *)linux_ipc }, /* 117 = linux_ipc */ { 1, (sy_call_t *)fsync }, /* 118 = fsync */ { 1, (sy_call_t *)linux_sigreturn }, /* 119 = linux_sigreturn */ { 0, (sy_call_t *)linux_clone }, /* 120 = linux_clone */ { 2, (sy_call_t *)setdomainname }, /* 121 = setdomainname */ { 1, (sy_call_t *)linux_newuname }, /* 122 = linux_newuname */ { 3, (sy_call_t *)linux_modify_ldt }, /* 123 = linux_modify_ldt */ { 0, (sy_call_t *)linux_adjtimex }, /* 124 = linux_adjtimex */ { 3, (sy_call_t *)mprotect }, /* 125 = mprotect */ { 3, (sy_call_t *)linux_sigprocmask }, /* 126 = linux_sigprocmask */ { 0, (sy_call_t *)linux_create_module }, /* 127 = linux_create_module */ { 0, (sy_call_t *)linux_init_module }, /* 128 = linux_init_module */ { 0, (sy_call_t *)linux_delete_module }, /* 129 = linux_delete_module */ { 0, (sy_call_t *)linux_get_kernel_syms }, /* 130 = linux_get_kernel_syms */ { 0, (sy_call_t *)linux_quotactl }, /* 131 = linux_quotactl */ { 1, (sy_call_t *)linux_getpgid }, /* 132 = linux_getpgid */ { 1, (sy_call_t *)fchdir }, /* 133 = fchdir */ { 0, (sy_call_t *)linux_bdflush }, /* 134 = linux_bdflush */ { 0, (sy_call_t *)nosys }, /* 135 = sysfs */ { 1, (sy_call_t *)linux_personality }, /* 136 = linux_personality */ { 0, (sy_call_t *)nosys }, /* 137 = afs_syscall */ { 0, (sy_call_t *)nosys }, /* 138 = setfsuid */ { 0, (sy_call_t *)nosys }, /* 139 = getfsuid */ { 5, (sy_call_t *)linux_llseek }, /* 140 = linux_llseek */ { 3, (sy_call_t *)linux_getdents }, /* 141 = linux_getdents */ { 5, (sy_call_t *)linux_newselect }, /* 142 = linux_newselect */ { 2, (sy_call_t *)flock }, /* 143 = flock */ { 3, (sy_call_t *)linux_msync }, /* 144 = linux_msync */ { 3, (sy_call_t *)readv }, /* 145 = readv */ { 3, (sy_call_t *)writev }, /* 146 = writev */ + { 0, (sy_call_t *)nosys }, /* 147 = getsid */ + { 0, (sy_call_t *)nosys }, /* 148 = fdatasync */ + { 0, (sy_call_t *)nosys }, /* 149 = _sysctl */ + { 2, (sy_call_t *)mlock }, /* 150 = mlock */ + { 2, (sy_call_t *)munlock }, /* 151 = munlock */ + { 1, (sy_call_t *)mlockall }, /* 152 = mlockall */ + { 0, (sy_call_t *)munlockall }, /* 153 = munlockall */ + { 2, (sy_call_t *)sched_setparam }, /* 154 = sched_setparam */ + { 2, (sy_call_t *)sched_getparam }, /* 155 = sched_getparam */ + { 3, (sy_call_t *)sched_setscheduler }, /* 156 = sched_setscheduler */ + { 1, (sy_call_t *)sched_getscheduler }, /* 157 = sched_getscheduler */ + { 0, (sy_call_t *)sched_yield }, /* 158 = sched_yield */ + { 1, (sy_call_t *)sched_get_priority_max }, /* 159 = sched_get_priority_max */ + { 1, (sy_call_t *)sched_get_priority_min }, /* 160 = sched_get_priority_min */ + { 2, (sy_call_t *)sched_rr_get_interval }, /* 161 = sched_rr_get_interval */ + { 2, (sy_call_t *)nanosleep }, /* 162 = nanosleep */ }; diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 910710a4c78c..b1ae549e8838 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -1,209 +1,235 @@ - $Id: syscalls.master,v 1.5 1997/04/09 15:34:09 bde Exp $ + $Id: syscalls.master,v 1.6 1997/12/17 03:12:35 kato Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). ; Processed to created linux_sysent.c, linux_syscalls.c and linux_syscall.h. ; Columns: number type nargs namespc name alt{name,tag,rtyp}/comments ; number system call number, must be in order ; type one of STD, OBSOL, UNIMPL, COMPAT ; namespc one of POSIX, BSD, STD, NOHIDE (I dont care :-) -Peter ; name psuedo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" ; altrtyp return type if not int (bogus - syscalls always return int) ; for UNIMPL/OBSOL, name continues with comments ; types: ; STD always included ; COMPAT included on COMPAT #ifdef ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only #include #include #include #include #include ; #ifdef's, etc. may be included, and are copied to the output files. 0 STD LINUX { int linux_setup(void); } 1 NOPROTO LINUX { int exit(int rval); } 2 STD LINUX { int linux_fork(void); } 3 NOPROTO LINUX { int read(int fd, char *buf, u_int nbyte); } 4 NOPROTO LINUX { int write(int fd, char *buf, u_int nbyte); } 5 STD LINUX { int linux_open(char *path, int flags, int mode); } 6 NOPROTO LINUX { int close(int fd); } 7 STD LINUX { int linux_waitpid(int pid, int *status, int options);} 8 STD LINUX { int linux_creat(char *path, int mode); } 9 NOPROTO LINUX { int link(char *path, char *link); } 10 STD LINUX { int linux_unlink(char *path); } 11 STD LINUX { int linux_execve(char *path, char **argp, char **envp); } 12 STD LINUX { int linux_chdir(char *path); } 13 STD LINUX { int linux_time(linux_time_t *tm); } 14 STD LINUX { int linux_mknod(char *path, int mode, int dev); } 15 STD LINUX { int linux_chmod(char *path, int mode); } 16 STD LINUX { int linux_chown(char *path, int uid, int gid); } 17 STD LINUX { int linux_break(char *nsize); } 18 STD LINUX { int linux_stat(char *path, struct ostat *up); } 19 STD LINUX { int linux_lseek(int fdes, long off, int whence); } 20 NOPROTO LINUX { int getpid(void); } 21 STD LINUX { int linux_mount(void); } 22 STD LINUX { int linux_umount(void); } 23 NOPROTO LINUX { int setuid(uid_t uid); } 24 NOPROTO LINUX { int getuid(void); } 25 STD LINUX { int linux_stime(void); } 26 STD LINUX { int linux_ptrace(void); } 27 STD LINUX { int linux_alarm(unsigned int secs); } 28 STD LINUX { int linux_fstat(int fd, struct ostat *up); } 29 STD LINUX { int linux_pause(void); } 30 STD LINUX { int linux_utime(char *fname, struct linux_utimbuf *times); } 31 STD LINUX { int linux_stty(void); } 32 STD LINUX { int linux_gtty(void); } 33 STD LINUX { int linux_access(char *path, int flags); } 34 STD LINUX { int linux_nice(int inc); } 35 STD LINUX { int linux_ftime(void); } 36 NOPROTO LINUX { int sync(void); } 37 STD LINUX { int linux_kill(int pid, int signum); } 38 STD LINUX { int linux_rename(char *from, char *to); } 39 STD LINUX { int linux_mkdir(char *path, int mode); } 40 STD LINUX { int linux_rmdir(char *path); } 41 NOPROTO LINUX { int dup(u_int fd); } 42 STD LINUX { int linux_pipe(int *pipefds); } 43 STD LINUX { int linux_times(struct linux_times_argv *buf); } 44 STD LINUX { int linux_prof(void); } 45 STD LINUX { int linux_brk(char *dsend); } 46 NOPROTO LINUX { int setgid(gid_t gid); } 47 NOPROTO LINUX { int getgid(void); } 48 STD LINUX { int linux_signal(int sig, linux_handler_t handler); } 49 NOPROTO LINUX { int geteuid(void); } 50 NOPROTO LINUX { int getegid(void); } 51 NOPROTO LINUX { int acct(char *path); } 52 STD LINUX { int linux_phys(void); } 53 STD LINUX { int linux_lock(void); } 54 STD LINUX { int linux_ioctl(int fd, u_long cmd, int arg); } 55 STD LINUX { int linux_fcntl(int fd, int cmd, int arg); } 56 STD LINUX { int linux_mpx(void); } 57 NOPROTO LINUX { int setpgid(int pid, int pgid); } 58 STD LINUX { int linux_ulimit(void); } 59 STD LINUX { int linux_olduname(struct linux_oldold_utsname *up); } 60 NOPROTO LINUX { int umask(int newmask); } 61 NOPROTO LINUX { int chroot(char *path); } 62 STD LINUX { int linux_ustat(void); } 63 NOPROTO LINUX { int dup2(u_int from, u_int to); } 64 NOPROTO LINUX { int getppid(void); } 65 NOPROTO LINUX { int getpgrp(void); } 66 NOPROTO LINUX { int setsid(void); } 67 STD LINUX { int linux_sigaction(int sig, \ struct linux_sigaction *nsa, \ struct linux_sigaction *osa); } 68 STD LINUX { int linux_siggetmask(void); } 69 STD LINUX { int linux_sigsetmask(linux_sigset_t mask); } 70 NOPROTO LINUX { int setreuid(int ruid, int euid); } 71 NOPROTO LINUX { int setregid(int rgid, int egid); } 72 STD LINUX { int linux_sigsuspend(int restart, \ linux_sigset_t oldmask, linux_sigset_t mask); } 73 STD LINUX { int linux_sigpending(linux_sigset_t *mask); } 74 NOPROTO LINUX { int osethostname(char *hostname, \ u_int len);} 75 NOPROTO LINUX { int osetrlimit(u_int which, \ struct ogetrlimit *rlp); } 76 NOPROTO LINUX { int ogetrlimit(u_int which, \ struct ogetrlimit *rlp); } 77 NOPROTO LINUX { int getrusage(int who, struct rusage *rusage); } 78 NOPROTO LINUX { int gettimeofday(struct timeval *tp, \ struct timezone *tzp); } 79 NOPROTO LINUX { int settimeofday(struct timeval *tp, \ struct timezone *tzp); } 80 NOPROTO LINUX { int getgroups(u_int gidsetsize, gid_t *gidset); } 81 NOPROTO LINUX { int setgroups(u_int gidsetsize, gid_t *gidset); } 82 STD LINUX { int linux_select(struct linux_select_argv *ptr); } 83 STD LINUX { int linux_symlink(char *path, char *to); } 84 NOPROTO LINUX { int ostat(char *path, struct ostat *up); } 85 STD LINUX { int linux_readlink(char *name, char *buf, \ int count); } 86 STD LINUX { int linux_uselib(char *library); } 87 NOPROTO LINUX { int swapon(char *name); } 88 NOPROTO LINUX { int reboot(int opt); } 89 STD LINUX { int linux_readdir(int fd, struct linux_dirent *dent, \ unsigned int count); } 90 STD LINUX { int linux_mmap(struct linux_mmap_argv *ptr); } 91 NOPROTO LINUX { int munmap(caddr_t addr, int len); } 92 STD LINUX { int linux_truncate(char *path, long length); } 93 NOPROTO LINUX { int oftruncate(int fd, long length); } 94 NOPROTO LINUX { int fchmod(int fd, int mode); } 95 NOPROTO LINUX { int fchown(int fd, int uid, int gid); } 96 NOPROTO LINUX { int getpriority(int which, int who); } 97 NOPROTO LINUX { int setpriority(int which, int who, int prio); } 98 NOPROTO LINUX { int profil(caddr_t samples, u_int size, \ u_int offset, u_int scale); } 99 STD LINUX { int linux_statfs(char *path, \ struct linux_statfs_buf *buf); } 100 STD LINUX { int linux_fstatfs(int fd, \ struct linux_statfs_buf *buf); } 101 STD LINUX { int linux_ioperm(unsigned int lo, \ unsigned int hi, int val); } 102 STD LINUX { int linux_socketcall(int what, void *args); } 103 STD LINUX { int linux_ksyslog(int what); } 104 STD LINUX { int linux_setitimer(u_int which, \ struct itimerval *itv, struct itimerval *oitv); } 105 STD LINUX { int linux_getitimer(u_int which, \ struct itimerval *itv); } 106 STD LINUX { int linux_newstat(char *path, \ struct linux_newstat *buf); } 107 STD LINUX { int linux_newlstat(char *path, \ struct linux_newstat *buf); } 108 STD LINUX { int linux_newfstat(int fd, struct linux_newstat *buf); } 109 STD LINUX { int linux_uname(struct linux_old_utsname *up); } 110 STD LINUX { int linux_iopl(int level); } 111 STD LINUX { int linux_vhangup(void); } 112 STD LINUX { int linux_idle(void); } 113 STD LINUX { int linux_vm86(void); } 114 STD LINUX { int linux_wait4(int pid, int *status, \ int options, struct rusage *rusage); } 115 STD LINUX { int linux_swapoff(void); } 116 STD LINUX { int linux_sysinfo(void); } 117 STD LINUX { int linux_ipc(int what, int arg1, int arg2, int arg3, \ caddr_t ptr); } 118 NOPROTO LINUX { int fsync(int fd); } 119 STD LINUX { int linux_sigreturn(struct linux_sigcontext *scp); } 120 STD LINUX { int linux_clone(void); } 121 NOPROTO LINUX { int setdomainname(char *name, \ int len); } 122 STD LINUX { int linux_newuname(struct linux_newuname_t *buf); } 123 STD LINUX { int linux_modify_ldt(int func, void *ptr, \ size_t bytecount); } 124 STD LINUX { int linux_adjtimex(void); } 125 NOPROTO LINUX { int mprotect(caddr_t addr, int len, int prot); } 126 STD LINUX { int linux_sigprocmask(int how, \ linux_sigset_t *mask, linux_sigset_t *omask); } 127 STD LINUX { int linux_create_module(void); } 128 STD LINUX { int linux_init_module(void); } 129 STD LINUX { int linux_delete_module(void); } 130 STD LINUX { int linux_get_kernel_syms(void); } 131 STD LINUX { int linux_quotactl(void); } 132 STD LINUX { int linux_getpgid(int pid); } 133 NOPROTO LINUX { int fchdir(int fd); } 134 STD LINUX { int linux_bdflush(void); } 135 UNIMPL LINUX sysfs 136 STD LINUX { int linux_personality(int per); } 137 UNIMPL LINUX afs_syscall 138 UNIMPL LINUX setfsuid 139 UNIMPL LINUX getfsuid 140 STD LINUX { int linux_llseek(int fd, u_int32_t ohigh, \ u_int32_t olow, caddr_t res, int whence); } 141 STD LINUX { int linux_getdents(int fd, void *dent, \ unsigned count); } 142 STD LINUX { int linux_newselect(int nfds, fd_set *readfds, \ fd_set *writefds, fd_set *exceptfds, \ struct timeval *timeout); } 143 NOPROTO LINUX { int flock(int fd, int how); } 144 STD LINUX { int linux_msync(caddr_t addr, int len, int fl); } 145 NOPROTO LINUX { int readv(int fd, struct iovec *iovp, \ u_int iovcnt); } 146 NOPROTO LINUX { int writev(int fd, struct iovec *iovp, \ u_int iovcnt); } + +; Turn on getsid after checking that it matches. + +147 UNIMPL LINUX getsid +148 UNIMPL LINUX fdatasync +149 UNIMPL LINUX _sysctl + +150 NOPROTO BSD { int mlock(const void *addr, size_t len); } +151 NOPROTO BSD { int munlock(const void *addr, size_t len); } +152 NOPROTO BSD { int mlockall(int how); } +153 NOPROTO BSD { int munlockall(void); } + + +154 NOPROTO POSIX { int sched_setparam (pid_t pid, const struct sched_param *param); } +155 NOPROTO POSIX { int sched_getparam (pid_t pid, struct sched_param *param); } + +156 NOPROTO POSIX { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } +157 NOPROTO POSIX { int sched_getscheduler (pid_t pid); } + +158 NOPROTO POSIX { int sched_yield (void); } +159 NOPROTO POSIX { int sched_get_priority_max (int policy); } +160 NOPROTO POSIX { int sched_get_priority_min (int policy); } +161 NOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } + +162 NOPROTO POSIX { int nanosleep(const struct timespec *rqtp, \ + struct timespec *rmtp); } diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 7f62e27c49d8..7336ac8d1be8 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -1,349 +1,357 @@ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp */ #include "opt_compat.h" #include #include #include #ifdef COMPAT_43 #define compat(n, name) n, (sy_call_t *)__CONCAT(o,name) #else #define compat(n, name) 0, (sy_call_t *)nosys #endif /* The casts are bogus but will do for now. */ struct sysent sysent[] = { { 0, (sy_call_t *)nosys }, /* 0 = syscall */ { 1, (sy_call_t *)exit }, /* 1 = exit */ { 0, (sy_call_t *)fork }, /* 2 = fork */ { 3, (sy_call_t *)read }, /* 3 = read */ { 3, (sy_call_t *)write }, /* 4 = write */ { 3, (sy_call_t *)open }, /* 5 = open */ { 1, (sy_call_t *)close }, /* 6 = close */ { 4, (sy_call_t *)wait4 }, /* 7 = wait4 */ { compat(2,creat) }, /* 8 = old creat */ { 2, (sy_call_t *)link }, /* 9 = link */ { 1, (sy_call_t *)unlink }, /* 10 = unlink */ { 0, (sy_call_t *)nosys }, /* 11 = obsolete execv */ { 1, (sy_call_t *)chdir }, /* 12 = chdir */ { 1, (sy_call_t *)fchdir }, /* 13 = fchdir */ { 3, (sy_call_t *)mknod }, /* 14 = mknod */ { 2, (sy_call_t *)chmod }, /* 15 = chmod */ { 3, (sy_call_t *)chown }, /* 16 = chown */ { 1, (sy_call_t *)obreak }, /* 17 = break */ { 3, (sy_call_t *)getfsstat }, /* 18 = getfsstat */ { compat(3,lseek) }, /* 19 = old lseek */ { 0, (sy_call_t *)getpid }, /* 20 = getpid */ { 4, (sy_call_t *)mount }, /* 21 = mount */ { 2, (sy_call_t *)unmount }, /* 22 = unmount */ { 1, (sy_call_t *)setuid }, /* 23 = setuid */ { 0, (sy_call_t *)getuid }, /* 24 = getuid */ { 0, (sy_call_t *)geteuid }, /* 25 = geteuid */ { 4, (sy_call_t *)ptrace }, /* 26 = ptrace */ { 3, (sy_call_t *)recvmsg }, /* 27 = recvmsg */ { 3, (sy_call_t *)sendmsg }, /* 28 = sendmsg */ { 6, (sy_call_t *)recvfrom }, /* 29 = recvfrom */ { 3, (sy_call_t *)accept }, /* 30 = accept */ { 3, (sy_call_t *)getpeername }, /* 31 = getpeername */ { 3, (sy_call_t *)getsockname }, /* 32 = getsockname */ { 2, (sy_call_t *)access }, /* 33 = access */ { 2, (sy_call_t *)chflags }, /* 34 = chflags */ { 2, (sy_call_t *)fchflags }, /* 35 = fchflags */ { 0, (sy_call_t *)sync }, /* 36 = sync */ { 2, (sy_call_t *)kill }, /* 37 = kill */ { compat(2,stat) }, /* 38 = old stat */ { 0, (sy_call_t *)getppid }, /* 39 = getppid */ { compat(2,lstat) }, /* 40 = old lstat */ { 1, (sy_call_t *)dup }, /* 41 = dup */ { 0, (sy_call_t *)pipe }, /* 42 = pipe */ { 0, (sy_call_t *)getegid }, /* 43 = getegid */ { 4, (sy_call_t *)profil }, /* 44 = profil */ { 4, (sy_call_t *)ktrace }, /* 45 = ktrace */ { 3, (sy_call_t *)sigaction }, /* 46 = sigaction */ { 0, (sy_call_t *)getgid }, /* 47 = getgid */ { 2, (sy_call_t *)sigprocmask }, /* 48 = sigprocmask */ { 2, (sy_call_t *)getlogin }, /* 49 = getlogin */ { 1, (sy_call_t *)setlogin }, /* 50 = setlogin */ { 1, (sy_call_t *)acct }, /* 51 = acct */ { 0, (sy_call_t *)sigpending }, /* 52 = sigpending */ { 2, (sy_call_t *)sigaltstack }, /* 53 = sigaltstack */ { 3, (sy_call_t *)ioctl }, /* 54 = ioctl */ { 1, (sy_call_t *)reboot }, /* 55 = reboot */ { 1, (sy_call_t *)revoke }, /* 56 = revoke */ { 2, (sy_call_t *)symlink }, /* 57 = symlink */ { 3, (sy_call_t *)readlink }, /* 58 = readlink */ { 3, (sy_call_t *)execve }, /* 59 = execve */ { 1, (sy_call_t *)umask }, /* 60 = umask */ { 1, (sy_call_t *)chroot }, /* 61 = chroot */ { compat(2,fstat) }, /* 62 = old fstat */ { compat(4,getkerninfo) }, /* 63 = old getkerninfo */ { compat(0,getpagesize) }, /* 64 = old getpagesize */ { 3, (sy_call_t *)msync }, /* 65 = msync */ { 0, (sy_call_t *)vfork }, /* 66 = vfork */ { 0, (sy_call_t *)nosys }, /* 67 = obsolete vread */ { 0, (sy_call_t *)nosys }, /* 68 = obsolete vwrite */ { 1, (sy_call_t *)sbrk }, /* 69 = sbrk */ { 1, (sy_call_t *)sstk }, /* 70 = sstk */ { compat(6,mmap) }, /* 71 = old mmap */ { 1, (sy_call_t *)ovadvise }, /* 72 = vadvise */ { 2, (sy_call_t *)munmap }, /* 73 = munmap */ { 3, (sy_call_t *)mprotect }, /* 74 = mprotect */ { 3, (sy_call_t *)madvise }, /* 75 = madvise */ { 0, (sy_call_t *)nosys }, /* 76 = obsolete vhangup */ { 0, (sy_call_t *)nosys }, /* 77 = obsolete vlimit */ { 3, (sy_call_t *)mincore }, /* 78 = mincore */ { 2, (sy_call_t *)getgroups }, /* 79 = getgroups */ { 2, (sy_call_t *)setgroups }, /* 80 = setgroups */ { 0, (sy_call_t *)getpgrp }, /* 81 = getpgrp */ { 2, (sy_call_t *)setpgid }, /* 82 = setpgid */ { 3, (sy_call_t *)setitimer }, /* 83 = setitimer */ { compat(0,wait) }, /* 84 = old wait */ { 1, (sy_call_t *)swapon }, /* 85 = swapon */ { 2, (sy_call_t *)getitimer }, /* 86 = getitimer */ { compat(2,gethostname) }, /* 87 = old gethostname */ { compat(2,sethostname) }, /* 88 = old sethostname */ { 0, (sy_call_t *)getdtablesize }, /* 89 = getdtablesize */ { 2, (sy_call_t *)dup2 }, /* 90 = dup2 */ { 0, (sy_call_t *)nosys }, /* 91 = getdopt */ { 3, (sy_call_t *)fcntl }, /* 92 = fcntl */ { 5, (sy_call_t *)select }, /* 93 = select */ { 0, (sy_call_t *)nosys }, /* 94 = setdopt */ { 1, (sy_call_t *)fsync }, /* 95 = fsync */ { 3, (sy_call_t *)setpriority }, /* 96 = setpriority */ { 3, (sy_call_t *)socket }, /* 97 = socket */ { 3, (sy_call_t *)connect }, /* 98 = connect */ { compat(3,accept) }, /* 99 = old accept */ { 2, (sy_call_t *)getpriority }, /* 100 = getpriority */ { compat(4,send) }, /* 101 = old send */ { compat(4,recv) }, /* 102 = old recv */ { 1, (sy_call_t *)sigreturn }, /* 103 = sigreturn */ { 3, (sy_call_t *)bind }, /* 104 = bind */ { 5, (sy_call_t *)setsockopt }, /* 105 = setsockopt */ { 2, (sy_call_t *)listen }, /* 106 = listen */ { 0, (sy_call_t *)nosys }, /* 107 = obsolete vtimes */ { compat(3,sigvec) }, /* 108 = old sigvec */ { compat(1,sigblock) }, /* 109 = old sigblock */ { compat(1,sigsetmask) }, /* 110 = old sigsetmask */ { 1, (sy_call_t *)sigsuspend }, /* 111 = sigsuspend */ { compat(2,sigstack) }, /* 112 = old sigstack */ { compat(3,recvmsg) }, /* 113 = old recvmsg */ { compat(3,sendmsg) }, /* 114 = old sendmsg */ { 0, (sy_call_t *)nosys }, /* 115 = obsolete vtrace */ { 2, (sy_call_t *)gettimeofday }, /* 116 = gettimeofday */ { 2, (sy_call_t *)getrusage }, /* 117 = getrusage */ { 5, (sy_call_t *)getsockopt }, /* 118 = getsockopt */ { 0, (sy_call_t *)nosys }, /* 119 = resuba */ { 3, (sy_call_t *)readv }, /* 120 = readv */ { 3, (sy_call_t *)writev }, /* 121 = writev */ { 2, (sy_call_t *)settimeofday }, /* 122 = settimeofday */ { 3, (sy_call_t *)fchown }, /* 123 = fchown */ { 2, (sy_call_t *)fchmod }, /* 124 = fchmod */ { compat(6,recvfrom) }, /* 125 = old recvfrom */ { 2, (sy_call_t *)setreuid }, /* 126 = setreuid */ { 2, (sy_call_t *)setregid }, /* 127 = setregid */ { 2, (sy_call_t *)rename }, /* 128 = rename */ { compat(2,truncate) }, /* 129 = old truncate */ { compat(2,ftruncate) }, /* 130 = old ftruncate */ { 2, (sy_call_t *)flock }, /* 131 = flock */ { 2, (sy_call_t *)mkfifo }, /* 132 = mkfifo */ { 6, (sy_call_t *)sendto }, /* 133 = sendto */ { 2, (sy_call_t *)shutdown }, /* 134 = shutdown */ { 4, (sy_call_t *)socketpair }, /* 135 = socketpair */ { 2, (sy_call_t *)mkdir }, /* 136 = mkdir */ { 1, (sy_call_t *)rmdir }, /* 137 = rmdir */ { 2, (sy_call_t *)utimes }, /* 138 = utimes */ { 0, (sy_call_t *)nosys }, /* 139 = obsolete 4.2 sigreturn */ { 2, (sy_call_t *)adjtime }, /* 140 = adjtime */ { compat(3,getpeername) }, /* 141 = old getpeername */ { compat(0,gethostid) }, /* 142 = old gethostid */ { compat(1,sethostid) }, /* 143 = old sethostid */ { compat(2,getrlimit) }, /* 144 = old getrlimit */ { compat(2,setrlimit) }, /* 145 = old setrlimit */ { compat(2,killpg) }, /* 146 = old killpg */ { 0, (sy_call_t *)setsid }, /* 147 = setsid */ { 4, (sy_call_t *)quotactl }, /* 148 = quotactl */ { compat(0,quota) }, /* 149 = old quota */ { compat(3,getsockname) }, /* 150 = old getsockname */ { 0, (sy_call_t *)nosys }, /* 151 = sem_lock */ { 0, (sy_call_t *)nosys }, /* 152 = sem_wakeup */ { 0, (sy_call_t *)nosys }, /* 153 = asyncdaemon */ { 0, (sy_call_t *)nosys }, /* 154 = nosys */ { 2, (sy_call_t *)nosys }, /* 155 = nfssvc */ { compat(4,getdirentries) }, /* 156 = old getdirentries */ { 2, (sy_call_t *)statfs }, /* 157 = statfs */ { 2, (sy_call_t *)fstatfs }, /* 158 = fstatfs */ { 0, (sy_call_t *)nosys }, /* 159 = nosys */ { 0, (sy_call_t *)nosys }, /* 160 = nosys */ { 2, (sy_call_t *)nosys }, /* 161 = getfh */ { 2, (sy_call_t *)getdomainname }, /* 162 = getdomainname */ { 2, (sy_call_t *)setdomainname }, /* 163 = setdomainname */ { 1, (sy_call_t *)uname }, /* 164 = uname */ { 2, (sy_call_t *)sysarch }, /* 165 = sysarch */ { 3, (sy_call_t *)rtprio }, /* 166 = rtprio */ { 0, (sy_call_t *)nosys }, /* 167 = nosys */ { 0, (sy_call_t *)nosys }, /* 168 = nosys */ { 5, (sy_call_t *)semsys }, /* 169 = semsys */ { 6, (sy_call_t *)msgsys }, /* 170 = msgsys */ { 4, (sy_call_t *)shmsys }, /* 171 = shmsys */ { 0, (sy_call_t *)nosys }, /* 172 = nosys */ { 0, (sy_call_t *)nosys }, /* 173 = nosys */ { 0, (sy_call_t *)nosys }, /* 174 = nosys */ { 0, (sy_call_t *)nosys }, /* 175 = nosys */ { 1, (sy_call_t *)ntp_adjtime }, /* 176 = ntp_adjtime */ { 0, (sy_call_t *)nosys }, /* 177 = sfork */ { 0, (sy_call_t *)nosys }, /* 178 = getdescriptor */ { 0, (sy_call_t *)nosys }, /* 179 = setdescriptor */ { 0, (sy_call_t *)nosys }, /* 180 = nosys */ { 1, (sy_call_t *)setgid }, /* 181 = setgid */ { 1, (sy_call_t *)setegid }, /* 182 = setegid */ { 1, (sy_call_t *)seteuid }, /* 183 = seteuid */ { 0, (sy_call_t *)nosys }, /* 184 = lfs_bmapv */ { 0, (sy_call_t *)nosys }, /* 185 = lfs_markv */ { 0, (sy_call_t *)nosys }, /* 186 = lfs_segclean */ { 0, (sy_call_t *)nosys }, /* 187 = lfs_segwait */ { 2, (sy_call_t *)stat }, /* 188 = stat */ { 2, (sy_call_t *)fstat }, /* 189 = fstat */ { 2, (sy_call_t *)lstat }, /* 190 = lstat */ { 2, (sy_call_t *)pathconf }, /* 191 = pathconf */ { 2, (sy_call_t *)fpathconf }, /* 192 = fpathconf */ { 0, (sy_call_t *)nosys }, /* 193 = nosys */ { 2, (sy_call_t *)getrlimit }, /* 194 = getrlimit */ { 2, (sy_call_t *)setrlimit }, /* 195 = setrlimit */ { 4, (sy_call_t *)getdirentries }, /* 196 = getdirentries */ { 8, (sy_call_t *)mmap }, /* 197 = mmap */ { 0, (sy_call_t *)nosys }, /* 198 = __syscall */ { 5, (sy_call_t *)lseek }, /* 199 = lseek */ { 4, (sy_call_t *)truncate }, /* 200 = truncate */ { 4, (sy_call_t *)ftruncate }, /* 201 = ftruncate */ { 6, (sy_call_t *)__sysctl }, /* 202 = __sysctl */ { 2, (sy_call_t *)mlock }, /* 203 = mlock */ { 2, (sy_call_t *)munlock }, /* 204 = munlock */ { 2, (sy_call_t *)utrace }, /* 205 = utrace */ { 1, (sy_call_t *)undelete }, /* 206 = undelete */ { 1, (sy_call_t *)getpgid }, /* 207 = getpgid */ { 0, (sy_call_t *)nosys }, /* 208 = newreboot */ { 3, (sy_call_t *)poll }, /* 209 = poll */ { 0, (sy_call_t *)lkmnosys }, /* 210 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 211 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 212 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 213 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 214 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 215 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 216 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 217 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 218 = lkmnosys */ { 0, (sy_call_t *)lkmnosys }, /* 219 = lkmnosys */ { 4, (sy_call_t *)__semctl }, /* 220 = __semctl */ { 3, (sy_call_t *)semget }, /* 221 = semget */ { 3, (sy_call_t *)semop }, /* 222 = semop */ { 1, (sy_call_t *)semconfig }, /* 223 = semconfig */ { 3, (sy_call_t *)msgctl }, /* 224 = msgctl */ { 2, (sy_call_t *)msgget }, /* 225 = msgget */ { 4, (sy_call_t *)msgsnd }, /* 226 = msgsnd */ { 5, (sy_call_t *)msgrcv }, /* 227 = msgrcv */ { 3, (sy_call_t *)shmat }, /* 228 = shmat */ { 3, (sy_call_t *)shmctl }, /* 229 = shmctl */ { 1, (sy_call_t *)shmdt }, /* 230 = shmdt */ { 3, (sy_call_t *)shmget }, /* 231 = shmget */ { 2, (sy_call_t *)clock_gettime }, /* 232 = clock_gettime */ { 2, (sy_call_t *)clock_settime }, /* 233 = clock_settime */ { 2, (sy_call_t *)clock_getres }, /* 234 = clock_getres */ { 0, (sy_call_t *)nosys }, /* 235 = timer_create */ { 0, (sy_call_t *)nosys }, /* 236 = timer_delete */ { 0, (sy_call_t *)nosys }, /* 237 = timer_settime */ { 0, (sy_call_t *)nosys }, /* 238 = timer_gettime */ { 0, (sy_call_t *)nosys }, /* 239 = timer_getoverrun */ { 2, (sy_call_t *)nanosleep }, /* 240 = nanosleep */ { 0, (sy_call_t *)nosys }, /* 241 = nosys */ { 0, (sy_call_t *)nosys }, /* 242 = nosys */ { 0, (sy_call_t *)nosys }, /* 243 = nosys */ { 0, (sy_call_t *)nosys }, /* 244 = nosys */ { 0, (sy_call_t *)nosys }, /* 245 = nosys */ { 0, (sy_call_t *)nosys }, /* 246 = nosys */ { 0, (sy_call_t *)nosys }, /* 247 = nosys */ { 0, (sy_call_t *)nosys }, /* 248 = nosys */ { 0, (sy_call_t *)nosys }, /* 249 = nosys */ { 3, (sy_call_t *)minherit }, /* 250 = minherit */ { 1, (sy_call_t *)rfork }, /* 251 = rfork */ { 3, (sy_call_t *)openbsd_poll }, /* 252 = openbsd_poll */ { 0, (sy_call_t *)issetugid }, /* 253 = issetugid */ { 3, (sy_call_t *)lchown }, /* 254 = lchown */ { 0, (sy_call_t *)nosys }, /* 255 = nosys */ { 0, (sy_call_t *)nosys }, /* 256 = nosys */ { 0, (sy_call_t *)nosys }, /* 257 = nosys */ { 0, (sy_call_t *)nosys }, /* 258 = nosys */ { 0, (sy_call_t *)nosys }, /* 259 = nosys */ { 0, (sy_call_t *)nosys }, /* 260 = nosys */ { 0, (sy_call_t *)nosys }, /* 261 = nosys */ { 0, (sy_call_t *)nosys }, /* 262 = nosys */ { 0, (sy_call_t *)nosys }, /* 263 = nosys */ { 0, (sy_call_t *)nosys }, /* 264 = nosys */ { 0, (sy_call_t *)nosys }, /* 265 = nosys */ { 0, (sy_call_t *)nosys }, /* 266 = nosys */ { 0, (sy_call_t *)nosys }, /* 267 = nosys */ { 0, (sy_call_t *)nosys }, /* 268 = nosys */ { 0, (sy_call_t *)nosys }, /* 269 = nosys */ { 0, (sy_call_t *)nosys }, /* 270 = nosys */ { 0, (sy_call_t *)nosys }, /* 271 = nosys */ { 0, (sy_call_t *)nosys }, /* 272 = nosys */ { 0, (sy_call_t *)nosys }, /* 273 = nosys */ { 0, (sy_call_t *)nosys }, /* 274 = nosys */ { 0, (sy_call_t *)nosys }, /* 275 = nosys */ { 0, (sy_call_t *)nosys }, /* 276 = nosys */ { 0, (sy_call_t *)nosys }, /* 277 = nosys */ { 0, (sy_call_t *)nosys }, /* 278 = nosys */ { 0, (sy_call_t *)nosys }, /* 279 = nosys */ { 0, (sy_call_t *)nosys }, /* 280 = nosys */ { 0, (sy_call_t *)nosys }, /* 281 = nosys */ { 0, (sy_call_t *)nosys }, /* 282 = nosys */ { 0, (sy_call_t *)nosys }, /* 283 = nosys */ { 0, (sy_call_t *)nosys }, /* 284 = nosys */ { 0, (sy_call_t *)nosys }, /* 285 = nosys */ { 0, (sy_call_t *)nosys }, /* 286 = nosys */ { 0, (sy_call_t *)nosys }, /* 287 = nosys */ { 0, (sy_call_t *)nosys }, /* 288 = nosys */ { 0, (sy_call_t *)nosys }, /* 289 = nosys */ { 0, (sy_call_t *)nosys }, /* 290 = nosys */ { 0, (sy_call_t *)nosys }, /* 291 = nosys */ { 0, (sy_call_t *)nosys }, /* 292 = nosys */ { 0, (sy_call_t *)nosys }, /* 293 = nosys */ { 0, (sy_call_t *)nosys }, /* 294 = nosys */ { 0, (sy_call_t *)nosys }, /* 295 = nosys */ { 0, (sy_call_t *)nosys }, /* 296 = nosys */ { 0, (sy_call_t *)nosys }, /* 297 = nosys */ { 0, (sy_call_t *)nosys }, /* 298 = nosys */ { 0, (sy_call_t *)nosys }, /* 299 = nosys */ { 1, (sy_call_t *)modnext }, /* 300 = modnext */ { 2, (sy_call_t *)modstat }, /* 301 = modstat */ { 1, (sy_call_t *)modfnext }, /* 302 = modfnext */ { 1, (sy_call_t *)modfind }, /* 303 = modfind */ { 1, (sy_call_t *)kldload }, /* 304 = kldload */ { 1, (sy_call_t *)kldunload }, /* 305 = kldunload */ { 1, (sy_call_t *)kldfind }, /* 306 = kldfind */ { 1, (sy_call_t *)kldnext }, /* 307 = kldnext */ { 2, (sy_call_t *)kldstat }, /* 308 = kldstat */ { 1, (sy_call_t *)kldfirstmod }, /* 309 = kldfirstmod */ { 1, (sy_call_t *)getsid }, /* 310 = getsid */ { 0, (sy_call_t *)nosys }, /* 311 = setresuid */ { 0, (sy_call_t *)nosys }, /* 312 = setresgid */ { 3, (sy_call_t *)signanosleep }, /* 313 = signanosleep */ { 1, (sy_call_t *)aio_return }, /* 314 = aio_return */ { 3, (sy_call_t *)aio_suspend }, /* 315 = aio_suspend */ { 2, (sy_call_t *)aio_cancel }, /* 316 = aio_cancel */ { 1, (sy_call_t *)aio_error }, /* 317 = aio_error */ { 1, (sy_call_t *)aio_read }, /* 318 = aio_read */ { 1, (sy_call_t *)aio_write }, /* 319 = aio_write */ { 4, (sy_call_t *)lio_listio }, /* 320 = lio_listio */ { 0, (sy_call_t *)yield }, /* 321 = yield */ { 1, (sy_call_t *)thr_sleep }, /* 322 = thr_sleep */ { 1, (sy_call_t *)thr_wakeup }, /* 323 = thr_wakeup */ { 1, (sy_call_t *)mlockall }, /* 324 = mlockall */ { 0, (sy_call_t *)munlockall }, /* 325 = munlockall */ { 2, (sy_call_t *)__getcwd }, /* 326 = __getcwd */ + { 2, (sy_call_t *)sched_setparam }, /* 327 = sched_setparam */ + { 2, (sy_call_t *)sched_getparam }, /* 328 = sched_getparam */ + { 3, (sy_call_t *)sched_setscheduler }, /* 329 = sched_setscheduler */ + { 1, (sy_call_t *)sched_getscheduler }, /* 330 = sched_getscheduler */ + { 0, (sy_call_t *)sched_yield }, /* 331 = sched_yield */ + { 1, (sy_call_t *)sched_get_priority_max }, /* 332 = sched_get_priority_max */ + { 1, (sy_call_t *)sched_get_priority_min }, /* 333 = sched_get_priority_min */ + { 2, (sy_call_t *)sched_rr_get_interval }, /* 334 = sched_rr_get_interval */ }; diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index 9718f6bce8fd..5278b344c4fa 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -1,187 +1,183 @@ /*- * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Karels at Berkeley Software Design, Inc. * * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD * project, to make these variables more userfriendly. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id: kern_mib.c,v 1.13 1997/12/25 13:14:21 gpalmer Exp $ + * $Id: kern_mib.c,v 1.14 1998/03/04 10:25:50 dufault Exp $ */ #include #include #include #include #include #include #include #if defined(SMP) #include #endif -#include "opt_posix4.h" - SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0, "Sysctl internal magic"); SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0, "High kernel, proc, limits &c"); SYSCTL_NODE(, CTL_VM, vm, CTLFLAG_RW, 0, "Virtual memory"); SYSCTL_NODE(, CTL_VFS, vfs, CTLFLAG_RW, 0, "File system"); SYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0, "Network, (see socket.h)"); SYSCTL_NODE(, CTL_DEBUG, debug, CTLFLAG_RW, 0, "Debugging"); SYSCTL_NODE(, CTL_HW, hw, CTLFLAG_RW, 0, "hardware"); SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0, "machine dependent"); SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0, "user-level"); -#ifdef POSIX4 -SYSCTL_NODE(, CTL_POSIX4, posix4, CTLFLAG_RW, 0, - "posix4, (see posix4.h)"); -#endif +SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0, + "p1003_1b, (see p1003_1b.h)"); SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD, osrelease, 0, ""); SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD, 0, BSD, ""); SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD, version, 0, ""); SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD, ostype, 0, ""); extern int osreldate; SYSCTL_INT(_kern, KERN_OSRELDATE, osreldate, CTLFLAG_RD, &osreldate, 0, ""); SYSCTL_INT(_kern, KERN_MAXPROC, maxproc, CTLFLAG_RD, &maxproc, 0, ""); SYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid, CTLFLAG_RW, &maxprocperuid, 0, ""); SYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD, 0, ARG_MAX, ""); -SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD, 0, _POSIX_VERSION, ""); +SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD, 0, _KPOSIX_VERSION, ""); SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD, 0, NGROUPS_MAX, ""); SYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD, 0, 1, ""); #ifdef _POSIX_SAVED_IDS SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD, 0, 1, ""); #else SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD, 0, 0, ""); #endif char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */ SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW, kernelname, sizeof kernelname, ""); #ifdef SMP SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD, &mp_ncpus, 0, ""); #else SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD, 0, 1, ""); #endif SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD, 0, BYTE_ORDER, ""); SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD, 0, PAGE_SIZE, ""); static char machine_arch[] = MACHINE_ARCH; SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD, machine_arch, 0, ""); char hostname[MAXHOSTNAMELEN]; SYSCTL_STRING(_kern, KERN_HOSTNAME, hostname, CTLFLAG_RW, hostname, sizeof(hostname), ""); int securelevel = -1; static int sysctl_kern_securelvl SYSCTL_HANDLER_ARGS { int error, level; level = securelevel; error = sysctl_handle_int(oidp, &level, 0, req); if (error || !req->newptr) return (error); if (level < securelevel) return (EPERM); securelevel = level; return (error); } SYSCTL_PROC(_kern, KERN_SECURELVL, securelevel, CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_kern_securelvl, "I", ""); char domainname[MAXHOSTNAMELEN]; SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW, &domainname, sizeof(domainname), ""); long hostid; /* Some trouble here, if sizeof (int) != sizeof (long) */ SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, ""); /* * This is really cheating. These actually live in the libc, something * which I'm not quite sure is a good idea anyway, but in order for * getnext and friends to actually work, we define dummies here. */ SYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RD, "", 0, ""); SYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD, 0, 0, ""); SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD, 0, 0, ""); diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 46089c7c9869..c0437d549d0f 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,756 +1,759 @@ /*- * Copyright (c) 1982, 1986, 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 - * $Id: kern_synch.c,v 1.50 1998/03/11 20:50:42 dufault Exp $ + * $Id: kern_synch.c,v 1.51 1998/03/28 10:33:06 bde Exp $ */ #include "opt_ktrace.h" #include #include #include #include #include #include #include #include #include #include #ifdef KTRACE #include #include #endif #include #include /* for UCHAR_MAX = typeof(p_priority)_MAX */ static void rqinit __P((void *)); SYSINIT(runqueue, SI_SUB_RUN_QUEUE, SI_ORDER_FIRST, rqinit, NULL) u_char curpriority; /* usrpri of curproc */ int lbolt; /* once a second sleep address */ static void endtsleep __P((void *)); static void roundrobin __P((void *arg)); static void schedcpu __P((void *arg)); static void updatepri __P((struct proc *p)); #define MAXIMUM_SCHEDULE_QUANTUM (1000000) /* arbitrary limit */ #ifndef DEFAULT_SCHEDULE_QUANTUM #define DEFAULT_SCHEDULE_QUANTUM 10 #endif static int quantum = DEFAULT_SCHEDULE_QUANTUM; /* default value */ static int sysctl_kern_quantum SYSCTL_HANDLER_ARGS { int error; int new_val = quantum; new_val = quantum; error = sysctl_handle_int(oidp, &new_val, 0, req); if (error == 0) { if ((new_val > 0) && (new_val < MAXIMUM_SCHEDULE_QUANTUM)) { quantum = new_val; } else { error = EINVAL; } } return (error); } SYSCTL_PROC(_kern, OID_AUTO, quantum, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof quantum, sysctl_kern_quantum, "I", ""); /* maybe_resched: Decide if you need to reschedule or not * taking the priorities and schedulers into account. */ static void maybe_resched(struct proc *chk) { struct proc *p = curproc; /* XXX */ + /* If the current scheduler is the idle scheduler or + * the priority is of the new one is higher then reschedule. + */ /* If the current scheduler is the idle scheduler or * the priority of the new one is higher then reschedule. */ if (p == 0 || RTP_PRIO_BASE(p->p_rtprio.type) == RTP_PRIO_IDLE || (chk->p_priority < curpriority && RTP_PRIO_BASE(p->p_rtprio.type) == RTP_PRIO_BASE(chk->p_rtprio.type)) ) need_resched(); } #define ROUNDROBIN_INTERVAL (hz / quantum) int roundrobin_interval(void) { return ROUNDROBIN_INTERVAL; } /* * Force switch among equal priority processes every 100ms. */ /* ARGSUSED */ static void roundrobin(arg) void *arg; { struct proc *p = curproc; /* XXX */ if (p == 0 || RTP_PRIO_NEED_RR(p->p_rtprio.type)) need_resched(); timeout(roundrobin, NULL, ROUNDROBIN_INTERVAL); } /* * Constants for digital decay and forget: * 90% of (p_estcpu) usage in 5 * loadav time * 95% of (p_pctcpu) usage in 60 seconds (load insensitive) * Note that, as ps(1) mentions, this can let percentages * total over 100% (I've seen 137.9% for 3 processes). * * Note that statclock() updates p_estcpu and p_cpticks asynchronously. * * We wish to decay away 90% of p_estcpu in (5 * loadavg) seconds. * That is, the system wants to compute a value of decay such * that the following for loop: * for (i = 0; i < (5 * loadavg); i++) * p_estcpu *= decay; * will compute * p_estcpu *= 0.1; * for all values of loadavg: * * Mathematically this loop can be expressed by saying: * decay ** (5 * loadavg) ~= .1 * * The system computes decay as: * decay = (2 * loadavg) / (2 * loadavg + 1) * * We wish to prove that the system's computation of decay * will always fulfill the equation: * decay ** (5 * loadavg) ~= .1 * * If we compute b as: * b = 2 * loadavg * then * decay = b / (b + 1) * * We now need to prove two things: * 1) Given factor ** (5 * loadavg) ~= .1, prove factor == b/(b+1) * 2) Given b/(b+1) ** power ~= .1, prove power == (5 * loadavg) * * Facts: * For x close to zero, exp(x) =~ 1 + x, since * exp(x) = 0! + x**1/1! + x**2/2! + ... . * therefore exp(-1/b) =~ 1 - (1/b) = (b-1)/b. * For x close to zero, ln(1+x) =~ x, since * ln(1+x) = x - x**2/2 + x**3/3 - ... -1 < x < 1 * therefore ln(b/(b+1)) = ln(1 - 1/(b+1)) =~ -1/(b+1). * ln(.1) =~ -2.30 * * Proof of (1): * Solve (factor)**(power) =~ .1 given power (5*loadav): * solving for factor, * ln(factor) =~ (-2.30/5*loadav), or * factor =~ exp(-1/((5/2.30)*loadav)) =~ exp(-1/(2*loadav)) = * exp(-1/b) =~ (b-1)/b =~ b/(b+1). QED * * Proof of (2): * Solve (factor)**(power) =~ .1 given factor == (b/(b+1)): * solving for power, * power*ln(b/(b+1)) =~ -2.30, or * power =~ 2.3 * (b + 1) = 4.6*loadav + 2.3 =~ 5*loadav. QED * * Actual power values for the implemented algorithm are as follows: * loadav: 1 2 3 4 * power: 5.68 10.32 14.94 19.55 */ /* calculations for digital decay to forget 90% of usage in 5*loadav sec */ #define loadfactor(loadav) (2 * (loadav)) #define decay_cpu(loadfac, cpu) (((loadfac) * (cpu)) / ((loadfac) + FSCALE)) /* decay 95% of `p_pctcpu' in 60 seconds; see CCPU_SHIFT before changing */ static fixpt_t ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */ /* * If `ccpu' is not equal to `exp(-1/20)' and you still want to use the * faster/more-accurate formula, you'll have to estimate CCPU_SHIFT below * and possibly adjust FSHIFT in "param.h" so that (FSHIFT >= CCPU_SHIFT). * * To estimate CCPU_SHIFT for exp(-1/20), the following formula was used: * 1 - exp(-1/20) ~= 0.0487 ~= 0.0488 == 1 (fixed pt, *11* bits). * * If you don't want to bother with the faster/more-accurate formula, you * can set CCPU_SHIFT to (FSHIFT + 1) which will use a slower/less-accurate * (more general) method of calculating the %age of CPU used by a process. */ #define CCPU_SHIFT 11 /* * Recompute process priorities, every hz ticks. */ /* ARGSUSED */ static void schedcpu(arg) void *arg; { register fixpt_t loadfac = loadfactor(averunnable.ldavg[0]); register struct proc *p; register int s; register unsigned int newcpu; for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) { /* * Increment time in/out of memory and sleep time * (if sleeping). We ignore overflow; with 16-bit int's * (remember them?) overflow takes 45 days. */ p->p_swtime++; if (p->p_stat == SSLEEP || p->p_stat == SSTOP) p->p_slptime++; p->p_pctcpu = (p->p_pctcpu * ccpu) >> FSHIFT; /* * If the process has slept the entire second, * stop recalculating its priority until it wakes up. */ if (p->p_slptime > 1) continue; s = splhigh(); /* prevent state changes and protect run queue */ /* * p_pctcpu is only for ps. */ #if (FSHIFT >= CCPU_SHIFT) p->p_pctcpu += (hz == 100)? ((fixpt_t) p->p_cpticks) << (FSHIFT - CCPU_SHIFT): 100 * (((fixpt_t) p->p_cpticks) << (FSHIFT - CCPU_SHIFT)) / hz; #else p->p_pctcpu += ((FSCALE - ccpu) * (p->p_cpticks * FSCALE / hz)) >> FSHIFT; #endif p->p_cpticks = 0; newcpu = (u_int) decay_cpu(loadfac, p->p_estcpu) + p->p_nice; p->p_estcpu = min(newcpu, UCHAR_MAX); resetpriority(p); if (p->p_priority >= PUSER) { #define PPQ (128 / NQS) /* priorities per queue */ if ((p != curproc) && #ifdef SMP (u_char)p->p_oncpu == 0xff && /* idle */ #endif p->p_stat == SRUN && (p->p_flag & P_INMEM) && (p->p_priority / PPQ) != (p->p_usrpri / PPQ)) { remrq(p); p->p_priority = p->p_usrpri; setrunqueue(p); } else p->p_priority = p->p_usrpri; } splx(s); } vmmeter(); wakeup((caddr_t)&lbolt); timeout(schedcpu, (void *)0, hz); } /* * Recalculate the priority of a process after it has slept for a while. * For all load averages >= 1 and max p_estcpu of 255, sleeping for at * least six times the loadfactor will decay p_estcpu to zero. */ static void updatepri(p) register struct proc *p; { register unsigned int newcpu = p->p_estcpu; register fixpt_t loadfac = loadfactor(averunnable.ldavg[0]); if (p->p_slptime > 5 * loadfac) p->p_estcpu = 0; else { p->p_slptime--; /* the first time was done in schedcpu */ while (newcpu && --p->p_slptime) newcpu = (int) decay_cpu(loadfac, newcpu); p->p_estcpu = min(newcpu, UCHAR_MAX); } resetpriority(p); } /* * We're only looking at 7 bits of the address; everything is * aligned to 4, lots of things are aligned to greater powers * of 2. Shift right by 8, i.e. drop the bottom 256 worth. */ #define TABLESIZE 128 static TAILQ_HEAD(slpquehead, proc) slpque[TABLESIZE]; #define LOOKUP(x) (((long)(x) >> 8) & (TABLESIZE - 1)) /* * During autoconfiguration or after a panic, a sleep will simply * lower the priority briefly to allow interrupts, then return. * The priority to be used (safepri) is machine-dependent, thus this * value is initialized and maintained in the machine-dependent layers. * This priority will typically be 0, or the lowest priority * that is safe for use on the interrupt stack; it can be made * higher to block network software interrupts after panics. */ int safepri; void sleepinit() { int i; for (i = 0; i < TABLESIZE; i++) TAILQ_INIT(&slpque[i]); } /* * General sleep call. Suspends the current process until a wakeup is * performed on the specified identifier. The process will then be made * runnable with the specified priority. Sleeps at most timo/hz seconds * (0 means no timeout). If pri includes PCATCH flag, signals are checked * before and after sleeping, else signals are not checked. Returns 0 if * awakened, EWOULDBLOCK if the timeout expires. If PCATCH is set and a * signal needs to be delivered, ERESTART is returned if the current system * call should be restarted if possible, and EINTR is returned if the system * call should be interrupted by the signal (return EINTR). */ int tsleep(ident, priority, wmesg, timo) void *ident; int priority, timo; const char *wmesg; { struct proc *p = curproc; int s, sig, catch = priority & PCATCH; struct callout_handle thandle; #ifdef KTRACE if (KTRPOINT(p, KTR_CSW)) ktrcsw(p->p_tracep, 1, 0); #endif s = splhigh(); if (cold || panicstr) { /* * After a panic, or during autoconfiguration, * just give interrupts a chance, then just return; * don't run any other procs or panic below, * in case this is the idle process and already asleep. */ splx(safepri); splx(s); return (0); } #ifdef DIAGNOSTIC if(p == NULL) panic("tsleep1"); if (ident == NULL || p->p_stat != SRUN) panic("tsleep"); /* XXX This is not exhaustive, just the most common case */ if ((p->p_procq.tqe_prev != NULL) && (*p->p_procq.tqe_prev == p)) panic("sleeping process already on another queue"); #endif p->p_wchan = ident; p->p_wmesg = wmesg; p->p_slptime = 0; p->p_priority = priority & PRIMASK; TAILQ_INSERT_TAIL(&slpque[LOOKUP(ident)], p, p_procq); if (timo) thandle = timeout(endtsleep, (void *)p, timo); /* * We put ourselves on the sleep queue and start our timeout * before calling CURSIG, as we could stop there, and a wakeup * or a SIGCONT (or both) could occur while we were stopped. * A SIGCONT would cause us to be marked as SSLEEP * without resuming us, thus we must be ready for sleep * when CURSIG is called. If the wakeup happens while we're * stopped, p->p_wchan will be 0 upon return from CURSIG. */ if (catch) { p->p_flag |= P_SINTR; if ((sig = CURSIG(p))) { if (p->p_wchan) unsleep(p); p->p_stat = SRUN; goto resume; } if (p->p_wchan == 0) { catch = 0; goto resume; } } else sig = 0; p->p_stat = SSLEEP; p->p_stats->p_ru.ru_nvcsw++; mi_switch(); resume: curpriority = p->p_usrpri; splx(s); p->p_flag &= ~P_SINTR; if (p->p_flag & P_TIMEOUT) { p->p_flag &= ~P_TIMEOUT; if (sig == 0) { #ifdef KTRACE if (KTRPOINT(p, KTR_CSW)) ktrcsw(p->p_tracep, 0, 0); #endif return (EWOULDBLOCK); } } else if (timo) untimeout(endtsleep, (void *)p, thandle); if (catch && (sig != 0 || (sig = CURSIG(p)))) { #ifdef KTRACE if (KTRPOINT(p, KTR_CSW)) ktrcsw(p->p_tracep, 0, 0); #endif if (p->p_sigacts->ps_sigintr & sigmask(sig)) return (EINTR); return (ERESTART); } #ifdef KTRACE if (KTRPOINT(p, KTR_CSW)) ktrcsw(p->p_tracep, 0, 0); #endif return (0); } /* * Implement timeout for tsleep. * If process hasn't been awakened (wchan non-zero), * set timeout flag and undo the sleep. If proc * is stopped, just unsleep so it will remain stopped. */ static void endtsleep(arg) void *arg; { register struct proc *p; int s; p = (struct proc *)arg; s = splhigh(); if (p->p_wchan) { if (p->p_stat == SSLEEP) setrunnable(p); else unsleep(p); p->p_flag |= P_TIMEOUT; } splx(s); } /* * Remove a process from its wait queue */ void unsleep(p) register struct proc *p; { int s; s = splhigh(); if (p->p_wchan) { TAILQ_REMOVE(&slpque[LOOKUP(p->p_wchan)], p, p_procq); p->p_wchan = 0; } splx(s); } /* * Make all processes sleeping on the specified identifier runnable. */ void wakeup(ident) register void *ident; { register struct slpquehead *qp; register struct proc *p; int s; s = splhigh(); qp = &slpque[LOOKUP(ident)]; restart: for (p = qp->tqh_first; p != NULL; p = p->p_procq.tqe_next) { #ifdef DIAGNOSTIC if (p->p_stat != SSLEEP && p->p_stat != SSTOP) panic("wakeup"); #endif if (p->p_wchan == ident) { TAILQ_REMOVE(qp, p, p_procq); p->p_wchan = 0; if (p->p_stat == SSLEEP) { /* OPTIMIZED EXPANSION OF setrunnable(p); */ if (p->p_slptime > 1) updatepri(p); p->p_slptime = 0; p->p_stat = SRUN; if (p->p_flag & P_INMEM) { setrunqueue(p); maybe_resched(p); } else { p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); } /* END INLINE EXPANSION */ goto restart; } } } splx(s); } /* * Make a process sleeping on the specified identifier runnable. * May wake more than one process if a target prcoess is currently * swapped out. */ void wakeup_one(ident) register void *ident; { register struct slpquehead *qp; register struct proc *p; int s; s = splhigh(); qp = &slpque[LOOKUP(ident)]; for (p = qp->tqh_first; p != NULL; p = p->p_procq.tqe_next) { #ifdef DIAGNOSTIC if (p->p_stat != SSLEEP && p->p_stat != SSTOP) panic("wakeup_one"); #endif if (p->p_wchan == ident) { TAILQ_REMOVE(qp, p, p_procq); p->p_wchan = 0; if (p->p_stat == SSLEEP) { /* OPTIMIZED EXPANSION OF setrunnable(p); */ if (p->p_slptime > 1) updatepri(p); p->p_slptime = 0; p->p_stat = SRUN; if (p->p_flag & P_INMEM) { setrunqueue(p); maybe_resched(p); break; } else { p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); } /* END INLINE EXPANSION */ } } } splx(s); } /* * The machine independent parts of mi_switch(). * Must be called at splstatclock() or higher. */ void mi_switch() { register struct proc *p = curproc; /* XXX */ register struct rlimit *rlim; register long s, u; int x; struct timeval tv; /* * XXX this spl is almost unnecessary. It is partly to allow for * sloppy callers that don't do it (issignal() via CURSIG() is the * main offender). It is partly to work around a bug in the i386 * cpu_switch() (the ipl is not preserved). We ran for years * without it. I think there was only a interrupt latency problem. * The main caller, tsleep(), does an splx() a couple of instructions * after calling here. The buggy caller, issignal(), usually calls * here at spl0() and sometimes returns at splhigh(). The process * then runs for a little too long at splhigh(). The ipl gets fixed * when the process returns to user mode (or earlier). * * It would probably be better to always call here at spl0(). Callers * are prepared to give up control to another process, so they must * be prepared to be interrupted. The clock stuff here may not * actually need splstatclock(). */ x = splstatclock(); #ifdef SIMPLELOCK_DEBUG if (p->p_simple_locks) printf("sleep: holding simple lock\n"); #endif /* * Compute the amount of time during which the current * process was running, and add that to its total so far. */ microtime(&tv); u = p->p_rtime.tv_usec + (tv.tv_usec - runtime.tv_usec); s = p->p_rtime.tv_sec + (tv.tv_sec - runtime.tv_sec); if (u < 0) { u += 1000000; s--; } else if (u >= 1000000) { u -= 1000000; s++; } #ifdef SMP if (s < 0) s = u = 0; #endif p->p_rtime.tv_usec = u; p->p_rtime.tv_sec = s; /* * Check if the process exceeds its cpu resource allocation. * If over max, kill it. */ if (p->p_stat != SZOMB) { rlim = &p->p_rlimit[RLIMIT_CPU]; if (s >= rlim->rlim_cur) { if (s >= rlim->rlim_max) killproc(p, "exceeded maximum CPU limit"); else { psignal(p, SIGXCPU); if (rlim->rlim_cur < rlim->rlim_max) rlim->rlim_cur += 5; } } } /* * Pick a new current process and record its start time. */ cnt.v_swtch++; cpu_switch(p); microtime(&runtime); splx(x); } /* * Initialize the (doubly-linked) run queues * to be empty. */ /* ARGSUSED*/ static void rqinit(dummy) void *dummy; { register int 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]; idqs[i].ph_link = idqs[i].ph_rlink = (struct proc *)&idqs[i]; } } /* * Change process state to be runnable, * placing it on the run queue if it is in memory, * and awakening the swapper if it isn't in memory. */ void setrunnable(p) register struct proc *p; { register int s; s = splhigh(); switch (p->p_stat) { case 0: case SRUN: case SZOMB: default: panic("setrunnable"); case SSTOP: case SSLEEP: unsleep(p); /* e.g. when sending signals */ break; case SIDL: break; } p->p_stat = SRUN; if (p->p_flag & P_INMEM) setrunqueue(p); splx(s); if (p->p_slptime > 1) updatepri(p); p->p_slptime = 0; if ((p->p_flag & P_INMEM) == 0) { p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); } else maybe_resched(p); } /* * Compute the priority of a process when running in user mode. * Arrange to reschedule if the resulting priority is better * than that of the current process. */ void resetpriority(p) register struct proc *p; { register unsigned int newpriority; if (p->p_rtprio.type == RTP_PRIO_NORMAL) { newpriority = PUSER + p->p_estcpu / 4 + 2 * p->p_nice; newpriority = min(newpriority, MAXPRI); p->p_usrpri = newpriority; } maybe_resched(p); } /* ARGSUSED */ static void sched_setup __P((void *dummy)); static void sched_setup(dummy) void *dummy; { /* Kick off timeout driven events by calling first time. */ roundrobin(NULL); schedcpu(NULL); } SYSINIT(sched_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, sched_setup, NULL) diff --git a/sys/kern/ksched.c b/sys/kern/ksched.c index 7ff85d622010..90c029ac311b 100644 --- a/sys/kern/ksched.c +++ b/sys/kern/ksched.c @@ -1,252 +1,256 @@ /* * 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 * 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. * */ /* ksched: Soft real time scheduling based on "rtprio". */ #include #include #include #include #include /* For need_resched */ -#include -#include +#include /* ksched: Real-time extension to support POSIX priority scheduling. */ -static struct timespec rr_interval; +struct ksched { + struct timespec rr_interval; +}; -int ksched_attach(int p4_instance, int fac_code, void **p) +int ksched_attach(struct ksched **p) { - rr_interval.tv_sec = 0; - rr_interval.tv_nsec = 1000000000L / roundrobin_interval(); + struct ksched *ksched= p31b_malloc(sizeof(*ksched)); - *p = 0; + ksched->rr_interval.tv_sec = 0; + ksched->rr_interval.tv_nsec = 1000000000L / roundrobin_interval(); + *p = ksched; return 0; } -int ksched_detach(void *p) +int ksched_detach(struct ksched *p) { + p31b_free(p); + return 0; } /* * XXX About priorities * - * POSIX4 requires that numerically higher priorities be of + * POSIX 1003.1b requires that numerically higher priorities be of * higher priority. It also permits sched_setparam to be * implementation defined for SCHED_OTHER. I don't like * the notion of inverted priorites for normal processes when * you can use "setpriority" for that. * * I'm rejecting sched_setparam for SCHED_OTHER with EINVAL. */ /* Macros to convert between the unix (lower numerically is higher priority) - * and POSIX4 (higher numerically is higher priority) + * and POSIX 1003.1b (higher numerically is higher priority) */ #define p4prio_to_rtpprio(P) (RTP_PRIO_MAX - (P)) #define rtpprio_to_p4prio(P) (RTP_PRIO_MAX - (P)) static inline int -getscheduler(int *ret, void *hook, struct proc *p) +getscheduler(int *ret, struct ksched *ksched, struct proc *p) { int e = 0; switch (p->p_rtprio.type) { case RTP_PRIO_FIFO: *ret = SCHED_FIFO; break; case RTP_PRIO_REALTIME: *ret = SCHED_RR; break; default: *ret = SCHED_OTHER; break; } return e; } -int ksched_setparam(int *ret, void *hook, +int ksched_setparam(int *ret, struct ksched *ksched, struct proc *p, const struct sched_param *param) { int e, policy; - e = getscheduler(&policy, hook, p); + e = getscheduler(&policy, ksched, p); if (e == 0) { if (policy == SCHED_OTHER) e = EINVAL; else - e = ksched_setscheduler(ret, hook, p, policy, param); + e = ksched_setscheduler(ret, ksched, p, policy, param); } return e; } -int ksched_getparam(int *ret, void *hook, +int ksched_getparam(int *ret, struct ksched *ksched, struct proc *p, struct sched_param *param) { if (RTP_PRIO_IS_REALTIME(p->p_rtprio.type)) param->sched_priority = rtpprio_to_p4prio(p->p_rtprio.prio); return 0; } /* * XXX The priority and scheduler modifications should * be moved into published interfaces in kern/kern_sync. * - * The permissions to modify process p were checked in "posix4proc()". + * The permissions to modify process p were checked in "p31b_proc()". * */ -int ksched_setscheduler(int *ret, void *hook, +int ksched_setscheduler(int *ret, struct ksched *ksched, struct proc *p, int policy, const struct sched_param *param) { int e = 0; struct rtprio rtp; switch(policy) { case SCHED_RR: case SCHED_FIFO: if (param->sched_priority >= RTP_PRIO_MIN && param->sched_priority <= RTP_PRIO_MAX) { rtp.type = (policy == SCHED_FIFO) ? RTP_PRIO_FIFO : RTP_PRIO_REALTIME; rtp.prio = p4prio_to_rtpprio(RTP_PRIO_MAX); p->p_rtprio = rtp; (void)resetpriority(p); } else e = EPERM; break; case SCHED_OTHER: { rtp.type = RTP_PRIO_NORMAL; rtp.prio = p4prio_to_rtpprio(RTP_PRIO_MIN); p->p_rtprio = rtp; /* XXX Simply revert to whatever we had for last * normal scheduler priorities. * This puts a requirement * on the scheduling code: You must leave the * scheduling info alone. */ (void)resetpriority(p); } break; } return e; } -int ksched_getscheduler(int *ret, void *hook, struct proc *p) +int ksched_getscheduler(int *ret, struct ksched *ksched, struct proc *p) { - return getscheduler(ret, hook, p); + return getscheduler(ret, ksched, p); } /* ksched_yield: Yield the CPU. */ -int ksched_yield(int *ret, void *hook) +int ksched_yield(int *ret, struct ksched *ksched) { need_resched(); return 0; } -int ksched_get_priority_max(int *ret, void *hook, int policy) +int ksched_get_priority_max(int *ret, struct ksched *ksched, int policy) { int e = 0; switch (policy) { case SCHED_FIFO: case SCHED_RR: *ret = RTP_PRIO_MAX; break; case SCHED_OTHER: *ret = PRIO_MAX; break; default: e = EINVAL; } return e; } -int ksched_get_priority_min(int *ret, void *hook, int policy) +int ksched_get_priority_min(int *ret, struct ksched *ksched, int policy) { int e = 0; switch (policy) { case SCHED_FIFO: case SCHED_RR: *ret = RTP_PRIO_MIN; break; case SCHED_OTHER: *ret = PRIO_MIN; break; default: e = EINVAL; } return e; } -int ksched_rr_get_interval(int *ret, void *hook, +int ksched_rr_get_interval(int *ret, struct ksched *ksched, struct proc *p, struct timespec *timespec) { - *timespec = rr_interval; + *timespec = ksched->rr_interval; return 0; } diff --git a/sys/kern/p1003_1b.c b/sys/kern/p1003_1b.c new file mode 100644 index 000000000000..ccbee6b80283 --- /dev/null +++ b/sys/kern/p1003_1b.c @@ -0,0 +1,239 @@ +/* + * Copyright (c) 1996, 1997, 1998 + * 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 + * 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. + * + */ + +/* p1003_1b: Real Time common code. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B"); + +/* p31b_proc: Return a proc struct corresponding to a pid to operate on. + * + * Enforce permission policy. + * + * The policy is the same as for sending signals except there + * is no notion of process groups. + * + * pid == 0 means my process. + * + * This is disabled until I've got a permission gate in again: + * only root can do this. + */ + +#if 0 +/* + * This is stolen from CANSIGNAL in kern_sig: + * + * Can process p, with pcred pc, do "write flavor" operations to process q? + */ +#define CAN_AFFECT(p, pc, q) \ + ((pc)->pc_ucred->cr_uid == 0 || \ + (pc)->p_ruid == (q)->p_cred->p_ruid || \ + (pc)->pc_ucred->cr_uid == (q)->p_cred->p_ruid || \ + (pc)->p_ruid == (q)->p_ucred->cr_uid || \ + (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid) +#else +#define CAN_AFFECT(p, pc, q) ((pc)->pc_ucred->cr_uid == 0) +#endif + +/* + * p31b_proc: Look up a proc from a PID. If proc is 0 it is + * my own proc. + */ +int p31b_proc(struct proc *p, pid_t pid, struct proc **pp) +{ + int ret = 0; + struct proc *other_proc = 0; + + if (pid == 0) + other_proc = p; + else + other_proc = pfind(pid); + + if (other_proc) + { + /* Enforce permission policy. + */ + if (CAN_AFFECT(p, p->p_cred, other_proc)) + *pp = other_proc; + else + ret = EPERM; + } + else + ret = ESRCH; + + return ret; +} + +int +syscall_not_present(struct proc *p, const char *s, struct nosys_args *uap) +{ + log(LOG_ERR, "cmd %s pid %d tried to use non-present %s\n", + p->p_comm, p->p_pid, s); + return nosys(p, uap); +} + +#if !defined(_KPOSIX_PRIORITY_SCHEDULING) + +/* Not configured but loadable via an LKM: + */ + +static int sched_attach(void) +{ + return 0; +} + +SYSCALL_NOT_PRESENT_GEN(sched_setparam) +SYSCALL_NOT_PRESENT_GEN(sched_getparam) +SYSCALL_NOT_PRESENT_GEN(sched_setscheduler) +SYSCALL_NOT_PRESENT_GEN(sched_getscheduler) +SYSCALL_NOT_PRESENT_GEN(sched_yield) +SYSCALL_NOT_PRESENT_GEN(sched_get_priority_max) +SYSCALL_NOT_PRESENT_GEN(sched_get_priority_min) +SYSCALL_NOT_PRESENT_GEN(sched_rr_get_interval) + +#else + +/* Configured in kernel version: + */ +static struct ksched *ksched; + +static int sched_attach(void) +{ + int ret = ksched_attach(&ksched); + + if (ret == 0) + p31b_setcfg(CTL_P1003_1B_PRIORITY_SCHEDULING, 1); + + return ret; +} + +int sched_setparam(struct proc *p, + struct sched_setparam_args *uap) +{ + int e; + + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_setparam(&p->p_retval[0], ksched, p, + (const struct sched_param *) &uap->param)) + ); + + return e; +} + +int sched_getparam(struct proc *p, + struct sched_getparam_args *uap) +{ + int e; + + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_getparam(&p->p_retval[0], ksched, p, uap->param)) + ); + + return e; +} +int sched_setscheduler(struct proc *p, + struct sched_setscheduler_args *uap) +{ + int e; + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_setscheduler(&p->p_retval[0], + ksched, p, uap->policy, uap->param)) + ); + + return e; +} +int sched_getscheduler(struct proc *p, + struct sched_getscheduler_args *uap) +{ + int e; + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_getscheduler(&p->p_retval[0], ksched, p)) + ); + + return e; +} +int sched_yield(struct proc *p, + struct sched_yield_args *uap) +{ + return ksched_yield(&p->p_retval[0], ksched); +} +int sched_get_priority_max(struct proc *p, + struct sched_get_priority_max_args *uap) +{ + return ksched_get_priority_max(&p->p_retval[0], + ksched, uap->policy); +} +int sched_get_priority_min(struct proc *p, + struct sched_get_priority_min_args *uap) +{ + return ksched_get_priority_min(&p->p_retval[0], + ksched, uap->policy); +} +int sched_rr_get_interval(struct proc *p, + struct sched_rr_get_interval_args *uap) +{ + int e; + + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_rr_get_interval(&p->p_retval[0], ksched, + p, uap->interval)) + ); + + return e; +} + +#endif + +static void p31binit(void *notused) +{ + (void) sched_attach(); +} + +SYSINIT(p31b, SI_SUB_P1003_1B, SI_ORDER_FIRST, p31binit, NULL); diff --git a/sys/kern/posix4_mib.c b/sys/kern/posix4_mib.c index 84532b8ef74f..523f76b87ca0 100644 --- a/sys/kern/posix4_mib.c +++ b/sys/kern/posix4_mib.c @@ -1,77 +1,94 @@ /*- * Copyright (c) 1998 * 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 * 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. * */ #include #include #include -#include +#include -static int facility[CTL_POSIX4_N_CTLS]; +static int facility[CTL_P1003_1B_MAXID - 1]; + +/* OID_AUTO isn't working with sysconf(3). I guess I'd have to + * modify it to do a lookup by name from the index. + * For now I've left it a top-level sysctl. + */ + +#if 1 + +#define P1B_SYSCTL(num, name) \ +SYSCTL_INT(_p1003_1b, num, \ + name, CTLFLAG_RD, facility + num - 1, 0, ""); + +#else + +#define P1B_SYSCTL(num, name) \ +SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ + name, CTLFLAG_RD, facility + num - 1, 0, ""); +SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B"); + +#endif -#define P4_SYSCTL(num, name) \ - SYSCTL_INT(_posix4, num, name, CTLFLAG_RD, facility + num - 1, 0, ""); -P4_SYSCTL(CTL_POSIX4_ASYNCHRONOUS_IO, asynchronous_io); -P4_SYSCTL(CTL_POSIX4_MAPPED_FILES, mapped_files); -P4_SYSCTL(CTL_POSIX4_MEMLOCK, memlock); -P4_SYSCTL(CTL_POSIX4_MEMLOCK_RANGE, memlock_range); -P4_SYSCTL(CTL_POSIX4_MEMORY_PROTECTION, memory_protection); -P4_SYSCTL(CTL_POSIX4_MESSAGE_PASSING, message_passing); -P4_SYSCTL(CTL_POSIX4_PRIORITIZED_IO, prioritized_io); -P4_SYSCTL(CTL_POSIX4_PRIORITY_SCHEDULING, priority_scheduling); -P4_SYSCTL(CTL_POSIX4_REALTIME_SIGNALS, realtime_signals); -P4_SYSCTL(CTL_POSIX4_SEMAPHORES, semaphores); -P4_SYSCTL(CTL_POSIX4_FSYNC, fsync); -P4_SYSCTL(CTL_POSIX4_SHARED_MEMORY_OBJECTS, shared_memory_objects); -P4_SYSCTL(CTL_POSIX4_SYNCHRONIZED_IO, synchronized_io); -P4_SYSCTL(CTL_POSIX4_TIMERS, timers); -P4_SYSCTL(CTL_POSIX4_AIO_LISTIO_MAX, aio_listio_max); -P4_SYSCTL(CTL_POSIX4_AIO_MAX, aio_max); -P4_SYSCTL(CTL_POSIX4_AIO_PRIO_DELTA_MAX, aio_prio_delta_max); -P4_SYSCTL(CTL_POSIX4_DELAYTIMER_MAX, delaytimer_max); -P4_SYSCTL(CTL_POSIX4_MQ_OPEN_MAX, mq_open_max); -P4_SYSCTL(CTL_POSIX4_PAGESIZE, pagesize); -P4_SYSCTL(CTL_POSIX4_RTSIG_MAX, rtsig_max); -P4_SYSCTL(CTL_POSIX4_SEM_NSEMS_MAX, sem_nsems_max); -P4_SYSCTL(CTL_POSIX4_SEM_VALUE_MAX, sem_value_max); -P4_SYSCTL(CTL_POSIX4_SIGQUEUE_MAX, sigqueue_max); -P4_SYSCTL(CTL_POSIX4_TIMER_MAX, timer_max); +P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io); +P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files); +P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock); +P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range); +P1B_SYSCTL(CTL_P1003_1B_MEMORY_PROTECTION, memory_protection); +P1B_SYSCTL(CTL_P1003_1B_MESSAGE_PASSING, message_passing); +P1B_SYSCTL(CTL_P1003_1B_PRIORITIZED_IO, prioritized_io); +P1B_SYSCTL(CTL_P1003_1B_PRIORITY_SCHEDULING, priority_scheduling); +P1B_SYSCTL(CTL_P1003_1B_REALTIME_SIGNALS, realtime_signals); +P1B_SYSCTL(CTL_P1003_1B_SEMAPHORES, semaphores); +P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync); +P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects); +P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io); +P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers); +P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max); +P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max); +P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max); +P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max); +P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max); +P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize); +P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max); +P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); +P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max); +P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max); +P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max); -/* posix4_facility: Set a facility to a value. This is - * probably a temporary measure until the LKM code is combined with this. +/* p31b_setcfg: Set the configuration */ -void posix4_facility(int num, int value) +void p31b_setcfg(int num, int value) { - if (num >= 1 && num <= CTL_POSIX4_N_CTLS) + if (num >= 1 && num < CTL_P1003_1B_MAXID) facility[num - 1] = value; } diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index ee2f34051fef..5a640914fca3 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -1,336 +1,344 @@ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp */ char *syscallnames[] = { "syscall", /* 0 = syscall */ "exit", /* 1 = exit */ "fork", /* 2 = fork */ "read", /* 3 = read */ "write", /* 4 = write */ "open", /* 5 = open */ "close", /* 6 = close */ "wait4", /* 7 = wait4 */ "old.creat", /* 8 = old creat */ "link", /* 9 = link */ "unlink", /* 10 = unlink */ "obs_execv", /* 11 = obsolete execv */ "chdir", /* 12 = chdir */ "fchdir", /* 13 = fchdir */ "mknod", /* 14 = mknod */ "chmod", /* 15 = chmod */ "chown", /* 16 = chown */ "break", /* 17 = break */ "getfsstat", /* 18 = getfsstat */ "old.lseek", /* 19 = old lseek */ "getpid", /* 20 = getpid */ "mount", /* 21 = mount */ "unmount", /* 22 = unmount */ "setuid", /* 23 = setuid */ "getuid", /* 24 = getuid */ "geteuid", /* 25 = geteuid */ "ptrace", /* 26 = ptrace */ "recvmsg", /* 27 = recvmsg */ "sendmsg", /* 28 = sendmsg */ "recvfrom", /* 29 = recvfrom */ "accept", /* 30 = accept */ "getpeername", /* 31 = getpeername */ "getsockname", /* 32 = getsockname */ "access", /* 33 = access */ "chflags", /* 34 = chflags */ "fchflags", /* 35 = fchflags */ "sync", /* 36 = sync */ "kill", /* 37 = kill */ "old.stat", /* 38 = old stat */ "getppid", /* 39 = getppid */ "old.lstat", /* 40 = old lstat */ "dup", /* 41 = dup */ "pipe", /* 42 = pipe */ "getegid", /* 43 = getegid */ "profil", /* 44 = profil */ "ktrace", /* 45 = ktrace */ "sigaction", /* 46 = sigaction */ "getgid", /* 47 = getgid */ "sigprocmask", /* 48 = sigprocmask */ "getlogin", /* 49 = getlogin */ "setlogin", /* 50 = setlogin */ "acct", /* 51 = acct */ "sigpending", /* 52 = sigpending */ "sigaltstack", /* 53 = sigaltstack */ "ioctl", /* 54 = ioctl */ "reboot", /* 55 = reboot */ "revoke", /* 56 = revoke */ "symlink", /* 57 = symlink */ "readlink", /* 58 = readlink */ "execve", /* 59 = execve */ "umask", /* 60 = umask */ "chroot", /* 61 = chroot */ "old.fstat", /* 62 = old fstat */ "old.getkerninfo", /* 63 = old getkerninfo */ "old.getpagesize", /* 64 = old getpagesize */ "msync", /* 65 = msync */ "vfork", /* 66 = vfork */ "obs_vread", /* 67 = obsolete vread */ "obs_vwrite", /* 68 = obsolete vwrite */ "sbrk", /* 69 = sbrk */ "sstk", /* 70 = sstk */ "old.mmap", /* 71 = old mmap */ "vadvise", /* 72 = vadvise */ "munmap", /* 73 = munmap */ "mprotect", /* 74 = mprotect */ "madvise", /* 75 = madvise */ "obs_vhangup", /* 76 = obsolete vhangup */ "obs_vlimit", /* 77 = obsolete vlimit */ "mincore", /* 78 = mincore */ "getgroups", /* 79 = getgroups */ "setgroups", /* 80 = setgroups */ "getpgrp", /* 81 = getpgrp */ "setpgid", /* 82 = setpgid */ "setitimer", /* 83 = setitimer */ "old.wait", /* 84 = old wait */ "swapon", /* 85 = swapon */ "getitimer", /* 86 = getitimer */ "old.gethostname", /* 87 = old gethostname */ "old.sethostname", /* 88 = old sethostname */ "getdtablesize", /* 89 = getdtablesize */ "dup2", /* 90 = dup2 */ "#91", /* 91 = getdopt */ "fcntl", /* 92 = fcntl */ "select", /* 93 = select */ "#94", /* 94 = setdopt */ "fsync", /* 95 = fsync */ "setpriority", /* 96 = setpriority */ "socket", /* 97 = socket */ "connect", /* 98 = connect */ "old.accept", /* 99 = old accept */ "getpriority", /* 100 = getpriority */ "old.send", /* 101 = old send */ "old.recv", /* 102 = old recv */ "sigreturn", /* 103 = sigreturn */ "bind", /* 104 = bind */ "setsockopt", /* 105 = setsockopt */ "listen", /* 106 = listen */ "obs_vtimes", /* 107 = obsolete vtimes */ "old.sigvec", /* 108 = old sigvec */ "old.sigblock", /* 109 = old sigblock */ "old.sigsetmask", /* 110 = old sigsetmask */ "sigsuspend", /* 111 = sigsuspend */ "old.sigstack", /* 112 = old sigstack */ "old.recvmsg", /* 113 = old recvmsg */ "old.sendmsg", /* 114 = old sendmsg */ "obs_vtrace", /* 115 = obsolete vtrace */ "gettimeofday", /* 116 = gettimeofday */ "getrusage", /* 117 = getrusage */ "getsockopt", /* 118 = getsockopt */ "#119", /* 119 = resuba */ "readv", /* 120 = readv */ "writev", /* 121 = writev */ "settimeofday", /* 122 = settimeofday */ "fchown", /* 123 = fchown */ "fchmod", /* 124 = fchmod */ "old.recvfrom", /* 125 = old recvfrom */ "setreuid", /* 126 = setreuid */ "setregid", /* 127 = setregid */ "rename", /* 128 = rename */ "old.truncate", /* 129 = old truncate */ "old.ftruncate", /* 130 = old ftruncate */ "flock", /* 131 = flock */ "mkfifo", /* 132 = mkfifo */ "sendto", /* 133 = sendto */ "shutdown", /* 134 = shutdown */ "socketpair", /* 135 = socketpair */ "mkdir", /* 136 = mkdir */ "rmdir", /* 137 = rmdir */ "utimes", /* 138 = utimes */ "obs_4.2", /* 139 = obsolete 4.2 sigreturn */ "adjtime", /* 140 = adjtime */ "old.getpeername", /* 141 = old getpeername */ "old.gethostid", /* 142 = old gethostid */ "old.sethostid", /* 143 = old sethostid */ "old.getrlimit", /* 144 = old getrlimit */ "old.setrlimit", /* 145 = old setrlimit */ "old.killpg", /* 146 = old killpg */ "setsid", /* 147 = setsid */ "quotactl", /* 148 = quotactl */ "old.quota", /* 149 = old quota */ "old.getsockname", /* 150 = old getsockname */ "#151", /* 151 = sem_lock */ "#152", /* 152 = sem_wakeup */ "#153", /* 153 = asyncdaemon */ "#154", /* 154 = nosys */ "nfssvc", /* 155 = nfssvc */ "old.getdirentries", /* 156 = old getdirentries */ "statfs", /* 157 = statfs */ "fstatfs", /* 158 = fstatfs */ "#159", /* 159 = nosys */ "#160", /* 160 = nosys */ "getfh", /* 161 = getfh */ "getdomainname", /* 162 = getdomainname */ "setdomainname", /* 163 = setdomainname */ "uname", /* 164 = uname */ "sysarch", /* 165 = sysarch */ "rtprio", /* 166 = rtprio */ "#167", /* 167 = nosys */ "#168", /* 168 = nosys */ "semsys", /* 169 = semsys */ "msgsys", /* 170 = msgsys */ "shmsys", /* 171 = shmsys */ "#172", /* 172 = nosys */ "#173", /* 173 = nosys */ "#174", /* 174 = nosys */ "#175", /* 175 = nosys */ "ntp_adjtime", /* 176 = ntp_adjtime */ "#177", /* 177 = sfork */ "#178", /* 178 = getdescriptor */ "#179", /* 179 = setdescriptor */ "#180", /* 180 = nosys */ "setgid", /* 181 = setgid */ "setegid", /* 182 = setegid */ "seteuid", /* 183 = seteuid */ "#184", /* 184 = lfs_bmapv */ "#185", /* 185 = lfs_markv */ "#186", /* 186 = lfs_segclean */ "#187", /* 187 = lfs_segwait */ "stat", /* 188 = stat */ "fstat", /* 189 = fstat */ "lstat", /* 190 = lstat */ "pathconf", /* 191 = pathconf */ "fpathconf", /* 192 = fpathconf */ "#193", /* 193 = nosys */ "getrlimit", /* 194 = getrlimit */ "setrlimit", /* 195 = setrlimit */ "getdirentries", /* 196 = getdirentries */ "mmap", /* 197 = mmap */ "__syscall", /* 198 = __syscall */ "lseek", /* 199 = lseek */ "truncate", /* 200 = truncate */ "ftruncate", /* 201 = ftruncate */ "__sysctl", /* 202 = __sysctl */ "mlock", /* 203 = mlock */ "munlock", /* 204 = munlock */ "utrace", /* 205 = utrace */ "undelete", /* 206 = undelete */ "getpgid", /* 207 = getpgid */ "#208", /* 208 = newreboot */ "poll", /* 209 = poll */ "lkmnosys", /* 210 = lkmnosys */ "lkmnosys", /* 211 = lkmnosys */ "lkmnosys", /* 212 = lkmnosys */ "lkmnosys", /* 213 = lkmnosys */ "lkmnosys", /* 214 = lkmnosys */ "lkmnosys", /* 215 = lkmnosys */ "lkmnosys", /* 216 = lkmnosys */ "lkmnosys", /* 217 = lkmnosys */ "lkmnosys", /* 218 = lkmnosys */ "lkmnosys", /* 219 = lkmnosys */ "__semctl", /* 220 = __semctl */ "semget", /* 221 = semget */ "semop", /* 222 = semop */ "semconfig", /* 223 = semconfig */ "msgctl", /* 224 = msgctl */ "msgget", /* 225 = msgget */ "msgsnd", /* 226 = msgsnd */ "msgrcv", /* 227 = msgrcv */ "shmat", /* 228 = shmat */ "shmctl", /* 229 = shmctl */ "shmdt", /* 230 = shmdt */ "shmget", /* 231 = shmget */ "clock_gettime", /* 232 = clock_gettime */ "clock_settime", /* 233 = clock_settime */ "clock_getres", /* 234 = clock_getres */ "#235", /* 235 = timer_create */ "#236", /* 236 = timer_delete */ "#237", /* 237 = timer_settime */ "#238", /* 238 = timer_gettime */ "#239", /* 239 = timer_getoverrun */ "nanosleep", /* 240 = nanosleep */ "#241", /* 241 = nosys */ "#242", /* 242 = nosys */ "#243", /* 243 = nosys */ "#244", /* 244 = nosys */ "#245", /* 245 = nosys */ "#246", /* 246 = nosys */ "#247", /* 247 = nosys */ "#248", /* 248 = nosys */ "#249", /* 249 = nosys */ "minherit", /* 250 = minherit */ "rfork", /* 251 = rfork */ "openbsd_poll", /* 252 = openbsd_poll */ "issetugid", /* 253 = issetugid */ "lchown", /* 254 = lchown */ "#255", /* 255 = nosys */ "#256", /* 256 = nosys */ "#257", /* 257 = nosys */ "#258", /* 258 = nosys */ "#259", /* 259 = nosys */ "#260", /* 260 = nosys */ "#261", /* 261 = nosys */ "#262", /* 262 = nosys */ "#263", /* 263 = nosys */ "#264", /* 264 = nosys */ "#265", /* 265 = nosys */ "#266", /* 266 = nosys */ "#267", /* 267 = nosys */ "#268", /* 268 = nosys */ "#269", /* 269 = nosys */ "#270", /* 270 = nosys */ "#271", /* 271 = nosys */ "#272", /* 272 = nosys */ "#273", /* 273 = nosys */ "#274", /* 274 = nosys */ "#275", /* 275 = nosys */ "#276", /* 276 = nosys */ "#277", /* 277 = nosys */ "#278", /* 278 = nosys */ "#279", /* 279 = nosys */ "#280", /* 280 = nosys */ "#281", /* 281 = nosys */ "#282", /* 282 = nosys */ "#283", /* 283 = nosys */ "#284", /* 284 = nosys */ "#285", /* 285 = nosys */ "#286", /* 286 = nosys */ "#287", /* 287 = nosys */ "#288", /* 288 = nosys */ "#289", /* 289 = nosys */ "#290", /* 290 = nosys */ "#291", /* 291 = nosys */ "#292", /* 292 = nosys */ "#293", /* 293 = nosys */ "#294", /* 294 = nosys */ "#295", /* 295 = nosys */ "#296", /* 296 = nosys */ "#297", /* 297 = nosys */ "#298", /* 298 = nosys */ "#299", /* 299 = nosys */ "modnext", /* 300 = modnext */ "modstat", /* 301 = modstat */ "modfnext", /* 302 = modfnext */ "modfind", /* 303 = modfind */ "kldload", /* 304 = kldload */ "kldunload", /* 305 = kldunload */ "kldfind", /* 306 = kldfind */ "kldnext", /* 307 = kldnext */ "kldstat", /* 308 = kldstat */ "kldfirstmod", /* 309 = kldfirstmod */ "getsid", /* 310 = getsid */ "#311", /* 311 = setresuid */ "#312", /* 312 = setresgid */ "signanosleep", /* 313 = signanosleep */ "aio_return", /* 314 = aio_return */ "aio_suspend", /* 315 = aio_suspend */ "aio_cancel", /* 316 = aio_cancel */ "aio_error", /* 317 = aio_error */ "aio_read", /* 318 = aio_read */ "aio_write", /* 319 = aio_write */ "lio_listio", /* 320 = lio_listio */ "yield", /* 321 = yield */ "thr_sleep", /* 322 = thr_sleep */ "thr_wakeup", /* 323 = thr_wakeup */ "mlockall", /* 324 = mlockall */ "munlockall", /* 325 = munlockall */ "__getcwd", /* 326 = __getcwd */ + "sched_setparam", /* 327 = sched_setparam */ + "sched_getparam", /* 328 = sched_getparam */ + "sched_setscheduler", /* 329 = sched_setscheduler */ + "sched_getscheduler", /* 330 = sched_getscheduler */ + "sched_yield", /* 331 = sched_yield */ + "sched_get_priority_max", /* 332 = sched_get_priority_max */ + "sched_get_priority_min", /* 333 = sched_get_priority_min */ + "sched_rr_get_interval", /* 334 = sched_rr_get_interval */ }; diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index a79702e105d4..e2333487974a 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,463 +1,474 @@ - $Id: syscalls.master,v 1.47 1998/01/30 11:33:01 phk Exp $ + $Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; ; System call name/number master file. ; Processed to created init_sysent.c, syscalls.c and syscall.h. ; Columns: number type nargs namespc name alt{name,tag,rtyp}/comments ; number system call number, must be in order ; type one of STD, OBSOL, UNIMPL, COMPAT ; namespc one of POSIX, BSD, NOHIDE ; name psuedo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" ; altrtyp return type if not int (bogus - syscalls always return int) ; for UNIMPL/OBSOL, name continues with comments ; types: ; STD always included ; COMPAT included on COMPAT #ifdef ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only ; #ifdef's, etc. may be included, and are copied to the output files. #include #include #include ; Reserved/unimplemented system calls in the range 0-150 inclusive ; are reserved for use in future Berkeley releases. ; Additional system calls implemented in vendor and other ; redistributions should be placed in the reserved range at the end ; of the current calls. 0 STD NOHIDE { int nosys(void); } syscall nosys_args int 1 STD NOHIDE { void exit(int rval); } exit rexit_args void 2 STD POSIX { int fork(void); } 3 STD POSIX { int read(int fd, char *buf, u_int nbyte); } 4 STD POSIX { int write(int fd, char *buf, u_int nbyte); } 5 STD POSIX { int open(char *path, int flags, int mode); } ; XXX should be { int open(const char *path, int flags, ...); } ; but we're not ready for `const' or varargs. ; XXX man page says `mode_t mode'. 6 STD POSIX { int close(int fd); } 7 STD BSD { int wait4(int pid, int *status, int options, \ struct rusage *rusage); } wait4 wait_args int 8 COMPAT BSD { int creat(char *path, int mode); } 9 STD POSIX { int link(char *path, char *link); } 10 STD POSIX { int unlink(char *path); } 11 OBSOL NOHIDE execv 12 STD POSIX { int chdir(char *path); } 13 STD BSD { int fchdir(int fd); } 14 STD POSIX { int mknod(char *path, int mode, int dev); } 15 STD POSIX { int chmod(char *path, int mode); } 16 STD POSIX { int chown(char *path, int uid, int gid); } 17 STD BSD { int obreak(char *nsize); } break obreak_args int 18 STD BSD { int getfsstat(struct statfs *buf, long bufsize, \ int flags); } 19 COMPAT POSIX { long lseek(int fd, long offset, int whence); } 20 STD POSIX { pid_t getpid(void); } 21 STD BSD { int mount(char *type, char *path, int flags, \ caddr_t data); } ; XXX 4.4lite2 uses `char *type' but we're not ready for that. ; XXX `path' should have type `const char *' but we're not ready for that. 22 STD BSD { int unmount(char *path, int flags); } 23 STD POSIX { int setuid(uid_t uid); } 24 STD POSIX { uid_t getuid(void); } 25 STD POSIX { uid_t geteuid(void); } 26 STD BSD { int ptrace(int req, pid_t pid, caddr_t addr, \ int data); } 27 STD BSD { int recvmsg(int s, struct msghdr *msg, int flags); } 28 STD BSD { int sendmsg(int s, caddr_t msg, int flags); } 29 STD BSD { int recvfrom(int s, caddr_t buf, size_t len, \ int flags, caddr_t from, int *fromlenaddr); } 30 STD BSD { int accept(int s, caddr_t name, int *anamelen); } 31 STD BSD { int getpeername(int fdes, caddr_t asa, int *alen); } 32 STD BSD { int getsockname(int fdes, caddr_t asa, int *alen); } 33 STD POSIX { int access(char *path, int flags); } 34 STD BSD { int chflags(char *path, int flags); } 35 STD BSD { int fchflags(int fd, int flags); } 36 STD BSD { int sync(void); } 37 STD POSIX { int kill(int pid, int signum); } 38 COMPAT POSIX { int stat(char *path, struct ostat *ub); } 39 STD POSIX { pid_t getppid(void); } 40 COMPAT POSIX { int lstat(char *path, struct ostat *ub); } 41 STD POSIX { int dup(u_int fd); } 42 STD POSIX { int pipe(void); } 43 STD POSIX { gid_t getegid(void); } 44 STD BSD { int profil(caddr_t samples, u_int size, \ u_int offset, u_int scale); } 45 STD BSD { int ktrace(char *fname, int ops, int facs, \ int pid); } 46 STD POSIX { int sigaction(int signum, struct sigaction *nsa, \ struct sigaction *osa); } 47 STD POSIX { gid_t getgid(void); } 48 STD POSIX { int sigprocmask(int how, sigset_t mask); } ; XXX note nonstandard (bogus) calling convention - the libc stub passes ; us the mask, not a pointer to it, and we return the old mask as the ; (int) return value. 49 STD BSD { int getlogin(char *namebuf, u_int namelen); } 50 STD BSD { int setlogin(char *namebuf); } 51 STD BSD { int acct(char *path); } 52 STD POSIX { int sigpending(void); } 53 STD BSD { int sigaltstack(struct sigaltstack *nss, \ struct sigaltstack *oss); } 54 STD POSIX { int ioctl(int fd, u_long com, caddr_t data); } 55 STD BSD { int reboot(int opt); } 56 STD POSIX { int revoke(char *path); } 57 STD POSIX { int symlink(char *path, char *link); } 58 STD POSIX { int readlink(char *path, char *buf, int count); } 59 STD POSIX { int execve(char *fname, char **argv, char **envv); } 60 STD POSIX { int umask(int newmask); } umask umask_args int 61 STD BSD { int chroot(char *path); } 62 COMPAT POSIX { int fstat(int fd, struct ostat *sb); } 63 COMPAT BSD { int getkerninfo(int op, char *where, int *size, \ int arg); } getkerninfo getkerninfo_args int 64 COMPAT BSD { int getpagesize(void); } \ getpagesize getpagesize_args int 65 STD BSD { int msync(void *addr, size_t len, int flags); } 66 STD BSD { int vfork(void); } 67 OBSOL NOHIDE vread 68 OBSOL NOHIDE vwrite 69 STD BSD { int sbrk(int incr); } 70 STD BSD { int sstk(int incr); } 71 COMPAT BSD { int mmap(void *addr, int len, int prot, \ int flags, int fd, long pos); } 72 STD BSD { int ovadvise(int anom); } vadvise ovadvise_args int 73 STD BSD { int munmap(void *addr, size_t len); } 74 STD BSD { int mprotect(const void *addr, size_t len, int prot); } 75 STD BSD { int madvise(void *addr, size_t len, int behav); } 76 OBSOL NOHIDE vhangup 77 OBSOL NOHIDE vlimit 78 STD BSD { int mincore(const void *addr, size_t len, \ char *vec); } 79 STD POSIX { int getgroups(u_int gidsetsize, gid_t *gidset); } 80 STD POSIX { int setgroups(u_int gidsetsize, gid_t *gidset); } 81 STD POSIX { int getpgrp(void); } 82 STD POSIX { int setpgid(int pid, int pgid); } 83 STD BSD { int setitimer(u_int which, struct itimerval *itv, \ struct itimerval *oitv); } 84 COMPAT BSD { int wait(void); } 85 STD BSD { int swapon(char *name); } 86 STD BSD { int getitimer(u_int which, struct itimerval *itv); } 87 COMPAT BSD { int gethostname(char *hostname, u_int len); } \ gethostname gethostname_args int 88 COMPAT BSD { int sethostname(char *hostname, u_int len); } \ sethostname sethostname_args int 89 STD BSD { int getdtablesize(void); } 90 STD POSIX { int dup2(u_int from, u_int to); } 91 UNIMPL BSD getdopt 92 STD POSIX { int fcntl(int fd, int cmd, int arg); } ; XXX should be { int fcntl(int fd, int cmd, ...); } ; but we're not ready for varargs. ; XXX man page says `int arg' too. 93 STD BSD { int select(int nd, fd_set *in, fd_set *ou, \ fd_set *ex, struct timeval *tv); } 94 UNIMPL BSD setdopt 95 STD POSIX { int fsync(int fd); } 96 STD BSD { int setpriority(int which, int who, int prio); } 97 STD BSD { int socket(int domain, int type, int protocol); } 98 STD BSD { int connect(int s, caddr_t name, int namelen); } 99 CPT_NOA BSD { int accept(int s, caddr_t name, int *anamelen); } \ accept accept_args int 100 STD BSD { int getpriority(int which, int who); } 101 COMPAT BSD { int send(int s, caddr_t buf, int len, int flags); } 102 COMPAT BSD { int recv(int s, caddr_t buf, int len, int flags); } 103 STD BSD { int sigreturn(struct sigcontext *sigcntxp); } 104 STD BSD { int bind(int s, caddr_t name, int namelen); } 105 STD BSD { int setsockopt(int s, int level, int name, \ caddr_t val, int valsize); } 106 STD BSD { int listen(int s, int backlog); } 107 OBSOL NOHIDE vtimes 108 COMPAT BSD { int sigvec(int signum, struct sigvec *nsv, \ struct sigvec *osv); } 109 COMPAT BSD { int sigblock(int mask); } 110 COMPAT BSD { int sigsetmask(int mask); } 111 STD POSIX { int sigsuspend(sigset_t mask); } ; XXX note nonstandard (bogus) calling convention - the libc stub passes ; us the mask, not a pointer to it. 112 COMPAT BSD { int sigstack(struct sigstack *nss, \ struct sigstack *oss); } 113 COMPAT BSD { int recvmsg(int s, struct omsghdr *msg, int flags); } 114 COMPAT BSD { int sendmsg(int s, caddr_t msg, int flags); } 115 OBSOL NOHIDE vtrace 116 STD BSD { int gettimeofday(struct timeval *tp, \ struct timezone *tzp); } 117 STD BSD { int getrusage(int who, struct rusage *rusage); } 118 STD BSD { int getsockopt(int s, int level, int name, \ caddr_t val, int *avalsize); } 119 UNIMPL NOHIDE resuba (BSD/OS 2.x) 120 STD BSD { int readv(int fd, struct iovec *iovp, u_int iovcnt); } 121 STD BSD { int writev(int fd, struct iovec *iovp, \ u_int iovcnt); } 122 STD BSD { int settimeofday(struct timeval *tv, \ struct timezone *tzp); } 123 STD BSD { int fchown(int fd, int uid, int gid); } 124 STD BSD { int fchmod(int fd, int mode); } 125 CPT_NOA BSD { int recvfrom(int s, caddr_t buf, size_t len, \ int flags, caddr_t from, int *fromlenaddr); } \ recvfrom recvfrom_args int 126 STD BSD { int setreuid(int ruid, int euid); } 127 STD BSD { int setregid(int rgid, int egid); } 128 STD POSIX { int rename(char *from, char *to); } 129 COMPAT BSD { int truncate(char *path, long length); } 130 COMPAT BSD { int ftruncate(int fd, long length); } 131 STD BSD { int flock(int fd, int how); } 132 STD POSIX { int mkfifo(char *path, int mode); } 133 STD BSD { int sendto(int s, caddr_t buf, size_t len, \ int flags, caddr_t to, int tolen); } 134 STD BSD { int shutdown(int s, int how); } 135 STD BSD { int socketpair(int domain, int type, int protocol, \ int *rsv); } 136 STD POSIX { int mkdir(char *path, int mode); } 137 STD POSIX { int rmdir(char *path); } 138 STD BSD { int utimes(char *path, struct timeval *tptr); } 139 OBSOL NOHIDE 4.2 sigreturn 140 STD BSD { int adjtime(struct timeval *delta, \ struct timeval *olddelta); } 141 COMPAT BSD { int getpeername(int fdes, caddr_t asa, int *alen); } 142 COMPAT BSD { long gethostid(void); } 143 COMPAT BSD { int sethostid(long hostid); } 144 COMPAT BSD { int getrlimit(u_int which, struct ogetrlimit *rlp); } 145 COMPAT BSD { int setrlimit(u_int which, struct ogetrlimit *rlp); } 146 COMPAT BSD { int killpg(int pgid, int signum); } 147 STD POSIX { int setsid(void); } 148 STD BSD { int quotactl(char *path, int cmd, int uid, \ caddr_t arg); } 149 COMPAT BSD { int quota(void); } 150 CPT_NOA BSD { int getsockname(int fdec, caddr_t asa, int *alen); }\ getsockname getsockname_args int ; Syscalls 151-180 inclusive are reserved for vendor-specific ; system calls. (This includes various calls added for compatibity ; with other Unix variants.) ; Some of these calls are now supported by BSD... 151 UNIMPL NOHIDE sem_lock (BSD/OS 2.x) 152 UNIMPL NOHIDE sem_wakeup (BSD/OS 2.x) 153 UNIMPL NOHIDE asyncdaemon (BSD/OS 2.x) 154 UNIMPL NOHIDE nosys ; 155 is initialized by the NFS code, if present. 155 NOIMPL BSD { int nfssvc(int flag, caddr_t argp); } 156 COMPAT BSD { int getdirentries(int fd, char *buf, u_int count, \ long *basep); } 157 STD BSD { int statfs(char *path, struct statfs *buf); } 158 STD BSD { int fstatfs(int fd, struct statfs *buf); } 159 UNIMPL NOHIDE nosys 160 UNIMPL NOHIDE nosys ; 161 is initialized by the NFS code, if present. 161 NOIMPL BSD { int getfh(char *fname, struct fhandle *fhp); } 162 STD BSD { int getdomainname(char *domainname, int len); } 163 STD BSD { int setdomainname(char *domainname, int len); } 164 STD BSD { int uname(struct utsname *name); } 165 STD BSD { int sysarch(int op, char *parms); } 166 STD BSD { int rtprio(int function, pid_t pid, \ struct rtprio *rtp); } 167 UNIMPL NOHIDE nosys 168 UNIMPL NOHIDE nosys 169 STD BSD { int semsys(int which, int a2, int a3, int a4, \ int a5); } ; XXX should be { int semsys(int which, ...); } 170 STD BSD { int msgsys(int which, int a2, int a3, int a4, \ int a5, int a6); } ; XXX should be { int msgsys(int which, ...); } 171 STD BSD { int shmsys(int which, int a2, int a3, int a4); } ; XXX should be { int shmsys(int which, ...); } 172 UNIMPL NOHIDE nosys 173 UNIMPL NOHIDE nosys 174 UNIMPL NOHIDE nosys 175 UNIMPL NOHIDE nosys 176 STD BSD { int ntp_adjtime(struct timex *tp); } 177 UNIMPL NOHIDE sfork (BSD/OS 2.x) 178 UNIMPL NOHIDE getdescriptor (BSD/OS 2.x) 179 UNIMPL NOHIDE setdescriptor (BSD/OS 2.x) 180 UNIMPL NOHIDE nosys ; Syscalls 180-199 are used by/reserved for BSD 181 STD POSIX { int setgid(gid_t gid); } 182 STD BSD { int setegid(gid_t egid); } 183 STD BSD { int seteuid(uid_t euid); } 184 UNIMPL BSD lfs_bmapv 185 UNIMPL BSD lfs_markv 186 UNIMPL BSD lfs_segclean 187 UNIMPL BSD lfs_segwait 188 STD POSIX { int stat(char *path, struct stat *ub); } 189 STD POSIX { int fstat(int fd, struct stat *sb); } 190 STD POSIX { int lstat(char *path, struct stat *ub); } 191 STD POSIX { int pathconf(char *path, int name); } 192 STD POSIX { int fpathconf(int fd, int name); } 193 UNIMPL NOHIDE nosys 194 STD BSD { int getrlimit(u_int which, \ struct orlimit *rlp); } \ getrlimit __getrlimit_args int 195 STD BSD { int setrlimit(u_int which, \ struct orlimit *rlp); } \ setrlimit __setrlimit_args int 196 STD BSD { int getdirentries(int fd, char *buf, u_int count, \ long *basep); } 197 STD BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \ int flags, int fd, long pad, off_t pos); } 198 STD NOHIDE { int nosys(void); } __syscall __syscall_args int 199 STD POSIX { off_t lseek(int fd, int pad, off_t offset, \ int whence); } 200 STD BSD { int truncate(char *path, int pad, off_t length); } 201 STD BSD { int ftruncate(int fd, int pad, off_t length); } 202 STD BSD { int __sysctl(int *name, u_int namelen, void *old, \ size_t *oldlenp, void *new, size_t newlen); } \ __sysctl sysctl_args int ; properly, __sysctl should be a NOHIDE, but making an exception ; here allows to avoid one in libc/sys/Makefile.inc. 203 STD BSD { int mlock(const void *addr, size_t len); } 204 STD BSD { int munlock(const void *addr, size_t len); } ; big problem here. Lite2, NetBSD and OpenBSD have syscall 205 as undelete() ; we should move utrace before it's too late. 205 STD BSD { int utrace(caddr_t addr, size_t len); } ; problem here. NetBSD/OpenBSD have syscall 206 as futimes() 206 STD BSD { int undelete(char *path); } 207 STD BSD { int getpgid(pid_t pid); } 208 UNIMPL NOHIDE newreboot (NetBSD) ; problem. NetBSD and OpenBSD have a different syscall number for poll() 209 STD BSD { int poll(struct pollfd *fds, u_int nfds, \ int timeout); } ; ; The following are reserved for loadable syscalls ; 210 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 211 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 212 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 213 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 214 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 215 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 216 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 217 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 218 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 219 NODEF NOHIDE lkmnosys lkmnosys nosys_args int ; ; The following were introduced with NetBSD/4.4Lite-2 ; 220 STD BSD { int __semctl(int semid, int semnum, int cmd, \ union semun *arg); } 221 STD BSD { int semget(key_t key, int nsems, int semflg); } 222 STD BSD { int semop(int semid, struct sembuf *sops, \ u_int nsops); } 223 STD BSD { int semconfig(int flag); } 224 STD BSD { int msgctl(int msqid, int cmd, \ struct msqid_ds *buf); } 225 STD BSD { int msgget(key_t key, int msgflg); } 226 STD BSD { int msgsnd(int msqid, void *msgp, size_t msgsz, \ int msgflg); } 227 STD BSD { int msgrcv(int msqid, void *msgp, size_t msgsz, \ long msgtyp, int msgflg); } 228 STD BSD { int shmat(int shmid, void *shmaddr, int shmflg); } 229 STD BSD { int shmctl(int shmid, int cmd, \ struct shmid_ds *buf); } 230 STD BSD { int shmdt(void *shmaddr); } 231 STD BSD { int shmget(key_t key, int size, int shmflg); } ; 232 STD POSIX { int clock_gettime(clockid_t clock_id, \ struct timespec *tp); } 233 STD POSIX { int clock_settime(clockid_t clock_id, \ const struct timespec *tp); } 234 STD POSIX { int clock_getres(clockid_t clock_id, \ struct timespec *tp); } 235 UNIMPL NOHIDE timer_create 236 UNIMPL NOHIDE timer_delete 237 UNIMPL NOHIDE timer_settime 238 UNIMPL NOHIDE timer_gettime 239 UNIMPL NOHIDE timer_getoverrun 240 STD POSIX { int nanosleep(const struct timespec *rqtp, \ struct timespec *rmtp); } 241 UNIMPL NOHIDE nosys 242 UNIMPL NOHIDE nosys 243 UNIMPL NOHIDE nosys 244 UNIMPL NOHIDE nosys 245 UNIMPL NOHIDE nosys 246 UNIMPL NOHIDE nosys 247 UNIMPL NOHIDE nosys 248 UNIMPL NOHIDE nosys 249 UNIMPL NOHIDE nosys ; syscall numbers initially used in OpenBSD 250 STD BSD { int minherit(void *addr, size_t len, int inherit); } 251 STD BSD { int rfork(int flags); } 252 STD BSD { int openbsd_poll(struct pollfd *fds, u_int nfds, \ int timeout); } 253 STD BSD { int issetugid(void); } 254 STD BSD { int lchown(char *path, int uid, int gid); } 255 UNIMPL NOHIDE nosys 256 UNIMPL NOHIDE nosys 257 UNIMPL NOHIDE nosys 258 UNIMPL NOHIDE nosys 259 UNIMPL NOHIDE nosys 260 UNIMPL NOHIDE nosys 261 UNIMPL NOHIDE nosys 262 UNIMPL NOHIDE nosys 263 UNIMPL NOHIDE nosys 264 UNIMPL NOHIDE nosys 265 UNIMPL NOHIDE nosys 266 UNIMPL NOHIDE nosys 267 UNIMPL NOHIDE nosys 268 UNIMPL NOHIDE nosys 269 UNIMPL NOHIDE nosys 270 UNIMPL NOHIDE nosys 271 UNIMPL NOHIDE nosys 272 UNIMPL NOHIDE nosys 273 UNIMPL NOHIDE nosys 274 UNIMPL NOHIDE nosys 275 UNIMPL NOHIDE nosys 276 UNIMPL NOHIDE nosys 277 UNIMPL NOHIDE nosys 278 UNIMPL NOHIDE nosys 279 UNIMPL NOHIDE nosys 280 UNIMPL NOHIDE nosys 281 UNIMPL NOHIDE nosys 282 UNIMPL NOHIDE nosys 283 UNIMPL NOHIDE nosys 284 UNIMPL NOHIDE nosys 285 UNIMPL NOHIDE nosys 286 UNIMPL NOHIDE nosys 287 UNIMPL NOHIDE nosys 288 UNIMPL NOHIDE nosys 289 UNIMPL NOHIDE nosys 290 UNIMPL NOHIDE nosys 291 UNIMPL NOHIDE nosys 292 UNIMPL NOHIDE nosys 293 UNIMPL NOHIDE nosys 294 UNIMPL NOHIDE nosys 295 UNIMPL NOHIDE nosys 296 UNIMPL NOHIDE nosys 297 UNIMPL NOHIDE nosys 298 UNIMPL NOHIDE nosys 299 UNIMPL NOHIDE nosys ; syscall numbers for FreeBSD 300 STD BSD { int modnext(int modid); } 301 STD BSD { int modstat(int modid, struct module_stat* stat); } 302 STD BSD { int modfnext(int modid); } 303 STD BSD { int modfind(char *name); } 304 STD BSD { int kldload(const char *file); } 305 STD BSD { int kldunload(int fileid); } 306 STD BSD { int kldfind(const char *file); } 307 STD BSD { int kldnext(int fileid); } 308 STD BSD { int kldstat(int fileid, struct kld_file_stat* stat); } 309 STD BSD { int kldfirstmod(int fileid); } 310 STD BSD { int getsid(pid_t pid); } 311 UNIMPL NOHIDE setresuid 312 UNIMPL NOHIDE setresgid 313 STD BSD { int signanosleep(const struct timespec *rqtp, \ struct timespec *rmtp, sigset_t *mask); } 314 STD BSD { int aio_return(struct aiocb *aiocbp); } 315 STD BSD { int aio_suspend(struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } 316 STD BSD { int aio_cancel(int fd, struct aiocb *aiocbp); } 317 STD BSD { int aio_error(struct aiocb *aiocbp); } 318 STD BSD { int aio_read(struct aiocb *aiocbp); } 319 STD BSD { int aio_write(struct aiocb *aiocbp); } 320 STD BSD { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } 321 STD BSD { int yield(void); } 322 STD BSD { int thr_sleep(const struct timespec *timeout); } 323 STD BSD { int thr_wakeup(pid_t pid); } 324 STD BSD { int mlockall(int how); } 325 STD BSD { int munlockall(void); } 326 STD BSD { int __getcwd(u_char *buf, u_int buflen); } + +327 STD POSIX { int sched_setparam (pid_t pid, const struct sched_param *param); } +328 STD POSIX { int sched_getparam (pid_t pid, struct sched_param *param); } + +329 STD POSIX { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } +330 STD POSIX { int sched_getscheduler (pid_t pid); } + +331 STD POSIX { int sched_yield (void); } +332 STD POSIX { int sched_get_priority_max (int policy); } +333 STD POSIX { int sched_get_priority_min (int policy); } +334 STD POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 33e524ebce0f..247eef093c68 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1,2053 +1,2053 @@ /* * Copyright (c) 1997 John S. Dyson. 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. John S. Dyson's name may not be used to endorse or promote products * derived from this software without specific prior written permission. * * DISCLAIMER: This code isn't warranted to do anything useful. Anything * bad that happens because of using this software isn't the responsibility * of the author. This software is distributed AS-IS. * - * $Id: vfs_aio.c,v 1.24 1998/02/25 06:30:15 bde Exp $ + * $Id: vfs_aio.c,v 1.25 1998/03/28 10:33:09 bde Exp $ */ /* - * This file contains support for the POSIX.4 AIO/LIO facility. + * This file contains support for the POSIX 1003.1B AIO/LIO facility. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int jobrefid; #define JOBST_NULL 0x0 #define JOBST_JOBQPROC 0x1 #define JOBST_JOBQGLOBAL 0x2 #define JOBST_JOBRUNNING 0x3 #define JOBST_JOBFINISHED 0x4 #define JOBST_JOBQBUF 0x5 #define JOBST_JOBBFINISHED 0x6 #ifndef MAX_AIO_PER_PROC #define MAX_AIO_PER_PROC 32 #endif #ifndef MAX_AIO_QUEUE_PER_PROC #define MAX_AIO_QUEUE_PER_PROC 256 /* Bigger than AIO_LISTIO_MAX */ #endif #ifndef MAX_AIO_PROCS #define MAX_AIO_PROCS 32 #endif #ifndef MAX_AIO_QUEUE #define MAX_AIO_QUEUE 1024 /* Bigger than AIO_LISTIO_MAX */ #endif #ifndef TARGET_AIO_PROCS #define TARGET_AIO_PROCS 0 #endif #ifndef MAX_BUF_AIO #define MAX_BUF_AIO 16 #endif #ifndef AIOD_TIMEOUT_DEFAULT #define AIOD_TIMEOUT_DEFAULT (10 * hz) #endif #ifndef AIOD_LIFETIME_DEFAULT #define AIOD_LIFETIME_DEFAULT (30 * hz) #endif static int max_aio_procs = MAX_AIO_PROCS; static int num_aio_procs = 0; static int target_aio_procs = TARGET_AIO_PROCS; static int max_queue_count = MAX_AIO_QUEUE; static int num_queue_count = 0; static int num_buf_aio = 0; static int num_aio_resv_start = 0; static int aiod_timeout; static int aiod_lifetime; static int max_aio_per_proc = MAX_AIO_PER_PROC, max_aio_queue_per_proc=MAX_AIO_QUEUE_PER_PROC; static int max_buf_aio = MAX_BUF_AIO; SYSCTL_NODE(_vfs, OID_AUTO, aio, CTLFLAG_RW, 0, "AIO mgmt"); SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_per_proc, CTLFLAG_RW, &max_aio_per_proc, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_queue_per_proc, CTLFLAG_RW, &max_aio_queue_per_proc, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_procs, CTLFLAG_RW, &max_aio_procs, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, num_aio_procs, CTLFLAG_RD, &num_aio_procs, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, num_queue_count, CTLFLAG_RD, &num_queue_count, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_queue, CTLFLAG_RW, &max_queue_count, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, target_aio_procs, CTLFLAG_RW, &target_aio_procs, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, num_buf_aio, CTLFLAG_RD, &num_buf_aio, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, aiod_lifetime, CTLFLAG_RW, &aiod_lifetime, 0, ""); SYSCTL_INT(_vfs_aio, OID_AUTO, aiod_timeout, CTLFLAG_RW, &aiod_timeout, 0, ""); /* * Job queue item */ #define AIOCBLIST_CANCELLED 0x1 #define AIOCBLIST_RUNDOWN 0x4 #define AIOCBLIST_ASYNCFREE 0x8 #define AIOCBLIST_DONE 0x10 struct aiocblist { TAILQ_ENTRY (aiocblist) list; /* List of jobs */ TAILQ_ENTRY (aiocblist) plist; /* List of jobs for proc */ int jobflags; int jobstate; int inputcharge, outputcharge; struct buf *bp; /* buffer pointer */ struct proc *userproc; /* User process */ struct aioproclist *jobaioproc; /* AIO process descriptor */ struct aio_liojob *lio; /* optional lio job */ struct aiocb *uuaiocb; /* pointer in userspace of aiocb */ struct aiocb uaiocb; /* Kernel I/O control block */ }; /* * AIO process info */ #define AIOP_FREE 0x1 /* proc on free queue */ #define AIOP_SCHED 0x2 /* proc explicitly scheduled */ struct aioproclist { int aioprocflags; /* AIO proc flags */ TAILQ_ENTRY(aioproclist) list; /* List of processes */ struct proc *aioproc; /* The AIO thread */ TAILQ_HEAD (,aiocblist) jobtorun; /* suggested job to run */ }; /* * data-structure for lio signal management */ struct aio_liojob { int lioj_flags; int lioj_buffer_count; int lioj_buffer_finished_count; int lioj_queue_count; int lioj_queue_finished_count; struct sigevent lioj_signal; /* signal on all I/O done */ TAILQ_ENTRY (aio_liojob) lioj_list; struct kaioinfo *lioj_ki; }; #define LIOJ_SIGNAL 0x1 /* signal on all done (lio) */ #define LIOJ_SIGNAL_POSTED 0x2 /* signal has been posted */ /* * per process aio data structure */ struct kaioinfo { int kaio_flags; /* per process kaio flags */ int kaio_maxactive_count; /* maximum number of AIOs */ int kaio_active_count; /* number of currently used AIOs */ int kaio_qallowed_count; /* maxiumu size of AIO queue */ int kaio_queue_count; /* size of AIO queue */ int kaio_ballowed_count; /* maximum number of buffers */ int kaio_queue_finished_count; /* number of daemon jobs finished */ int kaio_buffer_count; /* number of physio buffers */ int kaio_buffer_finished_count; /* count of I/O done */ struct proc *kaio_p; /* process that uses this kaio block */ TAILQ_HEAD (,aio_liojob) kaio_liojoblist; /* list of lio jobs */ TAILQ_HEAD (,aiocblist) kaio_jobqueue; /* job queue for process */ TAILQ_HEAD (,aiocblist) kaio_jobdone; /* done queue for process */ TAILQ_HEAD (,aiocblist) kaio_bufqueue; /* buffer job queue for process */ TAILQ_HEAD (,aiocblist) kaio_bufdone; /* buffer done queue for process */ }; #define KAIO_RUNDOWN 0x1 /* process is being run down */ #define KAIO_WAKEUP 0x2 /* wakeup process when there is a significant event */ static TAILQ_HEAD (,aioproclist) aio_freeproc, aio_activeproc; static TAILQ_HEAD(,aiocblist) aio_jobs; /* Async job list */ static TAILQ_HEAD(,aiocblist) aio_bufjobs; /* Phys I/O job list */ static TAILQ_HEAD(,aiocblist) aio_freejobs; /* Pool of free jobs */ static void aio_init_aioinfo(struct proc *p) ; static void aio_onceonly(void *) ; static int aio_free_entry(struct aiocblist *aiocbe); static void aio_process(struct aiocblist *aiocbe); static int aio_newproc(void) ; static int aio_aqueue(struct proc *p, struct aiocb *job, int type) ; static void aio_physwakeup(struct buf *bp); static int aio_fphysio(struct proc *p, struct aiocblist *aiocbe, int type); static int aio_qphysio(struct proc *p, struct aiocblist *iocb); static void aio_daemon(void *uproc); SYSINIT(aio, SI_SUB_VFS, SI_ORDER_ANY, aio_onceonly, NULL); static vm_zone_t kaio_zone=0, aiop_zone=0, aiocb_zone=0, aiol_zone=0, aiolio_zone=0; /* * Single AIOD vmspace shared amongst all of them */ static struct vmspace *aiovmspace = NULL; /* * Startup initialization */ void aio_onceonly(void *na) { TAILQ_INIT(&aio_freeproc); TAILQ_INIT(&aio_activeproc); TAILQ_INIT(&aio_jobs); TAILQ_INIT(&aio_bufjobs); TAILQ_INIT(&aio_freejobs); kaio_zone = zinit("AIO", sizeof (struct kaioinfo), 0, 0, 1); aiop_zone = zinit("AIOP", sizeof (struct aioproclist), 0, 0, 1); aiocb_zone = zinit("AIOCB", sizeof (struct aiocblist), 0, 0, 1); aiol_zone = zinit("AIOL", AIO_LISTIO_MAX * sizeof (int), 0, 0, 1); aiolio_zone = zinit("AIOLIO", AIO_LISTIO_MAX * sizeof (struct aio_liojob), 0, 0, 1); aiod_timeout = AIOD_TIMEOUT_DEFAULT; aiod_lifetime = AIOD_LIFETIME_DEFAULT; jobrefid = 1; } /* * Init the per-process aioinfo structure. * The aioinfo limits are set per-process for user limit (resource) management. */ void aio_init_aioinfo(struct proc *p) { struct kaioinfo *ki; if (p->p_aioinfo == NULL) { ki = zalloc(kaio_zone); p->p_aioinfo = ki; ki->kaio_flags = 0; ki->kaio_maxactive_count = max_aio_per_proc; ki->kaio_active_count = 0; ki->kaio_qallowed_count = max_aio_queue_per_proc; ki->kaio_queue_count = 0; ki->kaio_ballowed_count = max_buf_aio; ki->kaio_buffer_count = 0; ki->kaio_buffer_finished_count = 0; ki->kaio_p = p; TAILQ_INIT(&ki->kaio_jobdone); TAILQ_INIT(&ki->kaio_jobqueue); TAILQ_INIT(&ki->kaio_bufdone); TAILQ_INIT(&ki->kaio_bufqueue); TAILQ_INIT(&ki->kaio_liojoblist); } } /* * Free a job entry. Wait for completion if it is currently * active, but don't delay forever. If we delay, we return * a flag that says that we have to restart the queue scan. */ int aio_free_entry(struct aiocblist *aiocbe) { struct kaioinfo *ki; struct aioproclist *aiop; struct aio_liojob *lj; struct proc *p; int error; int s; if (aiocbe->jobstate == JOBST_NULL) panic("aio_free_entry: freeing already free job"); p = aiocbe->userproc; ki = p->p_aioinfo; lj = aiocbe->lio; if (ki == NULL) panic("aio_free_entry: missing p->p_aioinfo"); if (aiocbe->jobstate == JOBST_JOBRUNNING) { if (aiocbe->jobflags & AIOCBLIST_ASYNCFREE) return 0; aiocbe->jobflags |= AIOCBLIST_RUNDOWN; tsleep(aiocbe, PRIBIO|PCATCH, "jobwai", 0); } aiocbe->jobflags &= ~AIOCBLIST_ASYNCFREE; if (aiocbe->bp == NULL) { if (ki->kaio_queue_count <= 0) panic("aio_free_entry: process queue size <= 0"); if (num_queue_count <= 0) panic("aio_free_entry: system wide queue size <= 0"); if(lj) { lj->lioj_queue_count--; if (aiocbe->jobflags & AIOCBLIST_DONE) lj->lioj_queue_finished_count--; } ki->kaio_queue_count--; if (aiocbe->jobflags & AIOCBLIST_DONE) ki->kaio_queue_finished_count--; num_queue_count--; } else { if(lj) { lj->lioj_buffer_count--; if (aiocbe->jobflags & AIOCBLIST_DONE) lj->lioj_buffer_finished_count--; } if (aiocbe->jobflags & AIOCBLIST_DONE) ki->kaio_buffer_finished_count--; ki->kaio_buffer_count--; num_buf_aio--; } if ((ki->kaio_flags & KAIO_WAKEUP) || (ki->kaio_flags & KAIO_RUNDOWN) && ((ki->kaio_buffer_count == 0) && (ki->kaio_queue_count == 0))) { ki->kaio_flags &= ~KAIO_WAKEUP; wakeup(p); } if ( aiocbe->jobstate == JOBST_JOBQBUF) { if ((error = aio_fphysio(p, aiocbe, 1)) != 0) return error; if (aiocbe->jobstate != JOBST_JOBBFINISHED) panic("aio_free_entry: invalid physio finish-up state"); s = splbio(); TAILQ_REMOVE(&ki->kaio_bufdone, aiocbe, plist); splx(s); } else if ( aiocbe->jobstate == JOBST_JOBQPROC) { aiop = aiocbe->jobaioproc; TAILQ_REMOVE(&aiop->jobtorun, aiocbe, list); } else if ( aiocbe->jobstate == JOBST_JOBQGLOBAL) { TAILQ_REMOVE(&aio_jobs, aiocbe, list); } else if ( aiocbe->jobstate == JOBST_JOBFINISHED) { TAILQ_REMOVE(&ki->kaio_jobdone, aiocbe, plist); } else if ( aiocbe->jobstate == JOBST_JOBBFINISHED) { s = splbio(); TAILQ_REMOVE(&ki->kaio_bufdone, aiocbe, plist); splx(s); if (aiocbe->bp) { vunmapbuf(aiocbe->bp); relpbuf(aiocbe->bp); aiocbe->bp = NULL; } } if (lj && (lj->lioj_buffer_count == 0) && (lj->lioj_queue_count == 0)) { TAILQ_REMOVE(&ki->kaio_liojoblist, lj, lioj_list); zfree(aiolio_zone, lj); } TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); aiocbe->jobstate = JOBST_NULL; return 0; } /* * Rundown the jobs for a given process. */ void aio_proc_rundown(struct proc *p) { int s; struct kaioinfo *ki; struct aio_liojob *lj, *ljn; struct aiocblist *aiocbe, *aiocbn; ki = p->p_aioinfo; if (ki == NULL) return; ki->kaio_flags |= LIOJ_SIGNAL_POSTED; while ((ki->kaio_active_count > 0) || (ki->kaio_buffer_count > ki->kaio_buffer_finished_count)) { ki->kaio_flags |= KAIO_RUNDOWN; if (tsleep(p, PRIBIO, "kaiowt", aiod_timeout)) break; } restart1: for ( aiocbe = TAILQ_FIRST(&ki->kaio_jobdone); aiocbe; aiocbe = aiocbn) { aiocbn = TAILQ_NEXT(aiocbe, plist); if (aio_free_entry(aiocbe)) goto restart1; } restart2: for ( aiocbe = TAILQ_FIRST(&ki->kaio_jobqueue); aiocbe; aiocbe = aiocbn) { aiocbn = TAILQ_NEXT(aiocbe, plist); if (aio_free_entry(aiocbe)) goto restart2; } /* * Note the use of lots of splbio here, trying to avoid * splbio for long chains of I/O. Probably unnecessary. */ restart3: s = splbio(); while (TAILQ_FIRST(&ki->kaio_bufqueue)) { ki->kaio_flags |= KAIO_WAKEUP; tsleep (p, PRIBIO, "aioprn", 0); splx(s); goto restart3; } splx(s); restart4: s = splbio(); for ( aiocbe = TAILQ_FIRST(&ki->kaio_bufdone); aiocbe; aiocbe = aiocbn) { aiocbn = TAILQ_NEXT(aiocbe, plist); if (aio_free_entry(aiocbe)) { splx(s); goto restart4; } } splx(s); for ( lj = TAILQ_FIRST(&ki->kaio_liojoblist); lj; lj = ljn) { ljn = TAILQ_NEXT(lj, lioj_list); if ((lj->lioj_buffer_count == 0) && (lj->lioj_queue_count == 0)) { TAILQ_REMOVE(&ki->kaio_liojoblist, lj, lioj_list); zfree(aiolio_zone, lj); } else { #if defined(DIAGNOSTIC) printf("LIO job not cleaned up: B:%d, BF:%d, Q:%d, QF:%d\n", lj->lioj_buffer_count, lj->lioj_buffer_finished_count, lj->lioj_queue_count, lj->lioj_queue_finished_count); #endif } } zfree(kaio_zone, ki); p->p_aioinfo = NULL; } /* * Select a job to run (called by an AIO daemon) */ static struct aiocblist * aio_selectjob(struct aioproclist *aiop) { struct aiocblist *aiocbe; aiocbe = TAILQ_FIRST(&aiop->jobtorun); if (aiocbe) { TAILQ_REMOVE(&aiop->jobtorun, aiocbe, list); return aiocbe; } for (aiocbe = TAILQ_FIRST(&aio_jobs); aiocbe; aiocbe = TAILQ_NEXT(aiocbe, list)) { struct kaioinfo *ki; struct proc *userp; userp = aiocbe->userproc; ki = userp->p_aioinfo; if (ki->kaio_active_count < ki->kaio_maxactive_count) { TAILQ_REMOVE(&aio_jobs, aiocbe, list); return aiocbe; } } return NULL; } /* * The AIO processing activity. This is the code that does the * I/O request for the non-physio version of the operations. The * normal vn operations are used, and this code should work in * all instances for every type of file, including pipes, sockets, * fifos, and regular files. */ void aio_process(struct aiocblist *aiocbe) { struct filedesc *fdp; struct proc *userp, *mycp; struct aiocb *cb; struct file *fp; struct uio auio; struct iovec aiov; unsigned int fd; int cnt; static nperline=0; int error; off_t offset; int oublock_st, oublock_end; int inblock_st, inblock_end; userp = aiocbe->userproc; cb = &aiocbe->uaiocb; mycp = curproc; fdp = mycp->p_fd; fd = cb->aio_fildes; fp = fdp->fd_ofiles[fd]; aiov.iov_base = (void *) cb->aio_buf; aiov.iov_len = cb->aio_nbytes; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = offset = cb->aio_offset; auio.uio_resid = cb->aio_nbytes; cnt = cb->aio_nbytes; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = mycp; inblock_st = mycp->p_stats->p_ru.ru_inblock; oublock_st = mycp->p_stats->p_ru.ru_oublock; if (cb->aio_lio_opcode == LIO_READ) { auio.uio_rw = UIO_READ; error = (*fp->f_ops->fo_read)(fp, &auio, fp->f_cred); } else { auio.uio_rw = UIO_WRITE; error = (*fp->f_ops->fo_write)(fp, &auio, fp->f_cred); } inblock_end = mycp->p_stats->p_ru.ru_inblock; oublock_end = mycp->p_stats->p_ru.ru_oublock; aiocbe->inputcharge = inblock_end - inblock_st; aiocbe->outputcharge = oublock_end - oublock_st; if (error) { if (auio.uio_resid != cnt) { if (error == ERESTART || error == EINTR || error == EWOULDBLOCK) error = 0; if ((error == EPIPE) && (cb->aio_lio_opcode == LIO_WRITE)) psignal(userp, SIGPIPE); } } cnt -= auio.uio_resid; cb->_aiocb_private.error = error; cb->_aiocb_private.status = cnt; return; } /* * The AIO daemon, most of the actual work is done in aio_process, * but the setup (and address space mgmt) is done in this routine. */ static void aio_daemon(void *uproc) { int s; struct aioproclist *aiop; struct vmspace *myvm, *aiovm; struct proc *mycp; /* * Local copies of curproc (cp) and vmspace (myvm) */ mycp = curproc; myvm = mycp->p_vmspace; /* * We manage to create only one VM space for all AIOD processes. * The VM space for the first AIOD created becomes the shared VM * space for all of them. We add an additional reference count, * even for the first AIOD, so the address space does not go away, * and we continue to use that original VM space even if the first * AIOD exits. */ if ((aiovm = aiovmspace) == NULL) { aiovmspace = myvm; myvm->vm_refcnt++; /* * Remove userland cruft from address space. */ if (myvm->vm_shm) shmexit(mycp); pmap_remove_pages(&myvm->vm_pmap, 0, USRSTACK); vm_map_remove(&myvm->vm_map, 0, USRSTACK); myvm->vm_tsize = 0; myvm->vm_dsize = 0; myvm->vm_ssize = 0; } else { aiovm->vm_refcnt++; mycp->p_vmspace = aiovm; pmap_activate(mycp); vmspace_free(myvm); myvm = aiovm; } if (mycp->p_textvp) { vrele(mycp->p_textvp); mycp->p_textvp = NULL; } /* * Allocate and ready the aio control info. There is one * aiop structure per daemon. */ aiop = zalloc(aiop_zone); aiop->aioproc = mycp; aiop->aioprocflags |= AIOP_FREE; TAILQ_INIT(&aiop->jobtorun); /* * Place thread (lightweight process) onto the AIO free thread list */ if (TAILQ_EMPTY(&aio_freeproc)) wakeup(&aio_freeproc); TAILQ_INSERT_HEAD(&aio_freeproc, aiop, list); /* * Make up a name for the daemon */ strcpy(mycp->p_comm, "aiod"); /* * Get rid of our current filedescriptors. AIOD's don't need any * filedescriptors, except as temporarily inherited from the client. * Credentials are also cloned, and made equivalent to "root." */ fdfree(mycp); mycp->p_fd = NULL; mycp->p_ucred = crcopy(mycp->p_ucred); mycp->p_ucred->cr_uid = 0; mycp->p_ucred->cr_ngroups = 1; mycp->p_ucred->cr_groups[0] = 1; /* * The daemon resides in it's own pgrp. */ enterpgrp(mycp, mycp->p_pid, 1); /* * Mark special process type */ mycp->p_flag |= P_SYSTEM|P_KTHREADP; /* * Wakeup parent process. (Parent sleeps to keep from blasting away * creating to many daemons.) */ wakeup(mycp); while(1) { struct proc *curcp; struct aiocblist *aiocbe; /* * curcp is the current daemon process context. * userp is the current user process context. */ curcp = mycp; /* * Take daemon off of free queue */ if (aiop->aioprocflags & AIOP_FREE) { TAILQ_REMOVE(&aio_freeproc, aiop, list); TAILQ_INSERT_TAIL(&aio_activeproc, aiop, list); aiop->aioprocflags &= ~AIOP_FREE; } aiop->aioprocflags &= ~AIOP_SCHED; /* * Check for jobs */ while ( aiocbe = aio_selectjob(aiop)) { struct proc *userp; struct aiocb *cb; struct kaioinfo *ki; struct aio_liojob *lj; cb = &aiocbe->uaiocb; userp = aiocbe->userproc; aiocbe->jobstate = JOBST_JOBRUNNING; /* * Connect to process address space for user program */ if (userp != curcp) { struct vmspace *tmpvm; /* * Save the current address space that we are connected to. */ tmpvm = mycp->p_vmspace; /* * Point to the new user address space, and refer to it. */ mycp->p_vmspace = userp->p_vmspace; mycp->p_vmspace->vm_refcnt++; /* * Activate the new mapping. */ pmap_activate(mycp); /* * If the old address space wasn't the daemons own address * space, then we need to remove the daemon's reference from * the other process that it was acting on behalf of. */ if (tmpvm != myvm) { vmspace_free(tmpvm); } /* * Disassociate from previous clients file descriptors, and * associate to the new clients descriptors. Note that * the daemon doesn't need to worry about it's orginal * descriptors, because they were originally freed. */ if (mycp->p_fd) fdfree(mycp); mycp->p_fd = fdshare(userp); curcp = userp; } ki = userp->p_aioinfo; lj = aiocbe->lio; /* * Account for currently active jobs */ ki->kaio_active_count++; /* * Do the I/O function */ aiocbe->jobaioproc = aiop; aio_process(aiocbe); /* * decrement the active job count */ ki->kaio_active_count--; /* * increment the completion count for wakeup/signal comparisons */ aiocbe->jobflags |= AIOCBLIST_DONE; ki->kaio_queue_finished_count++; if (lj) { lj->lioj_queue_finished_count++; } if ((ki->kaio_flags & KAIO_WAKEUP) || (ki->kaio_flags & KAIO_RUNDOWN) && (ki->kaio_active_count == 0)) { ki->kaio_flags &= ~KAIO_WAKEUP; wakeup(userp); } s = splbio(); if (lj && (lj->lioj_flags & (LIOJ_SIGNAL|LIOJ_SIGNAL_POSTED)) == LIOJ_SIGNAL) { if ((lj->lioj_queue_finished_count == lj->lioj_queue_count) && (lj->lioj_buffer_finished_count == lj->lioj_buffer_count)) { psignal(userp, lj->lioj_signal.sigev_signo); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } } splx(s); aiocbe->jobstate = JOBST_JOBFINISHED; /* * If the I/O request should be automatically rundown, do the * needed cleanup. Otherwise, place the queue entry for * the just finished I/O request into the done queue for the * associated client. */ if (aiocbe->jobflags & AIOCBLIST_ASYNCFREE) { aiocbe->jobflags &= ~AIOCBLIST_ASYNCFREE; TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); } else { TAILQ_REMOVE(&ki->kaio_jobqueue, aiocbe, plist); TAILQ_INSERT_TAIL(&ki->kaio_jobdone, aiocbe, plist); } if (aiocbe->jobflags & AIOCBLIST_RUNDOWN) { wakeup(aiocbe); aiocbe->jobflags &= ~AIOCBLIST_RUNDOWN; } if (cb->aio_sigevent.sigev_notify == SIGEV_SIGNAL) { psignal(userp, cb->aio_sigevent.sigev_signo); } } /* * Disconnect from user address space */ if (curcp != mycp) { struct vmspace *tmpvm; /* * Get the user address space to disconnect from. */ tmpvm = mycp->p_vmspace; /* * Get original address space for daemon. */ mycp->p_vmspace = myvm; /* * Activate the daemon's address space. */ pmap_activate(mycp); #if defined(DIAGNOSTIC) if (tmpvm == myvm) printf("AIOD: vmspace problem -- %d\n", mycp->p_pid); #endif /* * remove our vmspace reference. */ vmspace_free(tmpvm); /* * disassociate from the user process's file descriptors. */ if (mycp->p_fd) fdfree(mycp); mycp->p_fd = NULL; curcp = mycp; } /* * If we are the first to be put onto the free queue, wakeup * anyone waiting for a daemon. */ TAILQ_REMOVE(&aio_activeproc, aiop, list); if (TAILQ_EMPTY(&aio_freeproc)) wakeup(&aio_freeproc); TAILQ_INSERT_HEAD(&aio_freeproc, aiop, list); aiop->aioprocflags |= AIOP_FREE; /* * If daemon is inactive for a long time, allow it to exit, thereby * freeing resources. */ if (((aiop->aioprocflags & AIOP_SCHED) == 0) && tsleep(mycp, PRIBIO, "aiordy", aiod_lifetime)) { if ((TAILQ_FIRST(&aio_jobs) == NULL) && (TAILQ_FIRST(&aiop->jobtorun) == NULL)) { if ((aiop->aioprocflags & AIOP_FREE) && (num_aio_procs > target_aio_procs)) { TAILQ_REMOVE(&aio_freeproc, aiop, list); zfree(aiop_zone, aiop); num_aio_procs--; #if defined(DIAGNOSTIC) if (mycp->p_vmspace->vm_refcnt <= 1) printf("AIOD: bad vm refcnt for exiting daemon: %d\n", mycp->p_vmspace->vm_refcnt); #endif exit1(mycp, 0); } } } } } /* * Create a new AIO daemon. This is mostly a kernel-thread fork routine. * The AIO daemon modifies it's environment itself. */ static int aio_newproc() { int error; struct rfork_args rfa; struct proc *p, *np; rfa.flags = RFPROC | RFCFDG; p = curproc; if (error = rfork(p, &rfa)) return error; np = pfind(p->p_retval[0]); cpu_set_fork_handler(np, aio_daemon, p); /* * Wait until daemon is started, but continue on just in case (to * handle error conditions. */ error = tsleep(np, PZERO, "aiosta", aiod_timeout); num_aio_procs++; return error; } /* * Try the high-performance physio method for eligible VCHR devices. This * routine doesn't require the use of any additional threads, and have * overhead. */ int aio_qphysio(p, aiocbe) struct proc *p; struct aiocblist *aiocbe; { int error; caddr_t sa; struct aiocb *cb; struct file *fp; struct buf *bp; int bflags; struct vnode *vp; struct kaioinfo *ki; struct filedesc *fdp; struct aio_liojob *lj; int fd; int majordev; int s; int cnt; dev_t dev; int rw; d_strategy_t *fstrategy; struct cdevsw *cdev; struct bdevsw *bdev; cb = &aiocbe->uaiocb; fdp = p->p_fd; fd = cb->aio_fildes; fp = fdp->fd_ofiles[fd]; if (fp->f_type != DTYPE_VNODE) { return -1; } vp = (struct vnode *)fp->f_data; if (vp->v_type != VCHR || ((cb->aio_nbytes & (DEV_BSIZE - 1)) != 0)) { return -1; } if ((cb->aio_nbytes > MAXPHYS) && (num_buf_aio >= max_buf_aio)) { return -1; } if ((vp->v_specinfo == NULL) || (vp->v_flag & VISTTY)) { return -1; } majordev = major(vp->v_rdev); if (majordev == NODEV) { return -1; } cdev = cdevsw[major(vp->v_rdev)]; if (cdev == NULL) { return -1; } bdev = cdev->d_bdev; if (bdev == NULL) { return -1; } ki = p->p_aioinfo; if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) { return -1; } cnt = cb->aio_nbytes; if (cnt > MAXPHYS) { return -1; } dev = makedev(bdev->d_maj, minor(vp->v_rdev)); /* * Physical I/O is charged directly to the process, so we don't have * to fake it. */ aiocbe->inputcharge = 0; aiocbe->outputcharge = 0; ki->kaio_buffer_count++; lj = aiocbe->lio; if (lj) { lj->lioj_buffer_count++; } /* create and build a buffer header for a transfer */ bp = (struct buf *)getpbuf(); /* * get a copy of the kva from the physical buffer */ bp->b_proc = p; bp->b_dev = dev; error = bp->b_error = 0; if (cb->aio_lio_opcode == LIO_WRITE) { rw = 0; bflags = B_WRITE; } else { rw = 1; bflags = B_READ; } bp->b_bcount = cb->aio_nbytes; bp->b_bufsize = cb->aio_nbytes; bp->b_flags = B_BUSY | B_PHYS | B_CALL | bflags; bp->b_iodone = aio_physwakeup; bp->b_saveaddr = bp->b_data; bp->b_data = (void *) cb->aio_buf; bp->b_blkno = btodb(cb->aio_offset); if (rw && !useracc(bp->b_data, bp->b_bufsize, B_WRITE)) { error = EFAULT; goto doerror; } if (!rw && !useracc(bp->b_data, bp->b_bufsize, B_READ)) { error = EFAULT; goto doerror; } /* bring buffer into kernel space */ vmapbuf(bp); s = splbio(); aiocbe->bp = bp; bp->b_spc = (void *)aiocbe; TAILQ_INSERT_TAIL(&aio_bufjobs, aiocbe, list); TAILQ_INSERT_TAIL(&ki->kaio_bufqueue, aiocbe, plist); aiocbe->jobstate = JOBST_JOBQBUF; cb->_aiocb_private.status = cb->aio_nbytes; num_buf_aio++; fstrategy = bdev->d_strategy; bp->b_error = 0; splx(s); /* perform transfer */ (*fstrategy)(bp); s = splbio(); /* * If we had an error invoking the request, or an error in processing * the request before we have returned, we process it as an error * in transfer. Note that such an I/O error is not indicated immediately, * but is returned using the aio_error mechanism. In this case, aio_suspend * will return immediately. */ if (bp->b_error || (bp->b_flags & B_ERROR)) { struct aiocb *job = aiocbe->uuaiocb; aiocbe->uaiocb._aiocb_private.status = 0; suword(&job->_aiocb_private.status, 0); aiocbe->uaiocb._aiocb_private.error = bp->b_error; suword(&job->_aiocb_private.error, bp->b_error); ki->kaio_buffer_finished_count++; if (aiocbe->jobstate != JOBST_JOBBFINISHED) { aiocbe->jobstate = JOBST_JOBBFINISHED; aiocbe->jobflags |= AIOCBLIST_DONE; TAILQ_REMOVE(&aio_bufjobs, aiocbe, list); TAILQ_REMOVE(&ki->kaio_bufqueue, aiocbe, plist); TAILQ_INSERT_TAIL(&ki->kaio_bufdone, aiocbe, plist); } } splx(s); return 0; doerror: ki->kaio_buffer_count--; if (lj) { lj->lioj_buffer_count--; } aiocbe->bp = NULL; relpbuf(bp); return error; } /* * This waits/tests physio completion. */ int aio_fphysio(p, iocb, flgwait) struct proc *p; struct aiocblist *iocb; int flgwait; { int s; struct buf *bp; int error; bp = iocb->bp; s = splbio(); if (flgwait == 0) { if ((bp->b_flags & B_DONE) == 0) { splx(s); return EINPROGRESS; } } while ((bp->b_flags & B_DONE) == 0) { if (tsleep((caddr_t)bp, PRIBIO, "physstr", aiod_timeout)) { if ((bp->b_flags & B_DONE) == 0) { splx(s); return EINPROGRESS; } else { break; } } } /* release mapping into kernel space */ vunmapbuf(bp); iocb->bp = 0; error = 0; /* * check for an error */ if (bp->b_flags & B_ERROR) { error = bp->b_error; } relpbuf(bp); return (error); } /* * Queue a new AIO request. Choosing either the threaded or direct physio * VCHR technique is done in this code. */ static int _aio_aqueue(struct proc *p, struct aiocb *job, struct aio_liojob *lj, int type) { struct filedesc *fdp; struct file *fp; unsigned int fd; int error; int opcode; struct aiocblist *aiocbe; struct aioproclist *aiop; struct kaioinfo *ki; if (aiocbe = TAILQ_FIRST(&aio_freejobs)) { TAILQ_REMOVE(&aio_freejobs, aiocbe, list); } else { aiocbe = zalloc (aiocb_zone); } aiocbe->inputcharge = 0; aiocbe->outputcharge = 0; suword(&job->_aiocb_private.status, -1); suword(&job->_aiocb_private.error, 0); suword(&job->_aiocb_private.kernelinfo, -1); error = copyin((caddr_t)job, (caddr_t) &aiocbe->uaiocb, sizeof aiocbe->uaiocb); if (error) { suword(&job->_aiocb_private.error, error); TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); return error; } /* * Save userspace address of the job info */ aiocbe->uuaiocb = job; /* * Get the opcode */ if (type != LIO_NOP) { aiocbe->uaiocb.aio_lio_opcode = type; } opcode = aiocbe->uaiocb.aio_lio_opcode; /* * Get the fd info for process */ fdp = p->p_fd; /* * Range check file descriptor */ fd = aiocbe->uaiocb.aio_fildes; if (fd >= fdp->fd_nfiles) { TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); if (type == 0) { suword(&job->_aiocb_private.error, EBADF); } return EBADF; } fp = fdp->fd_ofiles[fd]; if ((fp == NULL) || ((opcode == LIO_WRITE) && ((fp->f_flag & FWRITE) == 0))) { TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); if (type == 0) { suword(&job->_aiocb_private.error, EBADF); } return EBADF; } if (aiocbe->uaiocb.aio_offset == -1LL) { TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); if (type == 0) { suword(&job->_aiocb_private.error, EINVAL); } return EINVAL; } error = suword(&job->_aiocb_private.kernelinfo, jobrefid); if (error) { TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); if (type == 0) { suword(&job->_aiocb_private.error, EINVAL); } return error; } aiocbe->uaiocb._aiocb_private.kernelinfo = (void *)jobrefid; jobrefid++; if (jobrefid > INT_MAX) jobrefid = 1; if (opcode == LIO_NOP) { TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); if (type == 0) { suword(&job->_aiocb_private.error, 0); suword(&job->_aiocb_private.status, 0); suword(&job->_aiocb_private.kernelinfo, 0); } return 0; } if ((opcode != LIO_READ) && (opcode != LIO_WRITE)) { TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); if (type == 0) { suword(&job->_aiocb_private.status, 0); suword(&job->_aiocb_private.error, EINVAL); } return EINVAL; } suword(&job->_aiocb_private.error, EINPROGRESS); aiocbe->uaiocb._aiocb_private.error = EINPROGRESS; aiocbe->userproc = p; aiocbe->jobflags = 0; aiocbe->lio = lj; ki = p->p_aioinfo; if ((error = aio_qphysio(p, aiocbe)) == 0) { return 0; } else if (error > 0) { suword(&job->_aiocb_private.status, 0); aiocbe->uaiocb._aiocb_private.error = error; suword(&job->_aiocb_private.error, error); return error; } /* * No buffer for daemon I/O */ aiocbe->bp = NULL; ki->kaio_queue_count++; if (lj) { lj->lioj_queue_count++; } TAILQ_INSERT_TAIL(&ki->kaio_jobqueue, aiocbe, plist); TAILQ_INSERT_TAIL(&aio_jobs, aiocbe, list); aiocbe->jobstate = JOBST_JOBQGLOBAL; num_queue_count++; error = 0; /* * If we don't have a free AIO process, and we are below our * quota, then start one. Otherwise, depend on the subsequent * I/O completions to pick-up this job. If we don't sucessfully * create the new process (thread) due to resource issues, we * return an error for now (EAGAIN), which is likely not the * correct thing to do. */ retryproc: if (aiop = TAILQ_FIRST(&aio_freeproc)) { TAILQ_REMOVE(&aio_freeproc, aiop, list); TAILQ_INSERT_TAIL(&aio_activeproc, aiop, list); aiop->aioprocflags &= ~AIOP_FREE; wakeup(aiop->aioproc); } else if (((num_aio_resv_start + num_aio_procs) < max_aio_procs) && ((ki->kaio_active_count + num_aio_resv_start) < ki->kaio_maxactive_count)) { num_aio_resv_start++; if ((error = aio_newproc()) == 0) { num_aio_resv_start--; p->p_retval[0] = 0; goto retryproc; } num_aio_resv_start--; } return error; } /* * This routine queues an AIO request, checking for quotas. */ static int aio_aqueue(struct proc *p, struct aiocb *job, int type) { struct kaioinfo *ki; if (p->p_aioinfo == NULL) { aio_init_aioinfo(p); } if (num_queue_count >= max_queue_count) return EAGAIN; ki = p->p_aioinfo; if (ki->kaio_queue_count >= ki->kaio_qallowed_count) return EAGAIN; return _aio_aqueue(p, job, NULL, type); } /* * Support the aio_return system call, as a side-effect, kernel * resources are released. */ int aio_return(struct proc *p, struct aio_return_args *uap) { int s; int jobref, status; struct aiocblist *cb, *ncb; struct aiocb *ujob; struct kaioinfo *ki; struct proc *userp; ki = p->p_aioinfo; if (ki == NULL) { return EINVAL; } ujob = uap->aiocbp; jobref = fuword(&ujob->_aiocb_private.kernelinfo); if (jobref == -1 || jobref == 0) return EINVAL; for (cb = TAILQ_FIRST(&ki->kaio_jobdone); cb; cb = TAILQ_NEXT(cb, plist)) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { if (ujob == cb->uuaiocb) { p->p_retval[0] = cb->uaiocb._aiocb_private.status; } else { p->p_retval[0] = EFAULT; } if (cb->uaiocb.aio_lio_opcode == LIO_WRITE) { curproc->p_stats->p_ru.ru_oublock += cb->outputcharge; cb->outputcharge = 0; } else if (cb->uaiocb.aio_lio_opcode == LIO_READ) { curproc->p_stats->p_ru.ru_inblock += cb->inputcharge; cb->inputcharge = 0; } aio_free_entry(cb); return 0; } } s = splbio(); for (cb = TAILQ_FIRST(&ki->kaio_bufdone); cb; cb = ncb) { ncb = TAILQ_NEXT(cb, plist); if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { splx(s); if (ujob == cb->uuaiocb) { p->p_retval[0] = cb->uaiocb._aiocb_private.status; } else { p->p_retval[0] = EFAULT; } aio_free_entry(cb); return 0; } } splx(s); return (EINVAL); } /* * Allow a process to wakeup when any of the I/O requests are * completed. */ int aio_suspend(struct proc *p, struct aio_suspend_args *uap) { struct timeval atv; struct timespec ts; struct aiocb *const *cbptr, *cbp; struct kaioinfo *ki; struct aiocblist *cb; int i; int njoblist; int error, s, timo; int *ijoblist; struct aiocb **ujoblist; if (uap->nent >= AIO_LISTIO_MAX) return EINVAL; timo = 0; if (uap->timeout) { /* * Get timespec struct */ if (error = copyin((caddr_t) uap->timeout, (caddr_t) &ts, sizeof ts)) { return error; } if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000) return (EINVAL); TIMESPEC_TO_TIMEVAL(&atv, &ts) if (itimerfix(&atv)) return (EINVAL); s = splclock(); timevaladd(&atv, &time); timo = hzto(&atv); splx(s); } ki = p->p_aioinfo; if (ki == NULL) return EAGAIN; njoblist = 0; ijoblist = zalloc(aiol_zone); ujoblist = zalloc(aiol_zone); cbptr = uap->aiocbp; for(i = 0; i < uap->nent; i++) { cbp = (struct aiocb *) fuword((caddr_t) &cbptr[i]); if (cbp == 0) continue; ujoblist[njoblist] = cbp; ijoblist[njoblist] = fuword(&cbp->_aiocb_private.kernelinfo); njoblist++; } if (njoblist == 0) { zfree(aiol_zone, ijoblist); zfree(aiol_zone, ujoblist); return 0; } error = 0; while (1) { for (cb = TAILQ_FIRST(&ki->kaio_jobdone); cb; cb = TAILQ_NEXT(cb, plist)) { for(i = 0; i < njoblist; i++) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == ijoblist[i]) { if (ujoblist[i] != cb->uuaiocb) error = EINVAL; zfree(aiol_zone, ijoblist); zfree(aiol_zone, ujoblist); return error; } } } s = splbio(); for (cb = TAILQ_FIRST(&ki->kaio_bufdone); cb; cb = TAILQ_NEXT(cb, plist)) { for(i = 0; i < njoblist; i++) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == ijoblist[i]) { splx(s); if (ujoblist[i] != cb->uuaiocb) error = EINVAL; zfree(aiol_zone, ijoblist); zfree(aiol_zone, ujoblist); return error; } } } ki->kaio_flags |= KAIO_WAKEUP; error = tsleep(p, PRIBIO|PCATCH, "aiospn", timo); splx(s); if (error == EINTR) { zfree(aiol_zone, ijoblist); zfree(aiol_zone, ujoblist); return EINTR; } else if (error == EWOULDBLOCK) { zfree(aiol_zone, ijoblist); zfree(aiol_zone, ujoblist); return EAGAIN; } } /* NOTREACHED */ return EINVAL; } /* * aio_cancel at the kernel level is a NOOP right now. It * might be possible to support it partially in user mode, or * in kernel mode later on. */ int aio_cancel(struct proc *p, struct aio_cancel_args *uap) { return ENOSYS; } /* * aio_error is implemented in the kernel level for compatibility * purposes only. For a user mode async implementation, it would be * best to do it in a userland subroutine. */ int aio_error(struct proc *p, struct aio_error_args *uap) { int s; struct aiocblist *cb; struct kaioinfo *ki; int jobref; int error, status; ki = p->p_aioinfo; if (ki == NULL) return EINVAL; jobref = fuword(&uap->aiocbp->_aiocb_private.kernelinfo); if ((jobref == -1) || (jobref == 0)) return EINVAL; for (cb = TAILQ_FIRST(&ki->kaio_jobdone); cb; cb = TAILQ_NEXT(cb, plist)) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { p->p_retval[0] = cb->uaiocb._aiocb_private.error; return 0; } } for (cb = TAILQ_FIRST(&ki->kaio_jobqueue); cb; cb = TAILQ_NEXT(cb, plist)) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { p->p_retval[0] = EINPROGRESS; return 0; } } s = splbio(); for (cb = TAILQ_FIRST(&ki->kaio_bufdone); cb; cb = TAILQ_NEXT(cb, plist)) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { p->p_retval[0] = cb->uaiocb._aiocb_private.error; splx(s); return 0; } } for (cb = TAILQ_FIRST(&ki->kaio_bufqueue); cb; cb = TAILQ_NEXT(cb, plist)) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { p->p_retval[0] = EINPROGRESS; splx(s); return 0; } } splx(s); /* * Hack for lio */ /* status = fuword(&uap->aiocbp->_aiocb_private.status); if (status == -1) { return fuword(&uap->aiocbp->_aiocb_private.error); } */ return EINVAL; } int aio_read(struct proc *p, struct aio_read_args *uap) { struct filedesc *fdp; struct file *fp; struct uio auio; struct iovec aiov; unsigned int fd; int cnt; struct aiocb iocb; int error, pmodes; pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes); if ((pmodes & AIO_PMODE_SYNC) == 0) { return aio_aqueue(p, (struct aiocb *) uap->aiocbp, LIO_READ); } /* * Get control block */ if (error = copyin((caddr_t) uap->aiocbp, (caddr_t) &iocb, sizeof iocb)) return error; /* * Get the fd info for process */ fdp = p->p_fd; /* * Range check file descriptor */ fd = iocb.aio_fildes; if (fd >= fdp->fd_nfiles) return EBADF; fp = fdp->fd_ofiles[fd]; if ((fp == NULL) || ((fp->f_flag & FREAD) == 0)) return EBADF; if (iocb.aio_offset == -1LL) return EINVAL; auio.uio_resid = iocb.aio_nbytes; if (auio.uio_resid < 0) return (EINVAL); /* * Process sync simply -- queue async request. */ if ((iocb._aiocb_private.privatemodes & AIO_PMODE_SYNC) == 0) { return aio_aqueue(p, (struct aiocb *) uap->aiocbp, LIO_READ); } aiov.iov_base = (void *) iocb.aio_buf; aiov.iov_len = iocb.aio_nbytes; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = iocb.aio_offset; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; cnt = iocb.aio_nbytes; error = (*fp->f_ops->fo_read)(fp, &auio, fp->f_cred); if (error && (auio.uio_resid != cnt) && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; cnt -= auio.uio_resid; p->p_retval[0] = cnt; return error; } int aio_write(struct proc *p, struct aio_write_args *uap) { struct filedesc *fdp; struct file *fp; struct uio auio; struct iovec aiov; unsigned int fd; int cnt; struct aiocb iocb; int error; int pmodes; /* * Process sync simply -- queue async request. */ pmodes = fuword(&uap->aiocbp->_aiocb_private.privatemodes); if ((pmodes & AIO_PMODE_SYNC) == 0) { return aio_aqueue(p, (struct aiocb *) uap->aiocbp, LIO_WRITE); } if (error = copyin((caddr_t) uap->aiocbp, (caddr_t) &iocb, sizeof iocb)) return error; /* * Get the fd info for process */ fdp = p->p_fd; /* * Range check file descriptor */ fd = iocb.aio_fildes; if (fd >= fdp->fd_nfiles) return EBADF; fp = fdp->fd_ofiles[fd]; if ((fp == NULL) || ((fp->f_flag & FWRITE) == 0)) return EBADF; if (iocb.aio_offset == -1LL) return EINVAL; aiov.iov_base = (void *) iocb.aio_buf; aiov.iov_len = iocb.aio_nbytes; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = iocb.aio_offset; auio.uio_resid = iocb.aio_nbytes; if (auio.uio_resid < 0) return (EINVAL); auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; cnt = iocb.aio_nbytes; error = (*fp->f_ops->fo_write)(fp, &auio, fp->f_cred); if (error) { if (auio.uio_resid != cnt) { if (error == ERESTART || error == EINTR || error == EWOULDBLOCK) error = 0; if (error == EPIPE) psignal(p, SIGPIPE); } } cnt -= auio.uio_resid; p->p_retval[0] = cnt; return error; } int lio_listio(struct proc *p, struct lio_listio_args *uap) { int nent, nentqueued; struct aiocb *iocb, * const *cbptr; struct aiocblist *cb; struct kaioinfo *ki; struct aio_liojob *lj; int error, runningcode; int nerror; int i; int s; if ((uap->mode != LIO_NOWAIT) && (uap->mode != LIO_WAIT)) { return EINVAL; } nent = uap->nent; if (nent > AIO_LISTIO_MAX) { return EINVAL; } if (p->p_aioinfo == NULL) { aio_init_aioinfo(p); } if ((nent + num_queue_count) > max_queue_count) { return EAGAIN; } ki = p->p_aioinfo; if ((nent + ki->kaio_queue_count) > ki->kaio_qallowed_count) { return EAGAIN; } lj = zalloc(aiolio_zone); if (!lj) { return EAGAIN; } lj->lioj_flags = 0; lj->lioj_buffer_count = 0; lj->lioj_buffer_finished_count = 0; lj->lioj_queue_count = 0; lj->lioj_queue_finished_count = 0; lj->lioj_ki = ki; TAILQ_INSERT_TAIL(&ki->kaio_liojoblist, lj, lioj_list); /* * Setup signal */ if (uap->sig && (uap->mode == LIO_NOWAIT)) { error = copyin(uap->sig, &lj->lioj_signal, sizeof lj->lioj_signal); if (error) return error; lj->lioj_flags |= LIOJ_SIGNAL; lj->lioj_flags &= ~LIOJ_SIGNAL_POSTED; } else { lj->lioj_flags &= ~LIOJ_SIGNAL; } /* * get pointers to the list of I/O requests */ nerror = 0; nentqueued = 0; cbptr = uap->acb_list; for(i = 0; i < uap->nent; i++) { iocb = (struct aiocb *) fuword((caddr_t) &cbptr[i]); if (((int) iocb != -1) && ((int) iocb != NULL)) { error = _aio_aqueue(p, iocb, lj, 0); if (error == 0) { nentqueued++; } else { nerror++; } } } /* * If we haven't queued any, then just return error */ if (nentqueued == 0) { return 0; } /* * Calculate the appropriate error return */ runningcode = 0; if (nerror) runningcode = EIO; if (uap->mode == LIO_WAIT) { while (1) { int found; found = 0; for(i = 0; i < uap->nent; i++) { int jobref, command; /* * Fetch address of the control buf pointer in user space */ iocb = (struct aiocb *) fuword((caddr_t) &cbptr[i]); if (((int) iocb == -1) || ((int) iocb == 0)) continue; /* * Fetch the associated command from user space */ command = fuword(&iocb->aio_lio_opcode); if (command == LIO_NOP) { found++; continue; } jobref = fuword(&iocb->_aiocb_private.kernelinfo); for (cb = TAILQ_FIRST(&ki->kaio_jobdone); cb; cb = TAILQ_NEXT(cb, plist)) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { if (cb->uaiocb.aio_lio_opcode == LIO_WRITE) { curproc->p_stats->p_ru.ru_oublock += cb->outputcharge; cb->outputcharge = 0; } else if (cb->uaiocb.aio_lio_opcode == LIO_READ) { curproc->p_stats->p_ru.ru_inblock += cb->inputcharge; cb->inputcharge = 0; } found++; break; } } s = splbio(); for (cb = TAILQ_FIRST(&ki->kaio_bufdone); cb; cb = TAILQ_NEXT(cb, plist)) { if (((int) cb->uaiocb._aiocb_private.kernelinfo) == jobref) { found++; break; } } splx(s); } /* * If all I/Os have been disposed of, then we can return */ if (found == nentqueued) { return runningcode; } ki->kaio_flags |= KAIO_WAKEUP; error = tsleep(p, PRIBIO|PCATCH, "aiospn", 0); if (error == EINTR) { return EINTR; } else if (error == EWOULDBLOCK) { return EAGAIN; } } } return runningcode; } /* * This is a wierd hack so that we can post a signal. It is safe * to do so from a timeout routine, but *not* from an interrupt routine. */ static void process_signal(void *ljarg) { struct aio_liojob *lj = ljarg; if (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL) { if (lj->lioj_queue_count == lj->lioj_queue_finished_count) { psignal(lj->lioj_ki->kaio_p, lj->lioj_signal.sigev_signo); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } } } /* * Interrupt handler for physio, performs the necessary process wakeups, * and signals. */ static void aio_physwakeup(bp) struct buf *bp; { struct aiocblist *aiocbe; struct proc *p; struct kaioinfo *ki; struct aio_liojob *lj; int s; s = splbio(); wakeup((caddr_t) bp); bp->b_flags &= ~B_CALL; bp->b_flags |= B_DONE; aiocbe = (struct aiocblist *)bp->b_spc; if (aiocbe) { p = bp->b_proc; aiocbe->jobstate = JOBST_JOBBFINISHED; aiocbe->uaiocb._aiocb_private.status -= bp->b_resid; aiocbe->uaiocb._aiocb_private.error = 0; aiocbe->jobflags |= AIOCBLIST_DONE; if (bp->b_flags & B_ERROR) { aiocbe->uaiocb._aiocb_private.error = bp->b_error; } lj = aiocbe->lio; if (lj) { lj->lioj_buffer_finished_count++; /* * wakeup/signal if all of the interrupt jobs are done */ if (lj->lioj_buffer_finished_count == lj->lioj_buffer_count) { /* * post a signal if it is called for */ if ((lj->lioj_flags & (LIOJ_SIGNAL|LIOJ_SIGNAL_POSTED)) == LIOJ_SIGNAL) { lj->lioj_flags |= LIOJ_SIGNAL_POSTED; timeout(process_signal, lj, 0); } } } ki = p->p_aioinfo; if (ki) { ki->kaio_buffer_finished_count++; TAILQ_REMOVE(&aio_bufjobs, aiocbe, list); TAILQ_REMOVE(&ki->kaio_bufqueue, aiocbe, plist); TAILQ_INSERT_TAIL(&ki->kaio_bufdone, aiocbe, plist); /* * and do the wakeup */ if (ki->kaio_flags & (KAIO_RUNDOWN|KAIO_WAKEUP)) { ki->kaio_flags &= ~KAIO_WAKEUP; wakeup(p); } } } splx(s); } diff --git a/sys/posix4/aio.h b/sys/posix4/aio.h index 25e7d1c4cfe9..73319ece7920 100644 --- a/sys/posix4/aio.h +++ b/sys/posix4/aio.h @@ -1,107 +1,110 @@ /* XXX Conflicts with John's - not installed. */ /*- * 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 * 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. * - * $Id: aio.h,v 1.2 1998/03/08 17:25:11 dufault Exp $ + * $Id: aio.h,v 1.3 1998/03/23 14:05:25 bde Exp $ */ /* aio.h: P1003.1B-1993 Asynchronous I/O */ -#ifndef _AIO_H_ -#define _AIO_H_ +#ifndef _P1003_1B_AIO_H_ +#define _P1003_1B_AIO_H_ -#ifdef _POSIX4_INCLUDE_MAYBES +#include #include + +/* For struct sigevent: + */ +#ifdef KERNEL +#include +#else #include + +#ifdef _P1003_1B_INCLUDE_MAYBES #include #include #else struct timespec; -#include -#ifdef KERNEL -#include -#else -#include #endif #endif /* Return values: */ #define AIO_CANCELED 0x01 /* All operations cancelled */ #define AIO_NOTCANCELLED 0x02 /* Some not cancelled */ #define AIO_ALLDONE 0x04 /* None were cancelled */ /* lio_listio synchronization options */ #define LIO_WAIT 0x08 /* Suspend until complete */ #define LIO_NOWAIT 0x10 /* Continue operation */ /* lio_listio element operations */ #define LIO_READ 0x20 #define LIO_WRITE 0x40 #define LIO_NOP 0x80 typedef struct aiocb * const aio_listio_ctl; typedef const struct aiocb * const caio_listio_ctl; struct aiocb { int aio_fildes; /* File descriptor */ off_t aio_offset; /* File offset */ volatile void * aio_buf; /* Location of buffer */ size_t aio_nbytes; /* Length of transfer */ int aio_reqprio; /* Request priority offset */ struct sigevent aio_sigevent; /* Signal number and value */ int aio_lio_opcode; /* Operation to be performed */ }; #ifndef KERNEL #include __BEGIN_DECLS int aio_read __P((struct aiocb *)); int aio_write __P((struct aiocb *)); int lio_listio __P((int, aio_listio_ctl[], int, struct sigevent *)); int aio_error __P((const struct aiocb *)); ssize_t aio_return __P((struct aiocb *)); int aio_cancel __P((int, struct aiocb *)); int aio_suspend __P((caio_listio_ctl[], int, const struct timespec *)); int aio_fsync __P((int, struct aiocb *)); __END_DECLS #endif /* KERNEL */ -#endif /* _POSIX4_AIO_H_ */ +#endif /* _P1003_1B_AIO_H_ */ diff --git a/sys/posix4/ksched.c b/sys/posix4/ksched.c index 7ff85d622010..90c029ac311b 100644 --- a/sys/posix4/ksched.c +++ b/sys/posix4/ksched.c @@ -1,252 +1,256 @@ /* * 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 * 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. * */ /* ksched: Soft real time scheduling based on "rtprio". */ #include #include #include #include #include /* For need_resched */ -#include -#include +#include /* ksched: Real-time extension to support POSIX priority scheduling. */ -static struct timespec rr_interval; +struct ksched { + struct timespec rr_interval; +}; -int ksched_attach(int p4_instance, int fac_code, void **p) +int ksched_attach(struct ksched **p) { - rr_interval.tv_sec = 0; - rr_interval.tv_nsec = 1000000000L / roundrobin_interval(); + struct ksched *ksched= p31b_malloc(sizeof(*ksched)); - *p = 0; + ksched->rr_interval.tv_sec = 0; + ksched->rr_interval.tv_nsec = 1000000000L / roundrobin_interval(); + *p = ksched; return 0; } -int ksched_detach(void *p) +int ksched_detach(struct ksched *p) { + p31b_free(p); + return 0; } /* * XXX About priorities * - * POSIX4 requires that numerically higher priorities be of + * POSIX 1003.1b requires that numerically higher priorities be of * higher priority. It also permits sched_setparam to be * implementation defined for SCHED_OTHER. I don't like * the notion of inverted priorites for normal processes when * you can use "setpriority" for that. * * I'm rejecting sched_setparam for SCHED_OTHER with EINVAL. */ /* Macros to convert between the unix (lower numerically is higher priority) - * and POSIX4 (higher numerically is higher priority) + * and POSIX 1003.1b (higher numerically is higher priority) */ #define p4prio_to_rtpprio(P) (RTP_PRIO_MAX - (P)) #define rtpprio_to_p4prio(P) (RTP_PRIO_MAX - (P)) static inline int -getscheduler(int *ret, void *hook, struct proc *p) +getscheduler(int *ret, struct ksched *ksched, struct proc *p) { int e = 0; switch (p->p_rtprio.type) { case RTP_PRIO_FIFO: *ret = SCHED_FIFO; break; case RTP_PRIO_REALTIME: *ret = SCHED_RR; break; default: *ret = SCHED_OTHER; break; } return e; } -int ksched_setparam(int *ret, void *hook, +int ksched_setparam(int *ret, struct ksched *ksched, struct proc *p, const struct sched_param *param) { int e, policy; - e = getscheduler(&policy, hook, p); + e = getscheduler(&policy, ksched, p); if (e == 0) { if (policy == SCHED_OTHER) e = EINVAL; else - e = ksched_setscheduler(ret, hook, p, policy, param); + e = ksched_setscheduler(ret, ksched, p, policy, param); } return e; } -int ksched_getparam(int *ret, void *hook, +int ksched_getparam(int *ret, struct ksched *ksched, struct proc *p, struct sched_param *param) { if (RTP_PRIO_IS_REALTIME(p->p_rtprio.type)) param->sched_priority = rtpprio_to_p4prio(p->p_rtprio.prio); return 0; } /* * XXX The priority and scheduler modifications should * be moved into published interfaces in kern/kern_sync. * - * The permissions to modify process p were checked in "posix4proc()". + * The permissions to modify process p were checked in "p31b_proc()". * */ -int ksched_setscheduler(int *ret, void *hook, +int ksched_setscheduler(int *ret, struct ksched *ksched, struct proc *p, int policy, const struct sched_param *param) { int e = 0; struct rtprio rtp; switch(policy) { case SCHED_RR: case SCHED_FIFO: if (param->sched_priority >= RTP_PRIO_MIN && param->sched_priority <= RTP_PRIO_MAX) { rtp.type = (policy == SCHED_FIFO) ? RTP_PRIO_FIFO : RTP_PRIO_REALTIME; rtp.prio = p4prio_to_rtpprio(RTP_PRIO_MAX); p->p_rtprio = rtp; (void)resetpriority(p); } else e = EPERM; break; case SCHED_OTHER: { rtp.type = RTP_PRIO_NORMAL; rtp.prio = p4prio_to_rtpprio(RTP_PRIO_MIN); p->p_rtprio = rtp; /* XXX Simply revert to whatever we had for last * normal scheduler priorities. * This puts a requirement * on the scheduling code: You must leave the * scheduling info alone. */ (void)resetpriority(p); } break; } return e; } -int ksched_getscheduler(int *ret, void *hook, struct proc *p) +int ksched_getscheduler(int *ret, struct ksched *ksched, struct proc *p) { - return getscheduler(ret, hook, p); + return getscheduler(ret, ksched, p); } /* ksched_yield: Yield the CPU. */ -int ksched_yield(int *ret, void *hook) +int ksched_yield(int *ret, struct ksched *ksched) { need_resched(); return 0; } -int ksched_get_priority_max(int *ret, void *hook, int policy) +int ksched_get_priority_max(int *ret, struct ksched *ksched, int policy) { int e = 0; switch (policy) { case SCHED_FIFO: case SCHED_RR: *ret = RTP_PRIO_MAX; break; case SCHED_OTHER: *ret = PRIO_MAX; break; default: e = EINVAL; } return e; } -int ksched_get_priority_min(int *ret, void *hook, int policy) +int ksched_get_priority_min(int *ret, struct ksched *ksched, int policy) { int e = 0; switch (policy) { case SCHED_FIFO: case SCHED_RR: *ret = RTP_PRIO_MIN; break; case SCHED_OTHER: *ret = PRIO_MIN; break; default: e = EINVAL; } return e; } -int ksched_rr_get_interval(int *ret, void *hook, +int ksched_rr_get_interval(int *ret, struct ksched *ksched, struct proc *p, struct timespec *timespec) { - *timespec = rr_interval; + *timespec = ksched->rr_interval; return 0; } diff --git a/sys/posix4/mqueue.h b/sys/posix4/mqueue.h index 6fcf4409ed33..c59a4aa84f06 100644 --- a/sys/posix4/mqueue.h +++ b/sys/posix4/mqueue.h @@ -1,74 +1,76 @@ #ifndef _MQUEUE_H_ #define _MQUEUE_H_ -/* mqueue.h: POSIX.4 Message Queues */ +/* mqueue.h: POSIX 1003.1b Message Queues */ /*- * 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 * 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. * */ -#ifdef _POSIX4_INCLUDE_MAYBES +#include + +#ifdef _P1003_1B_INCLUDE_MAYBES #include #include #include #include #else struct sigevent; #endif typedef int mqd_t; /* message queue descriptors */ struct mq_attr { long mq_flags; /* message queue flags */ long mq_maxmsg; /* maximum number of messages */ long mq_msgsize; /* maximum message size */ long mq_curmsgs; /* number of messages currently queued */ }; #ifndef KERNEL #include __BEGIN_DECLS mqd_t mq_open __P((const char *, int oflag, ...)); int mq_close __P((mqd_t)); int mq_unlink __P((const char *)); int mq_send __P((mqd_t, const char *, size_t, unsigned int)); ssize_t mq_receive __P((mqd_t, char *, size_t, unsigned int *)); int mq_notify __P((mqd_t, const struct sigevent *)); int mq_setattr __P((mqd_t, const struct mq_attr *, struct mq_attr *)); int mq_getattr __P((mqd_t, struct mq_attr *)); __END_DECLS #endif /* KERNEL */ #endif /* _MQUEUE_H_ */ diff --git a/sys/posix4/p1003_1b.c b/sys/posix4/p1003_1b.c new file mode 100644 index 000000000000..ccbee6b80283 --- /dev/null +++ b/sys/posix4/p1003_1b.c @@ -0,0 +1,239 @@ +/* + * Copyright (c) 1996, 1997, 1998 + * 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 + * 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. + * + */ + +/* p1003_1b: Real Time common code. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B"); + +/* p31b_proc: Return a proc struct corresponding to a pid to operate on. + * + * Enforce permission policy. + * + * The policy is the same as for sending signals except there + * is no notion of process groups. + * + * pid == 0 means my process. + * + * This is disabled until I've got a permission gate in again: + * only root can do this. + */ + +#if 0 +/* + * This is stolen from CANSIGNAL in kern_sig: + * + * Can process p, with pcred pc, do "write flavor" operations to process q? + */ +#define CAN_AFFECT(p, pc, q) \ + ((pc)->pc_ucred->cr_uid == 0 || \ + (pc)->p_ruid == (q)->p_cred->p_ruid || \ + (pc)->pc_ucred->cr_uid == (q)->p_cred->p_ruid || \ + (pc)->p_ruid == (q)->p_ucred->cr_uid || \ + (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid) +#else +#define CAN_AFFECT(p, pc, q) ((pc)->pc_ucred->cr_uid == 0) +#endif + +/* + * p31b_proc: Look up a proc from a PID. If proc is 0 it is + * my own proc. + */ +int p31b_proc(struct proc *p, pid_t pid, struct proc **pp) +{ + int ret = 0; + struct proc *other_proc = 0; + + if (pid == 0) + other_proc = p; + else + other_proc = pfind(pid); + + if (other_proc) + { + /* Enforce permission policy. + */ + if (CAN_AFFECT(p, p->p_cred, other_proc)) + *pp = other_proc; + else + ret = EPERM; + } + else + ret = ESRCH; + + return ret; +} + +int +syscall_not_present(struct proc *p, const char *s, struct nosys_args *uap) +{ + log(LOG_ERR, "cmd %s pid %d tried to use non-present %s\n", + p->p_comm, p->p_pid, s); + return nosys(p, uap); +} + +#if !defined(_KPOSIX_PRIORITY_SCHEDULING) + +/* Not configured but loadable via an LKM: + */ + +static int sched_attach(void) +{ + return 0; +} + +SYSCALL_NOT_PRESENT_GEN(sched_setparam) +SYSCALL_NOT_PRESENT_GEN(sched_getparam) +SYSCALL_NOT_PRESENT_GEN(sched_setscheduler) +SYSCALL_NOT_PRESENT_GEN(sched_getscheduler) +SYSCALL_NOT_PRESENT_GEN(sched_yield) +SYSCALL_NOT_PRESENT_GEN(sched_get_priority_max) +SYSCALL_NOT_PRESENT_GEN(sched_get_priority_min) +SYSCALL_NOT_PRESENT_GEN(sched_rr_get_interval) + +#else + +/* Configured in kernel version: + */ +static struct ksched *ksched; + +static int sched_attach(void) +{ + int ret = ksched_attach(&ksched); + + if (ret == 0) + p31b_setcfg(CTL_P1003_1B_PRIORITY_SCHEDULING, 1); + + return ret; +} + +int sched_setparam(struct proc *p, + struct sched_setparam_args *uap) +{ + int e; + + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_setparam(&p->p_retval[0], ksched, p, + (const struct sched_param *) &uap->param)) + ); + + return e; +} + +int sched_getparam(struct proc *p, + struct sched_getparam_args *uap) +{ + int e; + + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_getparam(&p->p_retval[0], ksched, p, uap->param)) + ); + + return e; +} +int sched_setscheduler(struct proc *p, + struct sched_setscheduler_args *uap) +{ + int e; + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_setscheduler(&p->p_retval[0], + ksched, p, uap->policy, uap->param)) + ); + + return e; +} +int sched_getscheduler(struct proc *p, + struct sched_getscheduler_args *uap) +{ + int e; + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_getscheduler(&p->p_retval[0], ksched, p)) + ); + + return e; +} +int sched_yield(struct proc *p, + struct sched_yield_args *uap) +{ + return ksched_yield(&p->p_retval[0], ksched); +} +int sched_get_priority_max(struct proc *p, + struct sched_get_priority_max_args *uap) +{ + return ksched_get_priority_max(&p->p_retval[0], + ksched, uap->policy); +} +int sched_get_priority_min(struct proc *p, + struct sched_get_priority_min_args *uap) +{ + return ksched_get_priority_min(&p->p_retval[0], + ksched, uap->policy); +} +int sched_rr_get_interval(struct proc *p, + struct sched_rr_get_interval_args *uap) +{ + int e; + + (void) (0 + || (e = p31b_proc(p, uap->pid, &p)) + || (e = ksched_rr_get_interval(&p->p_retval[0], ksched, + p, uap->interval)) + ); + + return e; +} + +#endif + +static void p31binit(void *notused) +{ + (void) sched_attach(); +} + +SYSINIT(p31b, SI_SUB_P1003_1B, SI_ORDER_FIRST, p31binit, NULL); diff --git a/sys/posix4/posix4.h b/sys/posix4/posix4.h index 99ba8822a2b0..dd3418cb8f89 100644 --- a/sys/posix4/posix4.h +++ b/sys/posix4/posix4.h @@ -1,292 +1,118 @@ -#ifndef _POSIX4_POSIX4_H_ -#define _POSIX4_POSIX4_H_ +#ifndef _P1003_1B_P1003_1B_H_ +#define _P1003_1B_P1003_1B_H_ /*- * Copyright (c) 1996, 1997, 1998 * 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 * 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. * */ -#include +#include "opt_posix.h" -#ifdef _POSIX4_VISIBLE +#ifdef P1003_1B #include #include -#include +#include +#include -/* - * - * March 1, 1998: Details from here on change and this header file - * is volatile. - * - * Locally I've got PRIORITY SCHEDULING - * set as a system call available only to root - * and I'm still using a pseudo device to gate everything else. - * - * This interface vectors us into the kernel through a - * POSIX4 pseudo device with some user privilege authorization along - * the way. - * - * XXX I'm going with option 3. - * - * This has drawbacks from the point of view of ktrace. There - * are (at least) three ways to do this: - * - * 1. As it is being done, which is bad for ktrace and is hokey - * but is easy to extend during development; - * 2. Add a system call for every POSIX4 entry point, which - * will result in many more system calls (on the order of 64) - * 3. Add a system call for each POSIX4 option, which is a bit more - * useful for ktrace and will add only about 14 new system calls. - * +/* Generate syscall stubs for when something is optionally + * LKM'd. References "syscall_not_present". + * XXX Good candidate for sys/syscall.h */ +struct proc; +struct nosys_args; +extern int syscall_not_present(struct proc *, const char *, struct nosys_args *); -#define POSIX4_FACILITIES 16 -#define POSIX4_ONE_ONLY +#define SYSCALL_NOT_PRESENT_GEN(SC) \ +int SC (struct proc *p, struct SC##_args *uap) \ +{ \ + return syscall_not_present(p, #SC , (struct nosys_args *)uap); \ +} -/* - * All facility request structures have a posix4_dispatch header - * at the front. Return values are always an indication of - * success or failure and are automatically converted into an errno - * by the kernel. "Non-errno" return codes are handled via ret. - */ -struct posix4_dispatch { - int op; - int ret; -}; -#if defined(_POSIX_PRIORITY_SCHEDULING) +MALLOC_DECLARE(M_P31B); + +#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK) +#define p31b_free(P) free((P), M_P31B) + +int p31b_proc __P((struct proc *, pid_t, struct proc **)); + +void p31b_setcfg __P((int, int)); + +#ifdef _KPOSIX_PRIORITY_SCHEDULING /* * KSCHED_OP_RW is a vector of read/write flags for each entry indexed * by the enum ksched_op. * * 1 means you need write access, 0 means read is sufficient. */ enum ksched_op { #define KSCHED_OP_RW { 1, 0, 1, 0, 0, 0, 0, 0 } SCHED_SETPARAM, SCHED_GETPARAM, SCHED_SETSCHEDULER, SCHED_GETSCHEDULER, SCHED_YIELD, SCHED_GET_PRIORITY_MAX, SCHED_GET_PRIORITY_MIN, SCHED_RR_GET_INTERVAL, SCHED_OP_MAX }; -struct ksched -{ - struct posix4_dispatch dispatch; - pid_t pid; - int policy; - struct sched_param param; - struct timespec interval; -}; - -#endif /* _POSIX_PRIORITY_SCHEDULING */ - -#if defined(_POSIX_MEMLOCK) ^ defined(_POSIX_MEMLOCK_RANGE) -/* This implementation expects these two options to always be together. - * If one isn't handled it should be disabled at - * run time. - */ -#error _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE should always be together -#endif - -#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE) - -enum kmemlock_op { - -#define KMEMLOCK_OP_RW { 1, 1, 1, 1 } - - MEMLOCK_MLOCKALL, - MEMLOCK_MUNLOCKALL, - MEMLOCK_MLOCK, - MEMLOCK_MUNLOCK, - MEMLOCK_OP_MAX -}; - -struct kmemlock -{ - struct posix4_dispatch dispatch; - int flags; - void *addr; - size_t len; -}; - -#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */ - -#if defined(KERNEL) - -struct proc; - -void *posix4malloc __P((int *, size_t)); -void posix4free __P((int *, void *)); -int posix4proc __P((struct proc *, pid_t, struct proc **)); -int posix4ioctl __P((dev_t, int, caddr_t, int, struct proc *)); -void posix4attach __P((int)); -void posix4_facility __P((int, int)); - -struct lkm_table; -int posix4_init __P((struct lkm_table *, int , int )); +struct ksched; -#ifdef _POSIX_PRIORITY_SCHEDULING +int ksched_attach(struct ksched **); +int ksched_detach(struct ksched *); -int ksched_attach(int, int, void **); -int ksched_detach(void *); - -int ksched_setparam(int *, void *, +int ksched_setparam(int *, struct ksched *, struct proc *, const struct sched_param *); -int ksched_getparam(int *, void *, +int ksched_getparam(int *, struct ksched *, struct proc *, struct sched_param *); -int ksched_setscheduler(int *, void *, +int ksched_setscheduler(int *, struct ksched *, struct proc *, int, const struct sched_param *); -int ksched_getscheduler(int *, void *, struct proc *); - -int ksched_yield(int *, void *); - -int ksched_get_priority_max(int *, void *, int); -int ksched_get_priority_min(int *, void *, int); - -int ksched_rr_get_interval(int *, void *, struct proc *, struct timespec *); - -#endif /* _POSIX_PRIORITY_SCHEDULING */ - -#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE) +int ksched_getscheduler(int *, struct ksched *, struct proc *); -int kmemlock_attach(int, int, void **); -int kmemlock_detach(void *); -int kmlockall(int *, void *, int); -int kmunlockall(int *, void *); -int kmlock(int *, void *, const void *, size_t); -int kmunlock(int *, void *, const void *, size_t ); +int ksched_yield(int *, struct ksched *); -#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */ +int ksched_get_priority_max(int *, struct ksched *, int); +int ksched_get_priority_min(int *, struct ksched *, int); -#endif /* KERNEL */ +int ksched_rr_get_interval(int *, struct ksched *, struct proc *, struct timespec *); -/* A facility is an implementation of one of the optional portions of - * POSIX4 as selected by the feature test macros, such as the fixed - * priority scheduler or the realtime signals. - */ - -/* Each facility has a facility code, an opcode, and r-w attributes. - * To exercise the operation associated with an opcode you need the - * appropriate privileges on the POSIX4 device with the facility - * bit set in the minor number. This means that every facility has - * a protection bit: Probably more than we need, but it may have - * advantages. - * - */ - -#define posix4encode(FACILITY, RW) (FACILITY) -#define posix4decode(X, FACILITY_P) \ - do { \ - *(FACILITY_P) = ((X) & 0xff); \ - } while (0) - -/* - * The dispatch codes: - */ -#define IO_POSIX4_PRIORITY_SCHEDULING _IOWR('r', \ - CTL_POSIX4_PRIORITY_SCHEDULING, struct ksched) +#endif /* _KPOSIX_PRIORITY_SCHEDULING */ -#define IO_POSIX4_MEMLOCK _IOWR('r', \ - CTL_POSIX4_MEMLOCK, struct ksched) - -/* - * CTL_POSIX4 definitions for syscfg - */ - -#define CTL_POSIX4_ASYNCHRONOUS_IO 1 /* boolean */ -#define CTL_POSIX4_MAPPED_FILES 2 /* boolean */ -#define CTL_POSIX4_MEMLOCK 3 /* boolean */ -#define CTL_POSIX4_MEMLOCK_RANGE 4 /* boolean */ -#define CTL_POSIX4_MEMORY_PROTECTION 5 /* boolean */ -#define CTL_POSIX4_MESSAGE_PASSING 6 /* boolean */ -#define CTL_POSIX4_PRIORITIZED_IO 7 /* boolean */ -#define CTL_POSIX4_PRIORITY_SCHEDULING 8 /* boolean */ -#define CTL_POSIX4_REALTIME_SIGNALS 9 /* boolean */ -#define CTL_POSIX4_SEMAPHORES 10 /* boolean */ -#define CTL_POSIX4_FSYNC 11 /* boolean */ -#define CTL_POSIX4_SHARED_MEMORY_OBJECTS 12 /* boolean */ -#define CTL_POSIX4_SYNCHRONIZED_IO 13 /* boolean */ -#define CTL_POSIX4_TIMERS 14 /* boolean */ -#define CTL_POSIX4_AIO_LISTIO_MAX 15 /* int */ -#define CTL_POSIX4_AIO_MAX 16 /* int */ -#define CTL_POSIX4_AIO_PRIO_DELTA_MAX 17 /* int */ -#define CTL_POSIX4_DELAYTIMER_MAX 18 /* int */ -#define CTL_POSIX4_MQ_OPEN_MAX 19 /* int */ -#define CTL_POSIX4_PAGESIZE 20 /* int */ -#define CTL_POSIX4_RTSIG_MAX 21 /* int */ -#define CTL_POSIX4_SEM_NSEMS_MAX 22 /* int */ -#define CTL_POSIX4_SEM_VALUE_MAX 23 /* int */ -#define CTL_POSIX4_SIGQUEUE_MAX 24 /* int */ -#define CTL_POSIX4_TIMER_MAX 25 /* int */ - -#define CTL_POSIX4_N_CTLS 25 - -#define CTL_POSIX4_NAMES { \ - { 0, 0 }, \ - { "asynchronous_io", CTLTYPE_INT }, \ - { "mapped_files", CTLTYPE_INT }, \ - { "memlock", CTLTYPE_INT }, \ - { "memlock_range", CTLTYPE_INT }, \ - { "memory_protection", CTLTYPE_INT }, \ - { "message_passing", CTLTYPE_INT }, \ - { "prioritized_io", CTLTYPE_INT }, \ - { "priority_scheduling", CTLTYPE_INT }, \ - { "realtime_signals", CTLTYPE_INT }, \ - { "semaphores", CTLTYPE_INT }, \ - { "fsync", CTLTYPE_INT }, \ - { "shared_memory_objects", CTLTYPE_INT }, \ - { "synchronized_io", CTLTYPE_INT }, \ - { "timers", CTLTYPE_INT }, \ - { "aio_listio_max", CTLTYPE_INT }, \ - { "aio_max", CTLTYPE_INT }, \ - { "aio_prio_delta_max", CTLTYPE_INT }, \ - { "delaytimer_max", CTLTYPE_INT }, \ - { "mq_open_max", CTLTYPE_INT }, \ - { "pagesize", CTLTYPE_INT }, \ - { "rtsig_max", CTLTYPE_INT }, \ - { "nsems_max", CTLTYPE_INT }, \ - { "sem_value_max", CTLTYPE_INT }, \ - { "sigqueue_max", CTLTYPE_INT }, \ - { "timer_max", CTLTYPE_INT }, \ -} -#endif /* _POSIX4_VISIBLE */ -#endif /* _POSIX4_POSIX4_H_ */ +#endif /* P1003_1B */ +#endif /* _P1003_1B_P1003_1B_H_ */ diff --git a/sys/posix4/posix4_mib.c b/sys/posix4/posix4_mib.c index 84532b8ef74f..523f76b87ca0 100644 --- a/sys/posix4/posix4_mib.c +++ b/sys/posix4/posix4_mib.c @@ -1,77 +1,94 @@ /*- * Copyright (c) 1998 * 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 * 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. * */ #include #include #include -#include +#include -static int facility[CTL_POSIX4_N_CTLS]; +static int facility[CTL_P1003_1B_MAXID - 1]; + +/* OID_AUTO isn't working with sysconf(3). I guess I'd have to + * modify it to do a lookup by name from the index. + * For now I've left it a top-level sysctl. + */ + +#if 1 + +#define P1B_SYSCTL(num, name) \ +SYSCTL_INT(_p1003_1b, num, \ + name, CTLFLAG_RD, facility + num - 1, 0, ""); + +#else + +#define P1B_SYSCTL(num, name) \ +SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ + name, CTLFLAG_RD, facility + num - 1, 0, ""); +SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B"); + +#endif -#define P4_SYSCTL(num, name) \ - SYSCTL_INT(_posix4, num, name, CTLFLAG_RD, facility + num - 1, 0, ""); -P4_SYSCTL(CTL_POSIX4_ASYNCHRONOUS_IO, asynchronous_io); -P4_SYSCTL(CTL_POSIX4_MAPPED_FILES, mapped_files); -P4_SYSCTL(CTL_POSIX4_MEMLOCK, memlock); -P4_SYSCTL(CTL_POSIX4_MEMLOCK_RANGE, memlock_range); -P4_SYSCTL(CTL_POSIX4_MEMORY_PROTECTION, memory_protection); -P4_SYSCTL(CTL_POSIX4_MESSAGE_PASSING, message_passing); -P4_SYSCTL(CTL_POSIX4_PRIORITIZED_IO, prioritized_io); -P4_SYSCTL(CTL_POSIX4_PRIORITY_SCHEDULING, priority_scheduling); -P4_SYSCTL(CTL_POSIX4_REALTIME_SIGNALS, realtime_signals); -P4_SYSCTL(CTL_POSIX4_SEMAPHORES, semaphores); -P4_SYSCTL(CTL_POSIX4_FSYNC, fsync); -P4_SYSCTL(CTL_POSIX4_SHARED_MEMORY_OBJECTS, shared_memory_objects); -P4_SYSCTL(CTL_POSIX4_SYNCHRONIZED_IO, synchronized_io); -P4_SYSCTL(CTL_POSIX4_TIMERS, timers); -P4_SYSCTL(CTL_POSIX4_AIO_LISTIO_MAX, aio_listio_max); -P4_SYSCTL(CTL_POSIX4_AIO_MAX, aio_max); -P4_SYSCTL(CTL_POSIX4_AIO_PRIO_DELTA_MAX, aio_prio_delta_max); -P4_SYSCTL(CTL_POSIX4_DELAYTIMER_MAX, delaytimer_max); -P4_SYSCTL(CTL_POSIX4_MQ_OPEN_MAX, mq_open_max); -P4_SYSCTL(CTL_POSIX4_PAGESIZE, pagesize); -P4_SYSCTL(CTL_POSIX4_RTSIG_MAX, rtsig_max); -P4_SYSCTL(CTL_POSIX4_SEM_NSEMS_MAX, sem_nsems_max); -P4_SYSCTL(CTL_POSIX4_SEM_VALUE_MAX, sem_value_max); -P4_SYSCTL(CTL_POSIX4_SIGQUEUE_MAX, sigqueue_max); -P4_SYSCTL(CTL_POSIX4_TIMER_MAX, timer_max); +P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io); +P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files); +P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock); +P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range); +P1B_SYSCTL(CTL_P1003_1B_MEMORY_PROTECTION, memory_protection); +P1B_SYSCTL(CTL_P1003_1B_MESSAGE_PASSING, message_passing); +P1B_SYSCTL(CTL_P1003_1B_PRIORITIZED_IO, prioritized_io); +P1B_SYSCTL(CTL_P1003_1B_PRIORITY_SCHEDULING, priority_scheduling); +P1B_SYSCTL(CTL_P1003_1B_REALTIME_SIGNALS, realtime_signals); +P1B_SYSCTL(CTL_P1003_1B_SEMAPHORES, semaphores); +P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync); +P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects); +P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io); +P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers); +P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max); +P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max); +P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max); +P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max); +P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max); +P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize); +P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max); +P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); +P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max); +P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max); +P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max); -/* posix4_facility: Set a facility to a value. This is - * probably a temporary measure until the LKM code is combined with this. +/* p31b_setcfg: Set the configuration */ -void posix4_facility(int num, int value) +void p31b_setcfg(int num, int value) { - if (num >= 1 && num <= CTL_POSIX4_N_CTLS) + if (num >= 1 && num < CTL_P1003_1B_MAXID) facility[num - 1] = value; } diff --git a/sys/posix4/sched.h b/sys/posix4/sched.h index 50bc3c65b1dd..bd049339f921 100644 --- a/sys/posix4/sched.h +++ b/sys/posix4/sched.h @@ -1,74 +1,73 @@ #ifndef _SCHED_H_ #define _SCHED_H_ -/* sched.h: POSIX.4 Process Scheduling header */ +/* sched.h: POSIX 1003.1b Process Scheduling header */ /*- * 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. * */ -#include #include /* For pid_t */ #ifndef KERNEL #include /* Per P1003.4 */ #endif /* Scheduling policies */ #define SCHED_FIFO 1 #define SCHED_OTHER 2 #define SCHED_RR 3 struct sched_param { int sched_priority; }; #ifndef KERNEL #include int sched_setparam __P((pid_t, const struct sched_param *)); int sched_getparam __P((pid_t, struct sched_param *)); int sched_setscheduler __P((pid_t, int, const struct sched_param *)); int sched_getscheduler __P((pid_t)); int sched_yield __P((void)); int sched_get_priority_max __P((int)); int sched_get_priority_min __P((int)); int sched_rr_get_interval __P((pid_t, struct timespec *)); #endif /* KERNEL */ #endif /* _SCHED_H_ */ diff --git a/sys/posix4/semaphore.h b/sys/posix4/semaphore.h index 02cde3ee7821..f57a96f7e3f4 100644 --- a/sys/posix4/semaphore.h +++ b/sys/posix4/semaphore.h @@ -1,63 +1,65 @@ #ifndef _SEMAPHORE_H_ #define _SEMAPHORE_H_ -/* semaphore.h: POSIX.4 semaphores */ +/* semaphore.h: POSIX 1003.1b semaphores */ /*- * 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 * 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. * */ -#ifdef _POSIX4_INCLUDE_MAYBES +#include + +#ifdef _P1003_1B_INCLUDE_MAYBES #include #include #endif typedef int sem_t; #ifndef KERNEL #include __BEGIN_DECLS int sem_init __P((sem_t *, int, unsigned int)); int sem_destroy __P((sem_t *)); sem_t sem_open __P((const char *, int, ...)); int sem_close __P((sem_t *)); int sem_unlink __P((const char *)); int sem_wait __P((sem_t *)); int sem_trywait __P((sem_t *)); int sem_post __P((sem_t *)); int sem_getvalue __P((sem_t *, int *)); __END_DECLS #endif /* KERNEL */ #endif /* _SEMAPHORE_H_ */ diff --git a/sys/sys/_posix.h b/sys/sys/_posix.h index daf4fe2814e2..143596bd615c 100644 --- a/sys/sys/_posix.h +++ b/sys/sys/_posix.h @@ -1,73 +1,97 @@ #ifndef _SYS__POSIX_H_ #define _SYS__POSIX_H_ /*- * Copyright (c) 1998 HD Associates, Inc. * All rights reserved. * contact: dufault@hda.com * * 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. * * 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: $ + * $Id: _posix.h,v 1.1 1998/03/08 17:25:27 dufault Exp $ */ /* * This is a stand alone header file to set up for feature specification * defined to take place before the inclusion of any standard header. * It should only handle pre-processor defines. * * See section B.2.7 of 1003.1b-1993 * */ -#ifndef _POSIX_VERSION -#define _POSIX_VERSION 199009L +#ifdef KERNEL + +#ifndef ACTUALLY_LKM_NOT_KERNEL +#include "opt_posix.h" #endif -/* Test for visibility of pre-existing POSIX.4 features that should really - * be conditional. If _POSIX_C_SOURCE and _POSIX_SOURCE are not - * defined then permit the pre-existing features to show up: +/* Only kern_mib.c uses _POSIX_VERSION. Introduce a kernel + * one to avoid other pieces of the kernel getting dependant + * on that. + * XXX Complain if you think this dumb. + */ + +/* Make P1003 structures visible for the kernel if + * the P1003_1B option is in effect. */ -#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) -#define _POSIX4_VISIBLE_HISTORICALLY +#ifdef P1003_1B +#define _P1003_1B_VISIBLE +#ifndef _KPOSIX_VERSION +#define _KPOSIX_VERSION 199309L +#endif +#endif + +#ifndef _KPOSIX_VERSION +#define _KPOSIX_VERSION 199009L #endif -/* Test for visibility of additional POSIX.4 features: +#define _P1003_1B_VISIBLE_HISTORICALLY + +#else + +/* Default to existing user space version. */ -#if _POSIX_VERSION >= 199309L && \ - (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE >= 199309L) -#define _POSIX4_VISIBLE -#define _POSIX4_VISIBLE_HISTORICALLY +#ifndef _POSIX_VERSION +#define _POSIX_VERSION 199009L #endif -/* I'm not sure if I'm allowed to do this, but at least initially - * it may catch some teething problems: +/* Test for visibility of P1003.1B features: + * If _POSIX_SOURCE and POSIX_C_SOURCE are completely undefined + * they show up. + * + * If they specify a version including P1003.1B then they show up. + * + * (Two macros are added to permit hiding new extensions while + * keeping historic BSD features - that is not done now) + * */ -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE > _POSIX_VERSION) -#error _POSIX_C_SOURCE > _POSIX_VERSION +#if (!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)) || \ + (_POSIX_VERSION >= 199309L && defined(_POSIX_C_SOURCE) && \ + _POSIX_C_SOURCE >= 199309L) +#define _P1003_1B_VISIBLE +#define _P1003_1B_VISIBLE_HISTORICALLY #endif -#define POSIX4_VISIBLE You missed the leading _!! -#define POSIX4_VISIBLE_FORCEABLY You left the old define in the code!! - +#endif /* not KERNEL */ #endif /* _SYS__POSIX_H_ */ diff --git a/sys/sys/_sigset.h b/sys/sys/_sigset.h index ee3cabb4cae4..c02f9d8f58be 100644 --- a/sys/sys/_sigset.h +++ b/sys/sys/_sigset.h @@ -1,209 +1,236 @@ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)signal.h 8.4 (Berkeley) 5/4/95 - * $Id: signal.h,v 1.11 1997/02/22 09:45:53 peter Exp $ + * $Id: signal.h,v 1.12 1997/09/13 19:42:29 joerg Exp $ */ #ifndef _SYS_SIGNAL_H_ #define _SYS_SIGNAL_H_ #include +#include #include /* sig_atomic_t; trap codes; sigcontext */ #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ #endif #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #ifndef _POSIX_SOURCE #define SIGTRAP 5 /* trace trap (not reset when caught) */ #endif #define SIGABRT 6 /* abort() */ #ifndef _POSIX_SOURCE #define SIGIOT SIGABRT /* compatibility */ #define SIGEMT 7 /* EMT instruction */ #endif #define SIGFPE 8 /* floating point exception */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #ifndef _POSIX_SOURCE #define SIGBUS 10 /* bus error */ #endif #define SIGSEGV 11 /* segmentation violation */ #ifndef _POSIX_SOURCE #define SIGSYS 12 /* non-existent system call invoked */ #endif #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #ifndef _POSIX_SOURCE #define SIGURG 16 /* urgent condition on IO channel */ #endif #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ #ifndef _POSIX_SOURCE #define SIGIO 23 /* input/output possible signal */ #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ #define SIGWINCH 28 /* window size changes */ #define SIGINFO 29 /* information request */ #endif #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ /*- * Type of a signal handling function. * * Language spec sez signal handlers take exactly one arg, even though we * actually supply three. Ugh! * * We don't try to hide the difference by leaving out the args because * that would cause warnings about conformant programs. Nonconformant * programs can avoid the warnings by casting to (__sighandler_t *) or * sig_t before calling signal() or assigning to sa_handler or sv_handler. * * The kernel should reverse the cast before calling the function. It * has no way to do this, but on most machines 1-arg and 3-arg functions * have the same calling protocol so there is no problem in practice. * A bit in sa_flags could be used to specify the number of args. */ typedef void __sighandler_t __P((int)); #define SIG_DFL ((__sighandler_t *)0) #define SIG_IGN ((__sighandler_t *)1) #define SIG_ERR ((__sighandler_t *)-1) #ifndef _ANSI_SOURCE typedef unsigned int sigset_t; /* * Signal vector "template" used in sigaction call. */ struct sigaction { __sighandler_t *sa_handler; /* signal handler */ sigset_t sa_mask; /* signal mask to apply */ int sa_flags; /* see signal options below */ }; #ifndef _POSIX_SOURCE #define SA_ONSTACK 0x0001 /* take signal on signal stack */ #define SA_RESTART 0x0002 /* restart system call on signal return */ #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */ #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */ #define SA_NOCLDWAIT 0x0020 /* don't keep zombies around */ #ifdef COMPAT_SUNOS #define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */ #endif #endif /* _POSIX_SOURCE */ #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ /* * Flags for sigprocmask: */ #define SIG_BLOCK 1 /* block specified signal set */ #define SIG_UNBLOCK 2 /* unblock specified signal set */ #define SIG_SETMASK 3 /* set specified signal set */ #ifndef _POSIX_SOURCE typedef __sighandler_t *sig_t; /* type of pointer to a signal function */ /* * Structure used in sigaltstack call. */ struct sigaltstack { char *ss_sp; /* signal stack base */ int ss_size; /* signal stack length */ int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */ }; #define SS_ONSTACK 0x0001 /* take signal on alternate stack */ #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */ #define MINSIGSTKSZ 8192 /* minimum allowable stack */ #define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */ /* * 4.3 compatibility: * Signal vector "template" used in sigvec call. */ struct sigvec { __sighandler_t *sv_handler; /* signal handler */ int sv_mask; /* signal mask to apply */ int sv_flags; /* see signal options below */ }; #define SV_ONSTACK SA_ONSTACK #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ #define SV_RESETHAND SA_RESETHAND #define SV_NODEFER SA_NODEFER #define SV_NOCLDSTOP SA_NOCLDSTOP #define sv_onstack sv_flags /* isn't compatibility wonderful! */ /* * Structure used in sigstack call. */ struct sigstack { char *ss_sp; /* signal stack pointer */ int ss_onstack; /* current status */ }; /* * Macro for converting signal number to a mask suitable for * sigblock(). */ #define sigmask(m) (1 << ((m)-1)) #define BADSIG SIG_ERR #endif /* !_POSIX_SOURCE */ #endif /* !_ANSI_SOURCE */ +#ifdef _P1003_1B_VISIBLE_HISTORICALLY + +/* sys/aio.h unconditionally defined these */ + +union sigval { + int sival_int; /* Integer signal value */ + void *sival_ptr; /* Pointer signal value */ +}; + +typedef struct siginfo { + int si_signo; /* Signal number */ + int si_code; /* Cause of the signal */ + union sigval si_value; /* Signal value */ +} siginfo_t; + +struct sigevent { + int sigev_notify; /* Notification type */ + int sigev_signo; /* Signal number */ + union sigval sigev_value; /* Signal value */ +}; + +#define SIGEV_NONE 0 /* No async notification */ +#define SIGEV_SIGNAL 1 /* Generate a queued signal */ + +#endif + /* * For historical reasons; programs expect signal's return value to be * defined by . */ __BEGIN_DECLS __sighandler_t *signal __P((int, __sighandler_t *)); __END_DECLS #endif /* !_SYS_SIGNAL_H_ */ diff --git a/sys/sys/aio.h b/sys/sys/aio.h index 24a2ad7d0e44..29d26056ae3d 100644 --- a/sys/sys/aio.h +++ b/sys/sys/aio.h @@ -1,170 +1,144 @@ #ifndef _AIO_H_ #define _AIO_H_ /* * Copyright (c) 1997 John S. Dyson. 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. John S. Dyson's name may not be used to endorse or promote products * derived from this software without specific prior written permission. * * DISCLAIMER: This code isn't warranted to do anything useful. Anything * bad that happens because of using this software isn't the responsibility * of the author. This software is distributed AS-IS. * - * $Id: aio.h,v 1.5 1998/03/08 22:21:12 dufault Exp $ + * $Id: aio.h,v 1.6 1998/03/09 00:15:08 dufault Exp $ */ #include - -/**************************************************************************/ -/* Additions to signal.h -- hack alert. */ -/**************************************************************************/ -/* - * sigval structure: - */ -union sigval { - int sival_int; - void *sival_ptr; -}; - -/* - * this is the sigevent structure: - */ -struct sigevent { - int sigev_notify; /* Notification */ - int sigev_signo; /* Signal number */ - union sigval sigev_value; /* Not used yet in FreeBSD */ -}; - -/* - * values for sigev_notify: - */ -#define SIGEV_NONE 0 /* Don't post a signal */ -#define SIGEV_SIGNAL 1 /* Post specified signal */ - +#include /* * Returned by aio_cancel: * (Note that FreeBSD's aio is not cancellable -- yet.) */ #define AIO_CANCELED 0x1 #define AIO_NOTCANCELED 0x2 #define AIO_ALLDONE 0x3 /* * LIO opcodes */ #define LIO_NOP 0x0 #define LIO_WRITE 0x1 #define LIO_READ 0x2 /* * LIO modes */ #define LIO_NOWAIT 0x0 #define LIO_WAIT 0x1 /* * Maximum number of allowed LIO operations */ #define AIO_LISTIO_MAX 16 /* * Private mode bit for aio. * (This bit is set by the library routine * to allow the kernel to support sync * or async operations in the future.) */ #define AIO_PMODE_SYNC 0x1 #define AIO_PMODE_DONE 0x2 #define AIO_PMODE_SUSPEND 0x4 #define AIO_PMODE_ACTIVE 0x2357c0de /* * Private members for aiocb -- don't access * directly. */ struct __aiocb_private { int status; int error; int privatemodes; int active; int tid; int threadinfo; void *userinfo; void *kernelinfo; }; /* * I/O control block */ typedef struct aiocb { int aio_fildes; /* File descriptor */ off_t aio_offset; /* File offset for I/O */ volatile void *aio_buf; /* I/O buffer in process space */ size_t aio_nbytes; /* Number of bytes for I/O */ struct sigevent aio_sigevent; /* Signal to deliver */ int aio_lio_opcode; /* LIO opcode */ int aio_reqprio; /* Request priority -- ignored */ struct __aiocb_private _aiocb_private; } aiocb_t; #ifndef KERNEL /* * Asynchronously read from a file */ int aio_read( struct aiocb *iocb); /* * Asynchronously write to file */ int aio_write( struct aiocb *iocb); /* * List I/O Asynchronously/synchronously read/write to/from file * "lio_mode" specifies whether or not the I/O is synchronous. * "acb_list" is an array of "nacb_listent" I/O control blocks. * when all I/Os are complete, the optional signal "sig" is sent. */ int lio_listio( int lio_mode, struct aiocb * const acb_list[], int nacb_listent, struct sigevent *sig); /* * Get completion status * returns EINPROGRESS until I/O is complete. * this routine does not block. */ int aio_error( const struct aiocb *iocb); /* * Finish up I/O, releasing I/O resources and returns the value * that would have been associated with a synchronous I/O request. * This routine must be called once and only once for each * I/O control block who has had I/O associated with it. */ ssize_t aio_return( struct aiocb *iocb); /* * Cancel I/O -- implemented only to return AIO_NOTCANCELLED or * AIO_ALLDONE. No cancellation operation will occur. */ int aio_cancel( int fd, struct aiocb *iocb); /* * Suspend until all specified I/O or timeout is complete. */ int aio_suspend( const struct aiocb * const acb_list[], int nacb_listent, const struct timespec *tm); #else void aio_proc_rundown( struct proc *p); #endif #endif diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index dcd682e382c3..e5c14f6b0c6e 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -1,310 +1,311 @@ /*- * Copyright (c) 1995 Terrence R. Lambert * All rights reserved. * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 - * $Id: kernel.h,v 1.35 1997/11/18 07:23:40 bde Exp $ + * $Id: kernel.h,v 1.36 1997/12/12 04:00:47 dyson Exp $ */ #ifndef _SYS_KERNEL_H_ #define _SYS_KERNEL_H_ #ifdef KERNEL /* Global variables for the kernel. */ /* 1.1 */ extern long hostid; extern char hostname[MAXHOSTNAMELEN]; extern int hostnamelen; extern char domainname[MAXHOSTNAMELEN]; extern int domainnamelen; extern char kernelname[MAXPATHLEN]; /* 1.2 */ extern volatile struct timeval mono_time; extern struct timeval boottime; extern struct timeval runtime; extern struct timeval time; /* nonvolatile at ipl >= splclock() */ extern struct timezone tz; /* XXX */ extern int tick; /* usec per tick (1000000 / hz) */ extern int tickadj; /* "standard" clock skew, us./tick */ extern int hz; /* system clock's frequency */ extern int psratio; /* ratio: prof / stat */ extern int stathz; /* statistics clock's frequency */ extern int profhz; /* profiling clock's frequency */ extern int ticks; extern int lbolt; /* once a second sleep address */ extern int tickdelta; extern long timedelta; #endif /* KERNEL */ /* * The following macros are used to declare global sets of objects, which * are collected by the linker into a `struct linker_set' as defined below. * For ELF, this is done by constructing a separate segment for each set. * For a.out, it is done automatically by the linker. */ #if defined(__ELF__) #define MAKE_SET(set, sym) \ __asm__(".section .set." #set ",\"aw\""); \ __asm__(".long " #sym); \ __asm__(".previous") #define TEXT_SET(set, sym) MAKE_SET(set, sym) #define DATA_SET(set, sym) MAKE_SET(set, sym) #define BSS_SET(set, sym) MAKE_SET(set, sym) #define ABS_SET(set, sym) MAKE_SET(set, sym) #else /* * NB: the constants defined below must match those defined in * ld/ld.h. Since their calculation requires arithmetic, we * can't name them symbolically (e.g., 23 is N_SETT | N_EXT). */ #define MAKE_SET(set, sym, type) \ static void const * const __set_##set##_sym_##sym = &sym; \ asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym) #define TEXT_SET(set, sym) MAKE_SET(set, sym, 23) #define DATA_SET(set, sym) MAKE_SET(set, sym, 25) #define BSS_SET(set, sym) MAKE_SET(set, sym, 27) #define ABS_SET(set, sym) MAKE_SET(set, sym, 21) #endif /* * Enumerated types for known system startup interfaces. * * Startup occurs in ascending numeric order; the list entries are * sorted prior to attempting startup to guarantee order. Items * of the same level are arbitrated for order based on the 'order' * element. * * These numbers are arbitrary and are chosen ONLY for ordering; the * enumeration values are explicit rather than implicit to provide * for binary compatibility with inserted elements. * * The SI_SUB_RUN_SCHEDULER value must have the highest lexical value. * * The SI_SUB_CONSOLE and SI_SUB_SWAP values represent values used by * the BSD 4.4Lite but not by FreeBSD; they are maintained in dependent * order to support porting. * * The SI_SUB_PROTO_BEGIN and SI_SUB_PROTO_END bracket a range of * initializations to take place at splimp(). This is a historical * wart that should be removed -- probably running everything at * splimp() until the first init that doesn't want it is the correct * fix. They are currently present to ensure historical behavior. */ enum sysinit_sub_id { SI_SUB_DUMMY = 0x00000000, /* not executed; for linker*/ SI_SUB_CONSOLE = 0x08000000, /* console*/ SI_SUB_COPYRIGHT = 0x08000001, /* first use of console*/ SI_SUB_VM = 0x10000000, /* virtual memory system init*/ SI_SUB_KMEM = 0x18000000, /* kernel memory*/ SI_SUB_CPU = 0x20000000, /* CPU resource(s)*/ SI_SUB_DEVFS = 0x22000000, /* get DEVFS ready */ SI_SUB_DRIVERS = 0x23000000, /* Let Drivers initialize */ SI_SUB_CONFIGURE = 0x24000000, /* Configure devices */ SI_SUB_INTRINSIC = 0x28000000, /* proc 0*/ SI_SUB_RUN_QUEUE = 0x30000000, /* the run queue*/ SI_SUB_VM_CONF = 0x38000000, /* config VM, set limits*/ SI_SUB_VFS = 0x40000000, /* virtual file system*/ SI_SUB_CLOCKS = 0x48000000, /* real time and stat clocks*/ SI_SUB_MBUF = 0x50000000, /* mbufs*/ SI_SUB_CLIST = 0x58000000, /* clists*/ SI_SUB_SYSV_SHM = 0x64000000, /* System V shared memory*/ SI_SUB_SYSV_SEM = 0x68000000, /* System V semaphores*/ SI_SUB_SYSV_MSG = 0x6C000000, /* System V message queues*/ + SI_SUB_P1003_1B = 0x6E000000, /* P1003.1B realtime */ SI_SUB_PSEUDO = 0x70000000, /* pseudo devices*/ SI_SUB_PROTO_BEGIN = 0x80000000, /* XXX: set splimp (kludge)*/ SI_SUB_PROTO_IF = 0x84000000, /* interfaces*/ SI_SUB_PROTO_DOMAIN = 0x88000000, /* domains (address families?)*/ SI_SUB_PROTO_END = 0x8fffffff, /* XXX: set splx (kludge)*/ SI_SUB_KPROF = 0x90000000, /* kernel profiling*/ SI_SUB_KICK_SCHEDULER = 0xa0000000, /* start the timeout events*/ SI_SUB_INT_CONFIG_HOOKS = 0xa8000000, /* Interrupts enabled config */ SI_SUB_ROOT_CONF = 0xb0000000, /* Find root devices */ SI_SUB_DUMP_CONF = 0xb2000000, /* Find dump devices */ SI_SUB_MOUNT_ROOT = 0xb4000000, /* root mount*/ SI_SUB_ROOT_FDTAB = 0xb8000000, /* root vnode in fd table...*/ SI_SUB_SWAP = 0xc0000000, /* swap*/ SI_SUB_INTRINSIC_POST = 0xd0000000, /* proc 0 cleanup*/ SI_SUB_KTHREAD_INIT = 0xe0000000, /* init process*/ SI_SUB_KTHREAD_PAGE = 0xe4000000, /* pageout daemon*/ SI_SUB_KTHREAD_VM = 0xe8000000, /* vm daemon*/ SI_SUB_KTHREAD_UPDATE = 0xec000000, /* update daemon*/ SI_SUB_KTHREAD_IDLE = 0xee000000, /* idle procs*/ SI_SUB_SMP = 0xf0000000, /* idle procs*/ SI_SUB_RUN_SCHEDULER = 0xffffffff /* scheduler: no return*/ }; /* * Some enumerated orders; "ANY" sorts last. */ enum sysinit_elem_order { SI_ORDER_FIRST = 0x00000000, /* first*/ SI_ORDER_SECOND = 0x00000001, /* second*/ SI_ORDER_THIRD = 0x00000002, /* third*/ SI_ORDER_MIDDLE = 0x10000000, /* somewhere in the middle */ SI_ORDER_ANY = 0xffffffff /* last*/ }; /* * System initialization call types; currently two are supported... one * to do a simple function call and one to cause a process to be started * by the kernel on the callers behalf. */ typedef enum sysinit_elem_type { SI_TYPE_DEFAULT = 0x00000000, /* No special processing*/ SI_TYPE_KTHREAD = 0x00000001, /* start kernel thread*/ SI_TYPE_KPROCESS = 0x00000002 /* start kernel process*/ } si_elem_t; /* * A system initialization call instance * * The subsystem */ struct sysinit { unsigned int subsystem; /* subsystem identifier*/ unsigned int order; /* init order within subsystem*/ void (*func) __P((void *)); /* init function*/ void *udata; /* multiplexer/argument */ si_elem_t type; /* sysinit_elem_type*/ }; /* * Default: no special processing */ #define SYSINIT(uniquifier, subsystem, order, func, ident) \ static struct sysinit uniquifier ## _sys_init = { \ subsystem, \ order, \ func, \ ident, \ SI_TYPE_DEFAULT \ }; \ DATA_SET(sysinit_set,uniquifier ## _sys_init); /* * Call 'fork()' before calling '(*func)(ident)'; * for making a kernel 'thread' (or builtin process.) */ #define SYSINIT_KT(uniquifier, subsystem, order, func, ident) \ static struct sysinit uniquifier ## _sys_init = { \ subsystem, \ order, \ func, \ ident, \ SI_TYPE_KTHREAD \ }; \ DATA_SET(sysinit_set,uniquifier ## _sys_init); #define SYSINIT_KP(uniquifier, subsystem, order, func, ident) \ static struct sysinit uniquifier ## _sys_init = { \ subsystem, \ order, \ func, \ ident, \ SI_TYPE_KPROCESS \ }; \ DATA_SET(sysinit_set,uniquifier ## _sys_init); /* * A kernel process descriptor; used to start "internal" daemons * * Note: global_procpp may be NULL for no global save area */ struct kproc_desc { char *arg0; /* arg 0 (for 'ps' listing)*/ void (*func) __P((void)); /* "main" for kernel process*/ struct proc **global_procpp; /* ptr to proc ptr save area*/ }; void kproc_start __P((void *udata)); #ifdef PSEUDO_LKM #include #include #include #include #define PSEUDO_SET(init, name) \ extern struct linker_set MODVNOPS; \ MOD_MISC(name); \ static int \ name ## _load(struct lkm_table *lkmtp, int cmd) \ { init((void *)NULL /* XXX unused (?) */); return 0; } \ static int \ name ## _unload(struct lkm_table *lkmtp, int cmd) \ { return EINVAL; } \ int \ name ## _mod(struct lkm_table *lkmtp, int cmd, int ver) { \ MOD_DISPATCH(name, lkmtp, cmd, ver, name ## _load, name ## _unload, \ lkm_nullcmd); } \ struct __hack #else /* PSEUDO_LKM */ /* * Compatibility. To be deprecated after LKM is updated. */ #define PSEUDO_SET(sym, name) SYSINIT(ps, SI_SUB_PSEUDO, SI_ORDER_ANY, sym, 0) #endif /* PSEUDO_LKM */ struct linker_set { int ls_length; const void *ls_items[1]; /* really ls_length of them, * trailing NULL */ }; extern struct linker_set execsw_set; #endif /* !_SYS_KERNEL_H_*/ diff --git a/sys/sys/mman.h b/sys/sys/mman.h index 764ef357b96b..1ef56690ac7b 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -1,144 +1,144 @@ /*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)mman.h 8.2 (Berkeley) 1/9/95 - * $Id: mman.h,v 1.21 1998/03/04 10:26:35 dufault Exp $ + * $Id: mman.h,v 1.22 1998/03/08 17:25:33 dufault Exp $ */ #ifndef _SYS_MMAN_H_ #define _SYS_MMAN_H_ #include /* * Protections are chosen from these bits, or-ed together */ #define PROT_NONE 0x00 /* no permissions */ #define PROT_READ 0x01 /* pages can be read */ #define PROT_WRITE 0x02 /* pages can be written */ #define PROT_EXEC 0x04 /* pages can be executed */ /* * Flags contain sharing type and options. * Sharing types; choose one. */ #define MAP_SHARED 0x0001 /* share changes */ #define MAP_PRIVATE 0x0002 /* changes are private */ #define MAP_COPY MAP_PRIVATE /* Obsolete */ /* * Other flags */ #define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ #define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ #define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ #define MAP_INHERIT 0x0080 /* region is retained after exec */ #define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ -#ifdef _POSIX4_VISIBLE +#ifdef _P1003_1B_VISIBLE /* * Process memory locking */ #define MCL_CURRENT 0x0001 /* Lock only current memory */ #define MCL_FUTURE 0x0002 /* Lock all future memory as well */ -#endif /* _POSIX4_VISIBLE */ +#endif /* _P1003_1B_VISIBLE */ /* * Error return from mmap() */ #define MAP_FAILED ((void *)-1) /* * msync() flags */ #define MS_SYNC 0x0000 /* msync synchronously */ #define MS_ASYNC 0x0001 /* return immediately */ #define MS_INVALIDATE 0x0002 /* invalidate all cached data */ /* * Mapping type */ #define MAP_FILE 0x0000 /* map from file (default) */ #define MAP_ANON 0x1000 /* allocated from memory, swap space */ /* * Advice to madvise */ #define MADV_NORMAL 0 /* no further special treatment */ #define MADV_RANDOM 1 /* expect random page references */ #define MADV_SEQUENTIAL 2 /* expect sequential page references */ #define MADV_WILLNEED 3 /* will need these pages */ #define MADV_DONTNEED 4 /* dont need these pages */ #define MADV_FREE 5 /* dont need these pages, and junk contents */ /* * Return bits from mincore */ #define MINCORE_INCORE 0x1 /* Page is incore */ #define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */ #define MINCORE_MODIFIED 0x4 /* Page has been modified by us */ #define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ #define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ #ifndef KERNEL #include __BEGIN_DECLS -#ifdef _POSIX4_VISIBLE +#ifdef _P1003_1B_VISIBLE int mlockall __P((int)); int munlockall __P((void)); int shm_open __P((const char *, int, mode_t)); int shm_unlink __P((const char *)); -#endif /* _POSIX4_VISIBLE */ +#endif /* _P1003_1B_VISIBLE */ int mlock __P((const void *, size_t)); #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void * mmap __P((void *, size_t, int, int, int, off_t)); #endif int mprotect __P((const void *, size_t, int)); int msync __P((void *, size_t, int)); int munlock __P((const void *, size_t)); int munmap __P((void *, size_t)); #ifndef _POSIX_SOURCE int madvise __P((void *, size_t, int)); int mincore __P((const void *, size_t, char *)); int minherit __P((void *, size_t, int)); #endif __END_DECLS #endif /* !KERNEL */ #endif diff --git a/sys/sys/posix4.h b/sys/sys/posix4.h index 99ba8822a2b0..dd3418cb8f89 100644 --- a/sys/sys/posix4.h +++ b/sys/sys/posix4.h @@ -1,292 +1,118 @@ -#ifndef _POSIX4_POSIX4_H_ -#define _POSIX4_POSIX4_H_ +#ifndef _P1003_1B_P1003_1B_H_ +#define _P1003_1B_P1003_1B_H_ /*- * Copyright (c) 1996, 1997, 1998 * 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 * 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. * */ -#include +#include "opt_posix.h" -#ifdef _POSIX4_VISIBLE +#ifdef P1003_1B #include #include -#include +#include +#include -/* - * - * March 1, 1998: Details from here on change and this header file - * is volatile. - * - * Locally I've got PRIORITY SCHEDULING - * set as a system call available only to root - * and I'm still using a pseudo device to gate everything else. - * - * This interface vectors us into the kernel through a - * POSIX4 pseudo device with some user privilege authorization along - * the way. - * - * XXX I'm going with option 3. - * - * This has drawbacks from the point of view of ktrace. There - * are (at least) three ways to do this: - * - * 1. As it is being done, which is bad for ktrace and is hokey - * but is easy to extend during development; - * 2. Add a system call for every POSIX4 entry point, which - * will result in many more system calls (on the order of 64) - * 3. Add a system call for each POSIX4 option, which is a bit more - * useful for ktrace and will add only about 14 new system calls. - * +/* Generate syscall stubs for when something is optionally + * LKM'd. References "syscall_not_present". + * XXX Good candidate for sys/syscall.h */ +struct proc; +struct nosys_args; +extern int syscall_not_present(struct proc *, const char *, struct nosys_args *); -#define POSIX4_FACILITIES 16 -#define POSIX4_ONE_ONLY +#define SYSCALL_NOT_PRESENT_GEN(SC) \ +int SC (struct proc *p, struct SC##_args *uap) \ +{ \ + return syscall_not_present(p, #SC , (struct nosys_args *)uap); \ +} -/* - * All facility request structures have a posix4_dispatch header - * at the front. Return values are always an indication of - * success or failure and are automatically converted into an errno - * by the kernel. "Non-errno" return codes are handled via ret. - */ -struct posix4_dispatch { - int op; - int ret; -}; -#if defined(_POSIX_PRIORITY_SCHEDULING) +MALLOC_DECLARE(M_P31B); + +#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK) +#define p31b_free(P) free((P), M_P31B) + +int p31b_proc __P((struct proc *, pid_t, struct proc **)); + +void p31b_setcfg __P((int, int)); + +#ifdef _KPOSIX_PRIORITY_SCHEDULING /* * KSCHED_OP_RW is a vector of read/write flags for each entry indexed * by the enum ksched_op. * * 1 means you need write access, 0 means read is sufficient. */ enum ksched_op { #define KSCHED_OP_RW { 1, 0, 1, 0, 0, 0, 0, 0 } SCHED_SETPARAM, SCHED_GETPARAM, SCHED_SETSCHEDULER, SCHED_GETSCHEDULER, SCHED_YIELD, SCHED_GET_PRIORITY_MAX, SCHED_GET_PRIORITY_MIN, SCHED_RR_GET_INTERVAL, SCHED_OP_MAX }; -struct ksched -{ - struct posix4_dispatch dispatch; - pid_t pid; - int policy; - struct sched_param param; - struct timespec interval; -}; - -#endif /* _POSIX_PRIORITY_SCHEDULING */ - -#if defined(_POSIX_MEMLOCK) ^ defined(_POSIX_MEMLOCK_RANGE) -/* This implementation expects these two options to always be together. - * If one isn't handled it should be disabled at - * run time. - */ -#error _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE should always be together -#endif - -#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE) - -enum kmemlock_op { - -#define KMEMLOCK_OP_RW { 1, 1, 1, 1 } - - MEMLOCK_MLOCKALL, - MEMLOCK_MUNLOCKALL, - MEMLOCK_MLOCK, - MEMLOCK_MUNLOCK, - MEMLOCK_OP_MAX -}; - -struct kmemlock -{ - struct posix4_dispatch dispatch; - int flags; - void *addr; - size_t len; -}; - -#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */ - -#if defined(KERNEL) - -struct proc; - -void *posix4malloc __P((int *, size_t)); -void posix4free __P((int *, void *)); -int posix4proc __P((struct proc *, pid_t, struct proc **)); -int posix4ioctl __P((dev_t, int, caddr_t, int, struct proc *)); -void posix4attach __P((int)); -void posix4_facility __P((int, int)); - -struct lkm_table; -int posix4_init __P((struct lkm_table *, int , int )); +struct ksched; -#ifdef _POSIX_PRIORITY_SCHEDULING +int ksched_attach(struct ksched **); +int ksched_detach(struct ksched *); -int ksched_attach(int, int, void **); -int ksched_detach(void *); - -int ksched_setparam(int *, void *, +int ksched_setparam(int *, struct ksched *, struct proc *, const struct sched_param *); -int ksched_getparam(int *, void *, +int ksched_getparam(int *, struct ksched *, struct proc *, struct sched_param *); -int ksched_setscheduler(int *, void *, +int ksched_setscheduler(int *, struct ksched *, struct proc *, int, const struct sched_param *); -int ksched_getscheduler(int *, void *, struct proc *); - -int ksched_yield(int *, void *); - -int ksched_get_priority_max(int *, void *, int); -int ksched_get_priority_min(int *, void *, int); - -int ksched_rr_get_interval(int *, void *, struct proc *, struct timespec *); - -#endif /* _POSIX_PRIORITY_SCHEDULING */ - -#if defined(_POSIX_MEMLOCK) && defined(_POSIX_MEMLOCK_RANGE) +int ksched_getscheduler(int *, struct ksched *, struct proc *); -int kmemlock_attach(int, int, void **); -int kmemlock_detach(void *); -int kmlockall(int *, void *, int); -int kmunlockall(int *, void *); -int kmlock(int *, void *, const void *, size_t); -int kmunlock(int *, void *, const void *, size_t ); +int ksched_yield(int *, struct ksched *); -#endif /* _POSIX_MEMLOCK && _POSIX_MEMLOCK_RANGE */ +int ksched_get_priority_max(int *, struct ksched *, int); +int ksched_get_priority_min(int *, struct ksched *, int); -#endif /* KERNEL */ +int ksched_rr_get_interval(int *, struct ksched *, struct proc *, struct timespec *); -/* A facility is an implementation of one of the optional portions of - * POSIX4 as selected by the feature test macros, such as the fixed - * priority scheduler or the realtime signals. - */ - -/* Each facility has a facility code, an opcode, and r-w attributes. - * To exercise the operation associated with an opcode you need the - * appropriate privileges on the POSIX4 device with the facility - * bit set in the minor number. This means that every facility has - * a protection bit: Probably more than we need, but it may have - * advantages. - * - */ - -#define posix4encode(FACILITY, RW) (FACILITY) -#define posix4decode(X, FACILITY_P) \ - do { \ - *(FACILITY_P) = ((X) & 0xff); \ - } while (0) - -/* - * The dispatch codes: - */ -#define IO_POSIX4_PRIORITY_SCHEDULING _IOWR('r', \ - CTL_POSIX4_PRIORITY_SCHEDULING, struct ksched) +#endif /* _KPOSIX_PRIORITY_SCHEDULING */ -#define IO_POSIX4_MEMLOCK _IOWR('r', \ - CTL_POSIX4_MEMLOCK, struct ksched) - -/* - * CTL_POSIX4 definitions for syscfg - */ - -#define CTL_POSIX4_ASYNCHRONOUS_IO 1 /* boolean */ -#define CTL_POSIX4_MAPPED_FILES 2 /* boolean */ -#define CTL_POSIX4_MEMLOCK 3 /* boolean */ -#define CTL_POSIX4_MEMLOCK_RANGE 4 /* boolean */ -#define CTL_POSIX4_MEMORY_PROTECTION 5 /* boolean */ -#define CTL_POSIX4_MESSAGE_PASSING 6 /* boolean */ -#define CTL_POSIX4_PRIORITIZED_IO 7 /* boolean */ -#define CTL_POSIX4_PRIORITY_SCHEDULING 8 /* boolean */ -#define CTL_POSIX4_REALTIME_SIGNALS 9 /* boolean */ -#define CTL_POSIX4_SEMAPHORES 10 /* boolean */ -#define CTL_POSIX4_FSYNC 11 /* boolean */ -#define CTL_POSIX4_SHARED_MEMORY_OBJECTS 12 /* boolean */ -#define CTL_POSIX4_SYNCHRONIZED_IO 13 /* boolean */ -#define CTL_POSIX4_TIMERS 14 /* boolean */ -#define CTL_POSIX4_AIO_LISTIO_MAX 15 /* int */ -#define CTL_POSIX4_AIO_MAX 16 /* int */ -#define CTL_POSIX4_AIO_PRIO_DELTA_MAX 17 /* int */ -#define CTL_POSIX4_DELAYTIMER_MAX 18 /* int */ -#define CTL_POSIX4_MQ_OPEN_MAX 19 /* int */ -#define CTL_POSIX4_PAGESIZE 20 /* int */ -#define CTL_POSIX4_RTSIG_MAX 21 /* int */ -#define CTL_POSIX4_SEM_NSEMS_MAX 22 /* int */ -#define CTL_POSIX4_SEM_VALUE_MAX 23 /* int */ -#define CTL_POSIX4_SIGQUEUE_MAX 24 /* int */ -#define CTL_POSIX4_TIMER_MAX 25 /* int */ - -#define CTL_POSIX4_N_CTLS 25 - -#define CTL_POSIX4_NAMES { \ - { 0, 0 }, \ - { "asynchronous_io", CTLTYPE_INT }, \ - { "mapped_files", CTLTYPE_INT }, \ - { "memlock", CTLTYPE_INT }, \ - { "memlock_range", CTLTYPE_INT }, \ - { "memory_protection", CTLTYPE_INT }, \ - { "message_passing", CTLTYPE_INT }, \ - { "prioritized_io", CTLTYPE_INT }, \ - { "priority_scheduling", CTLTYPE_INT }, \ - { "realtime_signals", CTLTYPE_INT }, \ - { "semaphores", CTLTYPE_INT }, \ - { "fsync", CTLTYPE_INT }, \ - { "shared_memory_objects", CTLTYPE_INT }, \ - { "synchronized_io", CTLTYPE_INT }, \ - { "timers", CTLTYPE_INT }, \ - { "aio_listio_max", CTLTYPE_INT }, \ - { "aio_max", CTLTYPE_INT }, \ - { "aio_prio_delta_max", CTLTYPE_INT }, \ - { "delaytimer_max", CTLTYPE_INT }, \ - { "mq_open_max", CTLTYPE_INT }, \ - { "pagesize", CTLTYPE_INT }, \ - { "rtsig_max", CTLTYPE_INT }, \ - { "nsems_max", CTLTYPE_INT }, \ - { "sem_value_max", CTLTYPE_INT }, \ - { "sigqueue_max", CTLTYPE_INT }, \ - { "timer_max", CTLTYPE_INT }, \ -} -#endif /* _POSIX4_VISIBLE */ -#endif /* _POSIX4_POSIX4_H_ */ +#endif /* P1003_1B */ +#endif /* _P1003_1B_P1003_1B_H_ */ diff --git a/sys/sys/rtprio.h b/sys/sys/rtprio.h index c4a031ce999b..6f196ab1c0be 100644 --- a/sys/sys/rtprio.h +++ b/sys/sys/rtprio.h @@ -1,80 +1,80 @@ /* * 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: rtprio.h,v 1.5 1998/03/04 10:26:39 dufault Exp $ + * $Id: rtprio.h,v 1.6 1998/03/08 17:25:35 dufault Exp $ */ #ifndef _SYS_RTPRIO_H_ #define _SYS_RTPRIO_H_ /* * Process realtime-priority specifications to rtprio. */ /* priority types */ #define RTP_PRIO_REALTIME 0 #define RTP_PRIO_NORMAL 1 #define RTP_PRIO_IDLE 2 -/* RTP_PRIO_FIFO is POSIX.4 SCHED_FIFO. +/* RTP_PRIO_FIFO is POSIX.1B SCHED_FIFO. */ #define RTP_PRIO_FIFO_BIT 4 #define RTP_PRIO_FIFO (RTP_PRIO_REALTIME | RTP_PRIO_FIFO_BIT) #define RTP_PRIO_BASE(P) ((P) & ~RTP_PRIO_FIFO_BIT) #define RTP_PRIO_IS_REALTIME(P) (RTP_PRIO_BASE(P) == RTP_PRIO_REALTIME) #define RTP_PRIO_NEED_RR(P) ((P) != RTP_PRIO_FIFO) /* priority range */ #define RTP_PRIO_MIN 0 /* Highest priority */ #define RTP_PRIO_MAX 31 /* Lowest priority */ /* * rtprio() syscall functions */ #define RTP_LOOKUP 0 #define RTP_SET 1 #ifndef LOCORE struct rtprio { u_short type; u_short prio; }; #endif #ifndef KERNEL #include __BEGIN_DECLS int rtprio __P((int, pid_t, struct rtprio *)); __END_DECLS #endif /* !KERNEL */ #endif /* !_SYS_RTPRIO_H_ */ diff --git a/sys/sys/semaphore.h b/sys/sys/semaphore.h index 02cde3ee7821..f57a96f7e3f4 100644 --- a/sys/sys/semaphore.h +++ b/sys/sys/semaphore.h @@ -1,63 +1,65 @@ #ifndef _SEMAPHORE_H_ #define _SEMAPHORE_H_ -/* semaphore.h: POSIX.4 semaphores */ +/* semaphore.h: POSIX 1003.1b semaphores */ /*- * 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 * 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. * */ -#ifdef _POSIX4_INCLUDE_MAYBES +#include + +#ifdef _P1003_1B_INCLUDE_MAYBES #include #include #endif typedef int sem_t; #ifndef KERNEL #include __BEGIN_DECLS int sem_init __P((sem_t *, int, unsigned int)); int sem_destroy __P((sem_t *)); sem_t sem_open __P((const char *, int, ...)); int sem_close __P((sem_t *)); int sem_unlink __P((const char *)); int sem_wait __P((sem_t *)); int sem_trywait __P((sem_t *)); int sem_post __P((sem_t *)); int sem_getvalue __P((sem_t *, int *)); __END_DECLS #endif /* KERNEL */ #endif /* _SEMAPHORE_H_ */ diff --git a/sys/sys/signal.h b/sys/sys/signal.h index ee3cabb4cae4..c02f9d8f58be 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -1,209 +1,236 @@ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)signal.h 8.4 (Berkeley) 5/4/95 - * $Id: signal.h,v 1.11 1997/02/22 09:45:53 peter Exp $ + * $Id: signal.h,v 1.12 1997/09/13 19:42:29 joerg Exp $ */ #ifndef _SYS_SIGNAL_H_ #define _SYS_SIGNAL_H_ #include +#include #include /* sig_atomic_t; trap codes; sigcontext */ #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ #endif #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #ifndef _POSIX_SOURCE #define SIGTRAP 5 /* trace trap (not reset when caught) */ #endif #define SIGABRT 6 /* abort() */ #ifndef _POSIX_SOURCE #define SIGIOT SIGABRT /* compatibility */ #define SIGEMT 7 /* EMT instruction */ #endif #define SIGFPE 8 /* floating point exception */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #ifndef _POSIX_SOURCE #define SIGBUS 10 /* bus error */ #endif #define SIGSEGV 11 /* segmentation violation */ #ifndef _POSIX_SOURCE #define SIGSYS 12 /* non-existent system call invoked */ #endif #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #ifndef _POSIX_SOURCE #define SIGURG 16 /* urgent condition on IO channel */ #endif #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ #ifndef _POSIX_SOURCE #define SIGIO 23 /* input/output possible signal */ #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ #define SIGWINCH 28 /* window size changes */ #define SIGINFO 29 /* information request */ #endif #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ /*- * Type of a signal handling function. * * Language spec sez signal handlers take exactly one arg, even though we * actually supply three. Ugh! * * We don't try to hide the difference by leaving out the args because * that would cause warnings about conformant programs. Nonconformant * programs can avoid the warnings by casting to (__sighandler_t *) or * sig_t before calling signal() or assigning to sa_handler or sv_handler. * * The kernel should reverse the cast before calling the function. It * has no way to do this, but on most machines 1-arg and 3-arg functions * have the same calling protocol so there is no problem in practice. * A bit in sa_flags could be used to specify the number of args. */ typedef void __sighandler_t __P((int)); #define SIG_DFL ((__sighandler_t *)0) #define SIG_IGN ((__sighandler_t *)1) #define SIG_ERR ((__sighandler_t *)-1) #ifndef _ANSI_SOURCE typedef unsigned int sigset_t; /* * Signal vector "template" used in sigaction call. */ struct sigaction { __sighandler_t *sa_handler; /* signal handler */ sigset_t sa_mask; /* signal mask to apply */ int sa_flags; /* see signal options below */ }; #ifndef _POSIX_SOURCE #define SA_ONSTACK 0x0001 /* take signal on signal stack */ #define SA_RESTART 0x0002 /* restart system call on signal return */ #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */ #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */ #define SA_NOCLDWAIT 0x0020 /* don't keep zombies around */ #ifdef COMPAT_SUNOS #define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */ #endif #endif /* _POSIX_SOURCE */ #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ /* * Flags for sigprocmask: */ #define SIG_BLOCK 1 /* block specified signal set */ #define SIG_UNBLOCK 2 /* unblock specified signal set */ #define SIG_SETMASK 3 /* set specified signal set */ #ifndef _POSIX_SOURCE typedef __sighandler_t *sig_t; /* type of pointer to a signal function */ /* * Structure used in sigaltstack call. */ struct sigaltstack { char *ss_sp; /* signal stack base */ int ss_size; /* signal stack length */ int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */ }; #define SS_ONSTACK 0x0001 /* take signal on alternate stack */ #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */ #define MINSIGSTKSZ 8192 /* minimum allowable stack */ #define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */ /* * 4.3 compatibility: * Signal vector "template" used in sigvec call. */ struct sigvec { __sighandler_t *sv_handler; /* signal handler */ int sv_mask; /* signal mask to apply */ int sv_flags; /* see signal options below */ }; #define SV_ONSTACK SA_ONSTACK #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ #define SV_RESETHAND SA_RESETHAND #define SV_NODEFER SA_NODEFER #define SV_NOCLDSTOP SA_NOCLDSTOP #define sv_onstack sv_flags /* isn't compatibility wonderful! */ /* * Structure used in sigstack call. */ struct sigstack { char *ss_sp; /* signal stack pointer */ int ss_onstack; /* current status */ }; /* * Macro for converting signal number to a mask suitable for * sigblock(). */ #define sigmask(m) (1 << ((m)-1)) #define BADSIG SIG_ERR #endif /* !_POSIX_SOURCE */ #endif /* !_ANSI_SOURCE */ +#ifdef _P1003_1B_VISIBLE_HISTORICALLY + +/* sys/aio.h unconditionally defined these */ + +union sigval { + int sival_int; /* Integer signal value */ + void *sival_ptr; /* Pointer signal value */ +}; + +typedef struct siginfo { + int si_signo; /* Signal number */ + int si_code; /* Cause of the signal */ + union sigval si_value; /* Signal value */ +} siginfo_t; + +struct sigevent { + int sigev_notify; /* Notification type */ + int sigev_signo; /* Signal number */ + union sigval sigev_value; /* Signal value */ +}; + +#define SIGEV_NONE 0 /* No async notification */ +#define SIGEV_SIGNAL 1 /* Generate a queued signal */ + +#endif + /* * For historical reasons; programs expect signal's return value to be * defined by . */ __BEGIN_DECLS __sighandler_t *signal __P((int, __sighandler_t *)); __END_DECLS #endif /* !_SYS_SIGNAL_H_ */ diff --git a/sys/sys/syscall-hide.h b/sys/sys/syscall-hide.h index b79c0a86290e..4f9a7abc429f 100644 --- a/sys/sys/syscall-hide.h +++ b/sys/sys/syscall-hide.h @@ -1,233 +1,241 @@ /* * System call hiders. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp */ HIDE_POSIX(fork) HIDE_POSIX(read) HIDE_POSIX(write) HIDE_POSIX(open) HIDE_POSIX(close) HIDE_BSD(wait4) HIDE_BSD(creat) HIDE_POSIX(link) HIDE_POSIX(unlink) HIDE_POSIX(chdir) HIDE_BSD(fchdir) HIDE_POSIX(mknod) HIDE_POSIX(chmod) HIDE_POSIX(chown) HIDE_BSD(obreak) HIDE_BSD(getfsstat) HIDE_POSIX(lseek) HIDE_POSIX(getpid) HIDE_BSD(mount) HIDE_BSD(unmount) HIDE_POSIX(setuid) HIDE_POSIX(getuid) HIDE_POSIX(geteuid) HIDE_BSD(ptrace) HIDE_BSD(recvmsg) HIDE_BSD(sendmsg) HIDE_BSD(recvfrom) HIDE_BSD(accept) HIDE_BSD(getpeername) HIDE_BSD(getsockname) HIDE_POSIX(access) HIDE_BSD(chflags) HIDE_BSD(fchflags) HIDE_BSD(sync) HIDE_POSIX(kill) HIDE_POSIX(stat) HIDE_POSIX(getppid) HIDE_POSIX(lstat) HIDE_POSIX(dup) HIDE_POSIX(pipe) HIDE_POSIX(getegid) HIDE_BSD(profil) HIDE_BSD(ktrace) HIDE_POSIX(sigaction) HIDE_POSIX(getgid) HIDE_POSIX(sigprocmask) HIDE_BSD(getlogin) HIDE_BSD(setlogin) HIDE_BSD(acct) HIDE_POSIX(sigpending) HIDE_BSD(sigaltstack) HIDE_POSIX(ioctl) HIDE_BSD(reboot) HIDE_POSIX(revoke) HIDE_POSIX(symlink) HIDE_POSIX(readlink) HIDE_POSIX(execve) HIDE_POSIX(umask) HIDE_BSD(chroot) HIDE_POSIX(fstat) HIDE_BSD(getkerninfo) HIDE_BSD(getpagesize) HIDE_BSD(msync) HIDE_BSD(vfork) HIDE_BSD(sbrk) HIDE_BSD(sstk) HIDE_BSD(mmap) HIDE_BSD(ovadvise) HIDE_BSD(munmap) HIDE_BSD(mprotect) HIDE_BSD(madvise) HIDE_BSD(mincore) HIDE_POSIX(getgroups) HIDE_POSIX(setgroups) HIDE_POSIX(getpgrp) HIDE_POSIX(setpgid) HIDE_BSD(setitimer) HIDE_BSD(wait) HIDE_BSD(swapon) HIDE_BSD(getitimer) HIDE_BSD(gethostname) HIDE_BSD(sethostname) HIDE_BSD(getdtablesize) HIDE_POSIX(dup2) HIDE_BSD(getdopt) HIDE_POSIX(fcntl) HIDE_BSD(select) HIDE_BSD(setdopt) HIDE_POSIX(fsync) HIDE_BSD(setpriority) HIDE_BSD(socket) HIDE_BSD(connect) HIDE_BSD(accept) HIDE_BSD(getpriority) HIDE_BSD(send) HIDE_BSD(recv) HIDE_BSD(sigreturn) HIDE_BSD(bind) HIDE_BSD(setsockopt) HIDE_BSD(listen) HIDE_BSD(sigvec) HIDE_BSD(sigblock) HIDE_BSD(sigsetmask) HIDE_POSIX(sigsuspend) HIDE_BSD(sigstack) HIDE_BSD(recvmsg) HIDE_BSD(sendmsg) HIDE_BSD(gettimeofday) HIDE_BSD(getrusage) HIDE_BSD(getsockopt) HIDE_BSD(readv) HIDE_BSD(writev) HIDE_BSD(settimeofday) HIDE_BSD(fchown) HIDE_BSD(fchmod) HIDE_BSD(recvfrom) HIDE_BSD(setreuid) HIDE_BSD(setregid) HIDE_POSIX(rename) HIDE_BSD(truncate) HIDE_BSD(ftruncate) HIDE_BSD(flock) HIDE_POSIX(mkfifo) HIDE_BSD(sendto) HIDE_BSD(shutdown) HIDE_BSD(socketpair) HIDE_POSIX(mkdir) HIDE_POSIX(rmdir) HIDE_BSD(utimes) HIDE_BSD(adjtime) HIDE_BSD(getpeername) HIDE_BSD(gethostid) HIDE_BSD(sethostid) HIDE_BSD(getrlimit) HIDE_BSD(setrlimit) HIDE_BSD(killpg) HIDE_POSIX(setsid) HIDE_BSD(quotactl) HIDE_BSD(quota) HIDE_BSD(getsockname) HIDE_BSD(nfssvc) HIDE_BSD(getdirentries) HIDE_BSD(statfs) HIDE_BSD(fstatfs) HIDE_BSD(getfh) HIDE_BSD(getdomainname) HIDE_BSD(setdomainname) HIDE_BSD(uname) HIDE_BSD(sysarch) HIDE_BSD(rtprio) HIDE_BSD(semsys) HIDE_BSD(msgsys) HIDE_BSD(shmsys) HIDE_BSD(ntp_adjtime) HIDE_POSIX(setgid) HIDE_BSD(setegid) HIDE_BSD(seteuid) HIDE_BSD(lfs_bmapv) HIDE_BSD(lfs_markv) HIDE_BSD(lfs_segclean) HIDE_BSD(lfs_segwait) HIDE_POSIX(stat) HIDE_POSIX(fstat) HIDE_POSIX(lstat) HIDE_POSIX(pathconf) HIDE_POSIX(fpathconf) HIDE_BSD(getrlimit) HIDE_BSD(setrlimit) HIDE_BSD(getdirentries) HIDE_BSD(mmap) HIDE_POSIX(lseek) HIDE_BSD(truncate) HIDE_BSD(ftruncate) HIDE_BSD(__sysctl) HIDE_BSD(mlock) HIDE_BSD(munlock) HIDE_BSD(utrace) HIDE_BSD(undelete) HIDE_BSD(getpgid) HIDE_BSD(poll) HIDE_BSD(__semctl) HIDE_BSD(semget) HIDE_BSD(semop) HIDE_BSD(semconfig) HIDE_BSD(msgctl) HIDE_BSD(msgget) HIDE_BSD(msgsnd) HIDE_BSD(msgrcv) HIDE_BSD(shmat) HIDE_BSD(shmctl) HIDE_BSD(shmdt) HIDE_BSD(shmget) HIDE_POSIX(clock_gettime) HIDE_POSIX(clock_settime) HIDE_POSIX(clock_getres) HIDE_POSIX(nanosleep) HIDE_BSD(minherit) HIDE_BSD(rfork) HIDE_BSD(openbsd_poll) HIDE_BSD(issetugid) HIDE_BSD(lchown) HIDE_BSD(modnext) HIDE_BSD(modstat) HIDE_BSD(modfnext) HIDE_BSD(modfind) HIDE_BSD(kldload) HIDE_BSD(kldunload) HIDE_BSD(kldfind) HIDE_BSD(kldnext) HIDE_BSD(kldstat) HIDE_BSD(kldfirstmod) HIDE_BSD(getsid) HIDE_BSD(signanosleep) HIDE_BSD(aio_return) HIDE_BSD(aio_suspend) HIDE_BSD(aio_cancel) HIDE_BSD(aio_error) HIDE_BSD(aio_read) HIDE_BSD(aio_write) HIDE_BSD(lio_listio) HIDE_BSD(yield) HIDE_BSD(thr_sleep) HIDE_BSD(thr_wakeup) HIDE_BSD(mlockall) HIDE_BSD(munlockall) HIDE_BSD(__getcwd) +HIDE_POSIX(sched_setparam) +HIDE_POSIX(sched_getparam) +HIDE_POSIX(sched_setscheduler) +HIDE_POSIX(sched_getscheduler) +HIDE_POSIX(sched_yield) +HIDE_POSIX(sched_get_priority_max) +HIDE_POSIX(sched_get_priority_min) +HIDE_POSIX(sched_rr_get_interval) diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index c9397e805c7f..ec744632c806 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -1,239 +1,247 @@ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp */ #define SYS_syscall 0 #define SYS_exit 1 #define SYS_fork 2 #define SYS_read 3 #define SYS_write 4 #define SYS_open 5 #define SYS_close 6 #define SYS_wait4 7 /* 8 is old creat */ #define SYS_link 9 #define SYS_unlink 10 /* 11 is obsolete execv */ #define SYS_chdir 12 #define SYS_fchdir 13 #define SYS_mknod 14 #define SYS_chmod 15 #define SYS_chown 16 #define SYS_break 17 #define SYS_getfsstat 18 /* 19 is old lseek */ #define SYS_getpid 20 #define SYS_mount 21 #define SYS_unmount 22 #define SYS_setuid 23 #define SYS_getuid 24 #define SYS_geteuid 25 #define SYS_ptrace 26 #define SYS_recvmsg 27 #define SYS_sendmsg 28 #define SYS_recvfrom 29 #define SYS_accept 30 #define SYS_getpeername 31 #define SYS_getsockname 32 #define SYS_access 33 #define SYS_chflags 34 #define SYS_fchflags 35 #define SYS_sync 36 #define SYS_kill 37 /* 38 is old stat */ #define SYS_getppid 39 /* 40 is old lstat */ #define SYS_dup 41 #define SYS_pipe 42 #define SYS_getegid 43 #define SYS_profil 44 #define SYS_ktrace 45 #define SYS_sigaction 46 #define SYS_getgid 47 #define SYS_sigprocmask 48 #define SYS_getlogin 49 #define SYS_setlogin 50 #define SYS_acct 51 #define SYS_sigpending 52 #define SYS_sigaltstack 53 #define SYS_ioctl 54 #define SYS_reboot 55 #define SYS_revoke 56 #define SYS_symlink 57 #define SYS_readlink 58 #define SYS_execve 59 #define SYS_umask 60 #define SYS_chroot 61 /* 62 is old fstat */ /* 63 is old getkerninfo */ /* 64 is old getpagesize */ #define SYS_msync 65 #define SYS_vfork 66 /* 67 is obsolete vread */ /* 68 is obsolete vwrite */ #define SYS_sbrk 69 #define SYS_sstk 70 /* 71 is old mmap */ #define SYS_vadvise 72 #define SYS_munmap 73 #define SYS_mprotect 74 #define SYS_madvise 75 /* 76 is obsolete vhangup */ /* 77 is obsolete vlimit */ #define SYS_mincore 78 #define SYS_getgroups 79 #define SYS_setgroups 80 #define SYS_getpgrp 81 #define SYS_setpgid 82 #define SYS_setitimer 83 /* 84 is old wait */ #define SYS_swapon 85 #define SYS_getitimer 86 /* 87 is old gethostname */ /* 88 is old sethostname */ #define SYS_getdtablesize 89 #define SYS_dup2 90 #define SYS_fcntl 92 #define SYS_select 93 #define SYS_fsync 95 #define SYS_setpriority 96 #define SYS_socket 97 #define SYS_connect 98 /* 99 is old accept */ #define SYS_getpriority 100 /* 101 is old send */ /* 102 is old recv */ #define SYS_sigreturn 103 #define SYS_bind 104 #define SYS_setsockopt 105 #define SYS_listen 106 /* 107 is obsolete vtimes */ /* 108 is old sigvec */ /* 109 is old sigblock */ /* 110 is old sigsetmask */ #define SYS_sigsuspend 111 /* 112 is old sigstack */ /* 113 is old recvmsg */ /* 114 is old sendmsg */ /* 115 is obsolete vtrace */ #define SYS_gettimeofday 116 #define SYS_getrusage 117 #define SYS_getsockopt 118 #define SYS_readv 120 #define SYS_writev 121 #define SYS_settimeofday 122 #define SYS_fchown 123 #define SYS_fchmod 124 /* 125 is old recvfrom */ #define SYS_setreuid 126 #define SYS_setregid 127 #define SYS_rename 128 /* 129 is old truncate */ /* 130 is old ftruncate */ #define SYS_flock 131 #define SYS_mkfifo 132 #define SYS_sendto 133 #define SYS_shutdown 134 #define SYS_socketpair 135 #define SYS_mkdir 136 #define SYS_rmdir 137 #define SYS_utimes 138 /* 139 is obsolete 4.2 sigreturn */ #define SYS_adjtime 140 /* 141 is old getpeername */ /* 142 is old gethostid */ /* 143 is old sethostid */ /* 144 is old getrlimit */ /* 145 is old setrlimit */ /* 146 is old killpg */ #define SYS_setsid 147 #define SYS_quotactl 148 /* 149 is old quota */ /* 150 is old getsockname */ #define SYS_nfssvc 155 /* 156 is old getdirentries */ #define SYS_statfs 157 #define SYS_fstatfs 158 #define SYS_getfh 161 #define SYS_getdomainname 162 #define SYS_setdomainname 163 #define SYS_uname 164 #define SYS_sysarch 165 #define SYS_rtprio 166 #define SYS_semsys 169 #define SYS_msgsys 170 #define SYS_shmsys 171 #define SYS_ntp_adjtime 176 #define SYS_setgid 181 #define SYS_setegid 182 #define SYS_seteuid 183 #define SYS_stat 188 #define SYS_fstat 189 #define SYS_lstat 190 #define SYS_pathconf 191 #define SYS_fpathconf 192 #define SYS_getrlimit 194 #define SYS_setrlimit 195 #define SYS_getdirentries 196 #define SYS_mmap 197 #define SYS___syscall 198 #define SYS_lseek 199 #define SYS_truncate 200 #define SYS_ftruncate 201 #define SYS___sysctl 202 #define SYS_mlock 203 #define SYS_munlock 204 #define SYS_utrace 205 #define SYS_undelete 206 #define SYS_getpgid 207 #define SYS_poll 209 #define SYS___semctl 220 #define SYS_semget 221 #define SYS_semop 222 #define SYS_semconfig 223 #define SYS_msgctl 224 #define SYS_msgget 225 #define SYS_msgsnd 226 #define SYS_msgrcv 227 #define SYS_shmat 228 #define SYS_shmctl 229 #define SYS_shmdt 230 #define SYS_shmget 231 #define SYS_clock_gettime 232 #define SYS_clock_settime 233 #define SYS_clock_getres 234 #define SYS_nanosleep 240 #define SYS_minherit 250 #define SYS_rfork 251 #define SYS_openbsd_poll 252 #define SYS_issetugid 253 #define SYS_lchown 254 #define SYS_modnext 300 #define SYS_modstat 301 #define SYS_modfnext 302 #define SYS_modfind 303 #define SYS_kldload 304 #define SYS_kldunload 305 #define SYS_kldfind 306 #define SYS_kldnext 307 #define SYS_kldstat 308 #define SYS_kldfirstmod 309 #define SYS_getsid 310 #define SYS_signanosleep 313 #define SYS_aio_return 314 #define SYS_aio_suspend 315 #define SYS_aio_cancel 316 #define SYS_aio_error 317 #define SYS_aio_read 318 #define SYS_aio_write 319 #define SYS_lio_listio 320 #define SYS_yield 321 #define SYS_thr_sleep 322 #define SYS_thr_wakeup 323 #define SYS_mlockall 324 #define SYS_munlockall 325 #define SYS___getcwd 326 -#define SYS_MAXSYSCALL 327 +#define SYS_sched_setparam 327 +#define SYS_sched_getparam 328 +#define SYS_sched_setscheduler 329 +#define SYS_sched_getscheduler 330 +#define SYS_sched_yield 331 +#define SYS_sched_get_priority_max 332 +#define SYS_sched_get_priority_min 333 +#define SYS_sched_rr_get_interval 334 +#define SYS_MAXSYSCALL 335 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index b083dd73d3bd..3a85bd9827e3 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -1,195 +1,203 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp MIASM = \ syscall.o \ exit.o \ fork.o \ read.o \ write.o \ open.o \ close.o \ wait4.o \ link.o \ unlink.o \ chdir.o \ fchdir.o \ mknod.o \ chmod.o \ chown.o \ break.o \ getfsstat.o \ getpid.o \ mount.o \ unmount.o \ setuid.o \ getuid.o \ geteuid.o \ ptrace.o \ recvmsg.o \ sendmsg.o \ recvfrom.o \ accept.o \ getpeername.o \ getsockname.o \ access.o \ chflags.o \ fchflags.o \ sync.o \ kill.o \ getppid.o \ dup.o \ pipe.o \ getegid.o \ profil.o \ ktrace.o \ sigaction.o \ getgid.o \ sigprocmask.o \ getlogin.o \ setlogin.o \ acct.o \ sigpending.o \ sigaltstack.o \ ioctl.o \ reboot.o \ revoke.o \ symlink.o \ readlink.o \ execve.o \ umask.o \ chroot.o \ msync.o \ vfork.o \ sbrk.o \ sstk.o \ vadvise.o \ munmap.o \ mprotect.o \ madvise.o \ mincore.o \ getgroups.o \ setgroups.o \ getpgrp.o \ setpgid.o \ setitimer.o \ swapon.o \ getitimer.o \ getdtablesize.o \ dup2.o \ fcntl.o \ select.o \ fsync.o \ setpriority.o \ socket.o \ connect.o \ getpriority.o \ sigreturn.o \ bind.o \ setsockopt.o \ listen.o \ sigsuspend.o \ gettimeofday.o \ getrusage.o \ getsockopt.o \ readv.o \ writev.o \ settimeofday.o \ fchown.o \ fchmod.o \ setreuid.o \ setregid.o \ rename.o \ flock.o \ mkfifo.o \ sendto.o \ shutdown.o \ socketpair.o \ mkdir.o \ rmdir.o \ utimes.o \ adjtime.o \ setsid.o \ quotactl.o \ nfssvc.o \ statfs.o \ fstatfs.o \ getfh.o \ getdomainname.o \ setdomainname.o \ uname.o \ sysarch.o \ rtprio.o \ semsys.o \ msgsys.o \ shmsys.o \ ntp_adjtime.o \ setgid.o \ setegid.o \ seteuid.o \ stat.o \ fstat.o \ lstat.o \ pathconf.o \ fpathconf.o \ getrlimit.o \ setrlimit.o \ getdirentries.o \ mmap.o \ __syscall.o \ lseek.o \ truncate.o \ ftruncate.o \ __sysctl.o \ mlock.o \ munlock.o \ utrace.o \ undelete.o \ getpgid.o \ poll.o \ __semctl.o \ semget.o \ semop.o \ semconfig.o \ msgctl.o \ msgget.o \ msgsnd.o \ msgrcv.o \ shmat.o \ shmctl.o \ shmdt.o \ shmget.o \ clock_gettime.o \ clock_settime.o \ clock_getres.o \ nanosleep.o \ minherit.o \ rfork.o \ openbsd_poll.o \ issetugid.o \ lchown.o \ modnext.o \ modstat.o \ modfnext.o \ modfind.o \ kldload.o \ kldunload.o \ kldfind.o \ kldnext.o \ kldstat.o \ kldfirstmod.o \ getsid.o \ signanosleep.o \ aio_return.o \ aio_suspend.o \ aio_cancel.o \ aio_error.o \ aio_read.o \ aio_write.o \ lio_listio.o \ yield.o \ thr_sleep.o \ thr_wakeup.o \ mlockall.o \ munlockall.o \ - __getcwd.o \ No newline at end of file + __getcwd.o \ + sched_setparam.o \ + sched_getparam.o \ + sched_setscheduler.o \ + sched_getscheduler.o \ + sched_yield.o \ + sched_get_priority_max.o \ + sched_get_priority_min.o \ + sched_rr_get_interval.o diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index cd8f293cd235..542f6cec6ae2 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -1,415 +1,466 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Karels at Berkeley Software Design, Inc. * * 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $Id: sysctl.h,v 1.57 1997/09/07 16:53:52 bde Exp $ + * $Id: sysctl.h,v 1.58 1998/03/04 10:26:42 dufault Exp $ */ #ifndef _SYS_SYSCTL_H_ #define _SYS_SYSCTL_H_ +#include + /* * Definitions for sysctl call. The sysctl call uses a hierarchical name * for objects that can be examined or modified. The name is expressed as * a sequence of integers. Like a file path name, the meaning of each * component depends on its place in the hierarchy. The top-level and kern * identifiers are defined here, and other identifiers are defined in the * respective subsystem header files. */ #define CTL_MAXNAME 12 /* largest number of components supported */ /* * Each subsystem defined by sysctl defines a list of variables * for that subsystem. Each name is either a node with further * levels defined below it, or it is a leaf of some particular * type given below. Each sysctl level defines a set of name/type * pairs to be used by sysctl(1) in manipulating the subsystem. */ struct ctlname { char *ctl_name; /* subsystem name */ int ctl_type; /* type of name */ }; #define CTLTYPE 0xf /* Mask for the type */ #define CTLTYPE_NODE 1 /* name is a node */ #define CTLTYPE_INT 2 /* name describes an integer */ #define CTLTYPE_STRING 3 /* name describes a string */ #define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ #define CTLTYPE_OPAQUE 5 /* name describes a structure */ #define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) #define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ /* * USE THIS instead of a hardwired number from the categories below * to get dynamically assigned sysctl entries using the linker-set * technology. This is the way nearly all new sysctl variables should - * be implimented. + * be implemented. * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, ""); */ #define OID_AUTO (-1) #ifdef KERNEL #define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2, \ struct sysctl_req *req) /* * This describes the access space for a sysctl request. This is needed * so that we can use the interface from the kernel or from user-space. */ struct sysctl_req { struct proc *p; int lock; void *oldptr; int oldlen; int oldidx; int (*oldfunc)(struct sysctl_req *, const void *, int); void *newptr; int newlen; int newidx; int (*newfunc)(struct sysctl_req *, void *, int); }; /* * This describes one "oid" in the MIB tree. Potentially more nodes can * be hidden behind it, expanded by the handler. */ struct sysctl_oid { int oid_number; int oid_kind; void *oid_arg1; int oid_arg2; const char *oid_name; int (*oid_handler) SYSCTL_HANDLER_ARGS; const char *oid_fmt; }; #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) int sysctl_handle_int SYSCTL_HANDLER_ARGS; int sysctl_handle_string SYSCTL_HANDLER_ARGS; int sysctl_handle_opaque SYSCTL_HANDLER_ARGS; /* This is the "raw" function for a mib-oid */ #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ static const struct sysctl_oid sysctl__##parent##_##name = { \ nbr, kind, a1, a2, #name, handler, fmt }; \ TEXT_SET(sysctl_##parent, sysctl__##parent##_##name) /* This makes a node from which other oids can hang */ #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ extern struct linker_set sysctl_##parent##_##name; \ SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access, \ (void*)&sysctl_##parent##_##name, 0, handler, "N", descr); \ TEXT_SET(sysctl_##parent##_##name, sysctl__##parent##_##name) /* This is a string len can be 0 to indicate '\0' termination */ #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \ arg, len, sysctl_handle_string, "A", descr) /* This is a integer, if ptr is NULL, val is returned */ #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ ptr, val, sysctl_handle_int, "I", descr) /* This is anything, specified by a pointer and a lenth */ #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ ptr, len, sysctl_handle_opaque, fmt, descr) /* This is a struct, specified by a pointer and type */ #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ ptr, sizeof(struct type), sysctl_handle_opaque, \ "S," #type, descr) /* Needs a proc. Specify by pointer and arg */ #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ SYSCTL_OID(parent, nbr, name, access, \ ptr, arg, handler, fmt, descr) #endif /* KERNEL */ /* * Top-level identifiers */ #define CTL_UNSPEC 0 /* unused */ #define CTL_KERN 1 /* "high kernel": proc, limits */ #define CTL_VM 2 /* virtual memory */ #define CTL_VFS 3 /* file system, mount type is next */ #define CTL_NET 4 /* network, see socket.h */ #define CTL_DEBUG 5 /* debugging parameters */ #define CTL_HW 6 /* generic cpu/io */ #define CTL_MACHDEP 7 /* machine dependent */ #define CTL_USER 8 /* user-level */ - -#ifdef POSIX4 -#define CTL_POSIX4 9 /* user-level */ +#define CTL_P1003_1B 9 /* POSIX 1003.1B */ #define CTL_MAXID 10 /* number of valid top-level ids */ -#define CTL_POSIX4_NAME { "posix4", CTLTYPE_NODE }, -#else -#define CTL_MAXID 9 /* number of valid top-level ids */ -#define CTL_POSIX4_NAME -#endif /* POSIX4 */ - #define CTL_NAMES { \ { 0, 0 }, \ { "kern", CTLTYPE_NODE }, \ { "vm", CTLTYPE_NODE }, \ { "vfs", CTLTYPE_NODE }, \ { "net", CTLTYPE_NODE }, \ { "debug", CTLTYPE_NODE }, \ { "hw", CTLTYPE_NODE }, \ { "machdep", CTLTYPE_NODE }, \ { "user", CTLTYPE_NODE }, \ - CTL_POSIX4_NAME \ + { "p1003_1b", CTLTYPE_NODE }, \ } /* * CTL_KERN identifiers */ #define KERN_OSTYPE 1 /* string: system version */ #define KERN_OSRELEASE 2 /* string: system release */ #define KERN_OSREV 3 /* int: system revision */ #define KERN_VERSION 4 /* string: compile time info */ #define KERN_MAXVNODES 5 /* int: max vnodes */ #define KERN_MAXPROC 6 /* int: max processes */ #define KERN_MAXFILES 7 /* int: max open files */ #define KERN_ARGMAX 8 /* int: max arguments to exec */ #define KERN_SECURELVL 9 /* int: system security level */ #define KERN_HOSTNAME 10 /* string: hostname */ #define KERN_HOSTID 11 /* int: host identifier */ #define KERN_CLOCKRATE 12 /* struct: struct clockrate */ #define KERN_VNODE 13 /* struct: vnode structures */ #define KERN_PROC 14 /* struct: process entries */ #define KERN_FILE 15 /* struct: file entries */ #define KERN_PROF 16 /* node: kernel profiling info */ #define KERN_POSIX1 17 /* int: POSIX.1 version */ #define KERN_NGROUPS 18 /* int: # of supplemental group ids */ #define KERN_JOB_CONTROL 19 /* int: is job control available */ #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ #define KERN_BOOTTIME 21 /* struct: time kernel was booted */ #define KERN_NISDOMAINNAME 22 /* string: YP domain name */ #define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */ #define KERN_OSRELDATE 24 /* int: OS release date */ #define KERN_NTP_PLL 25 /* node: NTP PLL control */ #define KERN_BOOTFILE 26 /* string: name of booted kernel */ #define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ #define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ #define KERN_DUMPDEV 29 /* dev_t: device to dump on */ #define KERN_IPC 30 /* node: anything related to IPC */ #define KERN_DUMMY 31 /* unused */ #define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ #define KERN_USRSTACK 33 /* int: address of USRSTACK */ #define KERN_MAXID 34 /* number of valid kern ids */ #define CTL_KERN_NAMES { \ { 0, 0 }, \ { "ostype", CTLTYPE_STRING }, \ { "osrelease", CTLTYPE_STRING }, \ { "osrevision", CTLTYPE_INT }, \ { "version", CTLTYPE_STRING }, \ { "maxvnodes", CTLTYPE_INT }, \ { "maxproc", CTLTYPE_INT }, \ { "maxfiles", CTLTYPE_INT }, \ { "argmax", CTLTYPE_INT }, \ { "securelevel", CTLTYPE_INT }, \ { "hostname", CTLTYPE_STRING }, \ { "hostid", CTLTYPE_INT }, \ { "clockrate", CTLTYPE_STRUCT }, \ { "vnode", CTLTYPE_STRUCT }, \ { "proc", CTLTYPE_STRUCT }, \ { "file", CTLTYPE_STRUCT }, \ { "profiling", CTLTYPE_NODE }, \ { "posix1version", CTLTYPE_INT }, \ { "ngroups", CTLTYPE_INT }, \ { "job_control", CTLTYPE_INT }, \ { "saved_ids", CTLTYPE_INT }, \ { "boottime", CTLTYPE_STRUCT }, \ { "nisdomainname", CTLTYPE_STRING }, \ { "update", CTLTYPE_INT }, \ { "osreldate", CTLTYPE_INT }, \ { "ntp_pll", CTLTYPE_NODE }, \ { "bootfile", CTLTYPE_STRING }, \ { "maxfilesperproc", CTLTYPE_INT }, \ { "maxprocperuid", CTLTYPE_INT }, \ { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \ { "ipc", CTLTYPE_NODE }, \ { "dummy", CTLTYPE_INT }, \ { "ps_strings", CTLTYPE_INT }, \ { "usrstack", CTLTYPE_INT }, \ } /* * CTL_VFS identifiers */ #define CTL_VFS_NAMES { \ { "vfsconf", CTLTYPE_STRUCT }, \ } /* * KERN_PROC subtypes */ #define KERN_PROC_ALL 0 /* everything */ #define KERN_PROC_PID 1 /* by process id */ #define KERN_PROC_PGRP 2 /* by process group id */ #define KERN_PROC_SESSION 3 /* by session of pid */ #define KERN_PROC_TTY 4 /* by controlling tty */ #define KERN_PROC_UID 5 /* by effective uid */ #define KERN_PROC_RUID 6 /* by real uid */ /* * KERN_IPC identifiers */ #define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */ #define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */ #define KIPC_SOMAXCONN 3 /* int: max length of connection q */ #define KIPC_MAX_LINKHDR 4 /* int: max length of link header */ #define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */ #define KIPC_MAX_HDR 6 /* int: max total length of headers */ #define KIPC_MAX_DATALEN 7 /* int: max length of data? */ #define KIPC_MBSTAT 8 /* struct: mbuf usage statistics */ /* * CTL_HW identifiers */ #define HW_MACHINE 1 /* string: machine class */ #define HW_MODEL 2 /* string: specific machine model */ #define HW_NCPU 3 /* int: number of cpus */ #define HW_BYTEORDER 4 /* int: machine byte order */ #define HW_PHYSMEM 5 /* int: total memory */ #define HW_USERMEM 6 /* int: non-kernel memory */ #define HW_PAGESIZE 7 /* int: software page size */ #define HW_DISKNAMES 8 /* strings: disk drive names */ #define HW_DISKSTATS 9 /* struct: diskstats[] */ #define HW_FLOATINGPT 10 /* int: has HW floating point? */ #define HW_MACHINE_ARCH 11 /* string: machine architecture */ #define HW_MAXID 12 /* number of valid hw ids */ #define CTL_HW_NAMES { \ { 0, 0 }, \ { "machine", CTLTYPE_STRING }, \ { "model", CTLTYPE_STRING }, \ { "ncpu", CTLTYPE_INT }, \ { "byteorder", CTLTYPE_INT }, \ { "physmem", CTLTYPE_INT }, \ { "usermem", CTLTYPE_INT }, \ { "pagesize", CTLTYPE_INT }, \ { "disknames", CTLTYPE_STRUCT }, \ { "diskstats", CTLTYPE_STRUCT }, \ { "floatingpoint", CTLTYPE_INT }, \ } /* * CTL_USER definitions */ #define USER_CS_PATH 1 /* string: _CS_PATH */ #define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ #define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ #define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ #define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ #define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ #define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ #define USER_LINE_MAX 8 /* int: LINE_MAX */ #define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ #define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ #define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ #define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ #define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ #define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ #define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ #define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ #define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ #define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ #define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ #define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ #define USER_MAXID 21 /* number of valid user ids */ #define CTL_USER_NAMES { \ { 0, 0 }, \ { "cs_path", CTLTYPE_STRING }, \ { "bc_base_max", CTLTYPE_INT }, \ { "bc_dim_max", CTLTYPE_INT }, \ { "bc_scale_max", CTLTYPE_INT }, \ { "bc_string_max", CTLTYPE_INT }, \ { "coll_weights_max", CTLTYPE_INT }, \ { "expr_nest_max", CTLTYPE_INT }, \ { "line_max", CTLTYPE_INT }, \ { "re_dup_max", CTLTYPE_INT }, \ { "posix2_version", CTLTYPE_INT }, \ { "posix2_c_bind", CTLTYPE_INT }, \ { "posix2_c_dev", CTLTYPE_INT }, \ { "posix2_char_term", CTLTYPE_INT }, \ { "posix2_fort_dev", CTLTYPE_INT }, \ { "posix2_fort_run", CTLTYPE_INT }, \ { "posix2_localedef", CTLTYPE_INT }, \ { "posix2_sw_dev", CTLTYPE_INT }, \ { "posix2_upe", CTLTYPE_INT }, \ { "stream_max", CTLTYPE_INT }, \ { "tzname_max", CTLTYPE_INT }, \ } +#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */ +#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */ +#define CTL_P1003_1B_MEMLOCK 3 /* boolean */ +#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */ +#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */ +#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */ +#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */ +#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */ +#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */ +#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */ +#define CTL_P1003_1B_FSYNC 11 /* boolean */ +#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */ +#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */ +#define CTL_P1003_1B_TIMERS 14 /* boolean */ +#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */ +#define CTL_P1003_1B_AIO_MAX 16 /* int */ +#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */ +#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */ +#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */ +#define CTL_P1003_1B_PAGESIZE 20 /* int */ +#define CTL_P1003_1B_RTSIG_MAX 21 /* int */ +#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */ +#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */ +#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */ +#define CTL_P1003_1B_TIMER_MAX 25 /* int */ + +#define CTL_P1003_1B_MAXID 26 + +#define CTL_P1003_1B_NAMES { \ + { 0, 0 }, \ + { "asynchronous_io", CTLTYPE_INT }, \ + { "mapped_files", CTLTYPE_INT }, \ + { "memlock", CTLTYPE_INT }, \ + { "memlock_range", CTLTYPE_INT }, \ + { "memory_protection", CTLTYPE_INT }, \ + { "message_passing", CTLTYPE_INT }, \ + { "prioritized_io", CTLTYPE_INT }, \ + { "priority_scheduling", CTLTYPE_INT }, \ + { "realtime_signals", CTLTYPE_INT }, \ + { "semaphores", CTLTYPE_INT }, \ + { "fsync", CTLTYPE_INT }, \ + { "shared_memory_objects", CTLTYPE_INT }, \ + { "synchronized_io", CTLTYPE_INT }, \ + { "timers", CTLTYPE_INT }, \ + { "aio_listio_max", CTLTYPE_INT }, \ + { "aio_max", CTLTYPE_INT }, \ + { "aio_prio_delta_max", CTLTYPE_INT }, \ + { "delaytimer_max", CTLTYPE_INT }, \ + { "mq_open_max", CTLTYPE_INT }, \ + { "pagesize", CTLTYPE_INT }, \ + { "rtsig_max", CTLTYPE_INT }, \ + { "nsems_max", CTLTYPE_INT }, \ + { "sem_value_max", CTLTYPE_INT }, \ + { "sigqueue_max", CTLTYPE_INT }, \ + { "timer_max", CTLTYPE_INT }, \ +} + #ifdef KERNEL extern char machine[]; extern char osrelease[]; extern char ostype[]; int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, int *retval); int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, int *retval); /* int sysctl_clockrate __P((char *, size_t*)); int sysctl_file __P((char *, size_t*)); int sysctl_doproc __P((int *, u_int, char *, size_t*)); int sysctl_doprof __P((int *, u_int, void *, size_t *, void *, size_t)); */ #else /* !KERNEL */ #include __BEGIN_DECLS int sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); int sysctlbyname __P((const char *, void *, size_t *, void *, size_t)); __END_DECLS #endif /* KERNEL */ #endif /* !_SYS_SYSCTL_H_ */ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 6d3d8e0f26d0..16c56c637cc2 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -1,1169 +1,1206 @@ /* * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp */ #ifndef _SYS_SYSPROTO_H_ #define _SYS_SYSPROTO_H_ #include struct proc; struct nosys_args { int dummy; }; struct rexit_args { int rval; }; struct fork_args { int dummy; }; struct read_args { int fd; char * buf; u_int nbyte; }; struct write_args { int fd; char * buf; u_int nbyte; }; struct open_args { char * path; int flags; int mode; }; struct close_args { int fd; }; struct wait_args { int pid; int * status; int options; struct rusage * rusage; }; struct link_args { char * path; char * link; }; struct unlink_args { char * path; }; struct chdir_args { char * path; }; struct fchdir_args { int fd; }; struct mknod_args { char * path; int mode; int dev; }; struct chmod_args { char * path; int mode; }; struct chown_args { char * path; int uid; int gid; }; struct obreak_args { char * nsize; }; struct getfsstat_args { struct statfs * buf; long bufsize; int flags; }; struct getpid_args { int dummy; }; struct mount_args { char * type; char * path; int flags; caddr_t data; }; struct unmount_args { char * path; int flags; }; struct setuid_args { uid_t uid; }; struct getuid_args { int dummy; }; struct geteuid_args { int dummy; }; struct ptrace_args { int req; pid_t pid; caddr_t addr; int data; }; struct recvmsg_args { int s; struct msghdr * msg; int flags; }; struct sendmsg_args { int s; caddr_t msg; int flags; }; struct recvfrom_args { int s; caddr_t buf; size_t len; int flags; caddr_t from; int * fromlenaddr; }; struct accept_args { int s; caddr_t name; int * anamelen; }; struct getpeername_args { int fdes; caddr_t asa; int * alen; }; struct getsockname_args { int fdes; caddr_t asa; int * alen; }; struct access_args { char * path; int flags; }; struct chflags_args { char * path; int flags; }; struct fchflags_args { int fd; int flags; }; struct sync_args { int dummy; }; struct kill_args { int pid; int signum; }; struct getppid_args { int dummy; }; struct dup_args { u_int fd; }; struct pipe_args { int dummy; }; struct getegid_args { int dummy; }; struct profil_args { caddr_t samples; u_int size; u_int offset; u_int scale; }; struct ktrace_args { char * fname; int ops; int facs; int pid; }; struct sigaction_args { int signum; struct sigaction * nsa; struct sigaction * osa; }; struct getgid_args { int dummy; }; struct sigprocmask_args { int how; sigset_t mask; }; struct getlogin_args { char * namebuf; u_int namelen; }; struct setlogin_args { char * namebuf; }; struct acct_args { char * path; }; struct sigpending_args { int dummy; }; struct sigaltstack_args { struct sigaltstack * nss; struct sigaltstack * oss; }; struct ioctl_args { int fd; u_long com; caddr_t data; }; struct reboot_args { int opt; }; struct revoke_args { char * path; }; struct symlink_args { char * path; char * link; }; struct readlink_args { char * path; char * buf; int count; }; struct execve_args { char * fname; char ** argv; char ** envv; }; struct umask_args { int newmask; }; struct chroot_args { char * path; }; struct getpagesize_args { int dummy; }; struct msync_args { void * addr; size_t len; int flags; }; struct vfork_args { int dummy; }; struct sbrk_args { int incr; }; struct sstk_args { int incr; }; struct ovadvise_args { int anom; }; struct munmap_args { void * addr; size_t len; }; struct mprotect_args { const void * addr; size_t len; int prot; }; struct madvise_args { void * addr; size_t len; int behav; }; struct mincore_args { const void * addr; size_t len; char * vec; }; struct getgroups_args { u_int gidsetsize; gid_t * gidset; }; struct setgroups_args { u_int gidsetsize; gid_t * gidset; }; struct getpgrp_args { int dummy; }; struct setpgid_args { int pid; int pgid; }; struct setitimer_args { u_int which; struct itimerval * itv; struct itimerval * oitv; }; struct owait_args { int dummy; }; struct swapon_args { char * name; }; struct getitimer_args { u_int which; struct itimerval * itv; }; struct getdtablesize_args { int dummy; }; struct dup2_args { u_int from; u_int to; }; struct fcntl_args { int fd; int cmd; int arg; }; struct select_args { int nd; fd_set * in; fd_set * ou; fd_set * ex; struct timeval * tv; }; struct fsync_args { int fd; }; struct setpriority_args { int which; int who; int prio; }; struct socket_args { int domain; int type; int protocol; }; struct connect_args { int s; caddr_t name; int namelen; }; struct getpriority_args { int which; int who; }; struct sigreturn_args { struct sigcontext * sigcntxp; }; struct bind_args { int s; caddr_t name; int namelen; }; struct setsockopt_args { int s; int level; int name; caddr_t val; int valsize; }; struct listen_args { int s; int backlog; }; struct sigsuspend_args { sigset_t mask; }; struct gettimeofday_args { struct timeval * tp; struct timezone * tzp; }; struct getrusage_args { int who; struct rusage * rusage; }; struct getsockopt_args { int s; int level; int name; caddr_t val; int * avalsize; }; struct readv_args { int fd; struct iovec * iovp; u_int iovcnt; }; struct writev_args { int fd; struct iovec * iovp; u_int iovcnt; }; struct settimeofday_args { struct timeval * tv; struct timezone * tzp; }; struct fchown_args { int fd; int uid; int gid; }; struct fchmod_args { int fd; int mode; }; struct setreuid_args { int ruid; int euid; }; struct setregid_args { int rgid; int egid; }; struct rename_args { char * from; char * to; }; struct flock_args { int fd; int how; }; struct mkfifo_args { char * path; int mode; }; struct sendto_args { int s; caddr_t buf; size_t len; int flags; caddr_t to; int tolen; }; struct shutdown_args { int s; int how; }; struct socketpair_args { int domain; int type; int protocol; int * rsv; }; struct mkdir_args { char * path; int mode; }; struct rmdir_args { char * path; }; struct utimes_args { char * path; struct timeval * tptr; }; struct adjtime_args { struct timeval * delta; struct timeval * olddelta; }; struct ogethostid_args { int dummy; }; struct setsid_args { int dummy; }; struct quotactl_args { char * path; int cmd; int uid; caddr_t arg; }; struct oquota_args { int dummy; }; struct nfssvc_args { int flag; caddr_t argp; }; struct statfs_args { char * path; struct statfs * buf; }; struct fstatfs_args { int fd; struct statfs * buf; }; struct getfh_args { char * fname; struct fhandle * fhp; }; struct getdomainname_args { char * domainname; int len; }; struct setdomainname_args { char * domainname; int len; }; struct uname_args { struct utsname * name; }; struct sysarch_args { int op; char * parms; }; struct rtprio_args { int function; pid_t pid; struct rtprio * rtp; }; struct semsys_args { int which; int a2; int a3; int a4; int a5; }; struct msgsys_args { int which; int a2; int a3; int a4; int a5; int a6; }; struct shmsys_args { int which; int a2; int a3; int a4; }; struct ntp_adjtime_args { struct timex * tp; }; struct setgid_args { gid_t gid; }; struct setegid_args { gid_t egid; }; struct seteuid_args { uid_t euid; }; struct stat_args { char * path; struct stat * ub; }; struct fstat_args { int fd; struct stat * sb; }; struct lstat_args { char * path; struct stat * ub; }; struct pathconf_args { char * path; int name; }; struct fpathconf_args { int fd; int name; }; struct __getrlimit_args { u_int which; struct orlimit * rlp; }; struct __setrlimit_args { u_int which; struct orlimit * rlp; }; struct getdirentries_args { int fd; char * buf; u_int count; long * basep; }; struct mmap_args { caddr_t addr; size_t len; int prot; int flags; int fd; long pad; off_t pos; }; struct lseek_args { int fd; int pad; off_t offset; int whence; }; struct truncate_args { char * path; int pad; off_t length; }; struct ftruncate_args { int fd; int pad; off_t length; }; struct sysctl_args { int * name; u_int namelen; void * old; size_t * oldlenp; void * new; size_t newlen; }; struct mlock_args { const void * addr; size_t len; }; struct munlock_args { const void * addr; size_t len; }; struct utrace_args { caddr_t addr; size_t len; }; struct undelete_args { char * path; }; struct getpgid_args { pid_t pid; }; struct poll_args { struct pollfd * fds; u_int nfds; int timeout; }; struct __semctl_args { int semid; int semnum; int cmd; union semun * arg; }; struct semget_args { key_t key; int nsems; int semflg; }; struct semop_args { int semid; struct sembuf * sops; u_int nsops; }; struct semconfig_args { int flag; }; struct msgctl_args { int msqid; int cmd; struct msqid_ds * buf; }; struct msgget_args { key_t key; int msgflg; }; struct msgsnd_args { int msqid; void * msgp; size_t msgsz; int msgflg; }; struct msgrcv_args { int msqid; void * msgp; size_t msgsz; long msgtyp; int msgflg; }; struct shmat_args { int shmid; void * shmaddr; int shmflg; }; struct shmctl_args { int shmid; int cmd; struct shmid_ds * buf; }; struct shmdt_args { void * shmaddr; }; struct shmget_args { key_t key; int size; int shmflg; }; struct clock_gettime_args { clockid_t clock_id; struct timespec * tp; }; struct clock_settime_args { clockid_t clock_id; const struct timespec * tp; }; struct clock_getres_args { clockid_t clock_id; struct timespec * tp; }; struct nanosleep_args { const struct timespec * rqtp; struct timespec * rmtp; }; struct minherit_args { void * addr; size_t len; int inherit; }; struct rfork_args { int flags; }; struct openbsd_poll_args { struct pollfd * fds; u_int nfds; int timeout; }; struct issetugid_args { int dummy; }; struct lchown_args { char * path; int uid; int gid; }; struct modnext_args { int modid; }; struct modstat_args { int modid; struct module_stat * stat; }; struct modfnext_args { int modid; }; struct modfind_args { char * name; }; struct kldload_args { const char * file; }; struct kldunload_args { int fileid; }; struct kldfind_args { const char * file; }; struct kldnext_args { int fileid; }; struct kldstat_args { int fileid; struct kld_file_stat * stat; }; struct kldfirstmod_args { int fileid; }; struct getsid_args { pid_t pid; }; struct signanosleep_args { const struct timespec * rqtp; struct timespec * rmtp; sigset_t * mask; }; struct aio_return_args { struct aiocb * aiocbp; }; struct aio_suspend_args { struct aiocb *const * aiocbp; int nent; const struct timespec * timeout; }; struct aio_cancel_args { int fd; struct aiocb * aiocbp; }; struct aio_error_args { struct aiocb * aiocbp; }; struct aio_read_args { struct aiocb * aiocbp; }; struct aio_write_args { struct aiocb * aiocbp; }; struct lio_listio_args { int mode; struct aiocb *const * acb_list; int nent; struct sigevent * sig; }; struct yield_args { int dummy; }; struct thr_sleep_args { const struct timespec * timeout; }; struct thr_wakeup_args { pid_t pid; }; struct mlockall_args { int how; }; struct munlockall_args { int dummy; }; struct __getcwd_args { u_char * buf; u_int buflen; }; +struct sched_setparam_args { + pid_t pid; + const struct sched_param * param; +}; +struct sched_getparam_args { + pid_t pid; + struct sched_param * param; +}; +struct sched_setscheduler_args { + pid_t pid; + int policy; + const struct sched_param * param; +}; +struct sched_getscheduler_args { + pid_t pid; +}; +struct sched_yield_args { + int dummy; +}; +struct sched_get_priority_max_args { + int policy; +}; +struct sched_get_priority_min_args { + int policy; +}; +struct sched_rr_get_interval_args { + pid_t pid; + struct timespec * interval; +}; int nosys __P((struct proc *, struct nosys_args *)); void exit __P((struct proc *, struct rexit_args *)) __dead2; int fork __P((struct proc *, struct fork_args *)); int read __P((struct proc *, struct read_args *)); int write __P((struct proc *, struct write_args *)); int open __P((struct proc *, struct open_args *)); int close __P((struct proc *, struct close_args *)); int wait4 __P((struct proc *, struct wait_args *)); int link __P((struct proc *, struct link_args *)); int unlink __P((struct proc *, struct unlink_args *)); int chdir __P((struct proc *, struct chdir_args *)); int fchdir __P((struct proc *, struct fchdir_args *)); int mknod __P((struct proc *, struct mknod_args *)); int chmod __P((struct proc *, struct chmod_args *)); int chown __P((struct proc *, struct chown_args *)); int obreak __P((struct proc *, struct obreak_args *)); int getfsstat __P((struct proc *, struct getfsstat_args *)); int getpid __P((struct proc *, struct getpid_args *)); int mount __P((struct proc *, struct mount_args *)); int unmount __P((struct proc *, struct unmount_args *)); int setuid __P((struct proc *, struct setuid_args *)); int getuid __P((struct proc *, struct getuid_args *)); int geteuid __P((struct proc *, struct geteuid_args *)); int ptrace __P((struct proc *, struct ptrace_args *)); int recvmsg __P((struct proc *, struct recvmsg_args *)); int sendmsg __P((struct proc *, struct sendmsg_args *)); int recvfrom __P((struct proc *, struct recvfrom_args *)); int accept __P((struct proc *, struct accept_args *)); int getpeername __P((struct proc *, struct getpeername_args *)); int getsockname __P((struct proc *, struct getsockname_args *)); int access __P((struct proc *, struct access_args *)); int chflags __P((struct proc *, struct chflags_args *)); int fchflags __P((struct proc *, struct fchflags_args *)); int sync __P((struct proc *, struct sync_args *)); int kill __P((struct proc *, struct kill_args *)); int getppid __P((struct proc *, struct getppid_args *)); int dup __P((struct proc *, struct dup_args *)); int pipe __P((struct proc *, struct pipe_args *)); int getegid __P((struct proc *, struct getegid_args *)); int profil __P((struct proc *, struct profil_args *)); int ktrace __P((struct proc *, struct ktrace_args *)); int sigaction __P((struct proc *, struct sigaction_args *)); int getgid __P((struct proc *, struct getgid_args *)); int sigprocmask __P((struct proc *, struct sigprocmask_args *)); int getlogin __P((struct proc *, struct getlogin_args *)); int setlogin __P((struct proc *, struct setlogin_args *)); int acct __P((struct proc *, struct acct_args *)); int sigpending __P((struct proc *, struct sigpending_args *)); int sigaltstack __P((struct proc *, struct sigaltstack_args *)); int ioctl __P((struct proc *, struct ioctl_args *)); int reboot __P((struct proc *, struct reboot_args *)); int revoke __P((struct proc *, struct revoke_args *)); int symlink __P((struct proc *, struct symlink_args *)); int readlink __P((struct proc *, struct readlink_args *)); int execve __P((struct proc *, struct execve_args *)); int umask __P((struct proc *, struct umask_args *)); int chroot __P((struct proc *, struct chroot_args *)); int msync __P((struct proc *, struct msync_args *)); int vfork __P((struct proc *, struct vfork_args *)); int sbrk __P((struct proc *, struct sbrk_args *)); int sstk __P((struct proc *, struct sstk_args *)); int ovadvise __P((struct proc *, struct ovadvise_args *)); int munmap __P((struct proc *, struct munmap_args *)); int mprotect __P((struct proc *, struct mprotect_args *)); int madvise __P((struct proc *, struct madvise_args *)); int mincore __P((struct proc *, struct mincore_args *)); int getgroups __P((struct proc *, struct getgroups_args *)); int setgroups __P((struct proc *, struct setgroups_args *)); int getpgrp __P((struct proc *, struct getpgrp_args *)); int setpgid __P((struct proc *, struct setpgid_args *)); int setitimer __P((struct proc *, struct setitimer_args *)); int swapon __P((struct proc *, struct swapon_args *)); int getitimer __P((struct proc *, struct getitimer_args *)); int getdtablesize __P((struct proc *, struct getdtablesize_args *)); int dup2 __P((struct proc *, struct dup2_args *)); int fcntl __P((struct proc *, struct fcntl_args *)); int select __P((struct proc *, struct select_args *)); int fsync __P((struct proc *, struct fsync_args *)); int setpriority __P((struct proc *, struct setpriority_args *)); int socket __P((struct proc *, struct socket_args *)); int connect __P((struct proc *, struct connect_args *)); int getpriority __P((struct proc *, struct getpriority_args *)); int sigreturn __P((struct proc *, struct sigreturn_args *)); int bind __P((struct proc *, struct bind_args *)); int setsockopt __P((struct proc *, struct setsockopt_args *)); int listen __P((struct proc *, struct listen_args *)); int sigsuspend __P((struct proc *, struct sigsuspend_args *)); int gettimeofday __P((struct proc *, struct gettimeofday_args *)); int getrusage __P((struct proc *, struct getrusage_args *)); int getsockopt __P((struct proc *, struct getsockopt_args *)); int readv __P((struct proc *, struct readv_args *)); int writev __P((struct proc *, struct writev_args *)); int settimeofday __P((struct proc *, struct settimeofday_args *)); int fchown __P((struct proc *, struct fchown_args *)); int fchmod __P((struct proc *, struct fchmod_args *)); int setreuid __P((struct proc *, struct setreuid_args *)); int setregid __P((struct proc *, struct setregid_args *)); int rename __P((struct proc *, struct rename_args *)); int flock __P((struct proc *, struct flock_args *)); int mkfifo __P((struct proc *, struct mkfifo_args *)); int sendto __P((struct proc *, struct sendto_args *)); int shutdown __P((struct proc *, struct shutdown_args *)); int socketpair __P((struct proc *, struct socketpair_args *)); int mkdir __P((struct proc *, struct mkdir_args *)); int rmdir __P((struct proc *, struct rmdir_args *)); int utimes __P((struct proc *, struct utimes_args *)); int adjtime __P((struct proc *, struct adjtime_args *)); int setsid __P((struct proc *, struct setsid_args *)); int quotactl __P((struct proc *, struct quotactl_args *)); int nfssvc __P((struct proc *, struct nfssvc_args *)); int statfs __P((struct proc *, struct statfs_args *)); int fstatfs __P((struct proc *, struct fstatfs_args *)); int getfh __P((struct proc *, struct getfh_args *)); int getdomainname __P((struct proc *, struct getdomainname_args *)); int setdomainname __P((struct proc *, struct setdomainname_args *)); int uname __P((struct proc *, struct uname_args *)); int sysarch __P((struct proc *, struct sysarch_args *)); int rtprio __P((struct proc *, struct rtprio_args *)); int semsys __P((struct proc *, struct semsys_args *)); int msgsys __P((struct proc *, struct msgsys_args *)); int shmsys __P((struct proc *, struct shmsys_args *)); int ntp_adjtime __P((struct proc *, struct ntp_adjtime_args *)); int setgid __P((struct proc *, struct setgid_args *)); int setegid __P((struct proc *, struct setegid_args *)); int seteuid __P((struct proc *, struct seteuid_args *)); int stat __P((struct proc *, struct stat_args *)); int fstat __P((struct proc *, struct fstat_args *)); int lstat __P((struct proc *, struct lstat_args *)); int pathconf __P((struct proc *, struct pathconf_args *)); int fpathconf __P((struct proc *, struct fpathconf_args *)); int getrlimit __P((struct proc *, struct __getrlimit_args *)); int setrlimit __P((struct proc *, struct __setrlimit_args *)); int getdirentries __P((struct proc *, struct getdirentries_args *)); int mmap __P((struct proc *, struct mmap_args *)); int lseek __P((struct proc *, struct lseek_args *)); int truncate __P((struct proc *, struct truncate_args *)); int ftruncate __P((struct proc *, struct ftruncate_args *)); int __sysctl __P((struct proc *, struct sysctl_args *)); int mlock __P((struct proc *, struct mlock_args *)); int munlock __P((struct proc *, struct munlock_args *)); int utrace __P((struct proc *, struct utrace_args *)); int undelete __P((struct proc *, struct undelete_args *)); int getpgid __P((struct proc *, struct getpgid_args *)); int poll __P((struct proc *, struct poll_args *)); int lkmnosys __P((struct proc *, struct nosys_args *)); int __semctl __P((struct proc *, struct __semctl_args *)); int semget __P((struct proc *, struct semget_args *)); int semop __P((struct proc *, struct semop_args *)); int semconfig __P((struct proc *, struct semconfig_args *)); int msgctl __P((struct proc *, struct msgctl_args *)); int msgget __P((struct proc *, struct msgget_args *)); int msgsnd __P((struct proc *, struct msgsnd_args *)); int msgrcv __P((struct proc *, struct msgrcv_args *)); int shmat __P((struct proc *, struct shmat_args *)); int shmctl __P((struct proc *, struct shmctl_args *)); int shmdt __P((struct proc *, struct shmdt_args *)); int shmget __P((struct proc *, struct shmget_args *)); int clock_gettime __P((struct proc *, struct clock_gettime_args *)); int clock_settime __P((struct proc *, struct clock_settime_args *)); int clock_getres __P((struct proc *, struct clock_getres_args *)); int nanosleep __P((struct proc *, struct nanosleep_args *)); int minherit __P((struct proc *, struct minherit_args *)); int rfork __P((struct proc *, struct rfork_args *)); int openbsd_poll __P((struct proc *, struct openbsd_poll_args *)); int issetugid __P((struct proc *, struct issetugid_args *)); int lchown __P((struct proc *, struct lchown_args *)); int modnext __P((struct proc *, struct modnext_args *)); int modstat __P((struct proc *, struct modstat_args *)); int modfnext __P((struct proc *, struct modfnext_args *)); int modfind __P((struct proc *, struct modfind_args *)); int kldload __P((struct proc *, struct kldload_args *)); int kldunload __P((struct proc *, struct kldunload_args *)); int kldfind __P((struct proc *, struct kldfind_args *)); int kldnext __P((struct proc *, struct kldnext_args *)); int kldstat __P((struct proc *, struct kldstat_args *)); int kldfirstmod __P((struct proc *, struct kldfirstmod_args *)); int getsid __P((struct proc *, struct getsid_args *)); int signanosleep __P((struct proc *, struct signanosleep_args *)); int aio_return __P((struct proc *, struct aio_return_args *)); int aio_suspend __P((struct proc *, struct aio_suspend_args *)); int aio_cancel __P((struct proc *, struct aio_cancel_args *)); int aio_error __P((struct proc *, struct aio_error_args *)); int aio_read __P((struct proc *, struct aio_read_args *)); int aio_write __P((struct proc *, struct aio_write_args *)); int lio_listio __P((struct proc *, struct lio_listio_args *)); int yield __P((struct proc *, struct yield_args *)); int thr_sleep __P((struct proc *, struct thr_sleep_args *)); int thr_wakeup __P((struct proc *, struct thr_wakeup_args *)); int mlockall __P((struct proc *, struct mlockall_args *)); int munlockall __P((struct proc *, struct munlockall_args *)); int __getcwd __P((struct proc *, struct __getcwd_args *)); +int sched_setparam __P((struct proc *, struct sched_setparam_args *)); +int sched_getparam __P((struct proc *, struct sched_getparam_args *)); +int sched_setscheduler __P((struct proc *, struct sched_setscheduler_args *)); +int sched_getscheduler __P((struct proc *, struct sched_getscheduler_args *)); +int sched_yield __P((struct proc *, struct sched_yield_args *)); +int sched_get_priority_max __P((struct proc *, struct sched_get_priority_max_args *)); +int sched_get_priority_min __P((struct proc *, struct sched_get_priority_min_args *)); +int sched_rr_get_interval __P((struct proc *, struct sched_rr_get_interval_args *)); #ifdef COMPAT_43 struct ocreat_args { char * path; int mode; }; struct olseek_args { int fd; long offset; int whence; }; struct ostat_args { char * path; struct ostat * ub; }; struct olstat_args { char * path; struct ostat * ub; }; struct ofstat_args { int fd; struct ostat * sb; }; struct getkerninfo_args { int op; char * where; int * size; int arg; }; struct ommap_args { void * addr; int len; int prot; int flags; int fd; long pos; }; struct gethostname_args { char * hostname; u_int len; }; struct sethostname_args { char * hostname; u_int len; }; struct osend_args { int s; caddr_t buf; int len; int flags; }; struct orecv_args { int s; caddr_t buf; int len; int flags; }; struct osigvec_args { int signum; struct sigvec * nsv; struct sigvec * osv; }; struct osigblock_args { int mask; }; struct osigsetmask_args { int mask; }; struct osigstack_args { struct sigstack * nss; struct sigstack * oss; }; struct orecvmsg_args { int s; struct omsghdr * msg; int flags; }; struct osendmsg_args { int s; caddr_t msg; int flags; }; struct otruncate_args { char * path; long length; }; struct oftruncate_args { int fd; long length; }; struct ogetpeername_args { int fdes; caddr_t asa; int * alen; }; struct osethostid_args { long hostid; }; struct ogetrlimit_args { u_int which; struct ogetrlimit * rlp; }; struct osetrlimit_args { u_int which; struct ogetrlimit * rlp; }; struct okillpg_args { int pgid; int signum; }; struct ogetdirentries_args { int fd; char * buf; u_int count; long * basep; }; int ocreat __P((struct proc *, struct ocreat_args *)); int olseek __P((struct proc *, struct olseek_args *)); int ostat __P((struct proc *, struct ostat_args *)); int olstat __P((struct proc *, struct olstat_args *)); int ofstat __P((struct proc *, struct ofstat_args *)); int ogetkerninfo __P((struct proc *, struct getkerninfo_args *)); int ogetpagesize __P((struct proc *, struct getpagesize_args *)); int ommap __P((struct proc *, struct ommap_args *)); int owait __P((struct proc *, struct owait_args *)); int ogethostname __P((struct proc *, struct gethostname_args *)); int osethostname __P((struct proc *, struct sethostname_args *)); int oaccept __P((struct proc *, struct accept_args *)); int osend __P((struct proc *, struct osend_args *)); int orecv __P((struct proc *, struct orecv_args *)); int osigvec __P((struct proc *, struct osigvec_args *)); int osigblock __P((struct proc *, struct osigblock_args *)); int osigsetmask __P((struct proc *, struct osigsetmask_args *)); int osigstack __P((struct proc *, struct osigstack_args *)); int orecvmsg __P((struct proc *, struct orecvmsg_args *)); int osendmsg __P((struct proc *, struct osendmsg_args *)); int orecvfrom __P((struct proc *, struct recvfrom_args *)); int otruncate __P((struct proc *, struct otruncate_args *)); int oftruncate __P((struct proc *, struct oftruncate_args *)); int ogetpeername __P((struct proc *, struct ogetpeername_args *)); int ogethostid __P((struct proc *, struct ogethostid_args *)); int osethostid __P((struct proc *, struct osethostid_args *)); int ogetrlimit __P((struct proc *, struct ogetrlimit_args *)); int osetrlimit __P((struct proc *, struct osetrlimit_args *)); int okillpg __P((struct proc *, struct okillpg_args *)); int oquota __P((struct proc *, struct oquota_args *)); int ogetsockname __P((struct proc *, struct getsockname_args *)); int ogetdirentries __P((struct proc *, struct ogetdirentries_args *)); #endif /* COMPAT_43 */ #endif /* !_SYS_SYSPROTO_H_ */ diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index 9ac2c03c4ae4..b96572d6f8e1 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -1,196 +1,193 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. 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 the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)unistd.h 8.2 (Berkeley) 1/7/94 - * $Id: unistd.h,v 1.15 1998/03/04 10:26:46 dufault Exp $ + * $Id: unistd.h,v 1.16 1998/03/08 17:25:38 dufault Exp $ */ #ifndef _SYS_UNISTD_H_ #define _SYS_UNISTD_H_ #include /* compile-time symbolic constants */ #define _POSIX_JOB_CONTROL /* implementation supports job control */ /* * Although we have saved user/group IDs, we do not use them in setuid * as described in POSIX 1003.1, because the feature does not work for * root. We use the saved IDs in seteuid/setegid, which are not currently * part of the POSIX 1003.1 specification. */ #ifdef _NOT_AVAILABLE #define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ #endif -#if _POSIX_VERSION >= 199309L -#include -#endif - #define _POSIX2_VERSION 199212L /* execution-time symbolic constants */ /* chown requires appropriate privileges */ #define _POSIX_CHOWN_RESTRICTED 1 /* too-long path components generate errors */ #define _POSIX_NO_TRUNC 1 /* may disable terminal special characters */ #define _POSIX_VDISABLE 0xff /* access function */ #define F_OK 0 /* test for existence of file */ #define X_OK 0x01 /* test for execute or search permission */ #define W_OK 0x02 /* test for write permission */ #define R_OK 0x04 /* test for read permission */ /* whence values for lseek(2) */ #define SEEK_SET 0 /* set file offset to offset */ #define SEEK_CUR 1 /* set file offset to current plus offset */ #define SEEK_END 2 /* set file offset to EOF plus offset */ #ifndef _POSIX_SOURCE /* whence values for lseek(2); renamed by POSIX 1003.1 */ #define L_SET SEEK_SET #define L_INCR SEEK_CUR #define L_XTND SEEK_END #endif /* configurable pathname variables */ #define _PC_LINK_MAX 1 #define _PC_MAX_CANON 2 #define _PC_MAX_INPUT 3 #define _PC_NAME_MAX 4 #define _PC_PATH_MAX 5 #define _PC_PIPE_BUF 6 #define _PC_CHOWN_RESTRICTED 7 #define _PC_NO_TRUNC 8 #define _PC_VDISABLE 9 /* configurable system variables */ #define _SC_ARG_MAX 1 #define _SC_CHILD_MAX 2 #define _SC_CLK_TCK 3 #define _SC_NGROUPS_MAX 4 #define _SC_OPEN_MAX 5 #define _SC_JOB_CONTROL 6 #define _SC_SAVED_IDS 7 #define _SC_VERSION 8 #define _SC_BC_BASE_MAX 9 #define _SC_BC_DIM_MAX 10 #define _SC_BC_SCALE_MAX 11 #define _SC_BC_STRING_MAX 12 #define _SC_COLL_WEIGHTS_MAX 13 #define _SC_EXPR_NEST_MAX 14 #define _SC_LINE_MAX 15 #define _SC_RE_DUP_MAX 16 #define _SC_2_VERSION 17 #define _SC_2_C_BIND 18 #define _SC_2_C_DEV 19 #define _SC_2_CHAR_TERM 20 #define _SC_2_FORT_DEV 21 #define _SC_2_FORT_RUN 22 #define _SC_2_LOCALEDEF 23 #define _SC_2_SW_DEV 24 #define _SC_2_UPE 25 #define _SC_STREAM_MAX 26 #define _SC_TZNAME_MAX 27 /* configurable system strings */ #define _CS_PATH 1 -#ifdef _POSIX4_VISIBLE +#ifdef _P1003_1B_VISIBLE + +#define _POSIX_PRIORITY_SCHEDULING #if 0 /* Not until the dust settles after the header commit */ -#define _POSIX_PRIORITY_SCHEDULING #define _POSIX_ASYNCHRONOUS_IO #define _POSIX_MEMLOCK #define _POSIX_MEMLOCK_RANGE #endif -/* POSIX 4 sysconf options */ +/* POSIX.1B sysconf options */ #define _SC_ASYNCHRONOUS_IO 28 #define _SC_MAPPED_FILES 29 #define _SC_MEMLOCK 30 #define _SC_MEMLOCK_RANGE 31 #define _SC_MEMORY_PROTECTION 32 #define _SC_MESSAGE_PASSING 33 #define _SC_PRIORITIZED_IO 34 #define _SC_PRIORITY_SCHEDULING 35 #define _SC_REALTIME_SIGNALS 36 #define _SC_SEMAPHORES 37 #define _SC_FSYNC 38 #define _SC_SHARED_MEMORY_OBJECTS 39 #define _SC_SYNCHRONIZED_IO 40 #define _SC_TIMERS 41 #define _SC_AIO_LISTIO_MAX 42 #define _SC_AIO_MAX 43 #define _SC_AIO_PRIO_DELTA_MAX 44 #define _SC_DELAYTIMER_MAX 45 #define _SC_MQ_OPEN_MAX 46 #define _SC_PAGESIZE 47 #define _SC_RTSIG_MAX 48 #define _SC_SEM_NSEMS_MAX 49 #define _SC_SEM_VALUE_MAX 50 #define _SC_SIGQUEUE_MAX 51 #define _SC_TIMER_MAX 52 -/* POSIX 4 pathconf and fpathconf options */ +/* POSIX.1B pathconf and fpathconf options */ #define _PC_ASYNC_IO 53 #define _PC_PRIO_IO 54 #define _PC_SYNC_IO 55 -#endif /* _POSIX4_VISIBLE */ +#endif /* _P1003_1B_VISIBLE */ #ifndef _POSIX_SOURCE /* * rfork() options. * * XXX currently, operations without RFPROC set are not supported. */ #define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */ #define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */ #define RFFDG (1<<2) /* copy fd table */ #define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */ #define RFPROC (1<<4) /* change child (else changes curproc) */ #define RFMEM (1<<5) /* share `address space' */ #define RFNOWAIT (1<<6) /* parent need not wait() on child */ #define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */ #define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */ #define RFCFDG (1<<12) /* zero fd table */ #define RFTHREAD (1<<13) /* enable kernel thread support */ #define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ #endif /* !_POSIX_SOURCE */ #endif /* !_SYS_UNISTD_H_ */