diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-09-01 22:30:27 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-09-01 22:30:27 +0000 |
commit | 07f07ebc496d8282bdb12357703601f8cdead05f (patch) | |
tree | e78cb9954f69b7a52ffd80f19aed803a61801325 /sys/compat/linux/linux_sysctl.c | |
parent | b1c6d21217f0b1736cdebae0cc283188d9ae4724 (diff) | |
download | FreeBSD-src-07f07ebc496d8282bdb12357703601f8cdead05f.zip FreeBSD-src-07f07ebc496d8282bdb12357703601f8cdead05f.tar.gz |
Use the new kern_* functions to avoid the need to store arguments
in the stack gap. This converts most VFS and signal related system
calls, as well as select().
Discussed on: -arch
Approved by: marcel
Diffstat (limited to 'sys/compat/linux/linux_sysctl.c')
-rw-r--r-- | sys/compat/linux/linux_sysctl.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/compat/linux/linux_sysctl.c b/sys/compat/linux/linux_sysctl.c index 98dab20..d1f6996 100644 --- a/sys/compat/linux/linux_sysctl.c +++ b/sys/compat/linux/linux_sysctl.c @@ -80,20 +80,20 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) struct l___sysctl_args la; l_int *mib; int error, i; - caddr_t sg; error = copyin((caddr_t)args->args, &la, sizeof(la)); if (error) return (error); - if (la.nlen == 0 || la.nlen > LINUX_CTL_MAXNAME) + if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) return (ENOTDIR); - sg = stackgap_init(); - mib = stackgap_alloc(&sg, la.nlen * sizeof(l_int)); + mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK); error = copyin(la.name, mib, la.nlen * sizeof(l_int)); - if (error) + if (error) { + free(mib, M_TEMP); return (error); + } switch (mib[0]) { case LINUX_CTL_KERN: @@ -102,7 +102,9 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) switch (mib[1]) { case LINUX_KERN_VERSION: - return (handle_string(&la, version)); + error = handle_string(&la, version); + free(mib, M_TEMP); + return (error); default: break; } @@ -116,5 +118,6 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) printf("%c%d", (i) ? ',' : '{', mib[i]); printf("}\n"); + free(mib, M_TEMP); return (ENOTDIR); } |