Since cfuse usually runs as a nonprivileged user, its defaults must be a
little different from those of the other daemons. Add a flag to
common_init which can be used to set unprivileged daemon defaults.
SimpleMessenger::start() now just takes a boolean telling it whether to
daemonize. It doesn't need to check global variables or other arguments;
it just daemonizes if you tell it to; otherwise not.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Split common_init into several different parts which can be called
individually from libraries. Eliminate startup_flags.
Create ceph_argparse_pull and ceph_argparse_next.
Split off keyring_init from common_init.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Combine set_fg_logging into common_init. This eliminates the problem
where we briefly try to apply the logging settings from the config file
even in a program that needs to set foreground logging.
TestTimers, TestSignalHandlers, TestDoutStreambuf: don't initialize ceph
authentication. These applications don't need it.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
command-line programs (as opposed to daemons) should send their logs to
stderr rather than to a log file, syslog, etc. This is especially
important because most users want to run the ceph command-line programs
as non-root, and often only root has permissions to add to the ceph
log directory.
Create a new function, set_foreground_logging, that overrides ceph.conf
settings to force all log output to stderr. For daemons, we still only
send the very highest priority messages to stderr, and only before they
daemonize().
Don't ever log to stdout because it interferes with scripts that parse
the output of stdout. Instead, log to stderr if the user gives the
--foreground or --nodaemon argument.
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
- By default, append to $type.$name.log.
- Get old $hostname.$pid + $type.$name symlink behavior only with
g_conf.log_per_instance
- Add new g_conf.log_file option to force a particular file.
The problem is that on some platforms __u64 == uint64_t (x86_64), and on
others it's doesn't (ppc64). Which means we don't know whether to define
different versions of overloaded functions for both types or just one.
So, standardize on uint64_t. This plays nicer with STL, which defines
hash<uint64_t> on 64 bit arches but not 32 bit. Which means we can't
standarzie on __u64 or else hash<__u64> won't work. Bah!
Users still assume they hold the only reference, at least until
they call send_message.
One caveat is that ms_handle_failure is passed a message with an
unknown number of refs. The method should not try to free or
re-use the message.