/*
 * Copyright (C) 1999-2000 Wojciech Purczynski <wp@elzabsoft.pl>
 *
 * THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
 * IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
 * THE FREE SOFTWARE  FOUNDATION;  EITHER  VERSION 2 OF THE LICENSE, OR
 * (AT YOUR OPTION) ANY LATER VERSION.
 *
 * THIS PROGRAM 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 GENERAL PUBLIC LICENSE FOR MORE DETAILS.
 */

#ifndef _LIB_H
#define _LIB_H

#include <sys/syscall.h>
#include <linux/dcache.h>
#include <linux/sched.h>
#include <linux/malloc.h>
#include <linux/string.h>

extern void * sys_call_table[];

/* Ugh, I know that it is really ugly */
#define getppid() ((int (*)(void))sys_call_table[__NR_getppid])()

#define UID 	(current->uid)
#define EUID 	(current->euid)
#define GID 	(current->gid)
#define EGID 	(current->egid)
#define PID 	(current->pid)
#define PPID 	(getppid())

void log(rule_t*, int, const char *, const char *, const char *);
char *resolve_path(struct dentry *, char *, int);
char *get_exename(void);
#define put_exename(name) kfree_s((name), strlen(name))

#endif /* _LIB_H */
