# File lib/unix/sys/cpu.rb, line 320
    def self.state(num = 0)
      raise NoMethodError unless respond_to?(:processor_info, true)

      pinfo = ProcInfo.new

      if processor_info(num, pinfo) < 0
        raise Error, "process_info function failed"
      end

      case pinfo[:pi_state].to_i
        when P_ONLINE
          "online"
        when P_OFFLINE
          "offline"
        when P_POWEROFF
          "poweroff"
        when P_FAULTED
          "faulted"
        when P_NOINTR
          "nointr"
        when P_SPARE
          "spare"
        else
          "unknown"
      end
    end