[PATCH 08/12] quota: Add packed attribute to struct if_dqblk definition
Eugene Syromyatnikov
evgsyr at gmail.com
Wed Sep 21 03:12:01 UTC 2016
Since the only difference between 32-bit and 64-bit environments
regarding this structure is its padding, it has been decided to just add
packed attribute to it instead of going full mpers.
* quota.c: Add ATTRIBUTE_PACKED to struct if_dqblk definition.
---
quota.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/quota.c b/quota.c
index 905fece..4fb938b 100644
--- a/quota.c
+++ b/quota.c
@@ -49,6 +49,10 @@
#include "xlat/if_dqinfo_flags.h"
#include "xlat/if_dqinfo_valid.h"
+/* We add attribute packed due to the fact that the structure is 8-byte aligned
+ * on 64-bit systems and therefore has additional 4 bytes of padding, which
+ * leads to problems when it is used on 32-bit tracee which doesn't have such
+ * padding. */
struct if_dqblk
{
uint64_t dqb_bhardlimit;
@@ -60,7 +64,7 @@ struct if_dqblk
uint64_t dqb_btime;
uint64_t dqb_itime;
uint32_t dqb_valid;
-};
+} ATTRIBUTE_PACKED;
struct if_nextdqblk {
uint64_t dqb_bhardlimit;
--
1.7.10.4
More information about the Strace-devel
mailing list