bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH gnumach] Reorder mach_msg_type_t fields to ensure msgt_name and m


From: Flavio Cruz
Subject: [PATCH gnumach] Reorder mach_msg_type_t fields to ensure msgt_name and msgt_size are byte aligned
Date: Sat, 25 Nov 2023 01:27:53 -0500

msgt_unused appears right after msgt_size since msgt_size can be reduced
to only 8 bits in the future, so we leave the door opened to make
msgt_unused 13 bits long.
---
 include/mach/message.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/mach/message.h b/include/mach/message.h
index 17d3592..906ae79 100644
--- a/include/mach/message.h
+++ b/include/mach/message.h
@@ -238,12 +238,12 @@ typedef struct  {
      * kernel. Otherwise, we would have to replicate some of the MiG logic
      * internally in the kernel.
      */
-    unsigned int       msgt_inline : 1,
-                       msgt_longform : 1,
-                       msgt_deallocate : 1,
-                       msgt_name : 8,
+    unsigned int       msgt_name : 8,
                        msgt_size : 16,
-                       msgt_unused : 5;
+                       msgt_unused : 5,
+                       msgt_inline : 1,
+                       msgt_longform : 1,
+                       msgt_deallocate : 1;
     mach_msg_type_number_t   msgt_number;
 #else
     unsigned int       msgt_name : 8,
@@ -263,12 +263,12 @@ typedef struct {
          * union to overlay with the old field names.  */
         mach_msg_type_t        msgtl_header;
         struct {
-            unsigned int       msgtl_inline : 1,
-                    msgtl_longform : 1,
-                    msgtl_deallocate : 1,
-                    msgtl_name : 8,
+            unsigned int       msgtl_name : 8,
                     msgtl_size : 16,
-                    msgtl_unused : 5;
+                    msgtl_unused : 5,
+                    msgtl_inline : 1,
+                    msgtl_longform : 1,
+                    msgtl_deallocate : 1;
             mach_msg_type_number_t   msgtl_number;
         };
     };
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]