The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/ibcs2/ibcs2_other.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    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 
   25 #include <sys/cdefs.h>
   26 __FBSDID("$FreeBSD: releng/11.0/sys/i386/ibcs2/ibcs2_other.c 274476 2014-11-13 18:01:51Z kib $");
   27 
   28 /*
   29  * IBCS2 compatibility module.
   30  */
   31 
   32 #include "opt_spx_hack.h"
   33 
   34 #include <sys/param.h>
   35 #include <sys/systm.h>
   36 #include <sys/fcntl.h>
   37 #include <sys/lock.h>
   38 #include <sys/mutex.h>
   39 #include <sys/syscallsubr.h>
   40 #include <sys/sysproto.h>
   41 #include <sys/un.h>
   42 
   43 #include <i386/ibcs2/ibcs2_types.h>
   44 #include <i386/ibcs2/ibcs2_signal.h>
   45 #include <i386/ibcs2/ibcs2_util.h>
   46 #include <i386/ibcs2/ibcs2_proto.h>
   47 
   48 #define IBCS2_SECURE_GETLUID 1
   49 #define IBCS2_SECURE_SETLUID 2
   50 
   51 int
   52 ibcs2_secure(struct thread *td, struct ibcs2_secure_args *uap)
   53 {
   54         switch (uap->cmd) {
   55 
   56         case IBCS2_SECURE_GETLUID:              /* get login uid */
   57                 td->td_retval[0] = td->td_ucred->cr_uid;
   58                 return 0;
   59 
   60         case IBCS2_SECURE_SETLUID:              /* set login uid */
   61                 return EPERM;
   62 
   63         default:
   64                 printf("IBCS2: 'secure' cmd=%d not implemented\n", uap->cmd);
   65         }
   66 
   67         return EINVAL;
   68 }
   69 
   70 int
   71 ibcs2_lseek(struct thread *td, register struct ibcs2_lseek_args *uap)
   72 {
   73         struct lseek_args largs;
   74         int error;
   75 
   76         largs.fd = uap->fd;
   77         largs.offset = uap->offset;
   78         largs.whence = uap->whence;
   79         error = sys_lseek(td, &largs);
   80         return (error);
   81 }
   82 
   83 #ifdef SPX_HACK
   84 #include <sys/socket.h>
   85 #include <sys/un.h>     
   86 
   87 int
   88 spx_open(struct thread *td)
   89 {
   90         struct socket_args sock;
   91         struct sockaddr_un sun;
   92         int fd, error;
   93 
   94         /* obtain a socket. */
   95         DPRINTF(("SPX: open socket\n"));
   96         sock.domain = AF_UNIX;
   97         sock.type = SOCK_STREAM;
   98         sock.protocol = 0;
   99         error = sys_socket(td, &sock);
  100         if (error)
  101                 return error;
  102         fd = td->td_retval[0];
  103 
  104         /* connect the socket to standard X socket */
  105         DPRINTF(("SPX: connect to /tmp/X11-unix/X0\n"));
  106         sun.sun_family = AF_UNIX;
  107         strcpy(sun.sun_path, "/tmp/.X11-unix/X0");
  108         sun.sun_len = sizeof(struct sockaddr_un) - sizeof(sun.sun_path) +
  109             strlen(sun.sun_path) + 1;
  110 
  111         error = kern_connectat(td, AT_FDCWD, fd, (struct sockaddr *)&sun);
  112         if (error) {
  113                 kern_close(td, fd);
  114                 return error;
  115         }
  116         td->td_retval[0] = fd;
  117         return 0;
  118 }
  119 #endif /* SPX_HACK */

Cache object: 77d7edd3127a01ee408afee8c82c268e


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.