Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the code provided in the photos attached, write the indicated code in signal.hxx (seen as the TODO portions) as seen in photos 2, 3,

Using the code provided in the photos attached, write the indicated code in signal.hxx (seen as the TODO portions) as seen in photos 2, 3, 4 so that it functions with the code in photo 1. Photos 5 and onward are provided files as-is files and should be compatible with the signal.hxx
Code is written in C++
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
lection Find Packages Window include catonis include void 10. store signo, nemory_order_release): 21 signalhandler flags synchronous Default 24 for auto cucin.get char traits charioteoftel: Cecin.get()) if (id INVALID_SIGNAL) - - cout a signo1 cc id, load memory order acourel id.store INVALID_SIGNAL, memory_order_releasel coutstatic_casteunsignedetele : coute "\: MacBook Pro Bifndef COMP3400_2020_A3_signalha define COMP3400_2020_AB_signahak B include signals ude est except include et traits le cinitializer List namespace comp.3400_202 203 1 1 TODO Define class li here 21 TODO: Define sitanter error inte der er mere 31 Define signal handler geret and sel andere here B : Define signal_andler_default and signal_ ter_default here class l_handler_ee 100010.4.0 oer MacBook Pro Selection Find Packages 3) class signal_handler_op private TODO: Define op here. Pablic: TODO: Define traditional_op_type here. 11 TODO: Define si action type here. 02 46 45 private: TODO: Declare ERROR here. Definition is in pri s l .com 11 TODO: Declare IGNORE here. Definition is in provinsial.com // TODO: Declare DEFAULT here. Definition is provi sional. ) op_type type union traditionaloptypes_handler sigaction_op_type sa sigaction public TODO: Define all constructors and functions intim e signal handler op() signal handler signalhandler og cost shel: signal handler op sperater na handler op cost sho: signal_handler_apisignalhandler_default_t const Signal_handler_eple operator handler default Cat ) signal_handler_ signalhandler_ignoret const signal_handler_06 operater f ra handler_agnere con signal handler opsional handler error cont; MacBook Pro Selection Find Packa h e ment Programming C.. signa andler op operator tagna andler_error_t consta Signalhandler_epitraditional_op_type conste opls signal_handler_ople operator tradition Lop_type const opla Signalhandler opsiocong type const op signalhandler_ople operator (sigaction_ep_type const opla operator bool() const bool is error() consti bool is default() consti bool ishorel) const 31 bool is traditional() consti bool isigactie) consti traditional sigation opt type traditional ) con i onction ) consts bool operator signal handler op conta consta bool operater in signalhandler o conta consta Il nespace C 0 _2020 #include "provided-signal.hr MacBook Pro BABA 1 Bifndef COMP3400_2020W_A03_provided_signal_hxx. #define COMP3400_2020W_A03_provided_signal_hxx_ 6 7 8 9 #include #include #include ace comp3400_2026w::a3 { 16 17 /1 1 1/ The macros below used to detect an operating system varies by compiler 1911 and operating system. A site that lists these macro names by os 2011 is here: 21 22 / https://sourceforge.net/p/predef/wiki/Operating Systems/ 25 26 27 28 29 /1 // POSIX systems define struct sigaction's sa_flags member to be an "int". !! One might want to write code to determine the type of a struct member. // This can be easily done in C++11. See the detail namespace below. // 31 namespace detail { 34 35 1 Since sigaction is also the name of a function, referring to sigaction l can refer to struct sioaction or the function. To avoid a broblema MacBook Pro WANI w Selection Find Packages Window Help provided-signal.hxx-/Documents/Advanced Programming C++ provided-signal.hxx Sonali 31 namespace detail { 34 Since sigaction is the name of a function, referring to sigaction 35 // can refer to struct sigaction or the function. To avoid a problem, a 36 // type alias, struct sigaction_type, is defined and set to the struct 37 // sigaction type --not the sigaction function type. 31 39 using struct_sigaction_type = struct sigaction; 42 7 on idiom in C++ is to use a function template prototype in 43 // conjunction with code that ONLY looks at the return type of a function to 44 // figure out things about the type(s) passed in to that function's 45 // arguments. Such expressions must be only used within decltype 46 // for noexcept() clauses). 47 / 4811 NOTE: This function will NEVER be defined: only its prototype exists. 50 // The get_member_type() prototype only accepts a pointer to a member. If 511/ called with a pointer to a member, per language rules with function S2 // template argument type deduction, type deduction occurs. This causes 531/ T to be the struct/union/class type of the pointer passed in, and, 54// N to be the type of the member. 55 // 56 11 NOTE: Clearly this all happens at compile-time. 5711 58 template 59 H get member type(M T::.); 6211 Define a type alias, sigaction flags_type, to be the type of the 63 11struct sigaction's saflags member. Two things are important here: 64 | The "&" is needed some one needs a pointer to the member, and MacBook Pro View Selection Find Packages Window Help provided-signal.hxx--/Documents/Advanced Programming C++ provided-signal.hxx a3.co signal.ro // Define a type autosigaction Flags_type, to be the type of the 621/ struct sigactie flags member. Two things are important ner 64 // The '&' is neede e one needs a pointer to the member, and, 65 // the entire function "call" is wrapped in decltype which ONLY 66 // determines the resulting type of the expression: no code is ever called 68 // The result is sigaction_flags_type has the type of the sa_flags member. sing sigaction_flags_type = pe(detail::get_member_type(detail::struct_sigaction type 74 ) // namespace detail 76 77 78 enum class signal_handler_flags : typename detail isigaction_flags_type ( interruptable = SA_NODEFER, auto_restart_system_calls = SA_RESTART, revert_to_default = #if defined(_gnu_linux_) || defined(_linux_) 81 82 1/ For some unknown reason, SA RESETHAND in Linux is set to a value // larger than the maximus allowed by int, i.e., the value is likely // intended to be negative being improperly set with a positive value greater than /stdrinumeric limits intimax(). A static cast is used here to force successful compilation (and non-portable integer wrapping). NOTE: Since this is from the operating system it is "de facto correct even though it violates the standard, thus, we force the value to be set. 92 static_caststypename detailussigaction_flags_type(SA_RESETHAND), MacBook Pro DOVIL igrale provided signal Box static caststypename detail: :sigaction_flags_type>(SA_RESETHAND), delse 11 Otherwise, just the correct POSIX value... SA RESETHAND, tendif // Sifdef synchronous defaultauto_restart system calls, asynchronous_default - Interruptableauto_restart_system_calls 102 }; T 187 10 10 110 a ndler_op install signal_handler Signal_id consta id, ional handler op const& op signal handler default, Signal_handler_flags const& flagssignal_handler_flags :: synchronous_default ): 1 11 The following inline functions allow one to pass a signat handler 1 using a function pointer (sional-style or sigaction-style instead 116 inline signal_handler_op install signal_handler signal_id const& id, signal_handler_op11 traditional_op_type consta op. 11 Sional_handler_flags const& flagssignal_handler_flags11 synchronous default 12 return install signal_handlertid, signal_handler_op(op), flags) 125 126 127 intine signal_handler_op install signal_handler signal_id consta id, Signal_handler_opiisigaction_op_type const& op. MacBook Pro Selection Find Packages Window Help provided signal Documents Advanced Programming Co provided-signal.hr 110 inline signal_handler_op install signal_handler Signal_id consta id, Signal_handler_opis traditional_op_type consta op, Sional_handler_flags flagssignal_handler_flags.: synchronous default return install sional handler ad, signalhandler_op(op), Flags) 125 126 127 inline signal_handler_op install signalhandler signal_id consta id, signal_handler_op:: sigaction_op_type consta op. nal_handler_flags const& flags signal_handler_flagsis synchronous_defa return install signalhandler id, signal_handler_oplop), Flags 137 138 39 // The following convenience inline functions allow one pass a list (s.e., a 11 stdrinitializer_list signal_id) of signal numbers to install a specific 1/ handler. 161 142 inline stdrivector signal_handler_op install signal_handler stdii initializer_list signalido consta ids, signal_handler_op conste op signal_handler_default, Sional_handler_flags conste Flagssignalandler_flags11 synchronous_default stdii vector signal_handler_oppretval(); for (autob id ids) retval.push_back install signal_handler( id, op, flags)): return retrats MacBook Pro GAR File Edit View Selection Find Packages Window Help provided-signalho /Documents/Advanced Programming C++ provided signalhas Project d Programming C 141 inline std::ver n al_handler_op install signal_handler std::initializer_ st signal_1d consta ids, signal_handler_op constop signal_handler_default, Sional handler_flags const& flags signal_handler_flags! 1 synchronous_default de- al ha alho std::vector signal_handler_ope retval(); for (autos id : ids) retval.push_back install signal_handler( id, op, flags)); return retval: 153 155 inline std::vector signal handler op install signal handler std::initializer listesignal_id consta ids, signal handler op::traditional op type consta op. signal_handler flags consta flags signal handler flagst i synchronous_default 158 160 std::vector signal_handler_opretval(); for (autos id ids) retval.push_back install signal_handtertad, signal_handler_oplop), flags) return retvat: 169 se inline stor vector signal handler og install signal_handler std::initializer listesignal_id consta ids, signal_handler op!usigaction_op_type consta op. signal_handler flags conste flags signal_handler_flags::synchronous default 173 std: vector signal_handler_opretval(); OROW MacBook Pro 123ABOGB provided-signal.hxx - -/Documents/Advanced Programming C++ signal.hxx provided-signal.hxx std::vector retval{}; 174 for (auto& id : id 175 retval.push_back 176 install_signal_handler(id, signal_handler_op{op), flags) 177 ); 178 return retval; 179 } 18e 183 boot block_signals(std::initializer_list const& ids); 181 bool unblock_signals(std::initializer_list signal_id> const& id); 185 186 // 187 188 template 189 auto block_signals(Container const& c) -> 190 std::enable_if 191 std::is_same_v 192 std:: remove_cv_ta 193 std:: remove_reference tatypename Container::value type> 194 195 Signal_id 196 197 bool GE 199 sigset_t mask; 201 sigemptyset (mask); for (auto consta id : c) sigaddset (mask, id); 204 return sigprocmask(SIG_SETMASK, mask, NULL) - -1; MacBook Pro File Edit View Selection Find Packages Window Help D provided-signal.hxx--/Documents/Advanced Programming provided-signal.hocx Project signal ogramming C++ 209 template 210 auto unblock_signals(Container const& c) -> 211 std::enable_ita std::is_same_v 213 std:: remove_cv_tz std: remove_reference ttypename Container::value lloworld.com rovided-signal.com vided-signals signal 212 signal_id bool 219 220 1221 222 223 sigset_t mask; sigemptyset (Emask); for (auto const& id : c) sigaddset (mask, id); return sigprocrask(SIG_UNBLOCK, Smask, NULL) I= -1; 225 230. inline bool block_signal(signal_id const& id) 231 { 232 return block_signals({id}); 233 235 inline bool unblock_signal(signalid const& id) return unblock_signals({id}); 239 MacBook Pro std::renove_reference_tstypename Container::value_type signal_id bool sigset_t mask; sigemptyset (mask); 223 for (auto consta id : c) Sigaddset (mask, id); 25 return sigprocmask(SIG_UNBLOCK, Smask, NULL) != -1; 226 ) 230 231 232 inline boot block_signal(signal_id consta id) { return block_signals({id}); 235 inline bool unblock_signal(signalid consta id) return unblock_signals((id)); 237 238 241 242 >1 namespace comp3400_2020w11003 2 Bendif // Binder COMP 3400 2020W_A3 provided_signal MacBook Pro e TW ER Selection Find Packages Window Help provided-signal.cxx--Documents/Advanced Programming C++ provided the 1 include Sinclude "signal.hxx" namespace comp3400_2020 signal_handler_op::traditional_op_type const signal_handler_op::ERROR = SIG_ERR; signal_handler_op::traditional_op_type const signal_handler_op::IGNORE - SIG_IGN; sional handler op::traditional op type const signal handler op::DEFAULT = SIG DFL: 10 signal_handler_op install signal_handler sional id consta id, handler op consta op. dler_flags consta flags I struct sigaction act: sigenptyset (act.sa_mask): Set the required flags... act.sa_flags = static_cast std::underlying_type_t signal_handler_flags>(flags) // Set the appropriate handler function.. if (op.is traditional) act.sa handler op.traditional_op(); else act.sa_sigaction = op.sigaction op(); act.sa flags SA SIGINFO: struct sigaction old act: memset(old act, O, sizeoftold act); MacBook Pro ) NS 9 0 View Selection Find Packages Window Help provided-signal.cxx--/Documents/Advanced Programming C++ signal provided-signalux 23.co act.sa_flags [= SA_SIGINFO; C++ struct sigaction o memset(cold_act, e, f (old_act)); 37 38 if (sigaction(id, act, bold_act) w -1) return (signal_handler_error }; else if ((old act.sa flags & SA_SIGINFO) BE SA SIGINFO) return ( old_act.sa_sigaction }; { old_act.sa_handler ); 44bool block_signals(std::initializer_list const& ids) 56 sigset_t mask; sigemptyset (mask); for (auto consta id : ids) sigaddset (mask, id); return sigprocmask(SIG_UNBLOCK, Emask, NULL) != -1; 59 62 // namespace comp3400_2020W:: 203 CK11 MacBook Pro lection Find Packages Window include catonis include void 10. store signo, nemory_order_release): 21 signalhandler flags synchronous Default 24 for auto cucin.get char traits charioteoftel: Cecin.get()) if (id INVALID_SIGNAL) - - cout a signo1 cc id, load memory order acourel id.store INVALID_SIGNAL, memory_order_releasel coutstatic_casteunsignedetele : coute "\: MacBook Pro Bifndef COMP3400_2020_A3_signalha define COMP3400_2020_AB_signahak B include signals ude est except include et traits le cinitializer List namespace comp.3400_202 203 1 1 TODO Define class li here 21 TODO: Define sitanter error inte der er mere 31 Define signal handler geret and sel andere here B : Define signal_andler_default and signal_ ter_default here class l_handler_ee 100010.4.0 oer MacBook Pro Selection Find Packages 3) class signal_handler_op private TODO: Define op here. Pablic: TODO: Define traditional_op_type here. 11 TODO: Define si action type here. 02 46 45 private: TODO: Declare ERROR here. Definition is in pri s l .com 11 TODO: Declare IGNORE here. Definition is in provinsial.com // TODO: Declare DEFAULT here. Definition is provi sional. ) op_type type union traditionaloptypes_handler sigaction_op_type sa sigaction public TODO: Define all constructors and functions intim e signal handler op() signal handler signalhandler og cost shel: signal handler op sperater na handler op cost sho: signal_handler_apisignalhandler_default_t const Signal_handler_eple operator handler default Cat ) signal_handler_ signalhandler_ignoret const signal_handler_06 operater f ra handler_agnere con signal handler opsional handler error cont; MacBook Pro Selection Find Packa h e ment Programming C.. signa andler op operator tagna andler_error_t consta Signalhandler_epitraditional_op_type conste opls signal_handler_ople operator tradition Lop_type const opla Signalhandler opsiocong type const op signalhandler_ople operator (sigaction_ep_type const opla operator bool() const bool is error() consti bool is default() consti bool ishorel) const 31 bool is traditional() consti bool isigactie) consti traditional sigation opt type traditional ) con i onction ) consts bool operator signal handler op conta consta bool operater in signalhandler o conta consta Il nespace C 0 _2020 #include "provided-signal.hr MacBook Pro BABA 1 Bifndef COMP3400_2020W_A03_provided_signal_hxx. #define COMP3400_2020W_A03_provided_signal_hxx_ 6 7 8 9 #include #include #include ace comp3400_2026w::a3 { 16 17 /1 1 1/ The macros below used to detect an operating system varies by compiler 1911 and operating system. A site that lists these macro names by os 2011 is here: 21 22 / https://sourceforge.net/p/predef/wiki/Operating Systems/ 25 26 27 28 29 /1 // POSIX systems define struct sigaction's sa_flags member to be an "int". !! One might want to write code to determine the type of a struct member. // This can be easily done in C++11. See the detail namespace below. // 31 namespace detail { 34 35 1 Since sigaction is also the name of a function, referring to sigaction l can refer to struct sioaction or the function. To avoid a broblema MacBook Pro WANI w Selection Find Packages Window Help provided-signal.hxx-/Documents/Advanced Programming C++ provided-signal.hxx Sonali 31 namespace detail { 34 Since sigaction is the name of a function, referring to sigaction 35 // can refer to struct sigaction or the function. To avoid a problem, a 36 // type alias, struct sigaction_type, is defined and set to the struct 37 // sigaction type --not the sigaction function type. 31 39 using struct_sigaction_type = struct sigaction; 42 7 on idiom in C++ is to use a function template prototype in 43 // conjunction with code that ONLY looks at the return type of a function to 44 // figure out things about the type(s) passed in to that function's 45 // arguments. Such expressions must be only used within decltype 46 // for noexcept() clauses). 47 / 4811 NOTE: This function will NEVER be defined: only its prototype exists. 50 // The get_member_type() prototype only accepts a pointer to a member. If 511/ called with a pointer to a member, per language rules with function S2 // template argument type deduction, type deduction occurs. This causes 531/ T to be the struct/union/class type of the pointer passed in, and, 54// N to be the type of the member. 55 // 56 11 NOTE: Clearly this all happens at compile-time. 5711 58 template 59 H get member type(M T::.); 6211 Define a type alias, sigaction flags_type, to be the type of the 63 11struct sigaction's saflags member. Two things are important here: 64 | The "&" is needed some one needs a pointer to the member, and MacBook Pro View Selection Find Packages Window Help provided-signal.hxx--/Documents/Advanced Programming C++ provided-signal.hxx a3.co signal.ro // Define a type autosigaction Flags_type, to be the type of the 621/ struct sigactie flags member. Two things are important ner 64 // The '&' is neede e one needs a pointer to the member, and, 65 // the entire function "call" is wrapped in decltype which ONLY 66 // determines the resulting type of the expression: no code is ever called 68 // The result is sigaction_flags_type has the type of the sa_flags member. sing sigaction_flags_type = pe(detail::get_member_type(detail::struct_sigaction type 74 ) // namespace detail 76 77 78 enum class signal_handler_flags : typename detail isigaction_flags_type ( interruptable = SA_NODEFER, auto_restart_system_calls = SA_RESTART, revert_to_default = #if defined(_gnu_linux_) || defined(_linux_) 81 82 1/ For some unknown reason, SA RESETHAND in Linux is set to a value // larger than the maximus allowed by int, i.e., the value is likely // intended to be negative being improperly set with a positive value greater than /stdrinumeric limits intimax(). A static cast is used here to force successful compilation (and non-portable integer wrapping). NOTE: Since this is from the operating system it is "de facto correct even though it violates the standard, thus, we force the value to be set. 92 static_caststypename detailussigaction_flags_type(SA_RESETHAND), MacBook Pro DOVIL igrale provided signal Box static caststypename detail: :sigaction_flags_type>(SA_RESETHAND), delse 11 Otherwise, just the correct POSIX value... SA RESETHAND, tendif // Sifdef synchronous defaultauto_restart system calls, asynchronous_default - Interruptableauto_restart_system_calls 102 }; T 187 10 10 110 a ndler_op install signal_handler Signal_id consta id, ional handler op const& op signal handler default, Signal_handler_flags const& flagssignal_handler_flags :: synchronous_default ): 1 11 The following inline functions allow one to pass a signat handler 1 using a function pointer (sional-style or sigaction-style instead 116 inline signal_handler_op install signal_handler signal_id const& id, signal_handler_op11 traditional_op_type consta op. 11 Sional_handler_flags const& flagssignal_handler_flags11 synchronous default 12 return install signal_handlertid, signal_handler_op(op), flags) 125 126 127 intine signal_handler_op install signal_handler signal_id consta id, Signal_handler_opiisigaction_op_type const& op. MacBook Pro Selection Find Packages Window Help provided signal Documents Advanced Programming Co provided-signal.hr 110 inline signal_handler_op install signal_handler Signal_id consta id, Signal_handler_opis traditional_op_type consta op, Sional_handler_flags flagssignal_handler_flags.: synchronous default return install sional handler ad, signalhandler_op(op), Flags) 125 126 127 inline signal_handler_op install signalhandler signal_id consta id, signal_handler_op:: sigaction_op_type consta op. nal_handler_flags const& flags signal_handler_flagsis synchronous_defa return install signalhandler id, signal_handler_oplop), Flags 137 138 39 // The following convenience inline functions allow one pass a list (s.e., a 11 stdrinitializer_list signal_id) of signal numbers to install a specific 1/ handler. 161 142 inline stdrivector signal_handler_op install signal_handler stdii initializer_list signalido consta ids, signal_handler_op conste op signal_handler_default, Sional_handler_flags conste Flagssignalandler_flags11 synchronous_default stdii vector signal_handler_oppretval(); for (autob id ids) retval.push_back install signal_handler( id, op, flags)): return retrats MacBook Pro GAR File Edit View Selection Find Packages Window Help provided-signalho /Documents/Advanced Programming C++ provided signalhas Project d Programming C 141 inline std::ver n al_handler_op install signal_handler std::initializer_ st signal_1d consta ids, signal_handler_op constop signal_handler_default, Sional handler_flags const& flags signal_handler_flags! 1 synchronous_default de- al ha alho std::vector signal_handler_ope retval(); for (autos id : ids) retval.push_back install signal_handler( id, op, flags)); return retval: 153 155 inline std::vector signal handler op install signal handler std::initializer listesignal_id consta ids, signal handler op::traditional op type consta op. signal_handler flags consta flags signal handler flagst i synchronous_default 158 160 std::vector signal_handler_opretval(); for (autos id ids) retval.push_back install signal_handtertad, signal_handler_oplop), flags) return retvat: 169 se inline stor vector signal handler og install signal_handler std::initializer listesignal_id consta ids, signal_handler op!usigaction_op_type consta op. signal_handler flags conste flags signal_handler_flags::synchronous default 173 std: vector signal_handler_opretval(); OROW MacBook Pro 123ABOGB provided-signal.hxx - -/Documents/Advanced Programming C++ signal.hxx provided-signal.hxx std::vector retval{}; 174 for (auto& id : id 175 retval.push_back 176 install_signal_handler(id, signal_handler_op{op), flags) 177 ); 178 return retval; 179 } 18e 183 boot block_signals(std::initializer_list const& ids); 181 bool unblock_signals(std::initializer_list signal_id> const& id); 185 186 // 187 188 template 189 auto block_signals(Container const& c) -> 190 std::enable_if 191 std::is_same_v 192 std:: remove_cv_ta 193 std:: remove_reference tatypename Container::value type> 194 195 Signal_id 196 197 bool GE 199 sigset_t mask; 201 sigemptyset (mask); for (auto consta id : c) sigaddset (mask, id); 204 return sigprocmask(SIG_SETMASK, mask, NULL) - -1; MacBook Pro File Edit View Selection Find Packages Window Help D provided-signal.hxx--/Documents/Advanced Programming provided-signal.hocx Project signal ogramming C++ 209 template 210 auto unblock_signals(Container const& c) -> 211 std::enable_ita std::is_same_v 213 std:: remove_cv_tz std: remove_reference ttypename Container::value lloworld.com rovided-signal.com vided-signals signal 212 signal_id bool 219 220 1221 222 223 sigset_t mask; sigemptyset (Emask); for (auto const& id : c) sigaddset (mask, id); return sigprocrask(SIG_UNBLOCK, Smask, NULL) I= -1; 225 230. inline bool block_signal(signal_id const& id) 231 { 232 return block_signals({id}); 233 235 inline bool unblock_signal(signalid const& id) return unblock_signals({id}); 239 MacBook Pro std::renove_reference_tstypename Container::value_type signal_id bool sigset_t mask; sigemptyset (mask); 223 for (auto consta id : c) Sigaddset (mask, id); 25 return sigprocmask(SIG_UNBLOCK, Smask, NULL) != -1; 226 ) 230 231 232 inline boot block_signal(signal_id consta id) { return block_signals({id}); 235 inline bool unblock_signal(signalid consta id) return unblock_signals((id)); 237 238 241 242 >1 namespace comp3400_2020w11003 2 Bendif // Binder COMP 3400 2020W_A3 provided_signal MacBook Pro e TW ER Selection Find Packages Window Help provided-signal.cxx--Documents/Advanced Programming C++ provided the 1 include Sinclude "signal.hxx" namespace comp3400_2020 signal_handler_op::traditional_op_type const signal_handler_op::ERROR = SIG_ERR; signal_handler_op::traditional_op_type const signal_handler_op::IGNORE - SIG_IGN; sional handler op::traditional op type const signal handler op::DEFAULT = SIG DFL: 10 signal_handler_op install signal_handler sional id consta id, handler op consta op. dler_flags consta flags I struct sigaction act: sigenptyset (act.sa_mask): Set the required flags... act.sa_flags = static_cast std::underlying_type_t signal_handler_flags>(flags) // Set the appropriate handler function.. if (op.is traditional) act.sa handler op.traditional_op(); else act.sa_sigaction = op.sigaction op(); act.sa flags SA SIGINFO: struct sigaction old act: memset(old act, O, sizeoftold act); MacBook Pro ) NS 9 0 View Selection Find Packages Window Help provided-signal.cxx--/Documents/Advanced Programming C++ signal provided-signalux 23.co act.sa_flags [= SA_SIGINFO; C++ struct sigaction o memset(cold_act, e, f (old_act)); 37 38 if (sigaction(id, act, bold_act) w -1) return (signal_handler_error }; else if ((old act.sa flags & SA_SIGINFO) BE SA SIGINFO) return ( old_act.sa_sigaction }; { old_act.sa_handler ); 44bool block_signals(std::initializer_list const& ids) 56 sigset_t mask; sigemptyset (mask); for (auto consta id : ids) sigaddset (mask, id); return sigprocmask(SIG_UNBLOCK, Emask, NULL) != -1; 59 62 // namespace comp3400_2020W:: 203 CK11 MacBook Pro

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions