Hannu Lounento
4a2dbd9952
man: fix sd_journal_*_with_location's func argument
...
`sd_journal_print_with_location` and similar functions behave
inconsistently compared to their documentation, which says:
sd_journal_print_with_location(), sd_journal_printv_with_location(),
sd_journal_send_with_location(), sd_journal_sendv_with_location(),
and sd_journal_perror_with_location() [...] accept additional
parameters to explicitly set the source file name, function, and
line. Those arguments must contain valid journal entries including
the variable name, e.g. "CODE_FILE=src/foo.c", "CODE_LINE=666",
"CODE_FUNC=myfunc".
Calling e.g. `sd_journal_sendv_with_location` with
`CODE_FUNC=myfunction` as the value of the argument `func` results in
"CODE_FUNC" : "CODE_FUNC=myfunction"
because `sd_journal_*_with_location` implicitly prefix the argument
`func` with `CODE_FUNC=`. For example:
_public_ int sd_journal_sendv_with_location(
const char *file, const char *line,
const char *func,
const struct iovec *iov, int n) {
[...]
char *f;
[...]
niov = newa(struct iovec, n + 3);
[...]
ALLOCA_CODE_FUNC(f, func);
[...]
niov[n++] = IOVEC_MAKE_STRING(f);
return sd_journal_sendv(niov, n);
}
where `ALLOCA_CODE_FUNC` is:
#define ALLOCA_CODE_FUNC(f, func) \
do { \
size_t _fl; \
const char *_func = (func); \
char **_f = &(f); \
_fl = strlen(_func) + 1; \
*_f = newa(char, _fl + 10); \
memcpy(*_f, "CODE_FUNC=", 10); \
memcpy(*_f + 10, _func, _fl); \
} while (false)
The arguments `file` and `line` are _not_ prefixed similarly but
expected to be prefixed already with `CODE_FILE=` and `CODE_LINE=`
respectively and sent as is like the documentation describes.
That is, the argument `func` is treated differently and behaves
inconsistently compared to the arguments `file` and `line`. The behavior
seems still intentional:
_public_ int sd_journal_printv_with_location(int priority, const char *file, const char *line, const char *func, const char *format, va_list ap) {
[...]
/* func is initialized from __func__ which is not a macro, but
* a static const char[], hence cannot easily be prefixed with
* CODE_FUNC=, hence let's do it manually here. */
ALLOCA_CODE_FUNC(f, func);
[...]
}
Thus, change the documentation to match the actual behavior.
Note: `sd_journal_{print,send}` and `sd_journal_{print,send}v` work as
expected as they only pass the function name (i.e. without `CODE_FUNC=`)
to the `func` argument of the `sd_journal_*_with_location` functions
they call. For example:
#define sd_journal_print(priority, ...) sd_journal_print_with_location(priority, "CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, __VA_ARGS__)
(cherry picked from commit 673ed95966c741807f993f7fd6b5d93bbc504458)
(cherry picked from commit 121bbb59f3075a07c571dca9f7c628eb7433a99b)
(cherry picked from commit 2d2ec1eea4468dfb2e4ccc07ae43aa451e0e2cd2)
2023-07-10 22:01:38 +01:00
..
2023-03-31 08:51:56 +02:00
2021-10-01 17:27:34 +01:00
2021-12-12 21:13:50 +01:00
2021-10-01 17:27:34 +01:00
2021-12-09 19:21:55 +01:00
2022-05-05 12:30:06 +02:00
2022-01-07 17:37:37 +01:00
2021-12-25 15:07:40 +09:00
2022-02-28 09:52:17 +00:00
2022-10-01 19:05:53 +02:00
2021-10-01 17:27:34 +01:00
2022-01-23 13:29:28 +09:00
2022-02-08 11:55:13 +01:00
2021-10-07 22:13:12 +02:00
2022-12-22 17:30:53 +01:00
2023-04-29 11:36:49 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-06-29 10:44:18 +02:00
2021-07-12 12:09:20 +01:00
2020-11-09 13:23:58 +09:00
2022-01-05 15:19:13 +01:00
2021-10-01 17:27:34 +01:00
2023-04-29 11:36:49 +01:00
2021-10-04 11:05:22 +02:00
2022-11-03 16:49:16 +01:00
2022-06-02 20:04:06 +02:00
2020-11-09 13:23:58 +09:00
2020-12-16 10:54:57 +01:00
2021-05-03 20:19:19 +02:00
2023-04-29 11:36:49 +01:00
2021-10-01 17:27:34 +01:00
2020-11-09 13:23:58 +09:00
2021-10-01 17:27:34 +01:00
2021-10-01 17:27:34 +01:00
2022-02-23 08:56:03 +01:00
2021-10-01 17:27:34 +01:00
2021-10-01 17:27:34 +01:00
2021-10-01 17:27:34 +01:00
2020-11-09 13:23:58 +09:00
2021-06-14 11:16:38 +02:00
2022-08-08 10:27:45 +02:00
2021-05-10 23:10:44 +02:00
2022-04-28 18:12:00 +02:00
2022-04-05 22:18:31 +02:00
2020-11-09 13:23:58 +09:00
2022-04-12 12:28:24 +02:00
2022-06-02 20:04:06 +02:00
2022-01-07 17:37:37 +01:00
2021-03-01 13:40:52 +01:00
2020-12-21 12:39:18 +00:00
2023-04-29 11:36:49 +01:00
2021-05-25 17:42:34 +02:00
2022-04-05 16:10:26 +02:00
2022-03-23 12:25:01 +01:00
2022-03-24 21:29:13 +01:00
2021-08-11 09:34:45 +02:00
2021-10-01 17:27:34 +01:00
2022-05-04 16:11:34 +02:00
2020-11-09 13:23:58 +09:00
2023-04-29 11:36:49 +01:00
2021-04-21 21:00:11 +09:00
2021-08-18 13:36:14 +02:00
2021-05-26 12:45:20 +01:00
2022-02-23 08:56:03 +01:00
2021-07-27 09:43:29 +02:00
2020-11-09 13:23:58 +09:00
2021-06-30 03:51:05 -07:00
2022-05-05 11:48:22 +02:00
2022-05-05 11:48:22 +02:00
2022-05-05 11:48:22 +02:00
2022-05-05 11:48:22 +02:00
2023-04-29 11:36:49 +01:00
2022-05-07 15:17:56 +09:00
2022-05-05 11:48:22 +02:00
2022-05-05 11:48:22 +02:00
2022-05-05 11:48:22 +02:00
2022-05-05 11:48:22 +02:00
2022-05-05 11:48:22 +02:00
2023-06-02 22:45:46 +01:00
2022-05-05 11:48:22 +02:00
2022-08-08 10:27:45 +02:00
2022-08-08 09:57:47 +02:00
2021-07-27 09:43:29 +02:00
2021-10-01 17:27:34 +01:00
2022-01-24 00:21:15 +09:00
2023-04-29 11:36:49 +01:00
2021-10-01 17:27:34 +01:00
2020-11-09 13:23:58 +09:00
2021-11-11 14:36:50 +01:00
2021-07-07 15:27:28 +02:00
2023-03-31 08:51:56 +02:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-03-07 02:54:33 +09:00
2021-06-15 11:29:44 +01:00
2020-11-09 13:23:58 +09:00
2022-03-07 15:32:22 +09:00
2020-11-09 13:23:58 +09:00
2023-04-29 11:36:49 +01:00
2020-11-17 11:13:10 +01:00
2020-11-12 17:10:32 +09:00
2020-11-12 17:10:32 +09:00
2020-11-12 17:10:36 +09:00
2020-11-09 13:23:58 +09:00
2023-04-29 11:36:49 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-11-23 08:01:22 +01:00
2022-06-02 20:04:06 +02:00
2022-06-02 20:04:06 +02:00
2020-11-09 13:23:58 +09:00
2021-12-06 11:21:48 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:36 +09:00
2021-04-08 14:59:10 +02:00
2020-11-09 13:23:58 +09:00
2020-11-18 18:26:14 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:32 +09:00
2020-11-12 17:10:32 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:32 +09:00
2020-11-09 13:23:58 +09:00
2022-04-12 15:33:05 +02:00
2020-11-30 12:21:20 +01:00
2020-11-09 13:23:58 +09:00
2022-01-11 10:47:31 +00:00
2021-02-12 11:36:24 +01:00
2022-01-11 10:47:31 +00:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2022-04-12 12:35:44 +02:00
2020-11-12 17:10:36 +09:00
2021-01-04 11:01:17 +00:00
2021-03-02 12:18:53 +01:00
2020-11-12 17:10:32 +09:00
2021-02-20 13:44:02 +09:00
2021-03-07 02:54:33 +09:00
2021-02-21 20:26:51 +01:00
2020-11-12 17:10:32 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2022-01-12 16:05:59 +01:00
2020-11-09 13:23:58 +09:00
2021-06-30 23:33:00 +09:00
2020-11-09 13:23:58 +09:00
2021-07-10 13:19:50 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2022-04-12 15:33:05 +02:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:36 +09:00
2021-01-04 11:01:17 +00:00
2022-04-04 18:25:18 +02:00
2022-04-12 15:33:05 +02:00
2022-01-05 15:19:13 +01:00
2022-01-05 15:19:13 +01:00
2022-01-06 22:20:11 +09:00
2022-01-05 15:19:13 +01:00
2022-01-05 15:19:13 +01:00
2022-01-05 15:19:13 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:36 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-12-01 15:15:39 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:36 +09:00
2020-11-09 13:23:58 +09:00
2021-11-30 12:30:07 +00:00
2020-11-12 17:10:36 +09:00
2022-04-12 15:33:05 +02:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:36 +09:00
2020-11-12 17:10:32 +09:00
2020-11-09 13:23:58 +09:00
2021-06-15 20:58:56 +02:00
2021-08-20 11:09:48 +02:00
2022-02-14 15:13:23 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:32 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:32 +09:00
2021-02-16 22:16:17 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:36 +09:00
2021-12-17 11:45:55 +01:00
2020-11-09 13:23:58 +09:00
2023-07-10 22:01:38 +01:00
2021-02-25 05:54:11 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-11-30 13:54:27 +01:00
2021-04-19 12:20:29 -04:00
2020-11-09 13:23:58 +09:00
2022-08-08 10:27:44 +02:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:32 +09:00
2020-11-09 13:23:58 +09:00
2021-12-06 12:39:03 +01:00
2020-11-12 17:10:36 +09:00
2021-10-01 17:27:34 +01:00
2021-10-01 17:27:34 +01:00
2020-11-09 13:23:58 +09:00
2021-03-12 10:58:16 +01:00
2020-11-09 13:23:58 +09:00
2022-04-12 12:35:44 +02:00
2020-12-01 15:15:39 +01:00
2020-11-09 13:23:58 +09:00
2021-08-20 11:09:47 +02:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-10-01 17:27:34 +01:00
2022-10-13 22:53:23 +02:00
2021-02-19 14:05:42 +09:00
2021-02-17 21:09:14 +01:00
2022-04-11 13:51:28 +02:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2022-08-08 10:27:45 +02:00
2023-06-02 22:45:46 +01:00
2023-03-03 15:40:05 +01:00
2020-11-09 13:23:58 +09:00
2021-06-24 13:25:39 +02:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-12-14 00:08:55 +00:00
2023-03-31 08:51:56 +02:00
2020-11-09 13:23:58 +09:00
2021-12-14 00:08:55 +00:00
2022-03-22 00:23:25 +01:00
2020-11-09 13:23:58 +09:00
2021-10-07 11:50:52 +02:00
2020-11-09 13:23:58 +09:00
2023-04-29 11:36:49 +01:00
2022-11-08 11:21:08 +00:00
2022-04-22 20:22:40 +02:00
2020-12-17 20:02:32 +01:00
2021-05-07 21:36:27 +01:00
2022-03-17 19:02:10 +01:00
2020-11-09 13:23:58 +09:00
2022-12-14 17:52:33 +01:00
2021-04-23 17:56:34 +02:00
2021-05-19 10:25:26 +09:00
2020-11-09 13:23:58 +09:00
2021-07-27 09:43:29 +02:00
2023-03-31 08:51:56 +02:00
2023-07-10 22:01:38 +01:00
2021-11-18 10:38:48 +00:00
2021-08-31 13:52:52 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-12-16 10:54:57 +01:00
2020-11-09 13:23:58 +09:00
2021-09-10 13:39:16 +02:00
2021-04-30 16:55:50 +09:00
2021-03-01 13:40:52 +01:00
2020-11-09 13:23:58 +09:00
2022-08-08 10:27:45 +02:00
2022-04-12 11:02:16 +02:00
2022-01-12 16:05:59 +01:00
2023-04-29 11:36:49 +01:00
2022-02-09 20:34:29 +00:00
2021-12-17 11:45:55 +01:00
2020-11-09 13:23:58 +09:00
2022-01-12 16:05:59 +01:00
2020-11-09 13:23:58 +09:00
2021-10-13 02:21:44 +09:00
2020-11-09 13:23:58 +09:00
2023-03-31 08:51:56 +02:00
2020-11-09 13:23:58 +09:00
2023-04-29 11:36:49 +01:00
2023-03-31 08:51:57 +02:00
2022-01-28 12:52:52 +00:00
2020-11-09 13:23:58 +09:00
2021-12-12 21:13:50 +01:00
2023-04-29 11:36:49 +01:00
2022-04-28 15:46:44 +02:00
2020-11-09 13:23:58 +09:00
2021-07-27 09:43:29 +02:00
2021-01-29 08:42:39 +01:00
2020-11-09 13:23:58 +09:00
2023-04-29 11:36:49 +01:00
2021-03-12 11:22:58 +01:00
2020-11-09 13:23:58 +09:00
2021-04-19 23:16:02 +02:00
2021-11-22 22:33:24 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2022-04-12 11:02:16 +02:00
2023-06-02 22:45:46 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2022-02-04 17:43:44 +00:00
2022-04-25 10:06:08 +09:00
2021-07-07 11:08:21 +02:00
2022-08-08 10:27:44 +02:00
2022-10-01 19:05:53 +02:00
2020-11-09 13:23:58 +09:00
2022-03-22 18:04:52 +05:30
2022-03-21 20:06:13 +00:00
2022-04-12 11:02:16 +02:00
2021-09-27 09:19:02 +02:00
2020-12-28 10:52:33 +01:00
2020-11-09 13:23:58 +09:00
2021-08-09 21:06:28 +02:00
2023-06-02 22:45:46 +01:00
2021-05-31 19:22:51 +02:00
2020-11-09 13:23:58 +09:00
2021-12-16 09:56:13 +01:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2023-03-31 08:51:57 +02:00
2020-11-09 13:23:58 +09:00
2022-03-30 23:45:26 +02:00
2021-10-14 12:17:02 -05:00
2020-11-09 13:23:58 +09:00
2022-01-14 16:20:45 +09:00
2022-06-02 20:04:06 +02:00
2021-09-29 22:18:38 +01:00
2021-06-29 10:44:18 +02:00
2021-05-19 10:25:26 +09:00
2023-06-02 22:45:46 +01:00
2023-03-31 08:51:56 +02:00
2022-03-04 16:44:02 +01:00
2020-11-09 13:23:58 +09:00
2022-10-24 20:48:11 +02:00
2023-01-27 09:46:47 +00:00
2022-04-06 11:51:03 +02:00
2023-04-29 11:36:49 +01:00
2022-10-01 19:05:54 +02:00
2022-02-23 08:56:03 +01:00
2020-12-31 11:43:44 +00:00
2022-02-23 08:56:03 +01:00
2021-07-27 09:43:29 +02:00
2022-04-28 15:46:44 +02:00
2021-09-28 16:46:20 +02:00
2023-06-02 22:45:46 +01:00
2021-09-27 09:19:02 +02:00
2021-12-18 17:23:53 +00:00
2021-10-15 10:19:54 -05:00
2021-09-27 09:19:02 +02:00
2021-03-01 20:57:36 +01:00
2021-09-27 09:19:02 +02:00
2020-11-09 13:23:58 +09:00
2021-09-27 09:19:02 +02:00
2023-06-02 22:45:46 +01:00
2022-05-16 14:54:43 +02:00
2022-08-08 10:27:45 +02:00
2021-03-31 10:46:22 +02:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-09-24 18:35:42 +01:00
2021-08-09 21:06:28 +02:00
2023-06-02 22:45:46 +01:00
2021-10-01 17:27:34 +01:00
2020-11-09 13:23:58 +09:00
2020-11-12 17:10:32 +09:00
2020-11-12 17:10:32 +09:00
2020-11-12 17:10:32 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2020-11-09 13:23:58 +09:00
2021-04-12 13:03:26 +02:00
2022-03-13 18:30:57 +00:00
2022-08-08 10:27:45 +02:00
2020-12-16 17:21:48 +01:00
2020-11-09 13:23:58 +09:00
2022-02-23 08:56:03 +01:00
2022-01-07 17:37:37 +01:00
2022-03-30 23:45:26 +02:00
2022-05-11 19:12:24 +01:00
2021-11-23 19:46:56 +01:00
2021-10-01 17:27:34 +01:00