]> granicus.if.org Git - strace/blobdiff - tests/sigaction.c
Update copyright headers
[strace] / tests / sigaction.c
index 7b46944533443357fc3a91ee6dffa89d20f14ae9..95be197138ee22bbb7e02b4c97642f8792b9c4f3 100644 (file)
@@ -1,30 +1,10 @@
 /*
  * Check decoding of sigaction syscall.
  *
- * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2014-2018 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "tests.h"
@@ -85,20 +65,26 @@ k_sigaction(const kernel_ulong_t signum, const kernel_ulong_t new_act,
 }
 
 #if defined SPARC || defined SPARC64
-static const kernel_ulong_t signo =
-       (kernel_ulong_t) 0xbadc0ded00000000ULL | (unsigned int) -SIGUSR1;
+/*
+ * See arch/sparc/kernel/sys_sparc_32.c:sys_sparc_sigaction
+ * and arch/sparc/kernel/sys_sparc32.c:compat_sys_sparc_sigaction
+ */
+# define ADDR_INT ((unsigned int) -0xdefaced)
+# define SIGNO_INT ((unsigned int) -SIGUSR1)
 # define SIG_STR "-SIGUSR1"
 #else
-static const kernel_ulong_t signo =
-       (kernel_ulong_t) 0xbadc0ded00000000ULL | SIGUSR1;
+# define ADDR_INT ((unsigned int) 0xdefaced)
+# define SIGNO_INT ((unsigned int) SIGUSR1)
 # define SIG_STR "SIGUSR1"
 #endif
+static const kernel_ulong_t signo =
+       (kernel_ulong_t) 0xbadc0ded00000000ULL | SIGNO_INT;
+static const kernel_ulong_t addr =
+       (kernel_ulong_t) 0xfacefeed00000000ULL | ADDR_INT;
 
 int
 main(void)
 {
-       static const kernel_ulong_t addr =
-               (kernel_ulong_t) 0xfacefeed0defacedULL;
        union {
                sigset_t libc[1];
                unsigned long old[1];
@@ -131,7 +117,7 @@ main(void)
               (unsigned long) old_act + 2);
 
        k_sigaction(addr, 0, 0);
-       printf("sigaction(%d, NULL, NULL) = -1 EINVAL (%m)\n", (int) addr);
+       printf("sigaction(%d, NULL, NULL) = -1 EINVAL (%m)\n", ADDR_INT);
 
        memset(new_act, 0, sizeof(*new_act));