]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/util.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
9 extern char **saved_argv
;
11 static inline void save_argc_argv(int argc
, char **argv
) {
16 bool kexec_loaded(void);
18 int prot_from_flags(int flags
) _const_
;
21 void in_initrd_force(bool value
);
23 int on_ac_power(void);
25 static inline unsigned u64log2(uint64_t n
) {
26 #if __SIZEOF_LONG_LONG__ == 8
27 return (n
> 1) ? (unsigned) __builtin_clzll(n
) ^ 63U : 0;
33 static inline unsigned u32ctz(uint32_t n
) {
34 #if __SIZEOF_INT__ == 4
35 return n
!= 0 ? __builtin_ctz(n
) : 32;
41 static inline unsigned log2i(int x
) {
44 return __SIZEOF_INT__
* 8 - __builtin_clz(x
) - 1;
47 static inline unsigned log2u(unsigned x
) {
50 return sizeof(unsigned) * 8 - __builtin_clz(x
) - 1;
53 static inline unsigned log2u_round_up(unsigned x
) {
59 return log2u(x
- 1) + 1;
62 int container_get_leader(const char *machine
, pid_t
*pid
);
66 int str_verscmp(const char *s1
, const char *s2
);
68 void disable_coredumps(void);