blob: 8f0fa7b54aa208fd0220eb8551d4ff9a887d4a8c [file] [log] [blame]
Jorge Lucangeli Obesa6b034d2012-08-07 15:29:20 -07001/* util.h
2 * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 *
6 * Logging and other utility functions.
7 */
8
9#ifndef _UTIL_H_
10#define _UTIL_H_
11
12#include <stdlib.h>
13#include <syslog.h>
14
15#define die(_msg, ...) do { \
16 syslog(LOG_ERR, "libminijail: " _msg, ## __VA_ARGS__); \
17 abort(); \
18} while (0)
19
20#define pdie(_msg, ...) \
21 die(_msg ": %s", ## __VA_ARGS__, strerror(errno))
22
23#define warn(_msg, ...) \
24 syslog(LOG_WARNING, "libminijail: " _msg, ## __VA_ARGS__)
25
26#define info(_msg, ...) \
27 syslog(LOG_INFO, "libminijail: " _msg, ## __VA_ARGS__)
28
29int lookup_syscall(const char *name);
30const char *lookup_syscall_name(int nr);
31char *strip(char *s);
32
33#endif /* _UTIL_H_ */