s3:printing: Allow to run samba-bgqd as a standalone systemd service
[Samba.git] / lib / util / util_process.h
blob4da135bc6664dac43b03bfab907e540032052aa0
1 /*
2 * Unix SMB/CIFS implementation.
4 * Process utils.
6 * Copyright (c) 2013 Andreas Schneider <asn@samba.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #ifndef _SAMBA_UTIL_PROCESS_H
23 #define _SAMBA_UTIL_PROCESS_H
25 #include "replace.h"
27 /**
28 * @brief Set the process comment name.
30 * @param[in] comment The comment to set which shouldn't be longer than 16
31 * 16 characters (including \0).
33 * @return -1 on error, 0 on success.
35 int prctl_set_comment(const char *comment_format, ...) PRINTF_ATTRIBUTE(1,2);
37 /**
38 * @brief Set the process comment name and longname
40 * @param[in] short_format The comment to set which shouldn't be longer than 16
41 * 16 characters (including \0).
42 * @param[in] long_format The format string and arguments to produce the long
43 * form of the process name.
45 * @return -1 on error, 0 on success.
47 void process_set_title(const char *short_format, const char *long_format, ...)
48 PRINTF_ATTRIBUTE(1,3) PRINTF_ATTRIBUTE(2,3);
50 /**
51 * @brief Get the process comment name set from process_set_title()
53 * @return process comment name
55 const char *process_get_short_title(void);
57 /**
58 * @brief Get the process longname set from process_set_title()
60 * @return process longname
62 const char *process_get_long_title(void);
65 * @brief Save the binary name for later printing in smb_panic()
67 * @param[in] progname The binary name at process startup
69 * This is just for debugging in a panic, so we don't want to do
70 * anything more than return a fixed pointer, so we save a copy to a
71 * static variable.
73 void process_save_binary_name(const char *progname);
75 /**
76 * @brief Get the binary name set at startup process_save_binary_name()
78 * @return binary name set at startup
80 /* Samba binaries will set this during popt handling */
81 const char *process_get_saved_binary_name(void);
84 #endif