Deleted Added
full compact
linux_misc.c (293897) linux_misc.c (294368)
1/*-
2 * Copyright (c) 2002 Doug Rabson
3 * Copyright (c) 1994-1995 S��ren Schmidt
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 14 unchanged lines hidden (view full) ---

23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002 Doug Rabson
3 * Copyright (c) 1994-1995 S��ren Schmidt
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 14 unchanged lines hidden (view full) ---

23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: stable/10/sys/compat/linux/linux_misc.c 293897 2016-01-14 09:11:42Z glebius $");
31__FBSDID("$FreeBSD: stable/10/sys/compat/linux/linux_misc.c 294368 2016-01-20 01:09:53Z jhb $");
32
33#include "opt_compat.h"
34#include "opt_kdtrace.h"
35
36#include <sys/param.h>
37#include <sys/blist.h>
38#include <sys/fcntl.h>
39#if defined(__i386__)

--- 2317 unchanged lines hidden (view full) ---

2357 }
2358
2359 return (error);
2360}
2361
2362#if defined(DEBUG) || defined(KTR)
2363/* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */
2364
32
33#include "opt_compat.h"
34#include "opt_kdtrace.h"
35
36#include <sys/param.h>
37#include <sys/blist.h>
38#include <sys/fcntl.h>
39#if defined(__i386__)

--- 2317 unchanged lines hidden (view full) ---

2357 }
2358
2359 return (error);
2360}
2361
2362#if defined(DEBUG) || defined(KTR)
2363/* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */
2364
2365u_char linux_debug_map[howmany(LINUX_SYS_MAXSYSCALL, sizeof(u_char))];
2365#ifdef COMPAT_LINUX32
2366#define L_MAXSYSCALL LINUX32_SYS_MAXSYSCALL
2367#else
2368#define L_MAXSYSCALL LINUX_SYS_MAXSYSCALL
2369#endif
2366
2370
2371u_char linux_debug_map[howmany(L_MAXSYSCALL, sizeof(u_char))];
2372
2367static int
2368linux_debug(int syscall, int toggle, int global)
2369{
2370
2371 if (global) {
2372 char c = toggle ? 0 : 0xff;
2373
2374 memset(linux_debug_map, c, sizeof(linux_debug_map));
2375 return (0);
2376 }
2373static int
2374linux_debug(int syscall, int toggle, int global)
2375{
2376
2377 if (global) {
2378 char c = toggle ? 0 : 0xff;
2379
2380 memset(linux_debug_map, c, sizeof(linux_debug_map));
2381 return (0);
2382 }
2377 if (syscall < 0 || syscall >= LINUX_SYS_MAXSYSCALL)
2383 if (syscall < 0 || syscall >= L_MAXSYSCALL)
2378 return (EINVAL);
2379 if (toggle)
2380 clrbit(linux_debug_map, syscall);
2381 else
2382 setbit(linux_debug_map, syscall);
2383 return (0);
2384}
2384 return (EINVAL);
2385 if (toggle)
2386 clrbit(linux_debug_map, syscall);
2387 else
2388 setbit(linux_debug_map, syscall);
2389 return (0);
2390}
2391#undef L_MAXSYSCALL
2385
2386/*
2387 * Usage: sysctl linux.debug=<syscall_nr>.<0/1>
2388 *
2389 * E.g.: sysctl linux.debug=21.0
2390 *
2391 * As a special case, syscall "all" will apply to all syscalls globally.
2392 */

--- 116 unchanged lines hidden ---
2392
2393/*
2394 * Usage: sysctl linux.debug=<syscall_nr>.<0/1>
2395 *
2396 * E.g.: sysctl linux.debug=21.0
2397 *
2398 * As a special case, syscall "all" will apply to all syscalls globally.
2399 */

--- 116 unchanged lines hidden ---