FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/acct.h>
#include <sys/fcntl.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/syslog.h>
#include <sys/sysproto.h>
#include <sys/tty.h>
#include <sys/vnode.h>
#include <security/mac/mac_framework.h>
Go to the source code of this file.
Macros | |
#define | FLT_MANT_DIG 24 /* p */ |
#define | FLT_MAX_EXP 128 /* emax */ |
#define | ACCT_RUNNING 1 /* Accounting kthread is running. */ |
#define | ACCT_EXITREQ 2 /* Accounting kthread should exit. */ |
#define | MANT_MASK ((1 << (FLT_MANT_DIG - 1)) - 1) |
#define | CALC_BITS 28 |
#define | LOG2_1M 20 |
Functions | |
__FBSDID ("$FreeBSD$") | |
_Static_assert (sizeof(struct acctv3) - offsetof(struct acctv3, ac_trailer)==sizeof(struct acctv2) - offsetof(struct acctv2, ac_trailer), "trailer") | |
_Static_assert (sizeof(struct acctv3) - offsetof(struct acctv3, ac_len2)==sizeof(struct acctv2) - offsetof(struct acctv2, ac_len2), "len2") | |
static uint32_t | encode_timeval (struct timeval) |
static uint32_t | encode_long (long) |
static void | acctwatch (void) |
static void | acct_thread (void *) |
static int | acct_disable (struct thread *, int) |
SX_SYSINIT (acct, &acct_sx, "acct_sx") | |
SYSCTL_INT (_kern, OID_AUTO, acct_suspend, CTLFLAG_RW, &acctsuspend, 0, "percentage of free disk space below which accounting stops") | |
SYSCTL_INT (_kern, OID_AUTO, acct_resume, CTLFLAG_RW, &acctresume, 0, "percentage of free disk space above which accounting resumes") | |
static int | sysctl_acct_chkfreq (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_kern, OID_AUTO, acct_chkfreq, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &acctchkfreq, 0, sysctl_acct_chkfreq, "I", "frequency for checking the free space") | |
SYSCTL_INT (_kern, OID_AUTO, acct_configured, CTLFLAG_RD, &acct_configured, 0, "Accounting configured or not") | |
SYSCTL_INT (_kern, OID_AUTO, acct_suspended, CTLFLAG_RD, &acct_suspended, 0, "Accounting suspended or not") | |
int | sys_acct (struct thread *td, struct acct_args *uap) |
int | acct_process (struct thread *td) |
Variables | |
static int | acct_configured |
static int | acct_suspended |
static struct vnode * | acct_vp |
static struct ucred * | acct_cred |
static int | acct_flags |
static struct sx | acct_sx |
static int | acct_state |
static int | acctsuspend = 2 |
static int | acctresume = 4 |
static int | acctchkfreq = 15 |
#define ACCT_EXITREQ 2 /* Accounting kthread should exit. */ |
Definition at line 155 of file kern_acct.c.
#define ACCT_RUNNING 1 /* Accounting kthread is running. */ |
Definition at line 154 of file kern_acct.c.
#define CALC_BITS 28 |
Definition at line 452 of file kern_acct.c.
#define FLT_MANT_DIG 24 /* p */ |
Definition at line 121 of file kern_acct.c.
#define FLT_MAX_EXP 128 /* emax */ |
Definition at line 122 of file kern_acct.c.
#define LOG2_1M 20 |
Definition at line 455 of file kern_acct.c.
#define MANT_MASK ((1 << (FLT_MANT_DIG - 1)) - 1) |
Definition at line 444 of file kern_acct.c.
__FBSDID | ( | "$FreeBSD$" | ) |
_Static_assert | ( | sizeof(struct acctv3) - offsetof(struct acctv3, ac_len2) | = =sizeof(struct acctv2) - offsetof(struct acctv2, ac_len2) , |
"len2" | |||
) |
_Static_assert | ( | sizeof(struct acctv3) - offsetof(struct acctv3, ac_trailer) | = =sizeof(struct acctv2) - offsetof(struct acctv2, ac_trailer) , |
"trailer" | |||
) |
|
static |
Definition at line 314 of file kern_acct.c.
References acct_configured, acct_cred, acct_flags, acct_sx, acct_vp, crfree(), log(), and vn_close().
Referenced by acctwatch(), and sys_acct().
int acct_process | ( | struct thread * | td | ) |
Definition at line 337 of file kern_acct.c.
References acct_cred, acct_suspended, acct_sx, acct_vp, encode_long(), encode_timeval(), getboottime(), hz, microuptime(), proctree_lock, rufetchcalc(), st, tick, timevaladd(), timevalsub(), tty_udev(), and vn_rdwr().
Referenced by exit1().
|
static |
Definition at line 604 of file kern_acct.c.
References ACCT_EXITREQ, ACCT_RUNNING, acct_state, acct_sx, acctchkfreq, acctwatch(), hz, kproc_exit(), and sched_prio().
Referenced by sys_acct().
|
static |
Definition at line 548 of file kern_acct.c.
References acct_disable(), ACCT_EXITREQ, acct_state, acct_suspended, acct_sx, acct_vp, acctresume, acctsuspend, free(), log(), and malloc().
Referenced by acct_thread().
|
static |
Definition at line 513 of file kern_acct.c.
References FLT_MANT_DIG, FLT_MAX_EXP, log(), MANT_MASK, and printf().
Referenced by acct_process().
|
static |
Definition at line 463 of file kern_acct.c.
References CALC_BITS, FLT_MANT_DIG, FLT_MAX_EXP, LOG2_1M, MANT_MASK, and printf().
Referenced by acct_process().
SX_SYSINIT | ( | acct | , |
& | acct_sx, | ||
"acct_sx" | |||
) |
int sys_acct | ( | struct thread * | td, |
struct acct_args * | uap | ||
) |
Definition at line 205 of file kern_acct.c.
References acct_configured, acct_cred, acct_disable(), ACCT_EXITREQ, acct_flags, ACCT_RUNNING, acct_state, acct_suspended, acct_sx, acct_thread(), acct_vp, crhold(), flags, kproc_create(), log(), NDFREE(), priv_check(), vn_close(), vn_open(), and wakeup().
|
static |
Definition at line 171 of file kern_acct.c.
References acctchkfreq, and value.
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
acct_configured | , | ||
CTLFLAG_RD | , | ||
& | acct_configured, | ||
0 | , | ||
"Accounting configured or not" | |||
) |
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
acct_resume | , | ||
CTLFLAG_RW | , | ||
& | acctresume, | ||
0 | , | ||
"percentage of free disk space above which accounting resumes" | |||
) |
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
acct_suspend | , | ||
CTLFLAG_RW | , | ||
& | acctsuspend, | ||
0 | , | ||
"percentage of free disk space below which accounting stops" | |||
) |
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
acct_suspended | , | ||
CTLFLAG_RD | , | ||
& | acct_suspended, | ||
0 | , | ||
"Accounting suspended or not" | |||
) |
SYSCTL_PROC | ( | _kern | , |
OID_AUTO | , | ||
acct_chkfreq | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
& | acctchkfreq, | ||
0 | , | ||
sysctl_acct_chkfreq | , | ||
"I" | , | ||
"frequency for checking the free space" | |||
) |
|
static |
Definition at line 140 of file kern_acct.c.
Referenced by acct_disable(), and sys_acct().
|
static |
Definition at line 143 of file kern_acct.c.
Referenced by acct_disable(), acct_process(), and sys_acct().
|
static |
Definition at line 144 of file kern_acct.c.
Referenced by acct_disable(), and sys_acct().
|
static |
Definition at line 152 of file kern_acct.c.
Referenced by acct_thread(), acctwatch(), and sys_acct().
|
static |
Definition at line 141 of file kern_acct.c.
Referenced by acct_process(), acctwatch(), and sys_acct().
|
static |
Definition at line 145 of file kern_acct.c.
Referenced by acct_disable(), acct_process(), acct_thread(), acctwatch(), and sys_acct().
|
static |
Definition at line 142 of file kern_acct.c.
Referenced by acct_disable(), acct_process(), acctwatch(), and sys_acct().
|
static |
Definition at line 168 of file kern_acct.c.
Referenced by acct_thread(), and sysctl_acct_chkfreq().
|
static |
Definition at line 164 of file kern_acct.c.
Referenced by acctwatch().
|
static |
Definition at line 160 of file kern_acct.c.
Referenced by acctwatch().