Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Like with mqueue(3), create and remove the aio(3) sysctl nod...
details: https://anonhg.NetBSD.org/src/rev/fdd40595c78b
branches: trunk
changeset: 756876:fdd40595c78b
user: jruoho <jruoho%NetBSD.org@localhost>
date: Fri Aug 06 18:36:09 2010 +0000
description:
Like with mqueue(3), create and remove the aio(3) sysctl nodes dynamically.
diffstat:
share/man/man7/sysctl.7 | 21 ++++++++++++++++-
sys/kern/sys_aio.c | 58 ++++++++++++++++++++++++++++++++++++++----------
2 files changed, 64 insertions(+), 15 deletions(-)
diffs (194 lines):
diff -r 0046ba8cc8e7 -r fdd40595c78b share/man/man7/sysctl.7
--- a/share/man/man7/sysctl.7 Fri Aug 06 18:10:40 2010 +0000
+++ b/share/man/man7/sysctl.7 Fri Aug 06 18:36:09 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sysctl.7,v 1.50 2010/07/31 02:04:45 jruoho Exp $
+.\" $NetBSD: sysctl.7,v 1.51 2010/08/06 18:36:09 jruoho Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
.\"
-.Dd July 31, 2010
+.Dd August 6, 2010
.Dt SYSCTL 7
.Os
.Sh NAME
@@ -239,6 +239,8 @@
.Bl -column "kern.posix_reader_writer_locks" \
"struct kinfo_drivers" "not applicable"
.It Sy Second level name Type Changeable
+.It kern.aio_listio_max integer yes
+.It kern.aio_max integer yes
.It kern.arandom integer no
.It kern.argmax integer no
.It kern.boothowto integer no
@@ -296,6 +298,7 @@
.It kern.pipe node not applicable
.\" .It kern.posix node not applicable
.It kern.posix1version integer no
+.It kern.posix_aio integer no
.It kern.posix_barriers integer no
.It kern.posix_reader_writer_locks integer no
.\".It kern.posix_sched integer yes
@@ -329,6 +332,16 @@
.It kern.vnode struct vnode no
.El
.Bl -tag -width "123456"
+.It Li kern.aio_listio_max
+The maximum number of asynchronous
+.Tn I/O
+operations in a single list I/O call.
+Like with all variables related to
+.Xr aio 3 ,
+the variable may be created and removed dynamically
+upon loading or unloading the corresponding kernel module.
+.It Li kern.aio_max
+The maximum number of asynchronous I/O operations.
.It Li kern.arandom
This variable picks a random number each time it is queried.
The used random number generator
@@ -784,6 +797,10 @@
.It Li kern.posix1version ( KERN_POSIX1 )
The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
attempts to comply.
+.It Li kern.posix_aio
+The version of
+.St -p1003.1
+and its Asynchronous I/O option to which the system attempts to conform.
.It Li kern.posix_barriers ( KERN_POSIX_BARRIERS )
The version of
.St -p1003.1
diff -r 0046ba8cc8e7 -r fdd40595c78b sys/kern/sys_aio.c
--- a/sys/kern/sys_aio.c Fri Aug 06 18:10:40 2010 +0000
+++ b/sys/kern/sys_aio.c Fri Aug 06 18:36:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_aio.c,v 1.34 2010/06/24 13:03:11 hannken Exp $ */
+/* $NetBSD: sys_aio.c,v 1.35 2010/08/06 18:36:09 jruoho Exp $ */
/*
* Copyright (c) 2007 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.34 2010/06/24 13:03:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.35 2010/08/06 18:36:09 jruoho Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -73,15 +73,20 @@
static u_int aio_max = AIO_MAX;
static u_int aio_jobs_count;
+static struct sysctllog *aio_sysctl;
static struct pool aio_job_pool;
static struct pool aio_lio_pool;
static void * aio_ehook;
-static void aio_worker(void *);
-static void aio_process(struct aio_job *);
-static void aio_sendsig(struct proc *, struct sigevent *);
-static int aio_enqueue_job(int, void *, struct lio_req *);
-static void aio_exit(proc_t *, void *);
+static void aio_worker(void *);
+static void aio_process(struct aio_job *);
+static void aio_sendsig(struct proc *, struct sigevent *);
+static int aio_enqueue_job(int, void *, struct lio_req *);
+static void aio_exit(proc_t *, void *);
+
+static int sysctl_aio_listio_max(SYSCTLFN_PROTO);
+static int sysctl_aio_max(SYSCTLFN_PROTO);
+static int sysctl_aio_init(void);
static const struct syscall_package aio_syscalls[] = {
{ SYS_aio_cancel, 0, (sy_call_t *)sys_aio_cancel },
@@ -122,6 +127,9 @@
return EBUSY;
}
}
+ if (aio_sysctl != NULL)
+ sysctl_teardown(&aio_sysctl);
+
KASSERT(aio_jobs_count == 0);
exithook_disestablish(aio_ehook);
pool_destroy(&aio_job_pool);
@@ -142,9 +150,15 @@
pool_init(&aio_lio_pool, sizeof(struct lio_req), 0, 0, 0,
"aio_lio_pool", &pool_allocator_nointr, IPL_NONE);
aio_ehook = exithook_establish(aio_exit, NULL);
+
+ error = sysctl_aio_init();
+ if (error != 0) {
+ (void)aio_fini(false);
+ return error;
+ }
error = syscall_establish(NULL, aio_syscalls);
if (error != 0)
- aio_fini(false);
+ (void)aio_fini(false);
return error;
}
@@ -1077,15 +1091,23 @@
return 0;
}
-SYSCTL_SETUP(sysctl_aio_setup, "sysctl aio setup")
+static int
+sysctl_aio_init(void)
{
+ int rv;
- sysctl_createv(clog, 0, NULL, NULL,
+ aio_sysctl = NULL;
+
+ rv = sysctl_createv(&aio_sysctl, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern", NULL,
NULL, 0, NULL, 0,
CTL_KERN, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+
+ if (rv != 0)
+ return rv;
+
+ rv = sysctl_createv(&aio_sysctl, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_IMMEDIATE,
CTLTYPE_INT, "posix_aio",
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
@@ -1093,20 +1115,30 @@
"system attempts to conform"),
NULL, _POSIX_ASYNCHRONOUS_IO, NULL, 0,
CTL_KERN, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+
+ if (rv != 0)
+ return rv;
+
+ rv = sysctl_createv(&aio_sysctl, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "aio_listio_max",
SYSCTL_DESCR("Maximum number of asynchronous I/O "
"operations in a single list I/O call"),
sysctl_aio_listio_max, 0, &aio_listio_max, 0,
CTL_KERN, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+
+ if (rv != 0)
+ return rv;
+
+ rv = sysctl_createv(&aio_sysctl, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "aio_max",
SYSCTL_DESCR("Maximum number of asynchronous I/O "
"operations"),
sysctl_aio_max, 0, &aio_max, 0,
CTL_KERN, CTL_CREATE, CTL_EOL);
+
+ return rv;
}
/*
Home |
Main Index |
Thread Index |
Old Index