1*5aca2679Sjoerg /* $NetBSD: setemul.h,v 1.15 2011/04/26 15:51:32 joerg Exp $ */ 2470e7fc5Sjdolecek 3470e7fc5Sjdolecek /*- 4470e7fc5Sjdolecek * Copyright (c) 2000 The NetBSD Foundation, Inc. 5470e7fc5Sjdolecek * All rights reserved. 6470e7fc5Sjdolecek * 7470e7fc5Sjdolecek * Redistribution and use in source and binary forms, with or without 8470e7fc5Sjdolecek * modification, are permitted provided that the following conditions 9470e7fc5Sjdolecek * are met: 10470e7fc5Sjdolecek * 1. Redistributions of source code must retain the above copyright 11470e7fc5Sjdolecek * notice, this list of conditions and the following disclaimer. 12470e7fc5Sjdolecek * 2. Redistributions in binary form must reproduce the above copyright 13470e7fc5Sjdolecek * notice, this list of conditions and the following disclaimer in the 14470e7fc5Sjdolecek * documentation and/or other materials provided with the distribution. 15470e7fc5Sjdolecek * 16470e7fc5Sjdolecek * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17470e7fc5Sjdolecek * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18470e7fc5Sjdolecek * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19470e7fc5Sjdolecek * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20470e7fc5Sjdolecek * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21470e7fc5Sjdolecek * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22470e7fc5Sjdolecek * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23470e7fc5Sjdolecek * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24470e7fc5Sjdolecek * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25470e7fc5Sjdolecek * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26470e7fc5Sjdolecek * POSSIBILITY OF SUCH DAMAGE. 27470e7fc5Sjdolecek */ 28470e7fc5Sjdolecek 29470e7fc5Sjdolecek /* 30470e7fc5Sjdolecek * Copyright (c) 1988, 1993 31470e7fc5Sjdolecek * The Regents of the University of California. All rights reserved. 32470e7fc5Sjdolecek * (c) UNIX System Laboratories, Inc. 33470e7fc5Sjdolecek * All or some portions of this file are derived from material licensed 34470e7fc5Sjdolecek * to the University of California by American Telephone and Telegraph 35470e7fc5Sjdolecek * Co. or Unix System Laboratories, Inc. and are reproduced herein with 36470e7fc5Sjdolecek * the permission of UNIX System Laboratories, Inc. 37470e7fc5Sjdolecek * 38470e7fc5Sjdolecek * Redistribution and use in source and binary forms, with or without 39470e7fc5Sjdolecek * modification, are permitted provided that the following conditions 40470e7fc5Sjdolecek * are met: 41470e7fc5Sjdolecek * 1. Redistributions of source code must retain the above copyright 42470e7fc5Sjdolecek * notice, this list of conditions and the following disclaimer. 43470e7fc5Sjdolecek * 2. Redistributions in binary form must reproduce the above copyright 44470e7fc5Sjdolecek * notice, this list of conditions and the following disclaimer in the 45470e7fc5Sjdolecek * documentation and/or other materials provided with the distribution. 4689aaa1bbSagc * 3. Neither the name of the University nor the names of its contributors 47470e7fc5Sjdolecek * may be used to endorse or promote products derived from this software 48470e7fc5Sjdolecek * without specific prior written permission. 49470e7fc5Sjdolecek * 50470e7fc5Sjdolecek * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 51470e7fc5Sjdolecek * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52470e7fc5Sjdolecek * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53470e7fc5Sjdolecek * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 54470e7fc5Sjdolecek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55470e7fc5Sjdolecek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56470e7fc5Sjdolecek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57470e7fc5Sjdolecek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58470e7fc5Sjdolecek * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59470e7fc5Sjdolecek * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60470e7fc5Sjdolecek * SUCH DAMAGE. 61470e7fc5Sjdolecek */ 62470e7fc5Sjdolecek 63470e7fc5Sjdolecek #include <sys/cdefs.h> 64470e7fc5Sjdolecek 65470e7fc5Sjdolecek struct emulation { 66470e7fc5Sjdolecek const char *name; /* Emulation name */ 67862d4684Sjdolecek const char * const *sysnames; /* Array of system call names */ 68470e7fc5Sjdolecek int nsysnames; /* Number of */ 691dcd879fSenami const int *errnomap; /* Array of error number mapping */ 7008138ae4Sitojun int nerrnomap; /* number of elements in array */ 71f600368bSchristos const int *signalmap; /* Array of signal number mapping */ 72f600368bSchristos int nsignalmap; /* number of elements in array */ 732ccd4840Smrg u_int32_t flags; /* Special flags for this emulation */ 742ccd4840Smrg #define EMUL_FLAG_NETBSD32 0x00000001 /* this emulation is 752ccd4840Smrg * based on netbsd32 */ 76470e7fc5Sjdolecek }; 77470e7fc5Sjdolecek 783433691eSdsl extern const struct emulation *cur_emul; 793433691eSdsl extern const struct emulation *prev_emul; 80470e7fc5Sjdolecek 8187b62b5aSchristos void setemul(const char *, pid_t, int); 8287b62b5aSchristos void ectx_sanify(pid_t); 833433691eSdsl void ectx_delete(void); 84