Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107146266
D41640.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D41640.diff
View Options
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -82,6 +82,7 @@
#include <sys/sysproto.h>
#include <sys/systm.h>
#include <sys/thr.h>
+#include <sys/timerfd.h>
#include <sys/timex.h>
#include <sys/unistd.h>
#include <sys/ucontext.h>
@@ -3138,6 +3139,60 @@
return (error);
}
+int
+freebsd32_timerfd_gettime(struct thread *td,
+ struct freebsd32_timerfd_gettime_args *uap)
+{
+ struct itimerspec curr_value;
+ struct itimerspec32 curr_value32;
+ int error;
+
+ error = kern_timerfd_gettime(td, uap->fd, &curr_value);
+ if (error == 0) {
+ CP(curr_value, curr_value32, it_value.tv_sec);
+ CP(curr_value, curr_value32, it_value.tv_nsec);
+ CP(curr_value, curr_value32, it_interval.tv_sec);
+ CP(curr_value, curr_value32, it_interval.tv_nsec);
+ error = copyout(&curr_value32, uap->curr_value,
+ sizeof(curr_value32));
+ }
+
+ return (error);
+}
+
+int
+freebsd32_timerfd_settime(struct thread *td,
+ struct freebsd32_timerfd_settime_args *uap)
+{
+ struct itimerspec new_value, old_value;
+ struct itimerspec32 new_value32, old_value32;
+ int error;
+
+ error = copyin(uap->new_value, &new_value32, sizeof(new_value32));
+ if (error != 0)
+ return (error);
+ CP(new_value32, new_value, it_value.tv_sec);
+ CP(new_value32, new_value, it_value.tv_nsec);
+ CP(new_value32, new_value, it_interval.tv_sec);
+ CP(new_value32, new_value, it_interval.tv_nsec);
+ if (uap->old_value == NULL) {
+ error = kern_timerfd_settime(td, uap->fd, uap->flags,
+ &new_value, NULL);
+ } else {
+ error = kern_timerfd_settime(td, uap->fd, uap->flags,
+ &new_value, &old_value);
+ if (error == 0) {
+ CP(old_value, old_value32, it_value.tv_sec);
+ CP(old_value, old_value32, it_value.tv_nsec);
+ CP(old_value, old_value32, it_interval.tv_sec);
+ CP(old_value, old_value32, it_interval.tv_nsec);
+ error = copyout(&old_value32, uap->old_value,
+ sizeof(old_value32));
+ }
+ }
+ return (error);
+}
+
int
freebsd32_clock_getcpuclockid2(struct thread *td,
struct freebsd32_clock_getcpuclockid2_args *uap)
diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c
--- a/sys/kern/sys_timerfd.c
+++ b/sys/kern/sys_timerfd.c
@@ -54,11 +54,6 @@
#include <security/audit/audit.h>
-#ifdef COMPAT_FREEBSD32
-#include <compat/freebsd32/freebsd32.h>
-#include <compat/freebsd32/freebsd32_proto.h>
-#endif
-
static MALLOC_DEFINE(M_TIMERFD, "timerfd", "timerfd structures");
static struct sx timerfd_list_lock;
@@ -598,59 +593,3 @@
}
return (error);
}
-
-#ifdef COMPAT_FREEBSD32
-int
-freebsd32_timerfd_gettime(struct thread *td,
- struct freebsd32_timerfd_gettime_args *uap)
-{
- struct itimerspec curr_value;
- struct itimerspec32 curr_value32;
- int error;
-
- error = kern_timerfd_gettime(td, uap->fd, &curr_value);
- if (error == 0) {
- CP(curr_value, curr_value32, it_value.tv_sec);
- CP(curr_value, curr_value32, it_value.tv_nsec);
- CP(curr_value, curr_value32, it_interval.tv_sec);
- CP(curr_value, curr_value32, it_interval.tv_nsec);
- error = copyout(&curr_value32, uap->curr_value,
- sizeof(curr_value32));
- }
-
- return (error);
-}
-
-int
-freebsd32_timerfd_settime(struct thread *td,
- struct freebsd32_timerfd_settime_args *uap)
-{
- struct itimerspec new_value, old_value;
- struct itimerspec32 new_value32, old_value32;
- int error;
-
- error = copyin(uap->new_value, &new_value32, sizeof(new_value32));
- if (error != 0)
- return (error);
- CP(new_value32, new_value, it_value.tv_sec);
- CP(new_value32, new_value, it_value.tv_nsec);
- CP(new_value32, new_value, it_interval.tv_sec);
- CP(new_value32, new_value, it_interval.tv_nsec);
- if (uap->old_value == NULL) {
- error = kern_timerfd_settime(td, uap->fd, uap->flags,
- &new_value, NULL);
- } else {
- error = kern_timerfd_settime(td, uap->fd, uap->flags,
- &new_value, &old_value);
- if (error == 0) {
- CP(old_value, old_value32, it_value.tv_sec);
- CP(old_value, old_value32, it_value.tv_nsec);
- CP(old_value, old_value32, it_interval.tv_sec);
- CP(old_value, old_value32, it_interval.tv_nsec);
- error = copyout(&old_value32, uap->old_value,
- sizeof(old_value32));
- }
- }
- return (error);
-}
-#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 8:11 PM (21 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15757371
Default Alt Text
D41640.diff (4 KB)
Attached To
Mode
D41640: timerfd: Relocate 32-bit compat code
Attached
Detach File
Event Timeline
Log In to Comment