# Path: mirror/common.py
# def write_stderr(message, *args):
#     """
#     """
#     sys.stderr.write(message % args)
#     sys.stderr.write("\n")


import os, sys
import time
import mmap
import struct
import signal
    import cPickle as pickle
    import pickle
import mirror.color
import mirror.common
import mirror.task  as task
import mirror.error as error
    import mirror.configmanager
from mirror.common import write_stderr
    buffer.seek(2)
    size = struct.unpack("I", buffer.read(4))[0]

    taskqueue = pickle.loads(buffer.read(size))
    formatstr = ("Task:"+mirror.color.FOREGROUND_COLORS.GREEN
                +"%-18s"+mirror.color.COLOR_RESET+"\ttype:%14s\ttime: %s")
    for taskinfo in taskqueue:
        print(formatstr % (
              taskinfo.name, TASK_DESC[taskinfo.tasktype],
              time.asctime(time.localtime(taskinfo.time))))

    buffer.close()
    return error.MIRROR_OK

signals = {
          "stop"  : signal.SIGQUIT,
          "reload": signal.SIGHUP,
          } if mirror.common.is_os_windows else {
          "stop"  : signal.SIGINT,
          }

def signal_process(signame):
    signames = signals.keys()
    if signame not in signames:
        write_stderr(_("Invalid value for -s, "
                       "available: ") + ", ".join(signames))
        return error.MIRROR_ERRARG
    pidfile = mirror.configmanager.get_config_dir("mirrord.pid")
    pid = mirror.common.read_mirrord_pid(pidfile)
    if not pid:

# Path: mirror/common.py
# def write_stderr(message, *args):
#     """
#     """
#     sys.stderr.write(message % args)
#     sys.stderr.write("\n")


# Path: mirror/console.py
import os, sys
import time
import mmap
import struct
import signal
    import cPickle as pickle
    import pickle
import mirror.color
import mirror.common
import mirror.task  as task
import mirror.error as error
    import mirror.configmanager
from mirror.common import write_stderr

    buffer.seek(2)
    size = struct.unpack("I", buffer.read(4))[0]

    taskqueue = pickle.loads(buffer.read(size))
    formatstr = ("Task:"+mirror.color.FOREGROUND_COLORS.GREEN
                +"%-18s"+mirror.color.COLOR_RESET+"\ttype:%14s\ttime: %s")
    for taskinfo in taskqueue:
        print(formatstr % (
              taskinfo.name, TASK_DESC[taskinfo.tasktype],
              time.asctime(time.localtime(taskinfo.time))))

    buffer.close()
    return error.MIRROR_OK

signals = {
          "stop"  : signal.SIGQUIT,
          "reload": signal.SIGHUP,
          } if mirror.common.is_os_windows else {
          "stop"  : signal.SIGINT,
          }

def signal_process(signame):
    signames = signals.keys()
    if signame not in signames:
        write_stderr(_("Invalid value for -s, "
                       "available: ") + ", ".join(signames))
        return error.MIRROR_ERRARG
    pidfile = mirror.configmanager.get_config_dir("mirrord.pid")
    pid = mirror.common.read_mirrord_pid(pidfile)
    if not pid:

        write_stderr(_("Can not read mirrord's pid, "