ibcs2_isc.c revision 3584
175592Sru/*- 275592Sru * Copyright (c) 1994 S�ren Schmidt 375592Sru * Copyright (c) 1994 Sean Eric Fagan 4136910Sru * All rights reserved. 5114412Sru * 675592Sru * Redistribution and use in source and binary forms, with or without 775592Sru * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer 11 * in this position and unchanged. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. The name of the author may not be used to endorse or promote products 16 * derived from this software withough specific prior written permission 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * $Id: ibcs2_isc.c,v 1.5 1994/10/12 19:38:03 sos Exp $ 30 */ 31 32#include <i386/ibcs2/ibcs2.h> 33#include <sys/param.h> 34#include <sys/proc.h> 35#include <sys/sysent.h> 36#include <sys/errno.h> 37#include <sys/ioctl.h> 38#include <sys/signal.h> 39#include <sys/syslimits.h> 40#include <sys/timeb.h> 41#include <sys/unistd.h> 42#include <sys/utsname.h> 43#include <machine/cpu.h> 44#include <machine/psl.h> 45#include <machine/reg.h> 46 47int 48ibcs2_cisc(struct proc *p, void *args, int *retval) 49{ 50 struct trapframe *tf = (struct trapframe *)p->p_md.md_regs; 51 52 switch ((tf->tf_eax & 0xffffff00) >> 8) { 53 54 case 0x00: 55 printf("IBCS2: 'cisc #0' what is this ??\n"); 56 return 0; 57 58 case 0x02: 59 if (ibcs2_trace & IBCS2_TRACE_ISC) 60 printf("IBCS2: 'cisc rename'\n"); 61 return rename(p, args, retval); 62 63 case 0x03: 64 if (ibcs2_trace & IBCS2_TRACE_ISC) 65 printf("IBCS2: 'cisc sigaction'\n"); 66 return ibcs2_sigaction(p, args, retval); 67 68 case 0x04: 69 if (ibcs2_trace & IBCS2_TRACE_ISC) 70 printf("IBCS2: 'cisc sigprocmask'\n"); 71 return ibcs2_sigprocmask(p, args, retval); 72 73 case 0x05: 74 if (ibcs2_trace & IBCS2_TRACE_ISC) 75 printf("IBCS2: 'cisc sigpending'\n"); 76 return ibcs2_sigpending(p, args, retval); 77 78 case 0x06: 79 if (ibcs2_trace & IBCS2_TRACE_ISC) 80 printf("IBCS2: 'cisc getgroups'\n"); 81 return getgroups(p, args, retval); 82 83 case 0x07: 84 if (ibcs2_trace & IBCS2_TRACE_ISC) 85 printf("IBCS2: 'cisc setgroups'\n"); 86 return setgroups(p, args, retval); 87 88 case 0x08: /* pathconf */ 89 case 0x09: /* fpathconf */ 90 if (ibcs2_trace & IBCS2_TRACE_ISC) 91 printf("IBCS2: 'cisc (f)pathconf'"); 92 return ibcs2_pathconf(p, args, retval); 93 94 case 0x10: { /* sysconf */ 95 struct ibcs2_sysconf_args { 96 int num; 97 } *sysconf_args = args; 98 99 if (ibcs2_trace & IBCS2_TRACE_ISC) 100 printf("IBCS2: 'cisc sysconf'"); 101 switch (sysconf_args->num) { 102 case 0: /* _SC_ARG_MAX */ 103 *retval = (ARG_MAX); 104 break; 105 case 1: /* _SC_CHILD_MAX */ 106 *retval = (CHILD_MAX); 107 break; 108 case 2: /* _SC_CLK_TCK */ 109 *retval = (CLK_TCK); 110 break; 111 case 3: /* _SC_NGROUPS_MAX */ 112 *retval = (NGROUPS_MAX); 113 break; 114 case 4: /* _SC_OPEN_MAX */ 115 *retval = (OPEN_MAX); 116 break; 117 case 5: /* _SC_JOB_CONTROL */ 118#ifdef _POSIX_JOB_CONTORL 119 *retval = _POSIX_JOB_CONTORL; 120#else 121 *retval = (0); 122#endif 123 break; 124 case 6: /* _SC_SAVED_IDS */ 125#ifdef _POSIX_SAVED_IDS 126 *retval = (_POSIX_SAVED_IDS); 127#else 128 *retval = (0); 129#endif 130 break; 131 case 7: /* _SC_VERSION */ 132 *retval = (_POSIX_VERSION); 133 break; 134 default: 135 *retval = -1; 136 return EINVAL; 137 } 138 return 0; 139 } 140 141 case 0x0b: 142 if (ibcs2_trace & IBCS2_TRACE_ISC) 143 printf("IBCS2: 'cisc waitpid'\n"); 144 return ibcs2_wait(p, args, retval); 145 146 case 0x0c: 147 if (ibcs2_trace & IBCS2_TRACE_ISC) 148 printf("IBCS2: 'cisc setsid'\n"); 149 return setsid(p, args, retval); 150 151 case 0x0d: 152 if (ibcs2_trace & IBCS2_TRACE_ISC) 153 printf("IBCS2: 'cisc setpgid'\n"); 154 return setpgid(p, args, retval); 155 156 case 0x11: 157 if (ibcs2_trace & IBCS2_TRACE_ISC) 158 printf("IBCS2: 'cisc sigsuspend'\n"); 159 return ibcs2_sigsuspend(p, args, retval); 160 161 case 0x12: 162 if (ibcs2_trace & IBCS2_TRACE_ISC) 163 printf("IBCS2: 'cisc symlink'\n"); 164 return symlink(p, args, retval); 165 166 case 0x13: 167 if (ibcs2_trace & IBCS2_TRACE_ISC) 168 printf("IBCS2: 'cisc readlink'\n"); 169 return readlink(p, args, retval); 170 171 /* Here needs more work to be done */ 172 case 0x01: 173 printf("IBCS2: 'cisc setostype'"); 174 break; 175 case 0x0e: 176 printf("IBCS2: 'cisc adduser'"); 177 break; 178 case 0x0f: 179 printf("IBCS2: 'cisc setuser'"); 180 break; 181 case 0x14: 182 printf("IBCS2: 'cisc getmajor'"); 183 break; 184 default: 185 printf("IBCS2: 'cisc' function %d(0x%x)", 186 tf->tf_eax>>8, tf->tf_eax>>8); 187 break; 188 } 189 printf(" not implemented yet\n"); 190 return EINVAL; 191} 192