当前位置: 首页>>代码示例>>Python>>正文


Python signal.SIGBUS属性代码示例

本文整理汇总了Python中signal.SIGBUS属性的典型用法代码示例。如果您正苦于以下问题:Python signal.SIGBUS属性的具体用法?Python signal.SIGBUS怎么用?Python signal.SIGBUS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在signal的用法示例。


在下文中一共展示了signal.SIGBUS属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sig2exc

# 需要导入模块: import signal [as 别名]
# 或者: from signal import SIGBUS [as 别名]
def sig2exc(sig, frm):
            """ signal handler """

            error = PilotErrors()
            runJob.setGlobalPilotErrorDiag("!!FAILED!!3000!! SIGTERM Signal %s is caught in child pid=%d!\n" % (sig, os.getpid()))
            tolog(runJob.getGlobalPilotErrorDiag())
            if sig == signal.SIGTERM:
                runJob.setGlobalErrorCode(error.ERR_SIGTERM)
            elif sig == signal.SIGQUIT:
                runJob.setGlobalErrorCode(error.ERR_SIGQUIT)
            elif sig == signal.SIGSEGV:
                runJob.setGlobalErrorCode(error.ERR_SIGSEGV)
            elif sig == signal.SIGXCPU:
                runJob.setGlobalErrorCode(error.ERR_SIGXCPU)
            elif sig == signal.SIGBUS:
                runJob.setGlobalErrorCode(error.ERR_SIGBUS)
            elif sig == signal.SIGUSR1:
                runJob.setGlobalErrorCode(error.ERR_SIGUSR1)
            else:
                runJob.setGlobalErrorCode(error.ERR_KILLSIGNAL)
            runJob.setFailureCode(runJob.getGlobalErrorCode)
            # print to stderr
            print >> sys.stderr, runJob.getGlobalPilotErrorDiag()
            raise SystemError(sig) 
开发者ID:PanDAWMS,项目名称:pilot,代码行数:26,代码来源:RunJobEdison.py

示例2: sig2exc

# 需要导入模块: import signal [as 别名]
# 或者: from signal import SIGBUS [as 别名]
def sig2exc(sig, frm):
            """ signal handler """

            error = PilotErrors()
            runJob.setGlobalPilotErrorDiag("!!FAILED!!3000!! SIGTERM Signal %s is caught in child pid=%d!\n" % (sig, os.getpid()))
            tolog(runJob.getGlobalPilotErrorDiag())
            if sig == signal.SIGTERM:
                runJob.setGlobalErrorCode(error.ERR_SIGTERM)
            elif sig == signal.SIGQUIT:
                runJob.setGlobalErrorCode(error.ERR_SIGQUIT)
            elif sig == signal.SIGSEGV:
                runJob.setGlobalErrorCode(error.ERR_SIGSEGV)
            elif sig == signal.SIGXCPU:
                runJob.setGlobalErrorCode(error.ERR_SIGXCPU)
            elif sig == signal.SIGBUS:
                runJob.setGlobalErrorCode(error.ERR_SIGBUS)
            elif sig == signal.SIGUSR1:
                runJob.setGlobalErrorCode(error.ERR_SIGUSR1)
            else:
                runJob.setGlobalErrorCode(error.ERR_KILLSIGNAL)
            runJob.setFailureCode(runJob.getGlobalErrorCode())
            # print to stderr
            print >> sys.stderr, runJob.getGlobalPilotErrorDiag()
            raise SystemError(sig) 
开发者ID:PanDAWMS,项目名称:pilot,代码行数:26,代码来源:RunJob.py

示例3: signal_to_string

# 需要导入模块: import signal [as 别名]
# 或者: from signal import SIGBUS [as 别名]
def signal_to_string(self, signalNumber):
        if signalNumber < 0:
            signalNumber = signalNumber * -1

        if signalNumber == signal.SIGINT:
            return "SIGINT - Interrupt (Ctrl+C)"
        elif signalNumber == signal.SIGKILL:
            return "SIGKILL - Killed"
        elif signalNumber == signal.SIGTERM:
            return "SIGTERM - Terminated"
        elif signalNumber == signal.SIGSEGV:
            return "SIGSEGV - Segmentation fault"
        elif signalNumber == signal.SIGHUP:
            return "SIGHUP - Hang up"
        elif signalNumber == signal.SIGBUS:
            return "SIGBUS - Bus error"
        elif signalNumber == signal.SIGILL:
            return "SIGILL - Illegal instruction"
        elif signalNumber == signal.SIGFPE:
            return "SIGFPE - Floating point exception"
        elif signalNumber == signal.SIGPIPE:
            return "SIGPIPE - Broken pipe (write to pipe with no readers)"
        elif signalNumber == signal.SIGABRT:
            return "SIGABRT - Called abort()"
        elif signalNumber == signal.SIGXFSZ:
            return "SIGXFSZ - Process created files that were too big."
        elif signalNumber == signal.SIGXCPU:
            return "SIGXCPU - Process used too much CPU time."
        else:
            return "Unknown signal #" + str(signalNumber) 
开发者ID:skuhl,项目名称:autograder,代码行数:32,代码来源:autograder.py

示例4: test_sigbus

# 需要导入模块: import signal [as 别名]
# 或者: from signal import SIGBUS [as 别名]
def test_sigbus(self):
        self.check_fatal_error("""
            import _testcapi
            import faulthandler
            import signal

            faulthandler.enable()
            _testcapi.raise_signal(signal.SIGBUS)
            """,
            6,
            'Bus error') 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:13,代码来源:test_faulthandler.py

示例5: GetMonitorData

# 需要导入模块: import signal [as 别名]
# 或者: from signal import SIGBUS [as 别名]
def GetMonitorData(self):
        time.sleep(self.lookout_time)
        sytem_crash_report = self.get_crash_report(self.system_report_path)
        bucket = {}

        if not len(self.crash_trace):
            if self.process.returncode < 0:
                crashSignals = [
                    # POSIX.1-1990 signals
                    signal.SIGILL,
                    signal.SIGABRT,
                    signal.SIGFPE,
                    signal.SIGSEGV,
                    # SUSv2 / POSIX.1-2001 signals
                    signal.SIGBUS,
                    signal.SIGSYS,
                    signal.SIGTRAP,
            ]
            for crashSignal in crashSignals:
                if process.returncode == -crashSignal:
                    bucket["auxdat.txt"] = "Process exited with signal: %d" % -process.returncode
        else:
            bucket["auxdat.txt"] = "".join(self.crash_trace)

        if sytem_crash_report:
            bucket["system_crash_report.txt"] = sytem_crash_report

        if self.console_log:
            bucket["stdout.txt"] = "".join(self.console_log[-1000:])

        if self.failure:
            meta = {
                "environ": os.environ.data,
                "command": self.arguments
            }
            bucket["meta.txt"] = json.dumps(dict(meta))
            bucket["Bucket"] = os.path.basename(self.command)
            return bucket 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:40,代码来源:process.py

示例6: _StartProcess

# 需要导入模块: import signal [as 别名]
# 或者: from signal import SIGBUS [as 别名]
def _StartProcess(self):
        MonitorDebug(self._name, "_StartProcess")
        self.failure = False
        self.sanlog = []
        self.stderr = []
        self.stdout = []

        print("Command: {}".format(self.arguments))
        self.process = Popen(self.arguments, stderr=PIPE, stdout=PIPE,
                             env=os.environ, bufsize=1, close_fds=isPosix())

        # Todo: Add timeout= for GUI applications.
        stdout, stderr = self.process.communicate()

        if stderr.find("ERROR: AddressSanitizer: ") != -1:
            if stderr.find("AddressSanitizer failed to allocate") == -1:
                self.failure = True
                self.sanlog = re.findall(self.asan_regex, stderr, re.DOTALL)[0]
                self.stdout = stdout
                self.stderr = stderr
        else:
            if self.process.returncode < 0:
                crashSignals = [
                    # POSIX.1-1990 signals
                    signal.SIGILL,
                    signal.SIGABRT,
                    signal.SIGFPE,
                    signal.SIGSEGV,
                    # SUSv2 / POSIX.1-2001 signals
                    signal.SIGBUS,
                    signal.SIGSYS,
                    signal.SIGTRAP,
            ]
            for crashSignal in crashSignals:
                if process.returncode == -crashSignal:
                    self.failure = True
                    self.sanlog = "Process exited with signal: %d" % -process.returncode
                    self.stdout = stdout
                    self.stderr = stderr

        if self.failure:
            self._StopProcess() 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:44,代码来源:process.py


注:本文中的signal.SIGBUS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。