File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,8 @@ fn generate_binding(nginx: &NginxSource) {
216
216
// Bindings will not compile on Linux without block listing this item
217
217
// It is worth investigating why this is
218
218
. blocklist_item ( "IPPORT_RESERVED" )
219
+ // will be restored later in build.rs
220
+ . blocklist_item ( "NGX_ALIGNMENT" )
219
221
. generate_cstr ( true )
220
222
// The input header we would like to generate bindings for.
221
223
. header ( "build/wrapper.h" )
Original file line number Diff line number Diff line change 20
20
21
21
const char * NGX_RS_MODULE_SIGNATURE = NGX_MODULE_SIGNATURE ;
22
22
23
+ // NGX_ALIGNMENT could be defined as a constant or an expression, with the
24
+ // latter being unsupported by bindgen.
25
+ const size_t NGX_RS_ALIGNMENT = NGX_ALIGNMENT ;
26
+
23
27
// `--prefix=` results in not emitting the declaration
24
28
#ifndef NGX_PREFIX
25
29
#define NGX_PREFIX ""
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ pub use queue::*;
36
36
#[ cfg( ngx_feature = "stream" ) ]
37
37
pub use stream:: * ;
38
38
39
+ /// Default alignment for pool allocations.
40
+ pub const NGX_ALIGNMENT : usize = NGX_RS_ALIGNMENT ;
41
+
42
+ // Check if the allocations made with ngx_palloc are properly aligned.
43
+ // If the check fails, objects allocated from `ngx_pool` can violate Rust pointer alignment
44
+ // requirements.
45
+ const _: ( ) = assert ! ( core:: mem:: align_of:: <ngx_str_t>( ) <= NGX_ALIGNMENT ) ;
46
+
39
47
impl ngx_command_t {
40
48
/// Creates a new empty [`ngx_command_t`] instance.
41
49
///
You can’t perform that action at this time.
0 commit comments