root/compat/hpux/hppa/hpux_sig2.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. hpux_sys_sigaltstack

    1 /*      $OpenBSD: hpux_sig2.c,v 1.1 2004/09/19 21:56:18 mickey Exp $    */
    2 
    3 /*
    4  * Copyright (c) 2004 Michael Shalayeff
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   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  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
   20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   22  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   24  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   25  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   26  * THE POSSIBILITY OF SUCH DAMAGE.
   27  */
   28 
   29 
   30 #include <sys/param.h>
   31 #include <sys/systm.h>
   32 #include <sys/proc.h>
   33 #include <sys/mount.h>
   34 #include <sys/signalvar.h>
   35 #include <sys/syscallargs.h>
   36 
   37 #include <compat/hpux/hpux.h>
   38 #include <compat/hpux/hpux_sig.h>
   39 #include <compat/hpux/hpux_util.h>
   40 #include <compat/hpux/hppa/hpux_syscallargs.h>
   41 
   42 int
   43 hpux_sys_sigaltstack(struct proc *p, void *v, register_t *retval)
   44 {
   45         struct hpux_sys_sigaltstack_args /* {
   46                 syscallarg(struct hpux_sigaltstack *) nss;
   47                 syscallarg(struct hpux_sigaltstack *) oss;
   48         } */ *uap = v;
   49         struct sys_sigaltstack_args saa;
   50         hpux_stack_t hsa;
   51         stack_t *psa, sa;
   52         caddr_t sg;
   53         int error;
   54 
   55         if ((error = copyin(SCARG(uap, nss), &hsa, sizeof hsa)))
   56                 return (error);
   57 
   58         sa.ss_sp = hsa.ss_sp;
   59         sa.ss_size = hsa.ss_size;
   60         sa.ss_flags = hsa.ss_flags & SS_ONSTACK;
   61         if (hsa.ss_flags & HPUX_SS_DISABLE)
   62                 sa.ss_flags |= SS_DISABLE;
   63 
   64         sg = stackgap_init(p->p_emul);
   65         psa = stackgap_alloc(&sg, 2 * sizeof(struct sigaltstack));
   66         SCARG(&saa, nss) = &psa[0];
   67         SCARG(&saa, oss) = &psa[1];
   68 
   69         if ((error = copyout(&sa, psa, sizeof sa)))
   70                 return (error);
   71 
   72         if ((error = sys_sigaltstack(p, &saa, retval)))
   73                 return (error);
   74 
   75         if ((error = copyin(SCARG(&saa, oss), &sa, sizeof sa)))
   76                 return (error);
   77 
   78         hsa.ss_sp = sa.ss_sp;
   79         hsa.ss_flags = sa.ss_flags & SS_ONSTACK;
   80         if (sa.ss_flags & SS_DISABLE)
   81                 hsa.ss_flags |= HPUX_SS_DISABLE;
   82         hsa.ss_size = sa.ss_size;
   83 
   84         return (copyout(&hsa, SCARG(uap, oss), sizeof hsa));
   85 }

/* [<][>][^][v][top][bottom][index][help] */