freebsd-dev/sys/kern
Alexander Leidinger 6a1162d4cd MFP4 (with some minor changes):
Implement the linux_io_* syscalls (AIO). They are only enabled if the native
AIO code is available (either compiled in to the kernel or as a module) at
the time the functions are used. If the AIO stuff is not available there
will be a ENOSYS.

From the submitter:
---snip---
DESIGN NOTES:

1. Linux permits a process to own multiple AIO queues (distinguished by
   "context"), but FreeBSD creates only one single AIO queue per process.
   My code maintains a request queue (STAILQ of queue(3)) per "context",
   and throws all AIO requests of all contexts owned by a process into
   the single FreeBSD per-process AIO queue.

   When the process calls io_destroy(2), io_getevents(2), io_submit(2) and
   io_cancel(2), my code can pick out requests owned by the specified context
   from the single FreeBSD per-process AIO queue according to the per-context
   request queues maintained by my code.

2. The request queue maintained by my code stores contrast information between
   Linux IO control blocks (struct linux_iocb) and FreeBSD IO control blocks
   (struct aiocb). FreeBSD IO control block actually exists in userland memory
   space, required by FreeBSD native aio_XXXXXX(2).

3. It is quite troubling that the function io_getevents() of libaio-0.3.105
   needs to use Linux-specific "struct aio_ring", which is a partial mirror
   of context in user space. I would rather take the address of context in
   kernel as the context ID, but the io_getevents() of libaio forces me to
   take the address of the "ring" in user space as the context ID.

   To my surprise, one comment line in the file "io_getevents.c" of
   libaio-0.3.105 reads:

             Ben will hate me for this

REFERENCE:

1. Linux kernel source code:   http://www.kernel.org/pub/linux/kernel/v2.6/
   (include/linux/aio_abi.h, fs/aio.c)

2. Linux manual pages:         http://www.kernel.org/pub/linux/docs/manpages/
   (io_setup(2), io_destroy(2), io_getevents(2), io_submit(2), io_cancel(2))

3. Linux Scalability Effort:   http://lse.sourceforge.net/io/aio.html
   The design notes:           http://lse.sourceforge.net/io/aionotes.txt

4. The package libaio, both source and binary:
       http://rpmfind.net/linux/rpm2html/search.php?query=libaio
   Simple transparent interface to Linux AIO system calls.

5. Libaio-oracle:              http://oss.oracle.com/projects/libaio-oracle/
   POSIX AIO implementation based on Linux AIO system calls (depending on
   libaio).
---snip---

Submitted by:	Li, Xiao <intron@intron.ac>
2006-10-15 14:22:14 +00:00
..
bus_if.m - Revert making bus_generic_add_child() the default for BUS_ADD_CHILD(). 2006-09-11 22:20:37 +00:00
clock_if.m
cpufreq_if.m Introduce a new method, cpufreq_drv_type(), that returns the type of the 2005-02-18 00:23:36 +00:00
device_if.m
genassym.sh
imgact_aout.c Correct two vm object reference leaks in error cases. 2006-03-16 08:51:59 +00:00
imgact_elf32.c
imgact_elf64.c
imgact_elf.c Avoid a vm object reference leak in a rarely used code path. 2006-01-21 20:11:49 +00:00
imgact_gzip.c Maintain the lock on the vnode for most of exec_elfN_imgact(). 2005-12-24 04:57:50 +00:00
imgact_shell.c Fix a panic which could occur parsing #!-lines in a shell-script. If the 2005-06-19 02:21:03 +00:00
inflate.c Normalize a significant number of kernel malloc type names: 2005-10-31 15:41:29 +00:00
init_main.c SI_ORDER_THIRD + 2, not SI_ORDER_FOURTH + 2. 2006-09-26 00:15:56 +00:00
init_sysent.c Regenerate. 2006-10-03 20:48:11 +00:00
kern_acct.c Expore kern.acct_configured, a sysctl that reflects the configured/ 2006-09-17 11:00:36 +00:00
kern_acl.c Move POSIX.1e-specific utility routines from kern_acl.c to 2006-07-06 23:37:39 +00:00
kern_alq.c - Conditionalize Giant around VFS operations for ALQ, ktrace, and 2006-03-28 21:30:22 +00:00
kern_clock.c Unexpand an instance of TAILQ_EMPTY() 2006-06-14 03:14:26 +00:00
kern_condvar.c Fix a sleep queue race for KSE thread. 2006-02-23 00:13:58 +00:00
kern_conf.c Wait for thread count to reach zero in destroy_devl() even when no purge 2006-10-13 20:49:24 +00:00
kern_context.c
kern_cpu.c - Print message about cpufreq and timecounter TSC 2006-03-03 02:06:04 +00:00
kern_descrip.c return EBADF instead of successfully attaching (and then panicing) when 2006-09-24 02:29:53 +00:00
kern_environment.c Use a sleep mutex instead of an sx lock for the kernel environment. This 2006-07-09 21:42:58 +00:00
kern_event.c remove unnecessary NULL check... 2006-09-25 01:29:48 +00:00
kern_exec.c Audit the argv and env vectors passed in on exec: 2006-09-01 11:45:40 +00:00
kern_exit.c Back out one of the Giant removals from revision 1.272. Giant was not here to 2006-09-13 15:47:53 +00:00
kern_fork.c - Change process_exec function handlers prototype to include struct 2006-08-15 12:10:57 +00:00
kern_idle.c Divorce critical sections from spinlocks. Critical sections as denoted by 2005-04-04 21:53:56 +00:00
kern_intr.c Simplify the pager support in DDB. Allowing different db commands to 2006-07-12 21:22:44 +00:00
kern_jail.c Declare security and security.bsd sysctl hierarchies in sysctl.h along 2006-09-17 20:00:36 +00:00
kern_kse.c Close some races between procfs/ptrace and exit(2): 2006-02-22 18:57:50 +00:00
kern_kthread.c Don't do a PHOLD() in kthread_create() w/o a matching PRELE() in 2006-02-22 17:21:45 +00:00
kern_ktr.c Remove slightly oddly placed suser() call from the KTR/ALQ setup sysctl: 2006-09-09 16:09:01 +00:00
kern_ktrace.c Trim an obsolete comment. ktrgenio() stopped doing crazy gymnastics when 2006-07-31 15:31:43 +00:00
kern_linker.c Explicitly use STAILQ_REMOVE_HEAD() when we know we are removing the head 2006-07-10 19:28:57 +00:00
kern_lock.c If the buffer lock has waiters after the buffer has changed identity then 2006-10-02 02:06:27 +00:00
kern_lockf.c Print name of device instead of useless major/minor numbers. 2005-03-29 08:13:01 +00:00
kern_mac.c Remove MAC_DEBUG label counters, which were used to debug leaks and 2006-09-20 13:33:41 +00:00
kern_malloc.c Remove old kern.malloc sysctl, which generated a text representation of 2006-07-23 19:55:41 +00:00
kern_mbuf.c Remove VLAN mtag UMA zones and initialize ether_vtag and tso_segsz packet 2006-09-17 13:44:32 +00:00
kern_mib.c mp_ncpus is always (properly) initialized, even on UP kernels, so just use it. 2005-08-21 18:03:31 +00:00
kern_module.c Address a problem I missed in removing Giant from the kernel linker. Not 2006-06-26 18:34:45 +00:00
kern_mtxpool.c
kern_mutex.c - When spinning on a spin lock, if the debugger is active or we are in a 2006-08-15 18:26:12 +00:00
kern_ntptime.c Explicitly acquire Giant around the ntp_gettime() and assert it in the 2005-05-28 14:34:41 +00:00
kern_physio.c
kern_pmc.c Fix -Wundef. 2005-12-04 02:12:43 +00:00
kern_poll.c Change msleep() and tsleep() to not alter the calling thread's priority 2006-04-17 18:20:38 +00:00
kern_proc.c Remove duplicated $FreeBSD$. 2006-09-30 16:33:29 +00:00
kern_prot.c Declare security and security.bsd sysctl hierarchies in sysctl.h along 2006-09-17 20:00:36 +00:00
kern_resource.c Replace system call thr_getscheduler, thr_setscheduler, thr_setschedparam 2006-09-21 04:18:46 +00:00
kern_rwlock.c Adjust td_locks for non-spin mutexes, rwlocks, and sx locks so that it is 2006-07-27 21:45:55 +00:00
kern_sema.c
kern_shutdown.c On shutdown try to turn off all swap devices. This way GEOM providers are 2006-04-10 10:03:41 +00:00
kern_sig.c Move some declaration of 32-bit signal structures into file 2006-10-05 01:56:11 +00:00
kern_subr.c Reduce the scope of the page queues lock in vm_pgmoveco() now that 2006-08-12 19:47:49 +00:00
kern_switch.c Add scheduler CORE, the work I have done half a year ago, recent, 2006-06-13 13:12:56 +00:00
kern_sx.c Add a new 'show sleepchain' ddb command similar to 'show lockchain' except 2006-08-15 18:29:01 +00:00
kern_synch.c Use scheduler API sched_relinquish() to implement yield() syscall. 2006-06-15 06:41:57 +00:00
kern_syscalls.c Make system call modules a bit more robust: 2006-08-01 16:32:20 +00:00
kern_sysctl.c Kill an XXX remark that has been untrue since rev. 1.150 of this file. 2006-06-16 07:36:18 +00:00
kern_tc.c Commit the results of the typo hunt by Darren Pilgrim. 2006-08-04 07:56:35 +00:00
kern_thr.c Add compatible code to let 32bit libthr work on 64bit kernel. 2006-09-22 15:04:28 +00:00
kern_thread.c This is initial version of POSIX priority mutex support, a new userland 2006-08-28 04:24:51 +00:00
kern_time.c Move tz_minuteswest and tz_dsttime to subr_clock.c 2006-10-02 16:06:26 +00:00
kern_timeout.c Improve ktr(4) logging for callout(9) subsystem. Log all inserts and 2006-10-11 14:57:03 +00:00
kern_umtx.c Implement 32bit umtx_lock and umtx_unlock system calls, these two system 2006-10-06 08:22:08 +00:00
kern_uuid.c Separate functions with a newline. 2006-07-17 21:00:42 +00:00
kern_xxx.c
ksched.c Return priority range 0..PRI_MAX_TIMESHARE-PRI_MIN_TIMESHARE for 2006-07-12 05:54:17 +00:00
link_elf_obj.c Replace the kld_mtx mutex with a kld_sx sx lock and expand it's scope to 2006-06-21 20:42:08 +00:00
link_elf.c Let native elf class be registered earlier. 2006-07-14 22:39:18 +00:00
linker_if.m
Make.tags.inc
Makefile Add support for the generated file systrace_args.c. 2006-08-05 19:25:14 +00:00
makesyscalls.sh Add a new set of macros <prefix>_AUE_<syscallname> to sysproto.h that 2006-08-15 17:09:32 +00:00
md4c.c
md5c.c Fix a panic on sparc64 related to inproper aligment - we cannot assume, 2006-03-30 18:45:50 +00:00
p1003_1b.c Backout the feature which can change thread's scheduling option, I really 2006-07-13 06:41:26 +00:00
posix4_mib.c
sched_4bsd.c Add user priority loaning code to support priority propagation for 2006-08-25 06:12:53 +00:00
sched_core.c Add user priority loaning code to support priority propagation for 2006-08-25 06:12:53 +00:00
sched_ule.c Add user priority loaning code to support priority propagation for 2006-08-25 06:12:53 +00:00
serdev_if.m MFp4: Add the ipend() method to the serdev I/F to allow umbrella 2006-04-23 22:12:39 +00:00
subr_acl_posix1e.c Update and reformat comments for POSIX.1e ACL utility routines. 2006-07-23 19:35:10 +00:00
subr_autoconf.c Add a mutex to protect the list of interrupt config hooks. We do assume 2006-07-19 18:53:56 +00:00
subr_blist.c
subr_bus.c Add a default method for BUS_ADD_CHILD() that just calls 2006-09-11 19:41:31 +00:00
subr_clist.c
subr_clock.c Use utc_offset() where applicable, and hide the internals of it 2006-10-02 18:23:37 +00:00
subr_devstat.c - Remove two mtx_asserts that can incorrectly trigger if 2005-05-03 10:58:05 +00:00
subr_disk.c Unexpand TAILQ_FIRST(foo) == NULL to TAILQ_EMPTY(foo). 2006-05-29 05:43:26 +00:00
subr_eventhandler.c eliminate potential null deref 2005-02-23 19:32:29 +00:00
subr_firmware.c If linker_release_module() fails then we still hold a reference on 2006-06-25 12:36:21 +00:00
subr_hints.c Use a sleep mutex instead of an sx lock for the kernel environment. This 2006-07-09 21:42:58 +00:00
subr_kdb.c Add a funny sysctl: debug.kdb.trap_code . 2006-06-18 12:27:59 +00:00
subr_kobj.c Increment kobj_lookup_misses on a miss rather than decrementing it. 2005-12-29 18:00:42 +00:00
subr_lock.c Add a basic reader/writer lock implementation to the kernel. This 2006-01-27 23:13:26 +00:00
subr_log.c Use dynamic major number allocation. 2005-02-27 22:02:03 +00:00
subr_mbpool.c
subr_mchain.c Change API of mb_copy_t in libmchain so that netsmb can handle 2005-07-29 13:22:37 +00:00
subr_module.c
subr_msgbuf.c
subr_param.c Partially revert revision 1.66, which contained a change that did not 2005-10-14 19:15:10 +00:00
subr_pcpu.c Fix 'show allpcpu' ddb command on non-x86. CPU IDs are in the range 0 .. 2005-11-03 21:06:29 +00:00
subr_power.c General consensus is that it would be even better to run this in a 2005-11-09 16:22:56 +00:00
subr_prf.c Declare security and security.bsd sysctl hierarchies in sysctl.h along 2006-09-17 20:00:36 +00:00
subr_prof.c Change the addupc_*() functions to use the uintfptr_t type for pc rather 2005-12-16 22:08:32 +00:00
subr_rman.c - Fix rman_manage_region() to be a lot more intelligent. It now checks 2006-09-11 19:31:52 +00:00
subr_rtc.c Use utc_offset() where applicable, and hide the internals of it 2006-10-02 18:23:37 +00:00
subr_sbuf.c Make sbuf_copyin() return the number of bytes copied on success. 2005-12-23 11:49:53 +00:00
subr_scanf.c
subr_sleepqueue.c Print td_name instead of p_comm if td_name is non-empty for 2006-04-21 20:40:43 +00:00
subr_smp.c Rename the KDB_STOP_NMI kernel option to STOP_NMI and make it apply to all 2005-10-24 21:04:19 +00:00
subr_stack.c Correct typos 2006-05-28 22:15:28 +00:00
subr_taskqueue.c When starting up threads in taskqueue_start_threads create them 2006-05-24 22:11:07 +00:00
subr_trap.c Test before modifying p_sflag to avoid unconditionally cache line 2006-02-10 14:59:16 +00:00
subr_turnstile.c Add a new 'show sleepchain' ddb command similar to 'show lockchain' except 2006-08-15 18:29:01 +00:00
subr_unit.c Remove debugging printfs. 2005-03-14 06:51:29 +00:00
subr_witness.c Introduce a spinlock for synchronizing access to the video output hardware 2006-09-13 15:48:15 +00:00
sys_generic.c Prevent IOC_IN with zero size argument (this is only supported 2006-10-14 19:01:55 +00:00
sys_pipe.c Move some functions and definitions from uipc_socket2.c to uipc_socket.c: 2006-06-10 14:34:07 +00:00
sys_process.c Close a race condition where num can be larger than tmp, giving the user 2006-10-14 10:30:14 +00:00
sys_socket.c soreceive_generic(), and sopoll_generic(). Add new functions sosend(), 2006-07-24 15:20:08 +00:00
syscalls.c Regenerate. 2006-10-03 20:48:11 +00:00
syscalls.master Audit creat() system call (compat code), and change type for getpagesize(), 2006-10-03 20:46:52 +00:00
systrace_args.c Regenerate. 2006-09-21 04:19:48 +00:00
sysv_ipc.c
sysv_msg.c Remove MAC_DEBUG + MPRINTF debugging from System V IPC. This no longer 2006-09-20 13:40:00 +00:00
sysv_sem.c Remove MAC_DEBUG + MPRINTF debugging from System V IPC. This no longer 2006-09-20 13:40:00 +00:00
sysv_shm.c Remove MAC_DEBUG + MPRINTF debugging from System V IPC. This no longer 2006-09-20 13:40:00 +00:00
tty_compat.c Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43) 2006-01-10 09:19:10 +00:00
tty_conf.c
tty_cons.c If the console has no cncheckc method, use cngetc instead. 2006-05-26 11:00:20 +00:00
tty_pts.c Free tty struct after last close. This should fix the pty-leak by numbers. 2006-09-29 09:53:19 +00:00
tty_pty.c Back out part of rev. 1.149. While adding a workaround in ptcopen() to 2006-10-04 05:43:39 +00:00
tty_subr.c
tty_tty.c Use ctty instead of just returning. ctty just has a simple open that 2006-09-27 16:41:15 +00:00
tty.c Any call of tty_close() with a tty refcount of <= 1 is wrong and we will 2006-09-30 08:11:51 +00:00
uipc_accf.c o setsockopt(2) cannot remove accept filter. [1] 2005-06-11 11:59:48 +00:00
uipc_cow.c Previously, nothing prevented the page that was returned by pmap_extract() 2005-10-23 07:41:56 +00:00
uipc_domain.c soreceive_generic(), and sopoll_generic(). Add new functions sosend(), 2006-07-24 15:20:08 +00:00
uipc_mbuf2.c Define four constants, MBUF_{,MEM,CLUSTER,PACKET,TAG}_MEM_NAME, which 2005-07-17 14:04:03 +00:00
uipc_mbuf.c atomic_fetchadd_int is used by mb_free_ext(), but it 2006-09-21 09:55:43 +00:00
uipc_mqueue.c Use mount interlock to protect all changes to mnt_flag and mnt_kern_flag. 2006-09-26 04:12:49 +00:00
uipc_sem.c Swap the names "sem_exithook" and "sem_exechook" in the previous commit to 2006-08-16 08:25:40 +00:00
uipc_sockbuf.c Use sysctl_handle_long() instead of duplicating it's logic for 2006-09-06 21:59:36 +00:00
uipc_socket2.c Change two XXX's to two notes: the fact that SOCK_LOCK(so) == 2006-08-02 16:23:52 +00:00
uipc_socket.c Fix a case where socket I/O atomicity is violated due to not dropping 2006-09-22 15:34:16 +00:00
uipc_syscalls.c Introduce a field to struct vm_page for storing flags that are 2006-08-09 17:43:27 +00:00
uipc_usrreq.c Minor white space tweaks. 2006-08-13 23:16:59 +00:00
vfs_acl.c Move POSIX.1e-specific utility routines from kern_acl.c to 2006-07-06 23:37:39 +00:00
vfs_aio.c MFP4 (with some minor changes): 2006-10-15 14:22:14 +00:00
vfs_bio.c If the buffer lock has waiters after the buffer has changed identity then 2006-10-02 02:06:27 +00:00
vfs_cache.c Axe Giant from vn_fullpath(9). The vnode -> pathname lookup should be 2006-06-16 05:09:28 +00:00
vfs_cluster.c Add mnt_noasync counter to better handle interleaved calls to nmount(), 2006-09-26 04:15:59 +00:00
vfs_default.c Don't try to obtain a reference to a nonexisting (NULL) mount structure in 2006-09-20 00:27:02 +00:00
vfs_export.c Use mount interlock to protect all changes to mnt_flag and mnt_kern_flag. 2006-09-26 04:12:49 +00:00
vfs_extattr.c Add mnt_noasync counter to better handle interleaved calls to nmount(), 2006-09-26 04:15:59 +00:00
vfs_hash.c In vfs_hash_get(): mount point should never be changed 2006-04-18 08:05:08 +00:00
vfs_init.c Remove duplicate security checks already performed in kern_kldload(). 2006-06-26 18:33:32 +00:00
vfs_lookup.c Fix for a potential bug caught by Coverity. Pointed out to me by Kris Kennaway. 2006-09-14 17:57:02 +00:00
vfs_mount.c Fix the remaining race in the revs. 1.232, 1,233 that could occur during 2006-10-03 10:47:04 +00:00
vfs_subr.c Correct the comment: numvnodes is decreased on vdestroying the vnode. 2006-10-02 07:25:58 +00:00
vfs_syscalls.c Add mnt_noasync counter to better handle interleaved calls to nmount(), 2006-09-26 04:15:59 +00:00
vfs_vnops.c Simplify the code and remove two mutex operations. 2006-06-24 22:55:43 +00:00
vnode_if.src Remove two locking assertion entries that: 2006-05-31 14:06:06 +00:00