ibcs2_other.c revision 11397
1/* 2 * Copyright (c) 1995 Steven Wallace 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. The name of the author may not be used to endorse or promote products 11 * derived from this software without specific prior written permission 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * 24 * $Id$ 25 */ 26 27/* 28 * IBCS2 compatibility module. 29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/sysproto.h> 34#include <sys/kernel.h> 35 36#include <i386/ibcs2/ibcs2_types.h> 37#include <i386/ibcs2/ibcs2_signal.h> 38#include <i386/ibcs2/ibcs2_util.h> 39#include <i386/ibcs2/ibcs2_proto.h> 40 41#define IBCS2_SECURE_GETLUID 1 42#define IBCS2_SECURE_SETLUID 2 43 44int 45ibcs2_secure(struct proc *p, struct ibcs2_secure_args *uap, int *retval) 46{ 47 switch (uap->cmd) { 48 49 case IBCS2_SECURE_GETLUID: /* get login uid */ 50 *retval = p->p_ucred->cr_uid; 51 return 0; 52 53 case IBCS2_SECURE_SETLUID: /* set login uid */ 54 return EPERM; 55 56 default: 57 printf("IBCS2: 'secure' cmd=%d not implemented\n", uap->cmd); 58 } 59 60 return EINVAL; 61} 62 63int 64ibcs2_lseek(struct proc *p, register struct ibcs2_lseek_args *uap, int *retval) 65{ 66 struct lseek_args largs; 67 off_t lret; 68 int error; 69 70 largs.fd = uap->fd; 71 largs.offset = uap->offset; 72 largs.whence = uap->whence; 73 error = lseek(p, &largs, (int *)&lret); 74 *(long *)retval = lret; 75 return (error); 76} 77