cmake: improve dependency checks
[awesomized/libmemcached] / src / bin / memaslap / ms_sigsegv.c
index 303381f41c1fa0e16b70fc3075c069d0b3d54e80..4c421489903c016f32e7b2e15d37c36a758a3c09 100644 (file)
@@ -1,16 +1,17 @@
 /*
- * File:   ms_sigsegv.c
- * Author: Mingqiang Zhuang
- *
- * Created on March 15, 2009
- *
- * (c) Copyright 2009, Schooner Information Technology, Inc.
- * http://www.schoonerinfotech.com/
- *
- * Rewrite of stack dump:
- *  Copyright (C) 2009 Sun Microsystems
- *  Author Trond Norbye
- */
+    +--------------------------------------------------------------------+
+    | libmemcached - C/C++ Client Library for memcached                  |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted under the terms of the BSD license.    |
+    | You should have received a copy of the license in a bundled file   |
+    | named LICENSE; in case you did not receive a copy you can review   |
+    | the terms online at: https://opensource.org/licenses/BSD-3-Clause  |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2006-2014 Brian Aker   https://datadifferential.com/ |
+    | Copyright (c) 2020 Michael Wallner   <mike@php.net>                |
+    +--------------------------------------------------------------------+
+*/
 
 #include "mem_config.h"
 
@@ -28,10 +29,8 @@ int ms_setup_sigsegv(void);
 int ms_setup_sigpipe(void);
 int ms_setup_sigint(void);
 
-
 /* signal seg reaches, this function will run */
-static void ms_signal_segv(int signum, siginfo_t *info, void *ptr)
-{
+static void ms_signal_segv(int signum, siginfo_t *info, void *ptr) {
   UNUSED_ARGUMENT(signum);
   UNUSED_ARGUMENT(info);
   UNUSED_ARGUMENT(ptr);
@@ -47,8 +46,7 @@ static void ms_signal_segv(int signum, siginfo_t *info, void *ptr)
 }
 
 /* signal int reaches, this function will run */
-static void ms_signal_int(int signum, siginfo_t *info, void *ptr)
-{
+static void ms_signal_int(int signum, siginfo_t *info, void *ptr) {
   UNUSED_ARGUMENT(signum);
   UNUSED_ARGUMENT(info);
   UNUSED_ARGUMENT(ptr);
@@ -59,21 +57,18 @@ static void ms_signal_int(int signum, siginfo_t *info, void *ptr)
   exit(1);
 } /* ms_signal_int */
 
-
 /**
  * redirect signal seg
  *
  * @return if success, return EXIT_SUCCESS, else return -1
  */
-int ms_setup_sigsegv(void)
-{
+int ms_setup_sigsegv(void) {
   struct sigaction action;
 
   memset(&action, 0, sizeof(action));
-  action.sa_sigaction= ms_signal_segv;
-  action.sa_flags= SA_SIGINFO;
-  if (sigaction(SIGSEGV, &action, NULL) < 0)
-  {
+  action.sa_sigaction = ms_signal_segv;
+  action.sa_flags = SA_SIGINFO;
+  if (sigaction(SIGSEGV, &action, NULL) < 0) {
     perror("sigaction");
     return EXIT_SUCCESS;
   }
@@ -81,35 +76,30 @@ int ms_setup_sigsegv(void)
   return -1;
 } /* ms_setup_sigsegv */
 
-
 /**
  * redirect signal pipe
  *
  * @return if success, return EXIT_SUCCESS, else return -1
  */
-int ms_setup_sigpipe(void)
-{
+int ms_setup_sigpipe(void) {
   /* ignore the SIGPIPE signal */
   signal(SIGPIPE, SIG_IGN);
 
   return -1;
 } /* ms_setup_sigpipe */
 
-
 /**
  * redirect signal int
  *
  * @return if success, return EXIT_SUCCESS, else return -1
  */
-int ms_setup_sigint(void)
-{
+int ms_setup_sigint(void) {
   struct sigaction action_3;
 
   memset(&action_3, 0, sizeof(action_3));
-  action_3.sa_sigaction= ms_signal_int;
-  action_3.sa_flags= SA_SIGINFO;
-  if (sigaction(SIGINT, &action_3, NULL) < 0)
-  {
+  action_3.sa_sigaction = ms_signal_int;
+  action_3.sa_flags = SA_SIGINFO;
+  if (sigaction(SIGINT, &action_3, NULL) < 0) {
     perror("sigaction");
     return EXIT_SUCCESS;
   }
@@ -117,10 +107,8 @@ int ms_setup_sigint(void)
   return -1;
 } /* ms_setup_sigint */
 
-
 #ifndef SIGSEGV_NO_AUTO_INIT
-static void __attribute((constructor)) ms_init(void)
-{
+static void __attribute((constructor)) ms_init(void) {
   ms_setup_sigsegv();
   ms_setup_sigpipe();
   ms_setup_sigint();