opt
/
kaspersky
/
kav4fs
/
src
/
kernel
/
module.freebsd
➕ New
📤 Upload
✎ Editing:
module.c
← Back
/* * This source file is a part of a Kaspersky Antivirus Monitor. * Copyright (C) Kaspersky Lab, 1997-2010 * See License.txt for details * */ #include "module.h" #include "oas/small/protocol_alloc.h" MALLOC_DEFINE (M_KAVMON, "kavmon malloc", "kavmon memory block"); static lock_declare(monitor_lock); static int monitor_count, loaded = 0; void Monitor_ins_use(void) { write_lock(&monitor_lock); loaded = 1; ++monitor_count; write_unlock(&monitor_lock); } void Monitor_dec_use(void) { write_lock(&monitor_lock); --monitor_count; write_unlock(&monitor_lock); } int Monitor_busy(void) { int count; read_lock(&monitor_lock); count = monitor_count; read_unlock(&monitor_lock); return count?1:0; } int Monitor_ready_for_stop(void) { int count; read_lock(&monitor_lock); count = monitor_count; read_unlock(&monitor_lock); return count <= 2; } static int module_ctl (module_t mod, int what, void *arg) { int err = 0; switch (what) { case MOD_LOAD: lock_init(&monitor_lock,"kavmonitor module"); monitor_count = 0; m_config.version = 1; m_config.max_fname_len = DEFAULT_MAX_FNAME_LEN; m_config.deny_too_long_fname = DEFAULT_DENY_TOO_LONG_FNAME; Monitor_interface_init(); break; case MOD_UNLOAD: if (Monitor_busy()) return EBUSY; Monitor_interface_cleanup(); lock_finit(&monitor_lock); break; default: err = EINVAL; break; } return err; } /* This way seems to be a more compatible with older *BSD version */ moduledata_t kavmon = { "kavmonitor", (modeventhand_t) module_ctl, 0 }; DECLARE_MODULE (kavmonitor, kavmon, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
💾 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