Simplify AIO initialization now that it is standard.

- Mark AIO system calls as STD and remove the helpers to dynamically
  register them.
- Use COMPAT6 for the old system calls with the older sigevent instead of
  an 'o' prefix.
- Simplify the POSIX configuration to note that AIO is always available.
- Handle AIO in the default VOP_PATHCONF instead of special casing it in
  the pathconf() system call.  fpathconf() is still hackish.
- Remove freebsd32_aio_cancel() as it just called the native one directly.

Reviewed by:	kib
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D5589
This commit is contained in:
John Baldwin 2016-03-09 19:05:11 +00:00
parent b9befd33b4
commit 399e8c1773
10 changed files with 78 additions and 121 deletions

View File

@ -477,11 +477,11 @@
u_int nfds, int timeout); } u_int nfds, int timeout); }
253 AUE_ISSETUGID NOPROTO { int issetugid(void); } 253 AUE_ISSETUGID NOPROTO { int issetugid(void); }
254 AUE_LCHOWN NOPROTO { int lchown(char *path, int uid, int gid); } 254 AUE_LCHOWN NOPROTO { int lchown(char *path, int uid, int gid); }
255 AUE_NULL NOSTD { int freebsd32_aio_read( \ 255 AUE_NULL STD { int freebsd32_aio_read( \
struct aiocb32 *aiocbp); } struct aiocb32 *aiocbp); }
256 AUE_NULL NOSTD { int freebsd32_aio_write( \ 256 AUE_NULL STD { int freebsd32_aio_write( \
struct aiocb32 *aiocbp); } struct aiocb32 *aiocbp); }
257 AUE_NULL NOSTD { int freebsd32_lio_listio(int mode, \ 257 AUE_NULL STD { int freebsd32_lio_listio(int mode, \
struct aiocb32 * const *acb_list, \ struct aiocb32 * const *acb_list, \
int nent, struct sigevent32 *sig); } int nent, struct sigevent32 *sig); }
258 AUE_NULL UNIMPL nosys 258 AUE_NULL UNIMPL nosys
@ -562,20 +562,20 @@
312 AUE_SETRESGID NOPROTO { int setresgid(gid_t rgid, gid_t egid, \ 312 AUE_SETRESGID NOPROTO { int setresgid(gid_t rgid, gid_t egid, \
gid_t sgid); } gid_t sgid); }
313 AUE_NULL OBSOL signanosleep 313 AUE_NULL OBSOL signanosleep
314 AUE_NULL NOSTD { int freebsd32_aio_return( \ 314 AUE_NULL STD { int freebsd32_aio_return( \
struct aiocb32 *aiocbp); } struct aiocb32 *aiocbp); }
315 AUE_NULL NOSTD { int freebsd32_aio_suspend( \ 315 AUE_NULL STD { int freebsd32_aio_suspend( \
struct aiocb32 * const * aiocbp, int nent, \ struct aiocb32 * const * aiocbp, int nent, \
const struct timespec32 *timeout); } const struct timespec32 *timeout); }
316 AUE_NULL NOSTD { int freebsd32_aio_cancel(int fd, \ 316 AUE_NULL NOPROTO { int aio_cancel(int fd, \
struct aiocb *aiocbp); }
317 AUE_NULL STD { int freebsd32_aio_error( \
struct aiocb32 *aiocbp); } struct aiocb32 *aiocbp); }
317 AUE_NULL NOSTD { int freebsd32_aio_error( \ 318 AUE_NULL COMPAT6 { int freebsd32_aio_read( \
struct aiocb32 *aiocbp); }
318 AUE_NULL NOSTD { int freebsd32_oaio_read( \
struct oaiocb32 *aiocbp); } struct oaiocb32 *aiocbp); }
319 AUE_NULL NOSTD { int freebsd32_oaio_write( \ 319 AUE_NULL COMPAT6 { int freebsd32_aio_write( \
struct oaiocb32 *aiocbp); } struct oaiocb32 *aiocbp); }
320 AUE_NULL NOSTD { int freebsd32_olio_listio(int mode, \ 320 AUE_NULL COMPAT6 { int freebsd32_lio_listio(int mode, \
struct oaiocb32 * const *acb_list, \ struct oaiocb32 * const *acb_list, \
int nent, struct osigevent32 *sig); } int nent, struct osigevent32 *sig); }
321 AUE_NULL NOPROTO { int yield(void); } 321 AUE_NULL NOPROTO { int yield(void); }
@ -653,7 +653,7 @@
358 AUE_EXTATTR_DELETE_FILE NOPROTO { int extattr_delete_file( \ 358 AUE_EXTATTR_DELETE_FILE NOPROTO { int extattr_delete_file( \
const char *path, int attrnamespace, \ const char *path, int attrnamespace, \
const char *attrname); } const char *attrname); }
359 AUE_NULL NOSTD { int freebsd32_aio_waitcomplete( \ 359 AUE_NULL STD { int freebsd32_aio_waitcomplete( \
struct aiocb32 **aiocbp, \ struct aiocb32 **aiocbp, \
struct timespec32 *timeout); } struct timespec32 *timeout); }
360 AUE_GETRESUID NOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \ 360 AUE_GETRESUID NOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \
@ -837,7 +837,7 @@
462 AUE_NULL NOPROTO|NOSTD { int kmq_unlink(const char *path); } 462 AUE_NULL NOPROTO|NOSTD { int kmq_unlink(const char *path); }
463 AUE_NULL NOPROTO { int abort2(const char *why, int nargs, void **args); } 463 AUE_NULL NOPROTO { int abort2(const char *why, int nargs, void **args); }
464 AUE_NULL NOPROTO { int thr_set_name(long id, const char *name); } 464 AUE_NULL NOPROTO { int thr_set_name(long id, const char *name); }
465 AUE_NULL NOSTD { int freebsd32_aio_fsync(int op, \ 465 AUE_NULL STD { int freebsd32_aio_fsync(int op, \
struct aiocb32 *aiocbp); } struct aiocb32 *aiocbp); }
466 AUE_RTPRIO NOPROTO { int rtprio_thread(int function, \ 466 AUE_RTPRIO NOPROTO { int rtprio_thread(int function, \
lwpid_t lwpid, struct rtprio *rtp); } lwpid_t lwpid, struct rtprio *rtp); }
@ -1055,7 +1055,7 @@
__socklen_t * __restrict anamelen, \ __socklen_t * __restrict anamelen, \
int flags); } int flags); }
542 AUE_PIPE NOPROTO { int pipe2(int *fildes, int flags); } 542 AUE_PIPE NOPROTO { int pipe2(int *fildes, int flags); }
543 AUE_NULL NOSTD { int freebsd32_aio_mlock( \ 543 AUE_NULL STD { int freebsd32_aio_mlock( \
struct aiocb32 *aiocbp); } struct aiocb32 *aiocbp); }
#ifdef PAD64_REQUIRED #ifdef PAD64_REQUIRED
544 AUE_NULL STD { int freebsd32_procctl(int idtype, int pad, \ 544 AUE_NULL STD { int freebsd32_procctl(int idtype, int pad, \

View File

@ -1395,9 +1395,8 @@ sys_fpathconf(struct thread *td, struct fpathconf_args *uap)
if (error != 0) if (error != 0)
return (error); return (error);
/* If asynchronous I/O is available, it works for all descriptors. */
if (uap->name == _PC_ASYNC_IO) { if (uap->name == _PC_ASYNC_IO) {
td->td_retval[0] = async_io_version; td->td_retval[0] = _POSIX_ASYNCHRONOUS_IO;
goto out; goto out;
} }
vp = fp->f_vnode; vp = fp->f_vnode;

View File

@ -77,8 +77,7 @@ SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
#endif #endif
SYSCTL_INT(_p1003_1b, CTL_P1003_1B_ASYNCHRONOUS_IO, \ P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io);
asynchronous_io, CTLFLAG_RD, &async_io_version, 0, "");
P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files); P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock); P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);
P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range); P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range);
@ -170,12 +169,6 @@ p31b_set_standard(void *dummy)
p31b_setcfg(CTL_P1003_1B_MAPPED_FILES, 200112L); p31b_setcfg(CTL_P1003_1B_MAPPED_FILES, 200112L);
p31b_setcfg(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, 200112L); p31b_setcfg(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, 200112L);
p31b_setcfg(CTL_P1003_1B_PAGESIZE, PAGE_SIZE); p31b_setcfg(CTL_P1003_1B_PAGESIZE, PAGE_SIZE);
if (!p31b_iscfg(CTL_P1003_1B_AIO_LISTIO_MAX))
p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, -1);
if (!p31b_iscfg(CTL_P1003_1B_AIO_MAX))
p31b_setcfg(CTL_P1003_1B_AIO_MAX, -1);
if (!p31b_iscfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX))
p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, -1);
} }
SYSINIT(p31b_set_standard, SI_SUB_P1003_1B, SI_ORDER_ANY, p31b_set_standard, SYSINIT(p31b_set_standard, SI_SUB_P1003_1B, SI_ORDER_ANY, p31b_set_standard,

View File

@ -475,9 +475,9 @@
u_int nfds, int timeout); } u_int nfds, int timeout); }
253 AUE_ISSETUGID STD { int issetugid(void); } 253 AUE_ISSETUGID STD { int issetugid(void); }
254 AUE_LCHOWN STD { int lchown(char *path, int uid, int gid); } 254 AUE_LCHOWN STD { int lchown(char *path, int uid, int gid); }
255 AUE_NULL NOSTD { int aio_read(struct aiocb *aiocbp); } 255 AUE_NULL STD { int aio_read(struct aiocb *aiocbp); }
256 AUE_NULL NOSTD { int aio_write(struct aiocb *aiocbp); } 256 AUE_NULL STD { int aio_write(struct aiocb *aiocbp); }
257 AUE_NULL NOSTD { int lio_listio(int mode, \ 257 AUE_NULL STD { int lio_listio(int mode, \
struct aiocb * const *acb_list, \ struct aiocb * const *acb_list, \
int nent, struct sigevent *sig); } int nent, struct sigevent *sig); }
258 AUE_NULL UNIMPL nosys 258 AUE_NULL UNIMPL nosys
@ -554,16 +554,16 @@
312 AUE_SETRESGID STD { int setresgid(gid_t rgid, gid_t egid, \ 312 AUE_SETRESGID STD { int setresgid(gid_t rgid, gid_t egid, \
gid_t sgid); } gid_t sgid); }
313 AUE_NULL OBSOL signanosleep 313 AUE_NULL OBSOL signanosleep
314 AUE_NULL NOSTD { int aio_return(struct aiocb *aiocbp); } 314 AUE_NULL STD { int aio_return(struct aiocb *aiocbp); }
315 AUE_NULL NOSTD { int aio_suspend( \ 315 AUE_NULL STD { int aio_suspend( \
struct aiocb * const * aiocbp, int nent, \ struct aiocb * const * aiocbp, int nent, \
const struct timespec *timeout); } const struct timespec *timeout); }
316 AUE_NULL NOSTD { int aio_cancel(int fd, \ 316 AUE_NULL STD { int aio_cancel(int fd, \
struct aiocb *aiocbp); } struct aiocb *aiocbp); }
317 AUE_NULL NOSTD { int aio_error(struct aiocb *aiocbp); } 317 AUE_NULL STD { int aio_error(struct aiocb *aiocbp); }
318 AUE_NULL NOSTD { int oaio_read(struct oaiocb *aiocbp); } 318 AUE_NULL COMPAT6 { int aio_read(struct oaiocb *aiocbp); }
319 AUE_NULL NOSTD { int oaio_write(struct oaiocb *aiocbp); } 319 AUE_NULL COMPAT6 { int aio_write(struct oaiocb *aiocbp); }
320 AUE_NULL NOSTD { int olio_listio(int mode, \ 320 AUE_NULL COMPAT6 { int lio_listio(int mode, \
struct oaiocb * const *acb_list, \ struct oaiocb * const *acb_list, \
int nent, struct osigevent *sig); } int nent, struct osigevent *sig); }
321 AUE_NULL STD { int yield(void); } 321 AUE_NULL STD { int yield(void); }
@ -643,7 +643,7 @@
358 AUE_EXTATTR_DELETE_FILE STD { int extattr_delete_file(const char *path, \ 358 AUE_EXTATTR_DELETE_FILE STD { int extattr_delete_file(const char *path, \
int attrnamespace, \ int attrnamespace, \
const char *attrname); } const char *attrname); }
359 AUE_NULL NOSTD { int aio_waitcomplete( \ 359 AUE_NULL STD { int aio_waitcomplete( \
struct aiocb **aiocbp, \ struct aiocb **aiocbp, \
struct timespec *timeout); } struct timespec *timeout); }
360 AUE_GETRESUID STD { int getresuid(uid_t *ruid, uid_t *euid, \ 360 AUE_GETRESUID STD { int getresuid(uid_t *ruid, uid_t *euid, \
@ -830,7 +830,7 @@
462 AUE_NULL NOSTD { int kmq_unlink(const char *path); } 462 AUE_NULL NOSTD { int kmq_unlink(const char *path); }
463 AUE_NULL STD { int abort2(const char *why, int nargs, void **args); } 463 AUE_NULL STD { int abort2(const char *why, int nargs, void **args); }
464 AUE_NULL STD { int thr_set_name(long id, const char *name); } 464 AUE_NULL STD { int thr_set_name(long id, const char *name); }
465 AUE_NULL NOSTD { int aio_fsync(int op, struct aiocb *aiocbp); } 465 AUE_NULL STD { int aio_fsync(int op, struct aiocb *aiocbp); }
466 AUE_RTPRIO STD { int rtprio_thread(int function, \ 466 AUE_RTPRIO STD { int rtprio_thread(int function, \
lwpid_t lwpid, struct rtprio *rtp); } lwpid_t lwpid, struct rtprio *rtp); }
467 AUE_NULL UNIMPL nosys 467 AUE_NULL UNIMPL nosys
@ -977,7 +977,7 @@
__socklen_t * __restrict anamelen, \ __socklen_t * __restrict anamelen, \
int flags); } int flags); }
542 AUE_PIPE STD { int pipe2(int *fildes, int flags); } 542 AUE_PIPE STD { int pipe2(int *fildes, int flags); }
543 AUE_NULL NOSTD { int aio_mlock(struct aiocb *aiocbp); } 543 AUE_NULL STD { int aio_mlock(struct aiocb *aiocbp); }
544 AUE_NULL STD { int procctl(idtype_t idtype, id_t id, \ 544 AUE_NULL STD { int procctl(idtype_t idtype, id_t id, \
int com, void *data); } int com, void *data); }
545 AUE_POLL STD { int ppoll(struct pollfd *fds, u_int nfds, \ 545 AUE_POLL STD { int ppoll(struct pollfd *fds, u_int nfds, \

View File

@ -161,6 +161,7 @@ static int max_buf_aio = MAX_BUF_AIO;
SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0,
"Maximum buf aio requests per process (stored in the process)"); "Maximum buf aio requests per process (stored in the process)");
#ifdef COMPAT_FREEBSD6
typedef struct oaiocb { typedef struct oaiocb {
int aio_fildes; /* File descriptor */ int aio_fildes; /* File descriptor */
off_t aio_offset; /* File offset for I/O */ off_t aio_offset; /* File offset for I/O */
@ -171,6 +172,7 @@ typedef struct oaiocb {
int aio_reqprio; /* Request priority -- ignored */ int aio_reqprio; /* Request priority -- ignored */
struct __aiocb_private _aiocb_private; struct __aiocb_private _aiocb_private;
} oaiocb_t; } oaiocb_t;
#endif
/* /*
* Below is a key of locks used to protect each member of struct kaiocb * Below is a key of locks used to protect each member of struct kaiocb
@ -368,52 +370,7 @@ static moduledata_t aio_mod = {
NULL NULL
}; };
static struct syscall_helper_data aio_syscalls[] = { DECLARE_MODULE(aio, aio_mod, SI_SUB_VFS, SI_ORDER_ANY);
SYSCALL_INIT_HELPER(aio_cancel),
SYSCALL_INIT_HELPER(aio_error),
SYSCALL_INIT_HELPER(aio_fsync),
SYSCALL_INIT_HELPER(aio_mlock),
SYSCALL_INIT_HELPER(aio_read),
SYSCALL_INIT_HELPER(aio_return),
SYSCALL_INIT_HELPER(aio_suspend),
SYSCALL_INIT_HELPER(aio_waitcomplete),
SYSCALL_INIT_HELPER(aio_write),
SYSCALL_INIT_HELPER(lio_listio),
SYSCALL_INIT_HELPER(oaio_read),
SYSCALL_INIT_HELPER(oaio_write),
SYSCALL_INIT_HELPER(olio_listio),
SYSCALL_INIT_LAST
};
#ifdef COMPAT_FREEBSD32
#include <sys/mount.h>
#include <sys/socket.h>
#include <compat/freebsd32/freebsd32.h>
#include <compat/freebsd32/freebsd32_proto.h>
#include <compat/freebsd32/freebsd32_signal.h>
#include <compat/freebsd32/freebsd32_syscall.h>
#include <compat/freebsd32/freebsd32_util.h>
static struct syscall_helper_data aio32_syscalls[] = {
SYSCALL32_INIT_HELPER(freebsd32_aio_return),
SYSCALL32_INIT_HELPER(freebsd32_aio_suspend),
SYSCALL32_INIT_HELPER(freebsd32_aio_cancel),
SYSCALL32_INIT_HELPER(freebsd32_aio_error),
SYSCALL32_INIT_HELPER(freebsd32_aio_fsync),
SYSCALL32_INIT_HELPER(freebsd32_aio_mlock),
SYSCALL32_INIT_HELPER(freebsd32_aio_read),
SYSCALL32_INIT_HELPER(freebsd32_aio_write),
SYSCALL32_INIT_HELPER(freebsd32_aio_waitcomplete),
SYSCALL32_INIT_HELPER(freebsd32_lio_listio),
SYSCALL32_INIT_HELPER(freebsd32_oaio_read),
SYSCALL32_INIT_HELPER(freebsd32_oaio_write),
SYSCALL32_INIT_HELPER(freebsd32_olio_listio),
SYSCALL_INIT_LAST
};
#endif
DECLARE_MODULE(aio, aio_mod,
SI_SUB_VFS, SI_ORDER_ANY);
MODULE_VERSION(aio, 1); MODULE_VERSION(aio, 1);
/* /*
@ -422,7 +379,6 @@ MODULE_VERSION(aio, 1);
static int static int
aio_onceonly(void) aio_onceonly(void)
{ {
int error;
exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL,
EVENTHANDLER_PRI_ANY); EVENTHANDLER_PRI_ANY);
@ -447,19 +403,11 @@ aio_onceonly(void)
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiod_lifetime = AIOD_LIFETIME_DEFAULT; aiod_lifetime = AIOD_LIFETIME_DEFAULT;
jobrefid = 1; jobrefid = 1;
async_io_version = _POSIX_VERSION; p31b_setcfg(CTL_P1003_1B_ASYNCHRONOUS_IO, _POSIX_ASYNCHRONOUS_IO);
p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX); p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX);
p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE); p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE);
p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0); p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0);
error = syscall_helper_register(aio_syscalls, SY_THR_STATIC_KLD);
if (error)
return (error);
#ifdef COMPAT_FREEBSD32
error = syscall32_helper_register(aio32_syscalls, SY_THR_STATIC_KLD);
if (error)
return (error);
#endif
return (0); return (0);
} }
@ -1340,6 +1288,7 @@ unref:
return (error); return (error);
} }
#ifdef COMPAT_FREEBSD6
static int static int
convert_old_sigevent(struct osigevent *osig, struct sigevent *nsig) convert_old_sigevent(struct osigevent *osig, struct sigevent *nsig)
{ {
@ -1379,6 +1328,7 @@ aiocb_copyin_old_sigevent(struct aiocb *ujob, struct aiocb *kjob)
ojob = (struct oaiocb *)kjob; ojob = (struct oaiocb *)kjob;
return (convert_old_sigevent(&ojob->aio_sigevent, &kjob->aio_sigevent)); return (convert_old_sigevent(&ojob->aio_sigevent, &kjob->aio_sigevent));
} }
#endif
static int static int
aiocb_copyin(struct aiocb *ujob, struct aiocb *kjob) aiocb_copyin(struct aiocb *ujob, struct aiocb *kjob)
@ -1439,6 +1389,7 @@ static struct aiocb_ops aiocb_ops = {
.store_aiocb = aiocb_store_aiocb, .store_aiocb = aiocb_store_aiocb,
}; };
#ifdef COMPAT_FREEBSD6
static struct aiocb_ops aiocb_ops_osigevent = { static struct aiocb_ops aiocb_ops_osigevent = {
.copyin = aiocb_copyin_old_sigevent, .copyin = aiocb_copyin_old_sigevent,
.fetch_status = aiocb_fetch_status, .fetch_status = aiocb_fetch_status,
@ -1448,6 +1399,7 @@ static struct aiocb_ops aiocb_ops_osigevent = {
.store_kernelinfo = aiocb_store_kernelinfo, .store_kernelinfo = aiocb_store_kernelinfo,
.store_aiocb = aiocb_store_aiocb, .store_aiocb = aiocb_store_aiocb,
}; };
#endif
/* /*
* Queue a new AIO request. Choosing either the threaded or direct physio VCHR * Queue a new AIO request. Choosing either the threaded or direct physio VCHR
@ -2094,13 +2046,15 @@ sys_aio_error(struct thread *td, struct aio_error_args *uap)
} }
/* syscall - asynchronous read from a file (REALTIME) */ /* syscall - asynchronous read from a file (REALTIME) */
#ifdef COMPAT_FREEBSD6
int int
sys_oaio_read(struct thread *td, struct oaio_read_args *uap) freebsd6_aio_read(struct thread *td, struct freebsd6_aio_read_args *uap)
{ {
return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_READ, return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_READ,
&aiocb_ops_osigevent)); &aiocb_ops_osigevent));
} }
#endif
int int
sys_aio_read(struct thread *td, struct aio_read_args *uap) sys_aio_read(struct thread *td, struct aio_read_args *uap)
@ -2110,13 +2064,15 @@ sys_aio_read(struct thread *td, struct aio_read_args *uap)
} }
/* syscall - asynchronous write to a file (REALTIME) */ /* syscall - asynchronous write to a file (REALTIME) */
#ifdef COMPAT_FREEBSD6
int int
sys_oaio_write(struct thread *td, struct oaio_write_args *uap) freebsd6_aio_write(struct thread *td, struct freebsd6_aio_write_args *uap)
{ {
return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_WRITE, return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_WRITE,
&aiocb_ops_osigevent)); &aiocb_ops_osigevent));
} }
#endif
int int
sys_aio_write(struct thread *td, struct aio_write_args *uap) sys_aio_write(struct thread *td, struct aio_write_args *uap)
@ -2268,8 +2224,9 @@ kern_lio_listio(struct thread *td, int mode, struct aiocb * const *uacb_list,
} }
/* syscall - list directed I/O (REALTIME) */ /* syscall - list directed I/O (REALTIME) */
#ifdef COMPAT_FREEBSD6
int int
sys_olio_listio(struct thread *td, struct olio_listio_args *uap) freebsd6_lio_listio(struct thread *td, struct freebsd6_lio_listio_args *uap)
{ {
struct aiocb **acb_list; struct aiocb **acb_list;
struct sigevent *sigp, sig; struct sigevent *sigp, sig;
@ -2303,6 +2260,7 @@ sys_olio_listio(struct thread *td, struct olio_listio_args *uap)
free(acb_list, M_LIO); free(acb_list, M_LIO);
return (error); return (error);
} }
#endif
/* syscall - list directed I/O (REALTIME) */ /* syscall - list directed I/O (REALTIME) */
int int
@ -2582,6 +2540,13 @@ filt_lio(struct knote *kn, long hint)
} }
#ifdef COMPAT_FREEBSD32 #ifdef COMPAT_FREEBSD32
#include <sys/mount.h>
#include <sys/socket.h>
#include <compat/freebsd32/freebsd32.h>
#include <compat/freebsd32/freebsd32_proto.h>
#include <compat/freebsd32/freebsd32_signal.h>
#include <compat/freebsd32/freebsd32_syscall.h>
#include <compat/freebsd32/freebsd32_util.h>
struct __aiocb_private32 { struct __aiocb_private32 {
int32_t status; int32_t status;
@ -2589,6 +2554,7 @@ struct __aiocb_private32 {
uint32_t kernelinfo; uint32_t kernelinfo;
}; };
#ifdef COMPAT_FREEBSD6
typedef struct oaiocb32 { typedef struct oaiocb32 {
int aio_fildes; /* File descriptor */ int aio_fildes; /* File descriptor */
uint64_t aio_offset __packed; /* File offset for I/O */ uint64_t aio_offset __packed; /* File offset for I/O */
@ -2599,6 +2565,7 @@ typedef struct oaiocb32 {
int aio_reqprio; /* Request priority -- ignored */ int aio_reqprio; /* Request priority -- ignored */
struct __aiocb_private32 _aiocb_private; struct __aiocb_private32 _aiocb_private;
} oaiocb32_t; } oaiocb32_t;
#endif
typedef struct aiocb32 { typedef struct aiocb32 {
int32_t aio_fildes; /* File descriptor */ int32_t aio_fildes; /* File descriptor */
@ -2613,6 +2580,7 @@ typedef struct aiocb32 {
struct sigevent32 aio_sigevent; /* Signal to deliver */ struct sigevent32 aio_sigevent; /* Signal to deliver */
} aiocb32_t; } aiocb32_t;
#ifdef COMPAT_FREEBSD6
static int static int
convert_old_sigevent32(struct osigevent32 *osig, struct sigevent *nsig) convert_old_sigevent32(struct osigevent32 *osig, struct sigevent *nsig)
{ {
@ -2662,6 +2630,7 @@ aiocb32_copyin_old_sigevent(struct aiocb *ujob, struct aiocb *kjob)
return (convert_old_sigevent32(&job32.aio_sigevent, return (convert_old_sigevent32(&job32.aio_sigevent,
&kjob->aio_sigevent)); &kjob->aio_sigevent));
} }
#endif
static int static int
aiocb32_copyin(struct aiocb *ujob, struct aiocb *kjob) aiocb32_copyin(struct aiocb *ujob, struct aiocb *kjob)
@ -2746,6 +2715,7 @@ static struct aiocb_ops aiocb32_ops = {
.store_aiocb = aiocb32_store_aiocb, .store_aiocb = aiocb32_store_aiocb,
}; };
#ifdef COMPAT_FREEBSD6
static struct aiocb_ops aiocb32_ops_osigevent = { static struct aiocb_ops aiocb32_ops_osigevent = {
.copyin = aiocb32_copyin_old_sigevent, .copyin = aiocb32_copyin_old_sigevent,
.fetch_status = aiocb32_fetch_status, .fetch_status = aiocb32_fetch_status,
@ -2755,6 +2725,7 @@ static struct aiocb_ops aiocb32_ops_osigevent = {
.store_kernelinfo = aiocb32_store_kernelinfo, .store_kernelinfo = aiocb32_store_kernelinfo,
.store_aiocb = aiocb32_store_aiocb, .store_aiocb = aiocb32_store_aiocb,
}; };
#endif
int int
freebsd32_aio_return(struct thread *td, struct freebsd32_aio_return_args *uap) freebsd32_aio_return(struct thread *td, struct freebsd32_aio_return_args *uap)
@ -2799,13 +2770,6 @@ freebsd32_aio_suspend(struct thread *td, struct freebsd32_aio_suspend_args *uap)
return (error); return (error);
} }
int
freebsd32_aio_cancel(struct thread *td, struct freebsd32_aio_cancel_args *uap)
{
return (sys_aio_cancel(td, (struct aio_cancel_args *)uap));
}
int int
freebsd32_aio_error(struct thread *td, struct freebsd32_aio_error_args *uap) freebsd32_aio_error(struct thread *td, struct freebsd32_aio_error_args *uap)
{ {
@ -2813,13 +2777,16 @@ freebsd32_aio_error(struct thread *td, struct freebsd32_aio_error_args *uap)
return (kern_aio_error(td, (struct aiocb *)uap->aiocbp, &aiocb32_ops)); return (kern_aio_error(td, (struct aiocb *)uap->aiocbp, &aiocb32_ops));
} }
#ifdef COMPAT_FREEBSD6
int int
freebsd32_oaio_read(struct thread *td, struct freebsd32_oaio_read_args *uap) freebsd6_freebsd32_aio_read(struct thread *td,
struct freebsd6_freebsd32_aio_read_args *uap)
{ {
return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_READ, return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_READ,
&aiocb32_ops_osigevent)); &aiocb32_ops_osigevent));
} }
#endif
int int
freebsd32_aio_read(struct thread *td, struct freebsd32_aio_read_args *uap) freebsd32_aio_read(struct thread *td, struct freebsd32_aio_read_args *uap)
@ -2829,13 +2796,16 @@ freebsd32_aio_read(struct thread *td, struct freebsd32_aio_read_args *uap)
&aiocb32_ops)); &aiocb32_ops));
} }
#ifdef COMPAT_FREEBSD6
int int
freebsd32_oaio_write(struct thread *td, struct freebsd32_oaio_write_args *uap) freebsd6_freebsd32_aio_write(struct thread *td,
struct freebsd6_freebsd32_aio_write_args *uap)
{ {
return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_WRITE, return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_WRITE,
&aiocb32_ops_osigevent)); &aiocb32_ops_osigevent));
} }
#endif
int int
freebsd32_aio_write(struct thread *td, struct freebsd32_aio_write_args *uap) freebsd32_aio_write(struct thread *td, struct freebsd32_aio_write_args *uap)
@ -2884,8 +2854,10 @@ freebsd32_aio_fsync(struct thread *td, struct freebsd32_aio_fsync_args *uap)
&aiocb32_ops)); &aiocb32_ops));
} }
#ifdef COMPAT_FREEBSD6
int int
freebsd32_olio_listio(struct thread *td, struct freebsd32_olio_listio_args *uap) freebsd6_freebsd32_lio_listio(struct thread *td,
struct freebsd6_freebsd32_lio_listio_args *uap)
{ {
struct aiocb **acb_list; struct aiocb **acb_list;
struct sigevent *sigp, sig; struct sigevent *sigp, sig;
@ -2928,6 +2900,7 @@ freebsd32_olio_listio(struct thread *td, struct freebsd32_olio_listio_args *uap)
free(acb_list, M_LIO); free(acb_list, M_LIO);
return (error); return (error);
} }
#endif
int int
freebsd32_lio_listio(struct thread *td, struct freebsd32_lio_listio_args *uap) freebsd32_lio_listio(struct thread *td, struct freebsd32_lio_listio_args *uap)

View File

@ -472,6 +472,9 @@ vop_stdpathconf(ap)
{ {
switch (ap->a_name) { switch (ap->a_name) {
case _PC_ASYNC_IO:
*ap->a_retval = _POSIX_ASYNCHRONOUS_IO;
return (0);
case _PC_NAME_MAX: case _PC_NAME_MAX:
*ap->a_retval = NAME_MAX; *ap->a_retval = NAME_MAX;
return (0); return (0);

View File

@ -105,14 +105,6 @@ static int setutimes(struct thread *td, struct vnode *,
static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred, static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred,
struct thread *td); struct thread *td);
/*
* The module initialization routine for POSIX asynchronous I/O will
* set this to the version of AIO that it implements. (Zero means
* that it is not implemented.) This value is used here by pathconf()
* and in kern_descrip.c by fpathconf().
*/
int async_io_version;
/* /*
* Sync each mounted filesystem. * Sync each mounted filesystem.
*/ */
@ -2347,11 +2339,7 @@ kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name,
return (error); return (error);
NDFREE(&nd, NDF_ONLY_PNBUF); NDFREE(&nd, NDF_ONLY_PNBUF);
/* If asynchronous I/O is available, it works for all files. */ error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval);
if (name == _PC_ASYNC_IO)
td->td_retval[0] = async_io_version;
else
error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval);
vput(nd.ni_vp); vput(nd.ni_vp);
return (error); return (error);
} }

View File

@ -199,6 +199,7 @@ __sigseteq(sigset_t *set1, sigset_t *set2)
return (1); return (1);
} }
#ifdef COMPAT_FREEBSD6
struct osigevent { struct osigevent {
int sigev_notify; /* Notification type */ int sigev_notify; /* Notification type */
union { union {
@ -207,6 +208,7 @@ struct osigevent {
} __sigev_u; } __sigev_u;
union sigval sigev_value; /* Signal value */ union sigval sigev_value; /* Signal value */
}; };
#endif
typedef struct ksiginfo { typedef struct ksiginfo {
TAILQ_ENTRY(ksiginfo) ksi_link; TAILQ_ENTRY(ksiginfo) ksi_link;

View File

@ -50,7 +50,7 @@
* returns -1, the functions may be stubbed out. * returns -1, the functions may be stubbed out.
*/ */
#define _POSIX_ADVISORY_INFO 200112L #define _POSIX_ADVISORY_INFO 200112L
#define _POSIX_ASYNCHRONOUS_IO 0 #define _POSIX_ASYNCHRONOUS_IO 200112L
#define _POSIX_CHOWN_RESTRICTED 1 #define _POSIX_CHOWN_RESTRICTED 1
#define _POSIX_CLOCK_SELECTION (-1) #define _POSIX_CLOCK_SELECTION (-1)
#define _POSIX_CPUTIME 200112L #define _POSIX_CPUTIME 200112L

View File

@ -422,7 +422,6 @@ extern int vttoif_tab[];
*/ */
extern struct vnode *rootvnode; /* root (i.e. "/") vnode */ extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
extern struct mount *rootdevmp; /* "/dev" mount */ extern struct mount *rootdevmp; /* "/dev" mount */
extern int async_io_version; /* 0 or POSIX version of AIO i'face */
extern int desiredvnodes; /* number of vnodes desired */ extern int desiredvnodes; /* number of vnodes desired */
extern struct uma_zone *namei_zone; extern struct uma_zone *namei_zone;
extern struct vattr va_null; /* predefined null vattr structure */ extern struct vattr va_null; /* predefined null vattr structure */