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/compat/svr4_32/svr4_32_lwp.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: svr4_32_lwp.c,v 1.5 2003/01/20 08:27:40 martin Exp $   */
    2 
    3 /*-
    4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Christos Zoulas.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *        This product includes software developed by the NetBSD
   21  *        Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 #include <sys/cdefs.h>
   40 __KERNEL_RCSID(0, "$NetBSD: svr4_32_lwp.c,v 1.5 2003/01/20 08:27:40 martin Exp $");
   41 
   42 #include <sys/param.h>
   43 #include <sys/kernel.h>
   44 #include <sys/systm.h>
   45 #include <sys/queue.h>
   46 #include <sys/mbuf.h>
   47 #include <sys/file.h>
   48 #include <sys/mount.h>
   49 #include <sys/time.h>
   50 #include <sys/resourcevar.h>
   51 #include <sys/proc.h>
   52 #include <sys/user.h>
   53 #include <sys/socket.h>
   54 #include <sys/socketvar.h>
   55 #include <sys/sa.h>
   56 #include <sys/syscallargs.h>
   57 #include <sys/un.h>
   58 #include <sys/stat.h>
   59 
   60 #include <compat/svr4_32/svr4_32_types.h>
   61 #include <compat/svr4_32/svr4_32_util.h>
   62 #include <compat/svr4_32/svr4_32_socket.h>
   63 #include <compat/svr4_32/svr4_32_signal.h>
   64 #include <compat/svr4/svr4_sockmod.h>
   65 #include <compat/svr4_32/svr4_32_lwp.h>
   66 #include <compat/svr4_32/svr4_32_ucontext.h>
   67 #include <compat/svr4_32/svr4_32_syscallargs.h>
   68 
   69 
   70 #if 0
   71 int
   72 svr4_32_sys__lwp_self(p, v, retval)
   73         struct proc *p;
   74         void *v;
   75         register_t *retval;
   76 {
   77         return sys_getpid(p, v, retval);
   78 }
   79 #endif
   80 
   81 
   82 int
   83 svr4_32_sys__lwp_create(l, v, retval)
   84         struct lwp *l;
   85         void *v;
   86         register_t *retval;
   87 {
   88         struct svr4_32_sys__lwp_create_args *uap = v;
   89         struct sys__lwp_create_args lc;
   90         int flags;
   91         
   92         flags = 0;
   93         
   94         if (SCARG(uap, flags) & SVR4_LWP_DETACHED)
   95             flags  &= LWP_DETACHED;
   96        
   97         if (SCARG(uap, flags) & SVR4_LWP_SUSPENDED)
   98             flags  &= LWP_SUSPENDED;
   99 
  100         if (SCARG(uap, flags) & SVR4___LWP_ASLWP) {
  101                 /* XXX Punt! */
  102         }
  103 
  104 #if 0
  105         /* XXX this is probably incorrect */
  106         SCARG(&lc, ucp) = (ucontext_t *)SCARG(uap, uc);
  107         SCARG(&lc, new_lwp) = SCARG(uap, lwpid);
  108 #endif
  109         SCARG(&lc, flags) = flags;
  110         
  111         return sys__lwp_create(l, &lc, retval);
  112 }
  113 
  114 int
  115 svr4_32_sys__lwp_kill(l, v, retval)
  116         struct lwp *l;
  117         void *v;
  118         register_t *retval;
  119 {
  120         struct svr4_32_sys__lwp_kill_args *uap = v;
  121         struct sys_kill_args ap;
  122         SCARG(&ap, pid) = SCARG(uap, lwpid);
  123         SCARG(&ap, signum) = SCARG(uap, signum);
  124 
  125         return sys_kill(l, &ap, retval);
  126 }
  127 
  128 int
  129 svr4_32_sys__lwp_info(l, v, retval)
  130         struct lwp *l;
  131         void *v;
  132         register_t *retval;
  133 {
  134         struct svr4_32_sys__lwp_info_args *uap = v;
  135         struct proc *p = l->l_proc;
  136         struct svr4_32_lwpinfo lwpinfo;
  137         int error;
  138 
  139         TIMEVAL_TO_TIMESPEC(&p->p_stats->p_ru.ru_stime, &lwpinfo.lwp_stime);
  140         TIMEVAL_TO_TIMESPEC(&p->p_stats->p_ru.ru_utime, &lwpinfo.lwp_utime);
  141 
  142         if ((error = copyout(&lwpinfo, (caddr_t)(u_long)SCARG(uap, lwpinfo), 
  143                              sizeof(lwpinfo))) == -1)
  144                return error;
  145         return 0;
  146 }
  147 
  148 int
  149 svr4_32_sys__lwp_exit(l, v, retval)
  150         struct lwp *l;
  151         void *v;
  152         register_t *retval;
  153 {
  154 
  155         return sys__lwp_exit(l, NULL, retval);
  156 }
  157 
  158 int
  159 svr4_32_sys__lwp_wait(l, v, retval)
  160         struct lwp *l;
  161         void *v;
  162         register_t *retval;
  163 {
  164         struct svr4_32_sys__lwp_wait_args *uap = v;
  165         struct sys__lwp_wait_args ap;
  166 
  167         SCARG(&ap, wait_for) = SCARG(uap, wait_for);
  168         SCARG(&ap, departed) = NETBSD32PTR64(SCARG(uap, departed_lwp));
  169 
  170         return sys__lwp_wait(l, &ap, retval);
  171 }
  172 
  173 int
  174 svr4_32_sys__lwp_suspend(l, v, retval)
  175         struct lwp *l;
  176         void *v;
  177         register_t *retval;
  178 {
  179         struct svr4_32_sys__lwp_suspend_args *uap = v;
  180         struct sys__lwp_suspend_args ap;
  181 
  182         SCARG(&ap, target) = SCARG(uap, lwpid);
  183 
  184         return sys__lwp_suspend(l, &ap, retval);
  185 }
  186 
  187 int
  188 svr4_32_sys__lwp_continue(l, v, retval)
  189         struct lwp *l;
  190         void *v;
  191         register_t *retval;
  192 {
  193         struct svr4_32_sys__lwp_continue_args *uap = v;
  194         struct sys__lwp_continue_args ap;
  195 
  196         SCARG(&ap, target) = SCARG(uap, lwpid);
  197 
  198         return sys__lwp_continue(l, &ap, retval);
  199 }
  200 
  201 int
  202 svr4_32_sys__lwp_getprivate(l, v, retval)
  203         struct lwp *l;
  204         void *v;
  205         register_t *retval;
  206 {
  207         /* XXX NJWLWP: Replace with call to native version if we ever
  208          * implement that. */
  209 
  210         *retval = (register_t)l->l_private;
  211         return 0;
  212 }
  213 
  214 int
  215 svr4_32_sys__lwp_setprivate(l, v, retval)
  216         struct lwp *l;
  217         void *v;
  218         register_t *retval;
  219 {
  220 #if 0
  221         struct svr4_32_sys__lwp_setprivate_args *uap = v;
  222 
  223         /* XXX NJWLWP: Replace with call to native version if we ever
  224          * implement that. */
  225 
  226         return copyin(SCARG(uap, buffer), &l->l_private, sizeof(void *));
  227 #endif
  228         return 0;
  229 }

Cache object: bcabd0ed93436a46b6001820a83e1986


[ 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.