From: Anil Madhavapeddy Date: Wed, 4 Nov 2009 20:55:18 +0000 (+0000) Subject: Remove signal handler debug stubs for FPE/SEGV from stdext as they are not needed... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bcf618a3b4f491724ca0998bf517671b2a49cb1b;p=xcp%2Fxen-api-libs.git Remove signal handler debug stubs for FPE/SEGV from stdext as they are not needed by XAPI any more Signed-off-by: Anil Madhavapeddy --- diff --git a/stdext/Makefile b/stdext/Makefile index fd0edd6..fed4fd9 100644 --- a/stdext/Makefile +++ b/stdext/Makefile @@ -21,7 +21,7 @@ OCAML_TEST_LIB = $(shell ocamlfind query oUnit)/oUnit.cmxa STDEXT_OBJS = filenameext stringext arrayext hashtblext listext pervasiveext threadext ring \ qring fring opt bigbuffer unixext range vIO trie config date encodings forkhelpers \ - gzip sha1sum sigutil zerocheck base64 backtrace tar + gzip sha1sum zerocheck base64 backtrace tar INTF = $(foreach obj, $(STDEXT_OBJS),$(obj).cmi) LIBS = stdext.cma stdext.cmxa @@ -45,10 +45,10 @@ stdext.cmxa: libstdext_stubs.a $(foreach obj,$(STDEXT_OBJS),$(obj).cmx) stdext.cma: $(foreach obj,$(STDEXT_OBJS),$(obj).cmo) $(OCAMLC) -a -dllib dllstdext_stubs.so -cclib -lstdext_stubs -o $@ $(foreach obj,$(STDEXT_OBJS),$(obj).cmo) -stdext_stubs.a: unixext_stubs.o sigutil_stub.o zerocheck_stub.o +stdext_stubs.a: unixext_stubs.o zerocheck_stub.o ocamlmklib -o stdext_stubs $+ -libstdext_stubs.a: unixext_stubs.o sigutil_stub.o zerocheck_stub.o +libstdext_stubs.a: unixext_stubs.o zerocheck_stub.o ar rcs $@ $+ ocamlmklib -o stdext_stubs $+ diff --git a/stdext/sigutil.ml b/stdext/sigutil.ml deleted file mode 100644 index b766a08..0000000 --- a/stdext/sigutil.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * Copyright (C) 2006-2009 Citrix Systems Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; version 2.1 only. with the special - * exception on linking described in file LICENSE. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - *) -external install_fpe_handler : unit -> unit = "stub_install_fpe_handler" -external install_segv_handler : unit -> unit = "stub_install_segv_handler" diff --git a/stdext/sigutil.mli b/stdext/sigutil.mli deleted file mode 100644 index b766a08..0000000 --- a/stdext/sigutil.mli +++ /dev/null @@ -1,15 +0,0 @@ -(* - * Copyright (C) 2006-2009 Citrix Systems Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; version 2.1 only. with the special - * exception on linking described in file LICENSE. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - *) -external install_fpe_handler : unit -> unit = "stub_install_fpe_handler" -external install_segv_handler : unit -> unit = "stub_install_segv_handler" diff --git a/stdext/sigutil_stub.c b/stdext/sigutil_stub.c deleted file mode 100644 index f5234f7..0000000 --- a/stdext/sigutil_stub.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2006-2009 Citrix Systems Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; version 2.1 only. with the special - * exception on linking described in file LICENSE. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - */ - -#include -#include -#include -#include - -static void fpe_handler(int signum, siginfo_t *info, void *ptr) -{ - FILE *file; - if (signum != SIGFPE || info == NULL) - return; - file = fopen("/tmp/fpe_dump", "w+"); - if (file == NULL) - return; - - fprintf(file, "si_signo: %d\n", info->si_signo); - fprintf(file, "si_errno: %d\n", info->si_errno); - fprintf(file, "si_code: %d\n", info->si_code); - fprintf(file, "si_pid: %d\n", info->si_pid); - fprintf(file, "si_status: %d\n", info->si_status); - fprintf(file, "si_value: %d\n", info->si_value); - fprintf(file, "si_int: %lx\n", info->si_int); - fprintf(file, "si_ptr: %lx\n", (unsigned long) info->si_ptr); - fprintf(file, "si_addr: %lx\n", (unsigned long) info->si_addr); - fprintf(file, "uarg: %lx\n", (unsigned long) ptr); - fclose(file); - - kill(0, SIGFPE); -} - -static void segv_handler(int signum, siginfo_t *info, void *ptr) -{ - FILE *file; - if (signum != SIGSEGV || info == NULL) - return; - file = fopen("/tmp/segv_dump", "w+"); - if (file == NULL) - return; - - fprintf(file, "si_signo: %d\n", info->si_signo); - fprintf(file, "si_errno: %d\n", info->si_errno); - fprintf(file, "si_code: %d\n", info->si_code); - fprintf(file, "si_pid: %d\n", info->si_pid); - fprintf(file, "si_status: %d\n", info->si_status); - fprintf(file, "si_value: %d\n", info->si_value); - fprintf(file, "si_int: %lx\n", info->si_int); - fprintf(file, "si_ptr: %lx\n", (unsigned long) info->si_ptr); - fprintf(file, "si_addr: %lx\n", (unsigned long) info->si_addr); - fprintf(file, "uarg: %lx\n", (unsigned long) ptr); - fclose(file); - - kill(0, SIGSEGV); -} - -#define CAML_NAME_SPACE -#include -#include -#include -#include - -CAMLprim value stub_install_fpe_handler(value unit) -{ - CAMLparam1(unit); - struct sigaction act; - - act.sa_sigaction = fpe_handler; - act.sa_flags = SA_SIGINFO | SA_RESETHAND; - - sigaction(SIGFPE, &act, NULL); - - CAMLreturn(Val_unit); -} - -CAMLprim value stub_install_segv_handler(value unit) -{ - CAMLparam1(unit); - struct sigaction act; - act.sa_sigaction = segv_handler; - act.sa_flags = SA_SIGINFO | SA_RESETHAND; - - sigaction(SIGSEGV, &act, NULL); - - CAMLreturn(Val_unit); -}