#pragma once
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <alloca.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "formats-util.h"
#include "macro.h"
#include "missing.h"
#include "time-util.h"
static inline const char* yes_no(bool b) {
return b ? "yes" : "no";
}
static inline const char* true_false(bool b) {
return b ? "true" : "false";
}
static inline const char* one_zero(bool b) {
return b ? "1" : "0";
}
bool plymouth_running(void);
#define NULSTR_FOREACH(i, l) \
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
#define NULSTR_FOREACH_PAIR(i, j, l) \
for ((i) = (l), (j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
extern int saved_argc;
extern char **saved_argv;
bool kexec_loaded(void);
bool in_initrd(void);
int (*compar) (const void *, const void *, void *),
void *arg);
/**
* Normal qsort requires base to be nonnull. Here were require
* that only if nmemb > 0.
*/
if (nmemb <= 1)
return;
}
int on_ac_power(void);
memset(s, c, n);
return (uint8_t*)s + n;
}
errno = *saved_errno;
}
static inline int negative_errno(void) {
/* This helper should be used to shut up gcc if you know 'errno' is
* negative. Instead of "return -errno;", use "return negative_errno();"
* It will suppress bogus gcc warnings in case it assumes 'errno' might
* be 0 and thus the caller's error-handling might not be triggered. */
return -errno;
}
#if __SIZEOF_LONG_LONG__ == 8
#else
#error "Wut?"
#endif
}
#if __SIZEOF_INT__ == 4
return __builtin_ctz(n);
#else
#error "Wut?"
#endif
}
static inline unsigned log2i(int x) {
assert(x > 0);
}
static inline unsigned log2u(unsigned x) {
assert(x > 0);
}
static inline unsigned log2u_round_up(unsigned x) {
assert(x > 0);
if (x == 1)
return 0;
}
bool id128_is_valid(const char *s) _pure_;
int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *userns_fd, int *root_fd);
uint64_t physical_memory(void);
int update_reboot_param_file(const char *param);
int version(void);