History

pps: fix padding issue with PPS_FETCH for ioctl_compat

Issue is that x86 32-bit aligns to 4-bytes instead of 8-bytes so this patchset works around the issue and corrects the data returned in pps_fdata_compat.

Matt Ranostay committed 9 years ago

Commit c2a49fe1 parent 2ac66652 files · +98 −31Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/pps.h+19−0
@@ -55,6 +55,12 @@ struct pps_ktime { · 54 unmodified lines
55 __s32 nsec;55 __s32 nsec;
56 __u32 flags;56 __u32 flags;
57};57};
58
59struct pps_ktime_compat {
60 __s64 sec;
61 __s32 nsec;
62 __u32 flags;
63} __attribute__((packed, aligned(4)));
58#define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */64#define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */
59 65
60struct pps_kinfo {66struct pps_kinfo {
@@ -65,6 +71,14 @@ struct pps_kinfo { · 4 unmodified lines
65 int current_mode; /* current mode bits */71 int current_mode; /* current mode bits */
66};72};
67 73
74struct pps_kinfo_compat {
75 __u32 assert_sequence; /* seq. num. of assert event */
76 __u32 clear_sequence; /* seq. num. of clear event */
77 struct pps_ktime_compat assert_tu; /* time of assert event */
78 struct pps_ktime_compat clear_tu; /* time of clear event */
79 int current_mode; /* current mode bits */
80};
81
68struct pps_kparams {82struct pps_kparams {
69 int api_version; /* API version # */83 int api_version; /* API version # */
70 int mode; /* mode bits */84 int mode; /* mode bits */
@@ -114,6 +128,11 @@ struct pps_fdata { · 43 unmodified lines
114 struct pps_ktime timeout;128 struct pps_ktime timeout;
115};129};
116 130
131struct pps_fdata_compat {
132 struct pps_kinfo_compat info;
133 struct pps_ktime_compat timeout;
134};
135
117struct pps_bind_args {136struct pps_bind_args {
118 int tsformat; /* format of time stamps */137 int tsformat; /* format of time stamps */
119 int edge; /* selected event type */138 int edge; /* selected event type */