📄 etc.cpp
字号:
/*************************************************************************** etc.cpp - description ------------------- begin : Fri Jul 20 2001 copyright : (C) 2001 by Mark email : alben@yeah.net ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include <errno.h>#include "exception.h"#include "etc.h"SigFunc* Signal(int iSigNo, SigFunc* func, bool bRestart){ struct sigaction act, oact; act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0; if (bRestart) {#ifdef SA_RESTART act.sa_flags |= SA_RESTART;#endif } else {#ifdef SA_INTERRUPT act.sa_flags |= SA_INTERRUPT;#endif } if (sigaction(iSigNo, &act, &oact) < 0) throw CException(strerror(errno), __FILE__, __LINE__); return oact.sa_handler;}pid_t Fork(){ pid_t tPId = fork(); if (tPId < 0) throw CException(strerror(errno), __FILE__, __LINE__); return tPId;}int Kill(pid_t tPId, int iSigNo){ int iRet = kill(tPId, iSigNo); if (iRet < 0) throw CException(strerror(errno), __FILE__, __LINE__); return iRet;}int Sigprocmask(int iHow, const sigset_t* pNewSet, sigset_t* pOldSet){ int iRet; if ((iRet = sigprocmask(iHow, pNewSet, pOldSet)) < 0) throw CException(strerror(errno), __FILE__, __LINE__); return iRet;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -