assert_se(sigprocmask_many(SIG_BLOCK, &_t, __VA_ARGS__) >= 0); \
_t; \
})
+#define SIGNO_INVALID (-EINVAL)
static inline bool SIGNAL_VALID(int signo) {
return signo > 0 && signo < _NSIG;
sd_json_dispatch_uint32;
sd_json_dispatch_uint64;
sd_json_dispatch_uint8;
+ sd_json_dispatch_signal;
sd_json_dispatch_unsupported;
sd_json_dispatch_variant;
sd_json_dispatch_variant_noref;
#include "memstream-util.h"
#include "path-util.h"
#include "set.h"
+#include "signal-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
return 0;
}
+_public_ int sd_json_dispatch_signal(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) {
+ int *signo = userdata;
+ uint32_t k;
+ int r;
+
+ assert_return(variant, -EINVAL);
+
+ if (sd_json_variant_is_null(variant)) {
+ *signo = SIGNO_INVALID;
+ return 0;
+ }
+
+ r = sd_json_dispatch_uint32(name, variant, flags, &k);
+ if (r < 0)
+ return r;
+
+ if (!SIGNAL_VALID(k))
+ return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a valid signal.", strna(name));
+
+ *signo = k;
+ return 0;
+}
+
_public_ int sd_json_dispatch_unsupported(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) {
return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not allowed in this object.", strna(name));
}
int sd_json_dispatch_double(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata);
int sd_json_dispatch_uid_gid(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata);
int sd_json_dispatch_id128(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata);
+int sd_json_dispatch_signal(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata);
int sd_json_dispatch_unsupported(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata);
#define sd_json_dispatch_uint sd_json_dispatch_uint32