freebsd32_misc.c (694ef157b9b755b13fb724ef02b7964f59008d8c) freebsd32_misc.c (d060b420e0f6d8f6535dfcda6f580dad3f5613d3)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2002 Doug Rabson
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

242 return (error);
243}
244
245int
246freebsd32_wait6(struct thread *td, struct freebsd32_wait6_args *uap)
247{
248 struct __wrusage32 wru32;
249 struct __wrusage wru, *wrup;
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2002 Doug Rabson
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

242 return (error);
243}
244
245int
246freebsd32_wait6(struct thread *td, struct freebsd32_wait6_args *uap)
247{
248 struct __wrusage32 wru32;
249 struct __wrusage wru, *wrup;
250 struct siginfo32 si32;
250 struct __siginfo32 si32;
251 struct __siginfo si, *sip;
252 int error, status;
253
254 if (uap->wrusage != NULL)
255 wrup = &wru;
256 else
257 wrup = NULL;
258 if (uap->info != NULL) {

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

1021 return (EINVAL);
1022
1023 /*
1024 * Pass size of native structure in 'data'. Truncate
1025 * if necessary to avoid siginfo.
1026 */
1027 data = sizeof(r.pl);
1028 if (uap->data < offsetof(struct ptrace_lwpinfo32, pl_siginfo) +
251 struct __siginfo si, *sip;
252 int error, status;
253
254 if (uap->wrusage != NULL)
255 wrup = &wru;
256 else
257 wrup = NULL;
258 if (uap->info != NULL) {

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

1021 return (EINVAL);
1022
1023 /*
1024 * Pass size of native structure in 'data'. Truncate
1025 * if necessary to avoid siginfo.
1026 */
1027 data = sizeof(r.pl);
1028 if (uap->data < offsetof(struct ptrace_lwpinfo32, pl_siginfo) +
1029 sizeof(struct siginfo32))
1029 sizeof(struct __siginfo32))
1030 data = offsetof(struct ptrace_lwpinfo, pl_siginfo);
1031 break;
1032 case PT_GETREGS:
1033 bzero(&r.reg, sizeof(r.reg));
1034 break;
1035 case PT_GETFPREGS:
1036 bzero(&r.fpreg, sizeof(r.fpreg));
1037 break;

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

3266 ts.tv_sec = ts32.tv_sec;
3267 ts.tv_nsec = ts32.tv_nsec;
3268 tsp = &ts;
3269 }
3270 return (kern_thr_suspend(td, tsp));
3271}
3272
3273void
1030 data = offsetof(struct ptrace_lwpinfo, pl_siginfo);
1031 break;
1032 case PT_GETREGS:
1033 bzero(&r.reg, sizeof(r.reg));
1034 break;
1035 case PT_GETFPREGS:
1036 bzero(&r.fpreg, sizeof(r.fpreg));
1037 break;

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

3266 ts.tv_sec = ts32.tv_sec;
3267 ts.tv_nsec = ts32.tv_nsec;
3268 tsp = &ts;
3269 }
3270 return (kern_thr_suspend(td, tsp));
3271}
3272
3273void
3274siginfo_to_siginfo32(const siginfo_t *src, struct siginfo32 *dst)
3274siginfo_to_siginfo32(const siginfo_t *src, struct __siginfo32 *dst)
3275{
3276 bzero(dst, sizeof(*dst));
3277 dst->si_signo = src->si_signo;
3278 dst->si_errno = src->si_errno;
3279 dst->si_code = src->si_code;
3280 dst->si_pid = src->si_pid;
3281 dst->si_uid = src->si_uid;
3282 dst->si_status = src->si_status;

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

3315int
3316freebsd32_sigtimedwait(struct thread *td, struct freebsd32_sigtimedwait_args *uap)
3317{
3318 struct timespec32 ts32;
3319 struct timespec ts;
3320 struct timespec *timeout;
3321 sigset_t set;
3322 ksiginfo_t ksi;
3275{
3276 bzero(dst, sizeof(*dst));
3277 dst->si_signo = src->si_signo;
3278 dst->si_errno = src->si_errno;
3279 dst->si_code = src->si_code;
3280 dst->si_pid = src->si_pid;
3281 dst->si_uid = src->si_uid;
3282 dst->si_status = src->si_status;

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

3315int
3316freebsd32_sigtimedwait(struct thread *td, struct freebsd32_sigtimedwait_args *uap)
3317{
3318 struct timespec32 ts32;
3319 struct timespec ts;
3320 struct timespec *timeout;
3321 sigset_t set;
3322 ksiginfo_t ksi;
3323 struct siginfo32 si32;
3323 struct __siginfo32 si32;
3324 int error;
3325
3326 if (uap->timeout) {
3327 error = copyin(uap->timeout, &ts32, sizeof(ts32));
3328 if (error)
3329 return (error);
3330 ts.tv_sec = ts32.tv_sec;
3331 ts.tv_nsec = ts32.tv_nsec;

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

3338 return (error);
3339
3340 error = kern_sigtimedwait(td, set, &ksi, timeout);
3341 if (error)
3342 return (error);
3343
3344 if (uap->info) {
3345 siginfo_to_siginfo32(&ksi.ksi_info, &si32);
3324 int error;
3325
3326 if (uap->timeout) {
3327 error = copyin(uap->timeout, &ts32, sizeof(ts32));
3328 if (error)
3329 return (error);
3330 ts.tv_sec = ts32.tv_sec;
3331 ts.tv_nsec = ts32.tv_nsec;

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

3338 return (error);
3339
3340 error = kern_sigtimedwait(td, set, &ksi, timeout);
3341 if (error)
3342 return (error);
3343
3344 if (uap->info) {
3345 siginfo_to_siginfo32(&ksi.ksi_info, &si32);
3346 error = copyout(&si32, uap->info, sizeof(struct siginfo32));
3346 error = copyout(&si32, uap->info, sizeof(struct __siginfo32));
3347 }
3348
3349 if (error == 0)
3350 td->td_retval[0] = ksi.ksi_signo;
3351 return (error);
3352}
3353
3354/*
3355 * MPSAFE
3356 */
3357int
3358freebsd32_sigwaitinfo(struct thread *td, struct freebsd32_sigwaitinfo_args *uap)
3359{
3360 ksiginfo_t ksi;
3347 }
3348
3349 if (error == 0)
3350 td->td_retval[0] = ksi.ksi_signo;
3351 return (error);
3352}
3353
3354/*
3355 * MPSAFE
3356 */
3357int
3358freebsd32_sigwaitinfo(struct thread *td, struct freebsd32_sigwaitinfo_args *uap)
3359{
3360 ksiginfo_t ksi;
3361 struct siginfo32 si32;
3361 struct __siginfo32 si32;
3362 sigset_t set;
3363 int error;
3364
3365 error = copyin(uap->set, &set, sizeof(set));
3366 if (error)
3367 return (error);
3368
3369 error = kern_sigtimedwait(td, set, &ksi, NULL);
3370 if (error)
3371 return (error);
3372
3373 if (uap->info) {
3374 siginfo_to_siginfo32(&ksi.ksi_info, &si32);
3362 sigset_t set;
3363 int error;
3364
3365 error = copyin(uap->set, &set, sizeof(set));
3366 if (error)
3367 return (error);
3368
3369 error = kern_sigtimedwait(td, set, &ksi, NULL);
3370 if (error)
3371 return (error);
3372
3373 if (uap->info) {
3374 siginfo_to_siginfo32(&ksi.ksi_info, &si32);
3375 error = copyout(&si32, uap->info, sizeof(struct siginfo32));
3375 error = copyout(&si32, uap->info, sizeof(struct __siginfo32));
3376 }
3377 if (error == 0)
3378 td->td_retval[0] = ksi.ksi_signo;
3379 return (error);
3380}
3381
3382int
3383freebsd32_cpuset_setid(struct thread *td,

--- 790 unchanged lines hidden ---
3376 }
3377 if (error == 0)
3378 td->td_retval[0] = ksi.ksi_signo;
3379 return (error);
3380}
3381
3382int
3383freebsd32_cpuset_setid(struct thread *td,

--- 790 unchanged lines hidden ---