summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-07-11 04:40:11 -0400
committerLennart Poettering <lennart@poettering.net>2017-07-11 10:40:11 +0200
commite3e42fc2b52dbd284a56457269ca920d6ab46295 (patch)
tree73738fd640ffa419b210c859b7295761f82aee67 /src
parentf3b57eaf4591eee1b557b70493c2575859305b02 (diff)
downloadsystemd-e3e42fc2b52dbd284a56457269ca920d6ab46295.tar.gz
Add comments to log_functions which shouldn't be called from library code (#6326)
Diffstat (limited to 'src')
-rw-r--r--src/basic/log.c8
-rw-r--r--src/basic/log.h5
2 files changed, 13 insertions, 0 deletions
diff --git a/src/basic/log.c b/src/basic/log.c
index ab1e6cac1e..3fd53800a0 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -232,6 +232,8 @@ fail:
int log_open(void) {
int r;
+ /* Do not call from library code. */
+
/* If we don't use the console we close it here, to not get
* killed by SAK. If we don't use syslog we close it here so
* that we are not confused by somebody deleting the socket in
@@ -306,6 +308,8 @@ void log_set_target(LogTarget target) {
}
void log_close(void) {
+ /* Do not call from library code. */
+
log_close_journal();
log_close_syslog();
log_close_kmsg();
@@ -313,6 +317,8 @@ void log_close(void) {
}
void log_forget_fds(void) {
+ /* Do not call from library code. */
+
console_fd = kmsg_fd = syslog_fd = journal_fd = -1;
}
@@ -1034,6 +1040,8 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
}
void log_parse_environment_realm(LogRealm realm) {
+ /* Do not call from library code. */
+
const char *e;
if (get_ctty_devnr(0, NULL) < 0)
diff --git a/src/basic/log.h b/src/basic/log.h
index 57463fbb83..ff5d776b1d 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -86,6 +86,11 @@ int log_get_max_level_realm(LogRealm realm) _pure_;
#define log_get_max_level() \
log_get_max_level_realm(LOG_REALM)
+/* Functions below that open and close logs or configure logging based on the
+ * environment should not be called from library code — this is always a job
+ * for the application itself.
+ */
+
int log_open(void);
void log_close(void);
void log_forget_fds(void);