python: Fix several pep8 whitespace errors.
[cascardo/ovs.git] / python / ovs / daemon.py
index 0d119f2..61355c4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2011 Nicira Networks
+# Copyright (c) 2010, 2011, 2012 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import time
 
 import ovs.dirs
 import ovs.fatal_signal
-#import ovs.lockfile
 import ovs.process
 import ovs.socket_util
 import ovs.timeval
@@ -78,23 +77,12 @@ def set_pidfile(name):
     _pidfile = make_pidfile_name(name)
 
 
-def get_pidfile():
-    """Returns an absolute path to the configured pidfile, or None if no
-    pidfile is configured."""
-    return _pidfile
-
-
 def set_no_chdir():
     """Sets that we do not chdir to "/"."""
     global _chdir
     _chdir = False
 
 
-def is_chdir_enabled():
-    """Will we chdir to "/" as part of daemonizing?"""
-    return _chdir
-
-
 def ignore_existing_pidfile():
     """Normally, daemonize() or daemonize_start() will terminate the program
     with a message if a locked pidfile already exists.  If this function is
@@ -265,7 +253,6 @@ def _fork_and_wait_for_startup():
         # Running in parent process.
         os.close(rfd)
         ovs.timeval.postfork()
-        #ovs.lockfile.postfork()
 
         global _daemonize_fd
         _daemonize_fd = wfd
@@ -362,7 +349,9 @@ def daemonize_start():
         if _fork_and_wait_for_startup() > 0:
             # Running in parent process.
             sys.exit(0)
+
         # Running in daemon or monitor process.
+        os.setsid()
 
     if _monitor:
         saved_daemonize_fd = _daemonize_fd
@@ -384,7 +373,6 @@ def daemonize_complete():
     _fork_notify_startup(_daemonize_fd)
 
     if _detach:
-        os.setsid()
         if _chdir:
             os.chdir("/")
         _close_standard_fds()