def daemonize(self):
        """Daemonize process by doing Stevens double fork."""

        # flush any buffered data before fork/dup2.
        if self.stdout is not DEVNULL:
            self.stdout.flush()
        if self.stderr is not DEVNULL:
            self.stderr.flush()
        # sys.std* may not match STD{OUT,ERR}_FILENO.  Tough.
        for f in (sys.stdout, sys.stderr):
            f.flush()

        # fork first time
        self._fork()

        # decouple from parent environment
        os.chdir("/")
        os.setsid()
        os.umask(0)

        # fork second time
        self._fork()

        # redirect standard file descriptors
        with open(os.devnull, 'w+') as devnull:
            stdin = devnull if self.stdin <= DEVNULL else self.stdin
            stdout = devnull if self.stdout is DEVNULL else self.stdout
            stderr = devnull if self.stderr is DEVNULL else self.stderr
            os.dup2(stdin.fileno(), STDIN_FILENO)
            os.dup2(stdout.fileno(), STDOUT_FILENO)
            os.dup2(stderr.fileno(), STDERR_FILENO)

        if self.pidfile is not None:
            # write pidfile
            atexit.register(self.delete_pid)
            signal.signal(signal.SIGTERM, self.handle_sigterm)
            self.pidfile.write(os.getpid())
dataset/ETHPy150Open openstack/neutron/neutron/agent/linux/daemon.py/Daemon.daemonize/operator `is` -> `<=`