linux_sysctl.c (258541) | linux_sysctl.c (283427) |
---|---|
1/*- 2 * Copyright (c) 2001 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_sysctl.c 258541 2013-11-25 07:38:45Z attilio $"); | 30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_sysctl.c 283427 2015-05-24 16:14:41Z dchagin $"); |
31 32#include "opt_compat.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/lock.h> 37#include <sys/malloc.h> 38#include <sys/mutex.h> --- 96 unchanged lines hidden (view full) --- 135 136 if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) { 137 LIN_SDT_PROBE2(sysctl, linux_sysctl, wrong_length, la.nlen, 138 LINUX_CTL_MAXNAME); 139 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR); 140 return (ENOTDIR); 141 } 142 | 31 32#include "opt_compat.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/lock.h> 37#include <sys/malloc.h> 38#include <sys/mutex.h> --- 96 unchanged lines hidden (view full) --- 135 136 if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) { 137 LIN_SDT_PROBE2(sysctl, linux_sysctl, wrong_length, la.nlen, 138 LINUX_CTL_MAXNAME); 139 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR); 140 return (ENOTDIR); 141 } 142 |
143 mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK); | 143 mib = malloc(la.nlen * sizeof(l_int), M_LINUX, M_WAITOK); |
144 error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int)); 145 if (error) { 146 LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error); 147 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); | 144 error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int)); 145 if (error) { 146 LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error); 147 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); |
148 free(mib, M_TEMP); | 148 free(mib, M_LINUX); |
149 return (error); 150 } 151 152 switch (mib[0]) { 153 case LINUX_CTL_KERN: 154 if (la.nlen < 2) 155 break; 156 157 switch (mib[1]) { 158 case LINUX_KERN_VERSION: 159 error = handle_string(&la, version); | 149 return (error); 150 } 151 152 switch (mib[0]) { 153 case LINUX_CTL_KERN: 154 if (la.nlen < 2) 155 break; 156 157 switch (mib[1]) { 158 case LINUX_KERN_VERSION: 159 error = handle_string(&la, version); |
160 free(mib, M_TEMP); | 160 free(mib, M_LINUX); |
161 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); 162 return (error); 163 default: 164 break; 165 } 166 break; 167 default: 168 break; --- 12 unchanged lines hidden (view full) --- 181 sbuf_finish(sb); 182 sysctl_string = sbuf_data(sb); 183 linux_msg(td, "%s", sbuf_data(sb)); 184 LIN_SDT_PROBE1(sysctl, linux_sysctl, unsupported_sysctl, 185 sysctl_string); 186 sbuf_delete(sb); 187 } 188 | 161 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error); 162 return (error); 163 default: 164 break; 165 } 166 break; 167 default: 168 break; --- 12 unchanged lines hidden (view full) --- 181 sbuf_finish(sb); 182 sysctl_string = sbuf_data(sb); 183 linux_msg(td, "%s", sbuf_data(sb)); 184 LIN_SDT_PROBE1(sysctl, linux_sysctl, unsupported_sysctl, 185 sysctl_string); 186 sbuf_delete(sb); 187 } 188 |
189 free(mib, M_TEMP); | 189 free(mib, M_LINUX); |
190 191 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR); 192 return (ENOTDIR); 193} | 190 191 LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR); 192 return (ENOTDIR); 193} |