| 1 |
/* Define several variants of struct epoll_event from the Linux kernel, |
| 2 |
specifying various attributes that affect alignment and size. |
| 3 |
|
| 4 |
This test was developed for systems for which int is 32 bits and |
| 5 |
long long is 64 bits; it might need to be disabled for systems where |
| 6 |
either of those is not true. */ |
| 7 |
|
| 8 |
#define DESC_orig "original" |
| 9 |
struct epoll_event_orig { |
| 10 |
unsigned int events; |
| 11 |
unsigned long long data; |
| 12 |
}; |
| 13 |
|
| 14 |
#ifndef SKIP_ATTRIBUTE |
| 15 |
#define DESC_structmax "maximum useful struct alignment" |
| 16 |
struct epoll_event_structmax { |
| 17 |
unsigned int events; |
| 18 |
unsigned long long data; |
| 19 |
} __attribute__ ((aligned)); |
| 20 |
|
| 21 |
|
| 22 |
#define DESC_struct4 "4-byte struct alignment" |
| 23 |
struct epoll_event_struct4 { |
| 24 |
unsigned int events; |
| 25 |
unsigned long long data; |
| 26 |
} __attribute__ ((aligned(4))); |
| 27 |
|
| 28 |
#define DESC_struct8 "8-byte struct alignment" |
| 29 |
struct epoll_event_struct8 { |
| 30 |
unsigned int events; |
| 31 |
unsigned long long data; |
| 32 |
} __attribute__ ((aligned(8))); |
| 33 |
|
| 34 |
#define DESC_data4 "4-byte alignment for data" |
| 35 |
struct epoll_event_data4 { |
| 36 |
unsigned int events; |
| 37 |
unsigned long long data __attribute__ ((aligned(4))); |
| 38 |
}; |
| 39 |
|
| 40 |
#define DESC_data8 "8-byte alignment for data" |
| 41 |
struct epoll_event_data8 { |
| 42 |
unsigned int events; |
| 43 |
unsigned long long data __attribute__ ((aligned(8))); |
| 44 |
}; |
| 45 |
|
| 46 |
#define DESC_p "packed attribute" |
| 47 |
struct epoll_event_p { |
| 48 |
unsigned int events; |
| 49 |
unsigned long long data; |
| 50 |
} __attribute__ ((packed)); |
| 51 |
|
| 52 |
#define DESC_pstruct4 "packed attribute, 4-byte struct alignment" |
| 53 |
struct epoll_event_pstruct4 { |
| 54 |
unsigned int events; |
| 55 |
unsigned long long data; |
| 56 |
} __attribute__ ((packed)) __attribute__ ((aligned(4))); |
| 57 |
|
| 58 |
#define DESC_pstruct8 "packed attribute, 8-byte struct alignment" |
| 59 |
struct epoll_event_pstruct8 { |
| 60 |
unsigned int events; |
| 61 |
unsigned long long data; |
| 62 |
} __attribute__ ((packed)) __attribute__ ((aligned(8))); |
| 63 |
|
| 64 |
#define DESC_pdata4 "packed attribute, 4-byte alignment for data" |
| 65 |
struct epoll_event_pdata4 { |
| 66 |
unsigned int events; |
| 67 |
unsigned long long data __attribute__ ((aligned(4))); |
| 68 |
} __attribute__ ((packed)); |
| 69 |
|
| 70 |
#define DESC_pdata8 "packed attribute, 8-byte alignment for data" |
| 71 |
struct epoll_event_pdata8 { |
| 72 |
unsigned int events; |
| 73 |
unsigned long long data __attribute__ ((aligned(8))); |
| 74 |
} __attribute__ ((packed)); |
| 75 |
#endif |