diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/init_sysent.c | 28 | ||||
-rw-r--r-- | sys/kern/kern_descrip.c | 3 | ||||
-rw-r--r-- | sys/kern/link_elf_obj.c | 133 | ||||
-rw-r--r-- | sys/kern/posix4_mib.c | 9 | ||||
-rw-r--r-- | sys/kern/syscalls.c | 8 | ||||
-rw-r--r-- | sys/kern/syscalls.master | 26 | ||||
-rw-r--r-- | sys/kern/systrace_args.c | 78 | ||||
-rw-r--r-- | sys/kern/vfs_aio.c | 111 | ||||
-rw-r--r-- | sys/kern/vfs_default.c | 3 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 14 |
10 files changed, 171 insertions, 242 deletions
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 09ec05d..96c5229 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 285388 2015-07-11 15:22:11Z adrian + * created from FreeBSD: head/sys/kern/syscalls.master 296572 2016-03-09 19:05:11Z jhb */ #include "opt_compat.h" @@ -295,9 +295,9 @@ struct sysent sysent[] = { { AS(openbsd_poll_args), (sy_call_t *)sys_openbsd_poll, AUE_POLL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 252 = openbsd_poll */ { 0, (sy_call_t *)sys_issetugid, AUE_ISSETUGID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 253 = issetugid */ { AS(lchown_args), (sy_call_t *)sys_lchown, AUE_LCHOWN, NULL, 0, 0, 0, SY_THR_STATIC }, /* 254 = lchown */ - { AS(aio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 255 = aio_read */ - { AS(aio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 256 = aio_write */ - { AS(lio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 257 = lio_listio */ + { AS(aio_read_args), (sy_call_t *)sys_aio_read, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 255 = aio_read */ + { AS(aio_write_args), (sy_call_t *)sys_aio_write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 256 = aio_write */ + { AS(lio_listio_args), (sy_call_t *)sys_lio_listio, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 257 = lio_listio */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 258 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 259 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 260 = nosys */ @@ -354,13 +354,13 @@ struct sysent sysent[] = { { AS(setresuid_args), (sy_call_t *)sys_setresuid, AUE_SETRESUID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 311 = setresuid */ { AS(setresgid_args), (sy_call_t *)sys_setresgid, AUE_SETRESGID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 312 = setresgid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 313 = obsolete signanosleep */ - { AS(aio_return_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 314 = aio_return */ - { AS(aio_suspend_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 315 = aio_suspend */ - { AS(aio_cancel_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 316 = aio_cancel */ - { AS(aio_error_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 317 = aio_error */ - { AS(oaio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 318 = oaio_read */ - { AS(oaio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 319 = oaio_write */ - { AS(olio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 320 = olio_listio */ + { AS(aio_return_args), (sy_call_t *)sys_aio_return, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 314 = aio_return */ + { AS(aio_suspend_args), (sy_call_t *)sys_aio_suspend, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 315 = aio_suspend */ + { AS(aio_cancel_args), (sy_call_t *)sys_aio_cancel, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 316 = aio_cancel */ + { AS(aio_error_args), (sy_call_t *)sys_aio_error, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 317 = aio_error */ + { compat6(AS(freebsd6_aio_read_args),aio_read), AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 318 = freebsd6 aio_read */ + { compat6(AS(freebsd6_aio_write_args),aio_write), AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 319 = freebsd6 aio_write */ + { compat6(AS(freebsd6_lio_listio_args),lio_listio), AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 320 = freebsd6 lio_listio */ { 0, (sy_call_t *)sys_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 321 = yield */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 322 = obsolete thr_sleep */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 323 = obsolete thr_wakeup */ @@ -399,7 +399,7 @@ struct sysent sysent[] = { { AS(extattr_set_file_args), (sy_call_t *)sys_extattr_set_file, AUE_EXTATTR_SET_FILE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 356 = extattr_set_file */ { AS(extattr_get_file_args), (sy_call_t *)sys_extattr_get_file, AUE_EXTATTR_GET_FILE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 357 = extattr_get_file */ { AS(extattr_delete_file_args), (sy_call_t *)sys_extattr_delete_file, AUE_EXTATTR_DELETE_FILE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 358 = extattr_delete_file */ - { AS(aio_waitcomplete_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 359 = aio_waitcomplete */ + { AS(aio_waitcomplete_args), (sy_call_t *)sys_aio_waitcomplete, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 359 = aio_waitcomplete */ { AS(getresuid_args), (sy_call_t *)sys_getresuid, AUE_GETRESUID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 360 = getresuid */ { AS(getresgid_args), (sy_call_t *)sys_getresgid, AUE_GETRESGID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 361 = getresgid */ { 0, (sy_call_t *)sys_kqueue, AUE_KQUEUE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 362 = kqueue */ @@ -505,7 +505,7 @@ struct sysent sysent[] = { { AS(kmq_unlink_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 462 = kmq_unlink */ { AS(abort2_args), (sy_call_t *)sys_abort2, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 463 = abort2 */ { AS(thr_set_name_args), (sy_call_t *)sys_thr_set_name, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 464 = thr_set_name */ - { AS(aio_fsync_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 465 = aio_fsync */ + { AS(aio_fsync_args), (sy_call_t *)sys_aio_fsync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 465 = aio_fsync */ { AS(rtprio_thread_args), (sy_call_t *)sys_rtprio_thread, AUE_RTPRIO, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 466 = rtprio_thread */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 467 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 468 = nosys */ @@ -583,7 +583,7 @@ struct sysent sysent[] = { { AS(chflagsat_args), (sy_call_t *)sys_chflagsat, AUE_CHFLAGSAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 540 = chflagsat */ { AS(accept4_args), (sy_call_t *)sys_accept4, AUE_ACCEPT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 541 = accept4 */ { AS(pipe2_args), (sy_call_t *)sys_pipe2, AUE_PIPE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 542 = pipe2 */ - { AS(aio_mlock_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 543 = aio_mlock */ + { AS(aio_mlock_args), (sy_call_t *)sys_aio_mlock, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 543 = aio_mlock */ { AS(procctl_args), (sy_call_t *)sys_procctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 544 = procctl */ { AS(ppoll_args), (sy_call_t *)sys_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 545 = ppoll */ { AS(futimens_args), (sy_call_t *)sys_futimens, AUE_FUTIMES, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 546 = futimens */ diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index a74d27f..00bd54b 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1395,9 +1395,8 @@ sys_fpathconf(struct thread *td, struct fpathconf_args *uap) 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; diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index dfbcdfe..012d5b7 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -140,7 +140,7 @@ static int link_elf_each_function_name(linker_file_t, static int link_elf_each_function_nameval(linker_file_t, linker_function_nameval_callback_t, void *); -static void link_elf_reloc_local(linker_file_t); +static int link_elf_reloc_local(linker_file_t); static long link_elf_symtab_get(linker_file_t, const Elf_Sym **); static long link_elf_strtab_get(linker_file_t, caddr_t *); @@ -405,15 +405,26 @@ link_elf_link_preload(linker_class_t cls, const char *filename, break; } } - if (pb != ef->nprogtab) - panic("lost progbits"); - if (rl != ef->nreltab) - panic("lost reltab"); - if (ra != ef->nrelatab) - panic("lost relatab"); + if (pb != ef->nprogtab) { + printf("%s: lost progbits\n", filename); + error = ENOEXEC; + goto out; + } + if (rl != ef->nreltab) { + printf("%s: lost reltab\n", filename); + error = ENOEXEC; + goto out; + } + if (ra != ef->nrelatab) { + printf("%s: lost relatab\n", filename); + error = ENOEXEC; + goto out; + } /* Local intra-module relocations */ - link_elf_reloc_local(lf); + error = link_elf_reloc_local(lf); + if (error != 0) + goto out; *result = lf; return (0); @@ -634,8 +645,11 @@ link_elf_load_file(linker_class_t cls, const char *filename, ef->relatab = malloc(ef->nrelatab * sizeof(*ef->relatab), M_LINKER, M_WAITOK | M_ZERO); - if (symtabindex == -1) - panic("lost symbol table index"); + if (symtabindex == -1) { + link_elf_error(filename, "lost symbol table index"); + error = ENOEXEC; + goto out; + } /* Allocate space for and load the symbol table */ ef->ddbsymcnt = shdr[symtabindex].sh_size / sizeof(Elf_Sym); ef->ddbsymtab = malloc(shdr[symtabindex].sh_size, M_LINKER, M_WAITOK); @@ -650,8 +664,11 @@ link_elf_load_file(linker_class_t cls, const char *filename, goto out; } - if (symstrindex == -1) - panic("lost symbol string index"); + if (symstrindex == -1) { + link_elf_error(filename, "lost symbol string index"); + error = ENOEXEC; + goto out; + } /* Allocate space for and load the symbol strings */ ef->ddbstrcnt = shdr[symstrindex].sh_size; ef->ddbstrtab = malloc(shdr[symstrindex].sh_size, M_LINKER, M_WAITOK); @@ -884,19 +901,35 @@ link_elf_load_file(linker_class_t cls, const char *filename, break; } } - if (pb != ef->nprogtab) - panic("lost progbits"); - if (rl != ef->nreltab) - panic("lost reltab"); - if (ra != ef->nrelatab) - panic("lost relatab"); - if (mapbase != (vm_offset_t)ef->address + mapsize) - panic("mapbase 0x%lx != address %p + mapsize 0x%lx (0x%lx)\n", + if (pb != ef->nprogtab) { + link_elf_error(filename, "lost progbits"); + error = ENOEXEC; + goto out; + } + if (rl != ef->nreltab) { + link_elf_error(filename, "lost reltab"); + error = ENOEXEC; + goto out; + } + if (ra != ef->nrelatab) { + link_elf_error(filename, "lost relatab"); + error = ENOEXEC; + goto out; + } + if (mapbase != (vm_offset_t)ef->address + mapsize) { + printf( + "%s: mapbase 0x%lx != address %p + mapsize 0x%lx (0x%lx)\n", + filename != NULL ? filename : "<none>", (u_long)mapbase, ef->address, (u_long)mapsize, (u_long)(vm_offset_t)ef->address + mapsize); + error = ENOMEM; + goto out; + } /* Local intra-module relocations */ - link_elf_reloc_local(lf); + error = link_elf_reloc_local(lf); + if (error != 0) + goto out; /* Pull in dependencies */ VOP_UNLOCK(nd.ni_vp, 0); @@ -1034,12 +1067,16 @@ relocate_file(elf_file_t ef) /* Perform relocations without addend if there are any: */ for (i = 0; i < ef->nreltab; i++) { rel = ef->reltab[i].rel; - if (rel == NULL) - panic("lost a reltab!"); + if (rel == NULL) { + link_elf_error(ef->lf.filename, "lost a reltab!"); + return (ENOEXEC); + } rellim = rel + ef->reltab[i].nrel; base = findbase(ef, ef->reltab[i].sec); - if (base == 0) - panic("lost base for reltab"); + if (base == 0) { + link_elf_error(ef->lf.filename, "lost base for reltab"); + return (ENOEXEC); + } for ( ; rel < rellim; rel++) { symidx = ELF_R_SYM(rel->r_info); if (symidx >= ef->ddbsymcnt) @@ -1053,7 +1090,7 @@ relocate_file(elf_file_t ef) symname = symbol_name(ef, rel->r_info); printf("link_elf_obj: symbol %s undefined\n", symname); - return ENOENT; + return (ENOENT); } } } @@ -1061,12 +1098,17 @@ relocate_file(elf_file_t ef) /* Perform relocations with addend if there are any: */ for (i = 0; i < ef->nrelatab; i++) { rela = ef->relatab[i].rela; - if (rela == NULL) - panic("lost a relatab!"); + if (rela == NULL) { + link_elf_error(ef->lf.filename, "lost a relatab!"); + return (ENOEXEC); + } relalim = rela + ef->relatab[i].nrela; base = findbase(ef, ef->relatab[i].sec); - if (base == 0) - panic("lost base for relatab"); + if (base == 0) { + link_elf_error(ef->lf.filename, + "lost base for relatab"); + return (ENOEXEC); + } for ( ; rela < relalim; rela++) { symidx = ELF_R_SYM(rela->r_info); if (symidx >= ef->ddbsymcnt) @@ -1080,7 +1122,7 @@ relocate_file(elf_file_t ef) symname = symbol_name(ef, rela->r_info); printf("link_elf_obj: symbol %s undefined\n", symname); - return ENOENT; + return (ENOENT); } } } @@ -1092,7 +1134,7 @@ relocate_file(elf_file_t ef) */ elf_obj_cleanup_globals_cache(ef); - return 0; + return (0); } static int @@ -1375,7 +1417,7 @@ link_elf_fix_link_set(elf_file_t ef) } } -static void +static int link_elf_reloc_local(linker_file_t lf) { elf_file_t ef = (elf_file_t)lf; @@ -1393,12 +1435,16 @@ link_elf_reloc_local(linker_file_t lf) /* Perform relocations without addend if there are any: */ for (i = 0; i < ef->nreltab; i++) { rel = ef->reltab[i].rel; - if (rel == NULL) - panic("lost a reltab!"); + if (rel == NULL) { + link_elf_error(ef->lf.filename, "lost a reltab"); + return (ENOEXEC); + } rellim = rel + ef->reltab[i].nrel; base = findbase(ef, ef->reltab[i].sec); - if (base == 0) - panic("lost base for reltab"); + if (base == 0) { + link_elf_error(ef->lf.filename, "lost base for reltab"); + return (ENOEXEC); + } for ( ; rel < rellim; rel++) { symidx = ELF_R_SYM(rel->r_info); if (symidx >= ef->ddbsymcnt) @@ -1415,12 +1461,16 @@ link_elf_reloc_local(linker_file_t lf) /* Perform relocations with addend if there are any: */ for (i = 0; i < ef->nrelatab; i++) { rela = ef->relatab[i].rela; - if (rela == NULL) - panic("lost a relatab!"); + if (rela == NULL) { + link_elf_error(ef->lf.filename, "lost a relatab!"); + return (ENOEXEC); + } relalim = rela + ef->relatab[i].nrela; base = findbase(ef, ef->relatab[i].sec); - if (base == 0) - panic("lost base for relatab"); + if (base == 0) { + link_elf_error(ef->lf.filename, "lost base for reltab"); + return (ENOEXEC); + } for ( ; rela < relalim; rela++) { symidx = ELF_R_SYM(rela->r_info); if (symidx >= ef->ddbsymcnt) @@ -1433,6 +1483,7 @@ link_elf_reloc_local(linker_file_t lf) elf_obj_lookup); } } + return (0); } static long diff --git a/sys/kern/posix4_mib.c b/sys/kern/posix4_mib.c index e299787..a2be3ff 100644 --- a/sys/kern/posix4_mib.c +++ b/sys/kern/posix4_mib.c @@ -77,8 +77,7 @@ SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B"); #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_set_standard(void *dummy) 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, diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 1edb193..44ddd81 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 285388 2015-07-11 15:22:11Z adrian + * created from FreeBSD: head/sys/kern/syscalls.master 296572 2016-03-09 19:05:11Z jhb */ const char *syscallnames[] = { @@ -325,9 +325,9 @@ const char *syscallnames[] = { "aio_suspend", /* 315 = aio_suspend */ "aio_cancel", /* 316 = aio_cancel */ "aio_error", /* 317 = aio_error */ - "oaio_read", /* 318 = oaio_read */ - "oaio_write", /* 319 = oaio_write */ - "olio_listio", /* 320 = olio_listio */ + "compat6.aio_read", /* 318 = freebsd6 aio_read */ + "compat6.aio_write", /* 319 = freebsd6 aio_write */ + "compat6.lio_listio", /* 320 = freebsd6 lio_listio */ "yield", /* 321 = yield */ "obs_thr_sleep", /* 322 = obsolete thr_sleep */ "obs_thr_wakeup", /* 323 = obsolete thr_wakeup */ diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 6e6fb38..f08f5e3 100644 --- a/sys/kern/syscalls.master +++ b/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, \ diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 00a050f..6fd03f1 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -1605,30 +1605,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 1; break; } - /* oaio_read */ - case 318: { - struct oaio_read_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct oaiocb * */ - *n_args = 1; - break; - } - /* oaio_write */ - case 319: { - struct oaio_write_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct oaiocb * */ - *n_args = 1; - break; - } - /* olio_listio */ - case 320: { - struct olio_listio_args *p = params; - iarg[0] = p->mode; /* int */ - uarg[1] = (intptr_t) p->acb_list; /* struct oaiocb *const * */ - iarg[2] = p->nent; /* int */ - uarg[3] = (intptr_t) p->sig; /* struct osigevent * */ - *n_args = 4; - break; - } /* yield */ case 321: { *n_args = 0; @@ -5899,45 +5875,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* oaio_read */ - case 318: - switch(ndx) { - case 0: - p = "struct oaiocb *"; - break; - default: - break; - }; - break; - /* oaio_write */ - case 319: - switch(ndx) { - case 0: - p = "struct oaiocb *"; - break; - default: - break; - }; - break; - /* olio_listio */ - case 320: - switch(ndx) { - case 0: - p = "int"; - break; - case 1: - p = "struct oaiocb *const *"; - break; - case 2: - p = "int"; - break; - case 3: - p = "struct osigevent *"; - break; - default: - break; - }; - break; /* yield */ case 321: break; @@ -9876,21 +9813,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* oaio_read */ - case 318: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* oaio_write */ - case 319: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* olio_listio */ - case 320: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* yield */ case 321: /* mlockall */ diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 59dd57c..27fa239 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -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, "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 @@ typedef struct oaiocb { 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 @@ static moduledata_t aio_mod = { 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 <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); +DECLARE_MODULE(aio, aio_mod, SI_SUB_VFS, SI_ORDER_ANY); MODULE_VERSION(aio, 1); /* @@ -422,7 +379,6 @@ MODULE_VERSION(aio, 1); static int aio_onceonly(void) { - int error; exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, EVENTHANDLER_PRI_ANY); @@ -447,19 +403,11 @@ aio_onceonly(void) 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 @@ unref: return (error); } +#ifdef COMPAT_FREEBSD6 static int 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; 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 @@ static struct aiocb_ops aiocb_ops = { .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 @@ static struct aiocb_ops aiocb_ops_osigevent = { .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 @@ sys_aio_error(struct thread *td, struct aio_error_args *uap) } /* 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 @@ sys_aio_read(struct thread *td, struct aio_read_args *uap) } /* 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 @@ kern_lio_listio(struct thread *td, int mode, struct aiocb * const *uacb_list, } /* 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 @@ sys_olio_listio(struct thread *td, struct olio_listio_args *uap) free(acb_list, M_LIO); return (error); } +#endif /* syscall - list directed I/O (REALTIME) */ int @@ -2582,6 +2540,13 @@ filt_lio(struct knote *kn, long hint) } #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 { int32_t status; @@ -2589,6 +2554,7 @@ struct __aiocb_private32 { 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 @@ typedef struct oaiocb32 { 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 @@ typedef struct aiocb32 { 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 @@ aiocb32_copyin_old_sigevent(struct aiocb *ujob, struct aiocb *kjob) 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 @@ static struct aiocb_ops aiocb32_ops = { .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 @@ static struct aiocb_ops aiocb32_ops_osigevent = { .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 @@ freebsd32_aio_suspend(struct thread *td, struct freebsd32_aio_suspend_args *uap) } 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 @@ freebsd32_aio_read(struct thread *td, struct freebsd32_aio_read_args *uap) &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 @@ freebsd32_aio_fsync(struct thread *td, struct freebsd32_aio_fsync_args *uap) &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 @@ freebsd32_olio_listio(struct thread *td, struct freebsd32_olio_listio_args *uap) free(acb_list, M_LIO); return (error); } +#endif int freebsd32_lio_listio(struct thread *td, struct freebsd32_lio_listio_args *uap) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 3da8618..a7977bf 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -472,6 +472,9 @@ vop_stdpathconf(ap) { 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); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 26bcfa0..11813fc 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -106,14 +106,6 @@ static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred, 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 @@ kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, 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); } |