diff options
author | Ben Pfaff <blp@nicira.com> | 2009-11-16 15:09:50 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2009-11-16 15:20:01 -0800 |
commit | eb077b264f0801971e02f1fdcd62241388c7448e (patch) | |
tree | 67e5d1992f148bb1831854c79238ccbde4713f84 /lib/daemon.h | |
parent | b93d3b6cb28a925f530aef2009602c06f2f5ae60 (diff) | |
download | openvswitch-eb077b264f0801971e02f1fdcd62241388c7448e.tar.gz |
ovsdb-server: Maintain the database lock with --detach.
Before this commit, "ovsdb-server --detach" would detach after it opened
the database file, which meant that the child process did not hold the
file lock on the database file (because a forked child process does not
inherit its parents' locks). This commit fixes the problem by making
ovsdb-server open the database only after it has detached. This fix, in
turn, required that daemonize() not chdir to /, because this would break
databases whose names are given relative to the current directory, and so
this commit also changes ovsdb-server to do so later.
Diffstat (limited to 'lib/daemon.h')
-rw-r--r-- | lib/daemon.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/daemon.h b/lib/daemon.h index d0c324cfc..06280ac24 100644 --- a/lib/daemon.h +++ b/lib/daemon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Nicira Networks. + * Copyright (c) 2008, 2009 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,9 @@ char *make_pidfile_name(const char *name); void set_pidfile(const char *name); const char *get_pidfile(void); void set_no_chdir(void); +bool is_chdir_enabled(void); void set_detach(void); +bool get_detach(void); void daemonize(void); void die_if_already_running(void); void ignore_existing_pidfile(void); |