Index: head/sys/compat/freebsd32/syscalls.master =================================================================== --- head/sys/compat/freebsd32/syscalls.master +++ head/sys/compat/freebsd32/syscalls.master @@ -477,11 +477,11 @@ u_int nfds, int timeout); } 253 AUE_ISSETUGID NOPROTO { int issetugid(void); } 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); } -256 AUE_NULL NOSTD { int freebsd32_aio_write( \ +256 AUE_NULL STD { int freebsd32_aio_write( \ 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, \ int nent, struct sigevent32 *sig); } 258 AUE_NULL UNIMPL nosys @@ -562,20 +562,20 @@ 312 AUE_SETRESGID NOPROTO { int setresgid(gid_t rgid, gid_t egid, \ gid_t sgid); } 313 AUE_NULL OBSOL signanosleep -314 AUE_NULL NOSTD { int freebsd32_aio_return( \ +314 AUE_NULL STD { int freebsd32_aio_return( \ 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, \ 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); } -317 AUE_NULL NOSTD { int freebsd32_aio_error( \ - struct aiocb32 *aiocbp); } -318 AUE_NULL NOSTD { int freebsd32_oaio_read( \ +318 AUE_NULL COMPAT6 { int freebsd32_aio_read( \ struct oaiocb32 *aiocbp); } -319 AUE_NULL NOSTD { int freebsd32_oaio_write( \ +319 AUE_NULL COMPAT6 { int freebsd32_aio_write( \ 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, \ int nent, struct osigevent32 *sig); } 321 AUE_NULL NOPROTO { int yield(void); } @@ -653,7 +653,7 @@ 358 AUE_EXTATTR_DELETE_FILE NOPROTO { int extattr_delete_file( \ const char *path, int attrnamespace, \ const char *attrname); } -359 AUE_NULL NOSTD { int freebsd32_aio_waitcomplete( \ +359 AUE_NULL STD { int freebsd32_aio_waitcomplete( \ struct aiocb32 **aiocbp, \ struct timespec32 *timeout); } 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); } 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); } -465 AUE_NULL NOSTD { int freebsd32_aio_fsync(int op, \ +465 AUE_NULL STD { int freebsd32_aio_fsync(int op, \ struct aiocb32 *aiocbp); } 466 AUE_RTPRIO NOPROTO { int rtprio_thread(int function, \ lwpid_t lwpid, struct rtprio *rtp); } @@ -1055,7 +1055,7 @@ __socklen_t * __restrict anamelen, \ 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); } #ifdef PAD64_REQUIRED 544 AUE_NULL STD { int freebsd32_procctl(int idtype, int pad, \ Index: head/sys/kern/kern_descrip.c =================================================================== --- head/sys/kern/kern_descrip.c +++ head/sys/kern/kern_descrip.c @@ -1395,9 +1395,8 @@ if (error != 0) return (error); - /* If asynchronous I/O is available, it works for all descriptors. */ if (uap->name == _PC_ASYNC_IO) { - td->td_retval[0] = async_io_version; + td->td_retval[0] = _POSIX_ASYNCHRONOUS_IO; goto out; } vp = fp->f_vnode; Index: head/sys/kern/posix4_mib.c =================================================================== --- head/sys/kern/posix4_mib.c +++ head/sys/kern/posix4_mib.c @@ -77,8 +77,7 @@ #endif -SYSCTL_INT(_p1003_1b, CTL_P1003_1B_ASYNCHRONOUS_IO, \ - asynchronous_io, CTLFLAG_RD, &async_io_version, 0, ""); +P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io); P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files); P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock); P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range); @@ -170,12 +169,6 @@ p31b_setcfg(CTL_P1003_1B_MAPPED_FILES, 200112L); p31b_setcfg(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, 200112L); 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, Index: head/sys/kern/syscalls.master =================================================================== --- head/sys/kern/syscalls.master +++ head/sys/kern/syscalls.master @@ -475,9 +475,9 @@ u_int nfds, int timeout); } 253 AUE_ISSETUGID STD { int issetugid(void); } 254 AUE_LCHOWN STD { int lchown(char *path, int uid, int gid); } -255 AUE_NULL NOSTD { int aio_read(struct aiocb *aiocbp); } -256 AUE_NULL NOSTD { int aio_write(struct aiocb *aiocbp); } -257 AUE_NULL NOSTD { int lio_listio(int mode, \ +255 AUE_NULL STD { int aio_read(struct aiocb *aiocbp); } +256 AUE_NULL STD { int aio_write(struct aiocb *aiocbp); } +257 AUE_NULL STD { int lio_listio(int mode, \ struct aiocb * const *acb_list, \ int nent, struct sigevent *sig); } 258 AUE_NULL UNIMPL nosys @@ -554,16 +554,16 @@ 312 AUE_SETRESGID STD { int setresgid(gid_t rgid, gid_t egid, \ gid_t sgid); } 313 AUE_NULL OBSOL signanosleep -314 AUE_NULL NOSTD { int aio_return(struct aiocb *aiocbp); } -315 AUE_NULL NOSTD { int aio_suspend( \ +314 AUE_NULL STD { int aio_return(struct aiocb *aiocbp); } +315 AUE_NULL STD { int aio_suspend( \ struct aiocb * const * aiocbp, int nent, \ 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); } -317 AUE_NULL NOSTD { int aio_error(struct aiocb *aiocbp); } -318 AUE_NULL NOSTD { int oaio_read(struct oaiocb *aiocbp); } -319 AUE_NULL NOSTD { int oaio_write(struct oaiocb *aiocbp); } -320 AUE_NULL NOSTD { int olio_listio(int mode, \ +317 AUE_NULL STD { int aio_error(struct aiocb *aiocbp); } +318 AUE_NULL COMPAT6 { int aio_read(struct oaiocb *aiocbp); } +319 AUE_NULL COMPAT6 { int aio_write(struct oaiocb *aiocbp); } +320 AUE_NULL COMPAT6 { int lio_listio(int mode, \ struct oaiocb * const *acb_list, \ int nent, struct osigevent *sig); } 321 AUE_NULL STD { int yield(void); } @@ -643,7 +643,7 @@ 358 AUE_EXTATTR_DELETE_FILE STD { int extattr_delete_file(const char *path, \ int attrnamespace, \ const char *attrname); } -359 AUE_NULL NOSTD { int aio_waitcomplete( \ +359 AUE_NULL STD { int aio_waitcomplete( \ struct aiocb **aiocbp, \ struct timespec *timeout); } 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); } 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); } -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, \ lwpid_t lwpid, struct rtprio *rtp); } 467 AUE_NULL UNIMPL nosys @@ -977,7 +977,7 @@ __socklen_t * __restrict anamelen, \ 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, \ int com, void *data); } 545 AUE_POLL STD { int ppoll(struct pollfd *fds, u_int nfds, \ Index: head/sys/kern/vfs_aio.c =================================================================== --- head/sys/kern/vfs_aio.c +++ head/sys/kern/vfs_aio.c @@ -161,6 +161,7 @@ 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)"); +#ifdef COMPAT_FREEBSD6 typedef struct oaiocb { int aio_fildes; /* File descriptor */ off_t aio_offset; /* File offset for I/O */ @@ -171,6 +172,7 @@ int aio_reqprio; /* Request priority -- ignored */ struct __aiocb_private _aiocb_private; } oaiocb_t; +#endif /* * Below is a key of locks used to protect each member of struct kaiocb @@ -368,52 +370,7 @@ NULL }; -static struct syscall_helper_data aio_syscalls[] = { - 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 -#include -#include -#include -#include -#include -#include - -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); +DECLARE_MODULE(aio, aio_mod, SI_SUB_VFS, SI_ORDER_ANY); MODULE_VERSION(aio, 1); /* @@ -422,7 +379,6 @@ static int aio_onceonly(void) { - int error; exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, EVENTHANDLER_PRI_ANY); @@ -447,19 +403,11 @@ NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiod_lifetime = AIOD_LIFETIME_DEFAULT; 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_MAX, MAX_AIO_QUEUE); 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); } @@ -1340,6 +1288,7 @@ return (error); } +#ifdef COMPAT_FREEBSD6 static int convert_old_sigevent(struct osigevent *osig, struct sigevent *nsig) { @@ -1379,6 +1328,7 @@ ojob = (struct oaiocb *)kjob; return (convert_old_sigevent(&ojob->aio_sigevent, &kjob->aio_sigevent)); } +#endif static int aiocb_copyin(struct aiocb *ujob, struct aiocb *kjob) @@ -1439,6 +1389,7 @@ .store_aiocb = aiocb_store_aiocb, }; +#ifdef COMPAT_FREEBSD6 static struct aiocb_ops aiocb_ops_osigevent = { .copyin = aiocb_copyin_old_sigevent, .fetch_status = aiocb_fetch_status, @@ -1448,6 +1399,7 @@ .store_kernelinfo = aiocb_store_kernelinfo, .store_aiocb = aiocb_store_aiocb, }; +#endif /* * Queue a new AIO request. Choosing either the threaded or direct physio VCHR @@ -2094,13 +2046,15 @@ } /* syscall - asynchronous read from a file (REALTIME) */ +#ifdef COMPAT_FREEBSD6 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, &aiocb_ops_osigevent)); } +#endif int sys_aio_read(struct thread *td, struct aio_read_args *uap) @@ -2110,13 +2064,15 @@ } /* syscall - asynchronous write to a file (REALTIME) */ +#ifdef COMPAT_FREEBSD6 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, &aiocb_ops_osigevent)); } +#endif int sys_aio_write(struct thread *td, struct aio_write_args *uap) @@ -2268,8 +2224,9 @@ } /* syscall - list directed I/O (REALTIME) */ +#ifdef COMPAT_FREEBSD6 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 sigevent *sigp, sig; @@ -2303,6 +2260,7 @@ free(acb_list, M_LIO); return (error); } +#endif /* syscall - list directed I/O (REALTIME) */ int @@ -2582,6 +2540,13 @@ } #ifdef COMPAT_FREEBSD32 +#include +#include +#include +#include +#include +#include +#include struct __aiocb_private32 { int32_t status; @@ -2589,6 +2554,7 @@ uint32_t kernelinfo; }; +#ifdef COMPAT_FREEBSD6 typedef struct oaiocb32 { int aio_fildes; /* File descriptor */ uint64_t aio_offset __packed; /* File offset for I/O */ @@ -2599,6 +2565,7 @@ int aio_reqprio; /* Request priority -- ignored */ struct __aiocb_private32 _aiocb_private; } oaiocb32_t; +#endif typedef struct aiocb32 { int32_t aio_fildes; /* File descriptor */ @@ -2613,6 +2580,7 @@ struct sigevent32 aio_sigevent; /* Signal to deliver */ } aiocb32_t; +#ifdef COMPAT_FREEBSD6 static int convert_old_sigevent32(struct osigevent32 *osig, struct sigevent *nsig) { @@ -2662,6 +2630,7 @@ return (convert_old_sigevent32(&job32.aio_sigevent, &kjob->aio_sigevent)); } +#endif static int aiocb32_copyin(struct aiocb *ujob, struct aiocb *kjob) @@ -2746,6 +2715,7 @@ .store_aiocb = aiocb32_store_aiocb, }; +#ifdef COMPAT_FREEBSD6 static struct aiocb_ops aiocb32_ops_osigevent = { .copyin = aiocb32_copyin_old_sigevent, .fetch_status = aiocb32_fetch_status, @@ -2755,6 +2725,7 @@ .store_kernelinfo = aiocb32_store_kernelinfo, .store_aiocb = aiocb32_store_aiocb, }; +#endif int freebsd32_aio_return(struct thread *td, struct freebsd32_aio_return_args *uap) @@ -2800,26 +2771,22 @@ } int -freebsd32_aio_cancel(struct thread *td, struct freebsd32_aio_cancel_args *uap) -{ - - return (sys_aio_cancel(td, (struct aio_cancel_args *)uap)); -} - -int freebsd32_aio_error(struct thread *td, struct freebsd32_aio_error_args *uap) { return (kern_aio_error(td, (struct aiocb *)uap->aiocbp, &aiocb32_ops)); } +#ifdef COMPAT_FREEBSD6 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, &aiocb32_ops_osigevent)); } +#endif int freebsd32_aio_read(struct thread *td, struct freebsd32_aio_read_args *uap) @@ -2829,13 +2796,16 @@ &aiocb32_ops)); } +#ifdef COMPAT_FREEBSD6 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, &aiocb32_ops_osigevent)); } +#endif int freebsd32_aio_write(struct thread *td, struct freebsd32_aio_write_args *uap) @@ -2884,8 +2854,10 @@ &aiocb32_ops)); } +#ifdef COMPAT_FREEBSD6 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 sigevent *sigp, sig; @@ -2928,6 +2900,7 @@ free(acb_list, M_LIO); return (error); } +#endif int freebsd32_lio_listio(struct thread *td, struct freebsd32_lio_listio_args *uap) Index: head/sys/kern/vfs_default.c =================================================================== --- head/sys/kern/vfs_default.c +++ head/sys/kern/vfs_default.c @@ -472,6 +472,9 @@ { switch (ap->a_name) { + case _PC_ASYNC_IO: + *ap->a_retval = _POSIX_ASYNCHRONOUS_IO; + return (0); case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; return (0); Index: head/sys/kern/vfs_syscalls.c =================================================================== --- head/sys/kern/vfs_syscalls.c +++ head/sys/kern/vfs_syscalls.c @@ -106,14 +106,6 @@ 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. */ #ifndef _SYS_SYSPROTO_H_ @@ -2347,11 +2339,7 @@ return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - /* If asynchronous I/O is available, it works for all files. */ - if (name == _PC_ASYNC_IO) - td->td_retval[0] = async_io_version; - else - error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval); + error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval); vput(nd.ni_vp); return (error); } Index: head/sys/sys/signalvar.h =================================================================== --- head/sys/sys/signalvar.h +++ head/sys/sys/signalvar.h @@ -199,6 +199,7 @@ return (1); } +#ifdef COMPAT_FREEBSD6 struct osigevent { int sigev_notify; /* Notification type */ union { @@ -207,6 +208,7 @@ } __sigev_u; union sigval sigev_value; /* Signal value */ }; +#endif typedef struct ksiginfo { TAILQ_ENTRY(ksiginfo) ksi_link; Index: head/sys/sys/unistd.h =================================================================== --- head/sys/sys/unistd.h +++ head/sys/sys/unistd.h @@ -50,7 +50,7 @@ * returns -1, the functions may be stubbed out. */ #define _POSIX_ADVISORY_INFO 200112L -#define _POSIX_ASYNCHRONOUS_IO 0 +#define _POSIX_ASYNCHRONOUS_IO 200112L #define _POSIX_CHOWN_RESTRICTED 1 #define _POSIX_CLOCK_SELECTION (-1) #define _POSIX_CPUTIME 200112L Index: head/sys/sys/vnode.h =================================================================== --- head/sys/sys/vnode.h +++ head/sys/sys/vnode.h @@ -422,7 +422,6 @@ */ extern struct vnode *rootvnode; /* root (i.e. "/") vnode */ 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 struct uma_zone *namei_zone; extern struct vattr va_null; /* predefined null vattr structure */