blob: 1f13e57412eb5da03863c984981e160580392532 [file] [log] [blame]
Arnaldo Carvalho de Melofd0db102016-04-04 13:32:20 -03001/*
2 * System call table mapper
3 *
4 * (C) 2016 Arnaldo Carvalho de Melo <acme@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include "syscalltbl.h"
17#include <string.h>
18#include <libaudit.h>
19
20
21struct syscalltbl *syscalltbl__new(void)
22{
23 struct syscalltbl *tbl = malloc(sizeof(*tbl));
24 if (tbl) {
25 tbl->audit_machine = audit_detect_machine();
26 }
27 return tbl;
28}
29
30void syscalltbl__delete(struct syscalltbl *tbl)
31{
32 free(tbl);
33}
34
35const char *syscalltbl__name(const struct syscalltbl *tbl, int id)
36{
37 return audit_syscall_to_name(id, tbl->audit_machine);
38}
39
40int syscalltbl__id(struct syscalltbl *tbl, const char *name)
41{
42 return audit_name_to_syscall(name, tbl->audit_machine);
43}