Deleted Added
full compact
linux_misc.c (343345) linux_misc.c (346812)
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/11/sys/compat/linux/linux_misc.c 343345 2019-01-23 14:22:21Z emaste $");
31__FBSDID("$FreeBSD: stable/11/sys/compat/linux/linux_misc.c 346812 2019-04-28 09:53:08Z dchagin $");
32
33#include "opt_compat.h"
34
35#include <sys/param.h>
36#include <sys/blist.h>
37#include <sys/fcntl.h>
38#if defined(__i386__)
39#include <sys/imgact_aout.h>

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

109 */
110LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE);
111
112int stclohz; /* Statistics clock frequency */
113
114static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
115 RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, RLIMIT_STACK,
116 RLIMIT_CORE, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE,
32
33#include "opt_compat.h"
34
35#include <sys/param.h>
36#include <sys/blist.h>
37#include <sys/fcntl.h>
38#if defined(__i386__)
39#include <sys/imgact_aout.h>

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

109 */
110LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE);
111
112int stclohz; /* Statistics clock frequency */
113
114static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
115 RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, RLIMIT_STACK,
116 RLIMIT_CORE, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE,
117 RLIMIT_MEMLOCK, RLIMIT_AS
117 RLIMIT_MEMLOCK, RLIMIT_AS
118};
119
120struct l_sysinfo {
121 l_long uptime; /* Seconds since boot */
122 l_ulong loads[3]; /* 1, 5, and 15 minute load averages */
123#define LINUX_SYSINFO_LOADS_SCALE 65536
124 l_ulong totalram; /* Total usable main memory size */
125 l_ulong freeram; /* Available memory size */

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

832
833 if (nsec == LINUX_UTIME_OMIT || nsec == LINUX_UTIME_NOW)
834 return (0);
835 if (nsec >= 0 && nsec <= 999999999)
836 return (0);
837 return (1);
838}
839
118};
119
120struct l_sysinfo {
121 l_long uptime; /* Seconds since boot */
122 l_ulong loads[3]; /* 1, 5, and 15 minute load averages */
123#define LINUX_SYSINFO_LOADS_SCALE 65536
124 l_ulong totalram; /* Total usable main memory size */
125 l_ulong freeram; /* Available memory size */

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

832
833 if (nsec == LINUX_UTIME_OMIT || nsec == LINUX_UTIME_NOW)
834 return (0);
835 if (nsec >= 0 && nsec <= 999999999)
836 return (0);
837 return (1);
838}
839
840int
840int
841linux_utimensat(struct thread *td, struct linux_utimensat_args *args)
842{
843 struct l_timespec l_times[2];
844 struct timespec times[2], *timesp = NULL;
845 char *path = NULL;
846 int error, dfd, flags = 0;
847
848 dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;

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

907
908 if (args->flags & LINUX_AT_SYMLINK_NOFOLLOW)
909 flags |= AT_SYMLINK_NOFOLLOW;
910
911 if (path == NULL)
912 error = kern_futimens(td, dfd, timesp, UIO_SYSSPACE);
913 else {
914 error = kern_utimensat(td, dfd, path, UIO_SYSSPACE, timesp,
841linux_utimensat(struct thread *td, struct linux_utimensat_args *args)
842{
843 struct l_timespec l_times[2];
844 struct timespec times[2], *timesp = NULL;
845 char *path = NULL;
846 int error, dfd, flags = 0;
847
848 dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;

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

907
908 if (args->flags & LINUX_AT_SYMLINK_NOFOLLOW)
909 flags |= AT_SYMLINK_NOFOLLOW;
910
911 if (path == NULL)
912 error = kern_futimens(td, dfd, timesp, UIO_SYSSPACE);
913 else {
914 error = kern_utimensat(td, dfd, path, UIO_SYSSPACE, timesp,
915 UIO_SYSSPACE, flags);
915 UIO_SYSSPACE, flags);
916 LFREEPATH(path);
917 }
918
919 return (error);
920}
921
922int
923linux_futimesat(struct thread *td, struct linux_futimesat_args *args)

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

1214 return (0);
1215}
1216
1217struct l_itimerval {
1218 l_timeval it_interval;
1219 l_timeval it_value;
1220};
1221
916 LFREEPATH(path);
917 }
918
919 return (error);
920}
921
922int
923linux_futimesat(struct thread *td, struct linux_futimesat_args *args)

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

1214 return (0);
1215}
1216
1217struct l_itimerval {
1218 l_timeval it_interval;
1219 l_timeval it_value;
1220};
1221
1222#define B2L_ITIMERVAL(bip, lip) \
1222#define B2L_ITIMERVAL(bip, lip) \
1223 (bip)->it_interval.tv_sec = (lip)->it_interval.tv_sec; \
1224 (bip)->it_interval.tv_usec = (lip)->it_interval.tv_usec; \
1225 (bip)->it_value.tv_sec = (lip)->it_value.tv_sec; \
1226 (bip)->it_value.tv_usec = (lip)->it_value.tv_usec;
1227
1228int
1229linux_setitimer(struct thread *td, struct linux_setitimer_args *uap)
1230{

--- 1319 unchanged lines hidden ---
1223 (bip)->it_interval.tv_sec = (lip)->it_interval.tv_sec; \
1224 (bip)->it_interval.tv_usec = (lip)->it_interval.tv_usec; \
1225 (bip)->it_value.tv_sec = (lip)->it_value.tv_sec; \
1226 (bip)->it_value.tv_usec = (lip)->it_value.tv_usec;
1227
1228int
1229linux_setitimer(struct thread *td, struct linux_setitimer_args *uap)
1230{

--- 1319 unchanged lines hidden ---