Hannu Lounento
673ed95966
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__)
2023-06-01 20:25:21 +01:00
..
2023-05-28 23:53:18 +09:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2022-07-04 19:56:53 +02:00
2023-04-05 20:55:15 +02:00
2022-10-14 15:56:58 +02:00
2022-06-28 13:10:05 +02:00
2023-01-18 17:59:43 +00:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2023-04-20 13:43:34 +02:00
2022-02-08 11:55:13 +01:00
2023-04-05 20:55:15 +02:00
2023-05-06 21:55:05 +01:00
2023-06-01 06:33:13 +09:00
2022-06-28 16:05:31 +02:00
2022-10-26 08:39:34 +02:00
2023-02-06 09:19:04 +01:00
2023-04-13 12:17:40 +09:00
2022-10-26 08:39:34 +02:00
2023-02-28 21:42:29 +01:00
2022-11-16 00:12:16 +01:00
2023-03-29 02:08:18 +01:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2023-05-30 16:35:46 +09:00
2023-04-20 16:45:57 +02:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2022-12-17 13:54:16 +00:00
2022-10-26 08:39:34 +02:00
2023-04-05 20:55:15 +02:00
2023-01-11 17:18:57 +01:00
2023-05-12 08:38:20 +02:00
2023-05-26 17:04:37 +02:00
2023-03-08 15:32:59 +01:00
2023-05-15 22:53:22 +02:00
2023-03-08 15:32:59 +01:00
2023-05-17 12:25:01 +02:00
2022-01-07 17:37:37 +01:00
2022-09-23 15:10:53 +02:00
2023-05-22 18:05:29 +01:00
2022-08-26 11:15:44 +09:00
2022-08-24 14:50:48 +02:00
2022-10-01 11:35:46 +02:00
2022-06-28 13:10:05 +02:00
2023-03-15 19:56:19 +08:00
2023-05-18 17:18:11 +02:00
2023-05-21 15:48:57 +08:00
2023-01-11 17:12:54 +01:00
2023-05-17 12:25:01 +02:00
2022-10-17 15:10:53 +02:00
2022-05-05 11:48:22 +02:00
2023-02-12 00:54:07 +01:00
2022-08-23 12:14:58 +02:00
2022-05-05 11:48:22 +02:00
2023-04-22 17:41:17 +01:00
2023-04-25 14:33:09 +02:00
2022-07-27 08:41:03 -07:00
2022-05-05 11:48:22 +02:00
2022-08-11 09:53:55 +02:00
2022-10-12 09:57:24 +01:00
2022-09-30 14:20:28 +02:00
2023-05-19 15:18:23 +01:00
2022-05-05 11:48:22 +02:00
2023-04-05 21:50:04 +00:00
2023-01-11 17:12:54 +01:00
2023-02-28 21:42:29 +01:00
2022-10-26 08:39:34 +02:00
2023-01-11 17:12:54 +01:00
2022-12-07 10:26:31 +01:00
2023-03-30 18:55:55 +01:00
2023-03-30 18:29:49 +01:00
2022-07-04 19:56:53 +02:00
2023-05-30 13:45:49 +02:00
2022-11-25 17:37:30 +01:00
2023-03-07 16:22:13 +01:00
2023-03-08 15:32:59 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-03-30 18:55:55 +01:00
2023-04-25 12:24:25 +01:00
2022-08-23 09:24:44 +02:00
2023-04-22 17:41:17 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2022-10-11 16:59:00 +02:00
2022-10-26 08:39:34 +02:00
2022-10-11 16:59:00 +02:00
2023-01-09 13:23:11 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2022-06-28 13:10:05 +02:00
2022-06-28 13:10:05 +02:00
2022-06-28 13:10:05 +02:00
2022-06-28 13:10:05 +02:00
2022-06-28 13:10:05 +02:00
2022-06-30 10:55:39 +02:00
2023-02-09 14:30:43 +01:00
2022-04-12 15:33:05 +02:00
2023-04-04 15:18:00 +02:00
2022-01-11 10:47:31 +00:00
2022-06-30 10:35:27 +02:00
2022-01-11 10:47:31 +00:00
2023-04-25 12:24:25 +01:00
2022-10-11 16:59:00 +02:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2022-04-12 15:33:05 +02:00
2023-04-25 12:24:25 +01:00
2023-01-19 23:11:36 +09:00
2022-04-04 18:25:18 +02:00
2022-10-11 16:59:00 +02:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2022-10-11 16:59:00 +02:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-04-25 12:24:25 +01:00
2023-05-24 10:52:08 +02:00
2022-04-12 15:33:05 +02:00
2023-04-25 12:24:25 +01:00
2022-05-27 09:40:54 -04:00
2022-12-15 00:07:17 +09:00
2022-02-14 15:13:23 +01:00
2023-03-08 15:32:59 +01:00
2022-10-11 16:59:00 +02:00
2023-04-25 12:24:25 +01:00
2023-02-08 13:42:30 +01:00
2023-02-22 14:46:19 +09:00
2023-05-28 23:53:18 +09:00
2023-06-01 20:25:21 +01:00
2022-10-11 16:59:00 +02:00
2023-03-08 15:32:59 +01:00
2022-10-11 16:59:00 +02:00
2023-05-03 18:21:42 +02:00
2023-01-21 11:27:40 +00:00
2023-01-20 12:18:05 +00:00
2023-02-25 16:14:11 +01:00
2023-02-25 16:14:11 +01:00
2023-03-08 15:32:59 +01:00
2022-10-26 08:39:34 +02:00
2022-10-26 08:39:34 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2023-05-15 22:53:22 +02:00
2022-10-26 08:39:34 +02:00
2022-10-07 17:54:31 +02:00
2023-04-05 20:55:15 +02:00
2022-04-11 13:51:28 +02:00
2023-04-13 21:33:48 +01:00
2023-05-30 13:41:24 +02:00
2023-02-01 21:56:28 +00:00
2023-05-30 10:11:04 +02:00
2022-08-23 12:14:58 +02:00
2023-03-10 11:41:03 +01:00
2023-03-17 11:36:32 +09:00
2023-05-17 12:25:01 +02:00
2023-05-17 12:25:01 +02:00
2022-08-23 12:14:58 +02:00
2023-03-14 18:03:32 +01:00
2022-08-28 00:03:36 +09:00
2023-03-31 01:15:24 +08:00
2023-04-25 18:34:49 +02:00
2023-04-20 21:54:59 +02:00
2023-01-11 17:12:54 +01:00
2022-08-23 12:14:58 +02:00
2022-12-02 10:29:14 +09:00
2023-05-17 12:25:01 +02:00
2023-05-23 12:39:34 +02:00
2023-04-15 10:29:50 +01:00
2023-05-26 02:52:19 -07:00
2022-10-17 15:10:53 +02:00
2023-05-30 13:41:24 +02:00
2022-07-04 19:56:53 +02:00
2023-01-11 17:12:54 +01:00
2022-07-04 19:56:53 +02:00
2022-01-12 16:05:59 +01:00
2023-04-04 19:52:04 +01:00
2022-02-09 20:34:29 +00:00
2023-01-11 17:18:57 +01:00
2022-01-12 16:05:59 +01:00
2023-04-05 20:55:15 +02:00
2022-05-21 14:28:03 +02:00
2023-03-06 07:15:29 +09:00
2023-05-15 23:15:15 +01:00
2022-09-20 16:48:50 +02:00
2023-04-07 16:33:46 +02:00
2023-03-21 19:00:00 +09:00
2022-01-28 12:52:52 +00:00
2022-09-23 15:10:53 +02:00
2023-05-17 12:25:01 +02:00
2023-05-17 12:25:01 +02:00
2023-01-11 17:12:54 +01:00
2023-05-17 12:25:01 +02:00
2023-01-11 17:12:54 +01:00
2023-04-20 13:38:49 +02:00
2023-04-25 17:05:28 +02:00
2022-09-20 16:48:50 +02:00
2023-05-31 23:00:19 +02:00
2023-01-05 18:52:15 +01:00
2023-04-24 10:02:30 +02:00
2023-05-17 11:18:26 +02:00
2023-02-21 22:59:04 +00:00
2022-02-04 17:43:44 +00:00
2023-05-24 15:02:36 +01:00
2022-07-25 10:15:43 +02:00
2023-05-16 18:43:21 +01:00
2023-04-25 17:40:41 +02:00
2023-03-10 00:05:37 +00:00
2023-04-05 20:55:15 +02:00
2023-04-05 20:55:15 +02:00
2023-05-23 15:09:39 +02:00
2021-12-16 09:56:13 +01:00
2023-03-24 15:43:04 +01:00
2023-01-05 18:24:21 +01:00
2023-04-13 05:39:49 +02:00
2022-07-04 19:56:53 +02:00
2023-01-11 17:12:54 +01:00
2022-01-14 16:20:45 +09:00
2022-05-26 14:29:50 +02:00
2023-05-19 17:46:30 +02:00
2023-03-13 13:51:48 +00:00
2023-04-20 21:54:59 +02:00
2023-02-08 13:42:30 +01:00
2022-10-01 16:58:48 +02:00
2023-04-20 21:54:59 +02:00
2023-01-20 15:32:16 +09:00
2023-05-17 12:25:01 +02:00
2023-05-22 14:18:46 +09:00
2023-04-30 04:30:35 +09:00
2023-04-12 14:28:43 +02:00
2023-04-25 17:40:41 +02:00
2023-05-17 12:25:01 +02:00
2023-04-14 20:27:59 +01:00
2023-04-27 12:18:32 +02:00
2022-12-13 15:34:46 +01:00
2023-05-18 17:54:33 +09:00
2022-05-21 14:28:03 +02:00
2022-07-04 19:56:53 +02:00
2023-04-25 17:40:41 +02:00
2022-12-21 13:31:09 +09:00
2023-05-17 12:25:01 +02:00
2023-05-30 13:41:24 +02:00
2023-05-05 10:55:57 +08:00
2023-05-17 12:25:01 +02:00
2023-05-26 11:50:08 +09:00
2023-04-20 13:43:34 +02:00
2023-05-17 12:25:01 +02:00
2023-02-15 16:03:28 +01:00
2023-03-08 15:32:59 +01:00
2023-05-29 12:12:45 +02:00
2023-02-06 09:19:04 +01:00
2023-01-16 18:27:15 +09:00
2023-04-26 09:51:08 +09:00
2023-05-30 10:13:04 +02:00
2023-05-24 11:09:03 +01:00
2022-02-23 08:56:03 +01:00
2023-06-01 06:33:13 +09:00
2023-04-13 05:39:49 +02:00
2022-10-26 08:39:34 +02:00
2022-06-28 13:10:05 +02:00
2023-02-06 09:19:04 +01:00