]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/util.h
15444b2e5c576c9d524cb2258521c1a460cc0201
1 /* SPDX-License-Identifier: LGPL-2.1+ */
9 extern char **saved_argv
;
11 static inline void save_argc_argv(int argc
, char **argv
) {
16 extern char **saved_env
;
19 bool kexec_loaded(void);
21 int prot_from_flags(int flags
) _const_
;
24 void in_initrd_force(bool value
);
26 int on_ac_power(void);
28 static inline unsigned u64log2(uint64_t n
) {
29 #if __SIZEOF_LONG_LONG__ == 8
30 return (n
> 1) ? (unsigned) __builtin_clzll(n
) ^ 63U : 0;
36 static inline unsigned u32ctz(uint32_t n
) {
37 #if __SIZEOF_INT__ == 4
38 return n
!= 0 ? __builtin_ctz(n
) : 32;
44 static inline unsigned log2i(int x
) {
47 return __SIZEOF_INT__
* 8 - __builtin_clz(x
) - 1;
50 static inline unsigned log2u(unsigned x
) {
53 return sizeof(unsigned) * 8 - __builtin_clz(x
) - 1;
56 static inline unsigned log2u_round_up(unsigned x
) {
62 return log2u(x
- 1) + 1;
65 int container_get_leader(const char *machine
, pid_t
*pid
);
69 int str_verscmp(const char *s1
, const char *s2
);
71 void disable_coredumps(void);