Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linux/linux_misc.c
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) | ||||
/* The following are only present in newer Linux kernels. */ | /* The following are only present in newer Linux kernels. */ | ||||
sysinfo.totalbig = 0; | sysinfo.totalbig = 0; | ||||
sysinfo.freebig = 0; | sysinfo.freebig = 0; | ||||
sysinfo.mem_unit = 1; | sysinfo.mem_unit = 1; | ||||
return (copyout(&sysinfo, args->info, sizeof(sysinfo))); | return (copyout(&sysinfo, args->info, sizeof(sysinfo))); | ||||
} | } | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_alarm(struct thread *td, struct linux_alarm_args *args) | linux_alarm(struct thread *td, struct linux_alarm_args *args) | ||||
{ | { | ||||
struct itimerval it, old_it; | struct itimerval it, old_it; | ||||
u_int secs; | u_int secs; | ||||
int error; | int error; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
Show All 18 Lines | #endif | ||||
KASSERT(error == 0, ("kern_setitimer returns %d", error)); | KASSERT(error == 0, ("kern_setitimer returns %d", error)); | ||||
if ((old_it.it_value.tv_sec == 0 && old_it.it_value.tv_usec > 0) || | if ((old_it.it_value.tv_sec == 0 && old_it.it_value.tv_usec > 0) || | ||||
old_it.it_value.tv_usec >= 500000) | old_it.it_value.tv_usec >= 500000) | ||||
old_it.it_value.tv_sec++; | old_it.it_value.tv_sec++; | ||||
td->td_retval[0] = old_it.it_value.tv_sec; | td->td_retval[0] = old_it.it_value.tv_sec; | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif | |||||
int | int | ||||
linux_brk(struct thread *td, struct linux_brk_args *args) | linux_brk(struct thread *td, struct linux_brk_args *args) | ||||
{ | { | ||||
struct vmspace *vm = td->td_proc->p_vmspace; | struct vmspace *vm = td->td_proc->p_vmspace; | ||||
vm_offset_t new, old; | vm_offset_t new, old; | ||||
struct break_args /* { | struct break_args /* { | ||||
char * nsize; | char * nsize; | ||||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | cleanup: | ||||
if (a_out) | if (a_out) | ||||
kmap_free_wakeup(exec_map, (vm_offset_t)a_out, PAGE_SIZE); | kmap_free_wakeup(exec_map, (vm_offset_t)a_out, PAGE_SIZE); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* __i386__ */ | #endif /* __i386__ */ | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_select(struct thread *td, struct linux_select_args *args) | linux_select(struct thread *td, struct linux_select_args *args) | ||||
{ | { | ||||
l_timeval ltv; | l_timeval ltv; | ||||
struct timeval tv0, tv1, utv, *tvp; | struct timeval tv0, tv1, utv, *tvp; | ||||
int error; | int error; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
select_out: | select_out: | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(select)) | if (ldebug(select)) | ||||
printf(LMSG("select_out -> %d"), error); | printf(LMSG("select_out -> %d"), error); | ||||
#endif | #endif | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | |||||
int | int | ||||
linux_mremap(struct thread *td, struct linux_mremap_args *args) | linux_mremap(struct thread *td, struct linux_mremap_args *args) | ||||
{ | { | ||||
uintptr_t addr; | uintptr_t addr; | ||||
size_t len; | size_t len; | ||||
int error = 0; | int error = 0; | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
linux_msync(struct thread *td, struct linux_msync_args *args) | linux_msync(struct thread *td, struct linux_msync_args *args) | ||||
{ | { | ||||
return (kern_msync(td, args->addr, args->len, | return (kern_msync(td, args->addr, args->len, | ||||
args->fl & ~LINUX_MS_SYNC)); | args->fl & ~LINUX_MS_SYNC)); | ||||
} | } | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_time(struct thread *td, struct linux_time_args *args) | linux_time(struct thread *td, struct linux_time_args *args) | ||||
{ | { | ||||
struct timeval tv; | struct timeval tv; | ||||
l_time_t tm; | l_time_t tm; | ||||
int error; | int error; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(time)) | if (ldebug(time)) | ||||
printf(ARGS(time, "*")); | printf(ARGS(time, "*")); | ||||
#endif | #endif | ||||
microtime(&tv); | microtime(&tv); | ||||
tm = tv.tv_sec; | tm = tv.tv_sec; | ||||
if (args->tm && (error = copyout(&tm, args->tm, sizeof(tm)))) | if (args->tm && (error = copyout(&tm, args->tm, sizeof(tm)))) | ||||
return (error); | return (error); | ||||
td->td_retval[0] = tm; | td->td_retval[0] = tm; | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif | |||||
struct l_times_argv { | struct l_times_argv { | ||||
l_clock_t tms_utime; | l_clock_t tms_utime; | ||||
l_clock_t tms_stime; | l_clock_t tms_stime; | ||||
l_clock_t tms_cutime; | l_clock_t tms_cutime; | ||||
l_clock_t tms_cstime; | l_clock_t tms_cstime; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | #endif | ||||
return (copyout(&utsname, args->buf, sizeof(utsname))); | return (copyout(&utsname, args->buf, sizeof(utsname))); | ||||
} | } | ||||
struct l_utimbuf { | struct l_utimbuf { | ||||
l_time_t l_actime; | l_time_t l_actime; | ||||
l_time_t l_modtime; | l_time_t l_modtime; | ||||
}; | }; | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_utime(struct thread *td, struct linux_utime_args *args) | linux_utime(struct thread *td, struct linux_utime_args *args) | ||||
{ | { | ||||
struct timeval tv[2], *tvp; | struct timeval tv[2], *tvp; | ||||
struct l_utimbuf lut; | struct l_utimbuf lut; | ||||
char *fname; | char *fname; | ||||
int error; | int error; | ||||
Show All 17 Lines | #endif | ||||
} else | } else | ||||
tvp = NULL; | tvp = NULL; | ||||
error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp, | error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp, | ||||
UIO_SYSSPACE); | UIO_SYSSPACE); | ||||
LFREEPATH(fname); | LFREEPATH(fname); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | |||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_utimes(struct thread *td, struct linux_utimes_args *args) | linux_utimes(struct thread *td, struct linux_utimes_args *args) | ||||
{ | { | ||||
l_timeval ltv[2]; | l_timeval ltv[2]; | ||||
struct timeval tv[2], *tvp = NULL; | struct timeval tv[2], *tvp = NULL; | ||||
char *fname; | char *fname; | ||||
int error; | int error; | ||||
Show All 16 Lines | if (args->tptr != NULL) { | ||||
tvp = tv; | tvp = tv; | ||||
} | } | ||||
error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, | error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, | ||||
tvp, UIO_SYSSPACE); | tvp, UIO_SYSSPACE); | ||||
LFREEPATH(fname); | LFREEPATH(fname); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | |||||
static int | static int | ||||
linux_utimensat_nsec_valid(l_long nsec) | linux_utimensat_nsec_valid(l_long nsec) | ||||
{ | { | ||||
if (nsec == LINUX_UTIME_OMIT || nsec == LINUX_UTIME_NOW) | if (nsec == LINUX_UTIME_OMIT || nsec == LINUX_UTIME_NOW) | ||||
return (0); | return (0); | ||||
if (nsec >= 0 && nsec <= 999999999) | if (nsec >= 0 && nsec <= 999999999) | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | else { | ||||
error = kern_utimensat(td, dfd, path, UIO_SYSSPACE, timesp, | error = kern_utimensat(td, dfd, path, UIO_SYSSPACE, timesp, | ||||
UIO_SYSSPACE, flags); | UIO_SYSSPACE, flags); | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_futimesat(struct thread *td, struct linux_futimesat_args *args) | linux_futimesat(struct thread *td, struct linux_futimesat_args *args) | ||||
{ | { | ||||
l_timeval ltv[2]; | l_timeval ltv[2]; | ||||
struct timeval tv[2], *tvp = NULL; | struct timeval tv[2], *tvp = NULL; | ||||
char *fname; | char *fname; | ||||
int error, dfd; | int error, dfd; | ||||
Show All 16 Lines | if (args->utimes != NULL) { | ||||
tv[1].tv_usec = ltv[1].tv_usec; | tv[1].tv_usec = ltv[1].tv_usec; | ||||
tvp = tv; | tvp = tv; | ||||
} | } | ||||
error = kern_utimesat(td, dfd, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); | error = kern_utimesat(td, dfd, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); | ||||
LFREEPATH(fname); | LFREEPATH(fname); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | |||||
int | int | ||||
linux_common_wait(struct thread *td, int pid, int *status, | linux_common_wait(struct thread *td, int pid, int *status, | ||||
int options, struct rusage *ru) | int options, struct rusage *ru) | ||||
{ | { | ||||
int error, tmpstat; | int error, tmpstat; | ||||
error = kern_wait(td, pid, &tmpstat, options, ru); | error = kern_wait(td, pid, &tmpstat, options, ru); | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | if (args->info != NULL) { | ||||
} | } | ||||
error = copyout(&lsi, args->info, sizeof(lsi)); | error = copyout(&lsi, args->info, sizeof(lsi)); | ||||
} | } | ||||
td->td_retval[0] = 0; | td->td_retval[0] = 0; | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_mknod(struct thread *td, struct linux_mknod_args *args) | linux_mknod(struct thread *td, struct linux_mknod_args *args) | ||||
{ | { | ||||
char *path; | char *path; | ||||
int error; | int error; | ||||
LCONVPATHCREAT(td, args->path, &path); | LCONVPATHCREAT(td, args->path, &path); | ||||
Show All 32 Lines | #endif | ||||
default: | default: | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
} | } | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | |||||
int | int | ||||
linux_mknodat(struct thread *td, struct linux_mknodat_args *args) | linux_mknodat(struct thread *td, struct linux_mknodat_args *args) | ||||
{ | { | ||||
char *path; | char *path; | ||||
int error, dfd; | int error, dfd; | ||||
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; | dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; | ||||
▲ Show 20 Lines • Show All 1,400 Lines • Show Last 20 Lines |