Deleted Added
full compact
linux_misc.c (293524) linux_misc.c (293527)
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 293524 2016-01-09 15:58:42Z dchagin $");
31__FBSDID("$FreeBSD: stable/10/sys/compat/linux/linux_misc.c 293527 2016-01-09 16:08:22Z dchagin $");
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__)

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

2190 lts.tv_sec = uts.tv_sec;
2191 lts.tv_nsec = uts.tv_nsec;
2192 error = copyout(&lts, args->tsp, sizeof(lts));
2193 }
2194
2195 return (error);
2196}
2197
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__)

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

2190 lts.tv_sec = uts.tv_sec;
2191 lts.tv_nsec = uts.tv_nsec;
2192 error = copyout(&lts, args->tsp, sizeof(lts));
2193 }
2194
2195 return (error);
2196}
2197
2198#if defined(DEBUG) || defined(KTR)
2199/* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */
2200
2201u_char linux_debug_map[howmany(LINUX_SYS_MAXSYSCALL, sizeof(u_char))];
2202
2203static int
2204linux_debug(int syscall, int toggle, int global)
2205{
2206
2207 if (global) {
2208 char c = toggle ? 0 : 0xff;
2209
2210 memset(linux_debug_map, c, sizeof(linux_debug_map));
2211 return (0);
2212 }
2213 if (syscall < 0 || syscall >= LINUX_SYS_MAXSYSCALL)
2214 return (EINVAL);
2215 if (toggle)
2216 clrbit(linux_debug_map, syscall);
2217 else
2218 setbit(linux_debug_map, syscall);
2219 return (0);
2220}
2221
2222/*
2223 * Usage: sysctl linux.debug=<syscall_nr>.<0/1>
2224 *
2225 * E.g.: sysctl linux.debug=21.0
2226 *
2227 * As a special case, syscall "all" will apply to all syscalls globally.
2228 */
2229#define LINUX_MAX_DEBUGSTR 16
2198int
2230int
2231linux_sysctl_debug(SYSCTL_HANDLER_ARGS)
2232{
2233 char value[LINUX_MAX_DEBUGSTR], *p;
2234 int error, sysc, toggle;
2235 int global = 0;
2236
2237 value[0] = '\0';
2238 error = sysctl_handle_string(oidp, value, LINUX_MAX_DEBUGSTR, req);
2239 if (error || req->newptr == NULL)
2240 return (error);
2241 for (p = value; *p != '\0' && *p != '.'; p++);
2242 if (*p == '\0')
2243 return (EINVAL);
2244 *p++ = '\0';
2245 sysc = strtol(value, NULL, 0);
2246 toggle = strtol(p, NULL, 0);
2247 if (strcmp(value, "all") == 0)
2248 global = 1;
2249 error = linux_debug(sysc, toggle, global);
2250 return (error);
2251}
2252
2253#endif /* DEBUG || KTR */
2254
2255int
2199linux_sched_rr_get_interval(struct thread *td,
2200 struct linux_sched_rr_get_interval_args *uap)
2201{
2202 struct timespec ts;
2203 struct l_timespec lts;
2204 struct thread *tdt;
2205 int error;
2206

--- 82 unchanged lines hidden ---
2256linux_sched_rr_get_interval(struct thread *td,
2257 struct linux_sched_rr_get_interval_args *uap)
2258{
2259 struct timespec ts;
2260 struct l_timespec lts;
2261 struct thread *tdt;
2262 int error;
2263

--- 82 unchanged lines hidden ---