opt
/
kaspersky
/
kav4fs
/
src
/
kernel
/
module.freebsd
➕ New
📤 Upload
✎ Editing:
module.h
← Back
/* * This source file is a part of a Kaspersky Antivirus Monitor. * Copyright (C) Kaspersky Lab, 1997-2010 * See License.txt for details * */ #ifndef KAVMON_MODULE_H #define KAVMON_MODULE_H #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/conf.h> #include <sys/proc.h> #include <sys/vnode.h> #include <sys/mount.h> #include <sys/malloc.h> #include <sys/vmmeter.h> #include <sys/time.h> #include <sys/stat.h> #include <sys/namei.h> #include <sys/poll.h> #include <sys/dirent.h> #include <sys/resource.h> #include <sys/syslog.h> #include <sys/sysent.h> #include <sys/syscall.h> #include <sys/sysctl.h> #include <sys/sysproto.h> #include <sys/ioccom.h> #include <sys/module.h> #include <sys/conf.h> #include <machine/frame.h> #include <sys/file.h> #include <sys/lock.h> #include <sys/fcntl.h> #include <sys/filio.h> #include <sys/filedesc.h> MALLOC_DECLARE (M_KAVMON); #if (__FreeBSD__ < 4) #define NDFREE(a,b) #endif #if defined (__FreeBSD_version) && __FreeBSD_version < 400006 static __inline int memcmp(const void *b1, const void *b2, size_t len) { return (bcmp(b1, b2, len)); } static __inline void * memset(void *b, int c, size_t len) { char *bb; if (c == 0) bzero(b, len); else for (bb = (char *)b; len--; ) *bb++ = c; return (b); } #endif #define memmove(dst,src,len) memcpy(dst,src,len) #if defined (__FreeBSD_version) && __FreeBSD_version < 500000 #define SLEEP(queue, block) tsleep(&queue->waitq,(block==0)?PCATCH|PVM:PVM,"kavmonc",0); #define lock_declare(lock) struct simplelock lock #define lock_init(lock,name) simple_lock_init(lock) #define lock_finit(lock) #define read_lock(lock) simple_lock(lock) #define read_unlock(lock) simple_unlock(lock) #define write_lock(lock) read_lock(lock) #define write_unlock(lock) read_unlock(lock) #define FILEDESC_LOCK(fp) #define FILEDESC_UNLOCK(fp) #define PROC_LOCK(fp) #define PROC_UNLOCK(fp) #define sx_xlock(proc_list); #define sx_xunlock(proc_list); #define sx_slock(proc_list); #define sx_sunlock(proc_list); #define FOREACH_PROC_IN_SYSTEM(p) LIST_FOREACH((p),&allproc,p_list) #else #include <sys/sx.h> #if __FreeBSD_version < 700000 # define COMPAT_FILEDESC_XLOCK(fp) FILEDESC_LOCK(fp) # define COMPAT_FILEDESC_SLOCK(fp) FILEDESC_LOCK(fp) # define COMPAT_FILEDESC_XUNLOCK(fp) FILEDESC_UNLOCK(fp) # define COMPAT_FILEDESC_SUNLOCK(fp) FILEDESC_UNLOCK(fp) #else # define COMPAT_FILEDESC_XLOCK(fp) FILEDESC_XLOCK(fp) # define COMPAT_FILEDESC_SLOCK(fp) FILEDESC_SLOCK(fp) # define COMPAT_FILEDESC_XUNLOCK(fp) FILEDESC_XUNLOCK(fp) # define COMPAT_FILEDESC_SUNLOCK(fp) FILEDESC_SUNLOCK(fp) #endif #define MSLEEP_LOCK #define SLEEP(queue, block) write_unlock(&queue->lock);\ tsleep(&queue->waitq,(block==0)?PCATCH|PVM:PVM,"kavmonc",0);\ write_lock(&queue->lock); #define lock_declare(_lock) struct lock _lock #define lock_init(lock,name) lockinit(lock, 0, name, 0, 0) #define lock_finit(lock) lockdestroy(lock) #if __FreeBSD_version < 800000 #define read_lock(lock) lockmgr(lock, LK_SHARED, 0, 0) #define read_unlock(lock) lockmgr(lock, LK_RELEASE, 0, 0) #define write_lock(lock) lockmgr(lock, LK_EXCLUSIVE, 0, 0) #define write_unlock(lock) lockmgr(lock, LK_RELEASE, 0, 0) #else #define read_lock(lock) lockmgr(lock, LK_SHARED, 0) #define read_unlock(lock) lockmgr(lock, LK_RELEASE, 0) #define write_lock(lock) lockmgr(lock, LK_EXCLUSIVE, 0) #define write_unlock(lock) lockmgr(lock, LK_RELEASE, 0) #endif #if __FreeBSD_version >= 502000 #define nowrite NULL #define noioctl NULL #define nopoll NULL #define nommap NULL #define nostrategy NULL #define nodump NULL #endif #endif #define wake_up(waitq) wakeup(waitq) #define wake_up_interruptible(waitq) wakeup(waitq) #define init_waitqueue_head(wait) #define interruptible_sleep_on(chan) tsleep(chan,PCATCH|PVM,"kavmonb",0) #define MEM_ALLOC(size) malloc(size,M_KAVMON,M_WAITOK) #define MEM_FREE(ptr) free(ptr,M_KAVMON) #define PRN(format, args...) printf(format"\n" , ## args) #ifndef MIN #define MIN(a, b) ( (a) < (b) ? (a) : (b) ) #endif typedef struct { char lock; } wait_queue_head_t; #if defined (__FreeBSD_version) && __FreeBSD_version < 500000 #define TASK_INFO_ struct proc * tsk #else #define TASK_INFO_ struct thread * tsk #endif #define TASK_INFO TASK_INFO_, typedef off_t loff_t; #include "kavmon.h" #include "oas/small/device.h" #include "oas/small/protocol.h" #include "oas/small/protocol_packer.h" #include "oas/small/protocol_handler.h" #include "oas/small/protocol_request.h" #include "oas/small/protocol_transport_impl.h" #include "util.h" #include "kernel.h" #include "cache.h" #include "queue.h" #include "files.h" #include "interceptor.h" #include "interface.h" #include "interface_monitor.h" void Monitor_ins_use(void); void Monitor_dec_use(void); int Monitor_busy(void); int Monitor_ready_for_stop(void); #define PRN_ERR(format, args...) log(LOG_ERR, format, ## args) typedef volatile u_int compat_atomic_t; static inline void compat_atomic_set(compat_atomic_t *p, u_int v) { atomic_store_rel_int(p, v); } static inline u_int compat_atomic_inc_return(compat_atomic_t *p) { return atomic_fetchadd_int(p, 1) + 1; } static inline int timespec_equal(const struct timespec *a, const struct timespec *b) { return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); } #endif
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel