46 emsg.
Init(
"RtclSignalAction::Init",
"already initialized");
52 }
catch (exception& e) {
53 emsg.
Init(
"RtclSignalAction::Init",
string(
"exception: ")+e.what());
58 reinterpret_cast<ClientData
>(
fpObj));
80 struct sigaction sigact = {};
83 if (::sigaction(signum, &sigact, &
fOldAction[signum]) != 0) {
84 emsg.
InitErrno(
"RtclSignalAction::SetAction",
85 "sigaction() failed: ", errno);
101 emsg.
Init(
"RtclSignalAction::GetAction",
"no action for signal");
116 emsg.
Init(
"RtclSignalAction::ClearAction",
"no action for signal");
120 if (::sigaction(signum, &
fOldAction[signum],
nullptr) != 0) {
121 emsg.
InitErrno(
"RtclSignalAction::ClearAction",
122 "sigaction() failed: ", errno);
135 if (signum > 0 && signum < 32) {
147 emsg.
Init(
"RtclSignalAction::ValidSignal",
"unsupported signal");
157 Tcl_Read(
fShuttleChn,
reinterpret_cast<char*
>(&signum),
sizeof(signum));
160 Tcl_SetVar2Ex(
fpInterp,
"Rutil_signum",
nullptr,
161 Tcl_NewIntObj(
int(signum)), 0);
178 char signum_c = signum;
181 cerr <<
"RtclSignalAction::SignalHandler-E: write() failed, errno="
184 cerr <<
"RtclSignalAction::SignalHandler-E: spurious call" << endl;
221 if (::pipe(pipefd) < 0)
222 throw Rexception(
"RtclSignalAction::<ctor>",
"pipe() failed: ", errno);
231 Tcl_SetChannelOption(
nullptr,
fShuttleChn,
"-buffersize",
"64");
232 Tcl_SetChannelOption(
nullptr,
fShuttleChn,
"-encoding",
"binary");
233 Tcl_SetChannelOption(
nullptr,
fShuttleChn,
"-translation",
"binary");
235 Tcl_CreateChannelHandler(
fShuttleChn, TCL_READABLE,
237 reinterpret_cast<ClientData
>(
this));
245 for (
size_t i=0; i<32; i++) {
void Init(const std::string &meth, const std::string &text)
FIXME_docs.
void InitErrno(const std::string &meth, const std::string &text, int errnum)
FIXME_docs.
static void ThunkTclChannelHandler(ClientData cdata, int mask)
FIXME_docs.
bool SetAction(int signum, Tcl_Obj *pobj, RerrMsg &emsg)
FIXME_docs.
void TclChannelHandler(int mask)
FIXME_docs.
struct sigaction fOldAction[32]
original sigaction
static RtclSignalAction * fpObj
pointer to singleton
static bool Init(Tcl_Interp *interp, RerrMsg &emsg)
FIXME_docs.
~RtclSignalAction()
Destructor.
static RtclSignalAction * Obj()
FIXME_docs.
RtclSignalAction(Tcl_Interp *interp)
constructor
bool fActionSet[32]
true if SetAction() done
int fFdPipeWrite
attn pipe write fd
bool ClearAction(int signum, RerrMsg &emsg)
FIXME_docs.
static void ThunkTclExitProc(ClientData cdata)
FIXME_docs.
Tcl_Channel fShuttleChn
Tcl channel.
bool GetAction(int signum, Tcl_Obj *&pobj, RerrMsg &emsg)
FIXME_docs.
bool ValidSignal(int signum, RerrMsg &emsg)
FIXME_docs.
Tcl_Interp * fpInterp
Tcl interpreter used.
int fFdPipeRead
attn pipe read fd
RtclOPtr fpScript[32]
action scripts
static void SignalHandler(int signum)
FIXME_docs.
Declaration of class ReventLoop.