1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "creds-util.h"
5 #include "env-util.h"
6 #include "fd-util.h"
7 #include "fileio.h"
8 #include "unit.h"
9
10 int unit_name_printf(const Unit *u, const char* text, char **ret);
11 int unit_full_printf_full(const Unit *u, const char *text, size_t max_length, char **ret);
unit_full_printf(const Unit * u,const char * text,char ** ret)12 static inline int unit_full_printf(const Unit *u, const char *text, char **ret) {
13 return unit_full_printf_full(u, text, LONG_LINE_MAX, ret);
14 }
unit_path_printf(const Unit * u,const char * text,char ** ret)15 static inline int unit_path_printf(const Unit *u, const char *text, char **ret) {
16 return unit_full_printf_full(u, text, PATH_MAX-1, ret);
17 }
unit_fd_printf(const Unit * u,const char * text,char ** ret)18 static inline int unit_fd_printf(const Unit *u, const char *text, char **ret) {
19 return unit_full_printf_full(u, text, FDNAME_MAX, ret);
20 }
unit_cred_printf(const Unit * u,const char * text,char ** ret)21 static inline int unit_cred_printf(const Unit *u, const char *text, char **ret) {
22 return unit_full_printf_full(u, text, CREDENTIAL_NAME_MAX, ret);
23 }
unit_env_printf(const Unit * u,const char * text,char ** ret)24 static inline int unit_env_printf(const Unit *u, const char *text, char **ret) {
25 return unit_full_printf_full(u, text, sc_arg_max(), ret);
26 }
27