sysent.h revision 50477
12255Ssos/*- 22255Ssos * Copyright (c) 1982, 1988, 1991 The Regents of the University of California. 32255Ssos * All rights reserved. 42255Ssos * 52255Ssos * Redistribution and use in source and binary forms, with or without 62255Ssos * modification, are permitted provided that the following conditions 72255Ssos * are met: 82255Ssos * 1. Redistributions of source code must retain the above copyright 92255Ssos * notice, this list of conditions and the following disclaimer. 102255Ssos * 2. Redistributions in binary form must reproduce the above copyright 112255Ssos * notice, this list of conditions and the following disclaimer in the 122255Ssos * documentation and/or other materials provided with the distribution. 132255Ssos * 3. All advertising materials mentioning features or use of this software 142255Ssos * must display the following acknowledgement: 152255Ssos * This product includes software developed by the University of 162255Ssos * California, Berkeley and its contributors. 172255Ssos * 4. Neither the name of the University nor the names of its contributors 182255Ssos * may be used to endorse or promote products derived from this software 192255Ssos * without specific prior written permission. 202255Ssos * 212255Ssos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 222255Ssos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 232255Ssos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 242255Ssos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 252255Ssos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 262255Ssos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 272255Ssos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 282255Ssos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 292255Ssos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 302255Ssos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 312255Ssos * SUCH DAMAGE. 322255Ssos * 3350477Speter * $FreeBSD: head/sys/sys/sysent.h 50477 1999-08-28 01:08:13Z peter $ 342255Ssos */ 352255Ssos 362255Ssos#ifndef _SYS_SYSENT_H_ 3714917Sbde#define _SYS_SYSENT_H_ 382255Ssos 3933054Sbdestruct proc; 4033054Sbde 4130994Sphktypedef int sy_call_t __P((struct proc *, void *)); 4210905Sbde 432255Ssosstruct sysent { /* system call table */ 442255Ssos int sy_narg; /* number of arguments */ 4510905Sbde sy_call_t *sy_call; /* implementing function */ 462255Ssos}; 4722521Sdyson#define SCARG(p,k) ((p)->k) /* get arg from args pointer */ 4822521Sdyson /* placeholder till we integrate rest of lite2 syscallargs changes XXX */ 492255Ssos 5010905Sbdestruct image_params; 5114331Speterstruct trapframe; 5210905Sbde 532255Ssosstruct sysentvec { 542255Ssos int sv_size; /* number of entries */ 552255Ssos struct sysent *sv_table; /* pointer to sysent */ 5614917Sbde u_int sv_mask; /* optional mask to index */ 573472Ssos int sv_sigsize; /* size of signal translation table */ 583472Ssos int *sv_sigtbl; /* signal translation table */ 5915036Ssmpatel int sv_errsize; /* size of errno translation table */ 603472Ssos int *sv_errtbl; /* errno translation table */ 6135496Seivind int (*sv_transtrap) __P((int, int)); 6235496Seivind /* translate trap-to-signal mapping */ 6336735Sdfr int (*sv_fixup) __P((long **, struct image_params *)); 6410905Sbde /* stack fixup function */ 6519182Sbde void (*sv_sendsig) __P((void (*)(int), int, int, u_long)); 6614331Speter /* send signal */ 6714331Speter char *sv_sigcode; /* start of sigtramp code */ 6814331Speter int *sv_szsigcode; /* size of sigtramp code */ 6914331Speter void (*sv_prepsyscall) __P((struct trapframe *, int *, 7014917Sbde u_int *, caddr_t *)); 7116474Sdyson char *sv_name; /* name of binary type */ 7239154Sjdp int (*sv_coredump) __P((struct proc *p)); 7339154Sjdp /* function to dump core, or NULL */ 742255Ssos}; 752255Ssos 762255Ssos#ifdef KERNEL 777090Sbdeextern struct sysentvec aout_sysvec; 782255Ssosextern struct sysent sysent[]; 792255Ssos 8042433Sdfr#define NO_SYSCALL (-1) 8142433Sdfr 8242433Sdfrstruct module; 8342433Sdfr 8442433Sdfrstruct syscall_module_data { 8542433Sdfr int (*chainevh)(struct module *, int, void *); /* next handler */ 8642433Sdfr void *chainarg; /* arg for next event handler */ 8742433Sdfr int *offset; /* offset into sysent */ 8842433Sdfr struct sysent *new_sysent; /* new sysent */ 8942433Sdfr struct sysent old_sysent; /* old sysent */ 9042433Sdfr}; 9142433Sdfr 9242433Sdfr#define SYSCALL_MODULE(name, offset, new_sysent, evh, arg) \ 9342433Sdfrstatic struct syscall_module_data name##_syscall_mod = { \ 9442433Sdfr evh, arg, offset, new_sysent \ 9542433Sdfr}; \ 9642433Sdfr \ 9742433Sdfrstatic moduledata_t name##_mod = { \ 9842433Sdfr #name, \ 9942433Sdfr syscall_module_handler, \ 10042433Sdfr &name##_syscall_mod \ 10142433Sdfr}; \ 10242433SdfrDECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 10342433Sdfr 10442433Sdfrint syscall_register __P((int *offset, struct sysent *new_sysent, 10542433Sdfr struct sysent *old_sysent)); 10642433Sdfrint syscall_deregister __P((int *offset, struct sysent *old_sysent)); 10742433Sdfrint syscall_module_handler __P((struct module *mod, int what, void *arg)); 10842433Sdfr 10942433Sdfr#endif /* KERNEL */ 11042433Sdfr 11114917Sbde#endif /* !_SYS_SYSENT_H_ */ 112