1 /* 2 * Copyright 2015, Rene Gollent, rene@gollent.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "SignalInfo.h" 7 8 #include <string.h> 9 10 11 SignalInfo::SignalInfo() 12 : 13 fSignal(0), 14 fDeadly(false) 15 { 16 memset(&fHandler, 0, sizeof(fHandler)); 17 } 18 19 20 SignalInfo::SignalInfo(const SignalInfo& other) 21 : 22 fSignal(other.fSignal), 23 fDeadly(other.fDeadly) 24 { 25 memcpy(&fHandler, &other.fHandler, sizeof(fHandler)); 26 } 27 28 29 SignalInfo::SignalInfo(int signal, const struct sigaction& handler, 30 bool deadly) 31 : 32 fSignal(signal), 33 fDeadly(deadly) 34 { 35 memcpy(&fHandler, &handler, sizeof(fHandler)); 36 } 37 38 39 void 40 SignalInfo::SetTo(int signal, const struct sigaction& handler, bool deadly) 41 { 42 fSignal = signal; 43 fDeadly = deadly; 44 45 memcpy(&fHandler, &handler, sizeof(fHandler)); 46 } 47