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) {
216216 // Bindings will not compile on Linux without block listing this item
217217 // It is worth investigating why this is
218218 . blocklist_item ( "IPPORT_RESERVED" )
219+ // will be restored later in build.rs
220+ . blocklist_item ( "NGX_ALIGNMENT" )
219221 . generate_cstr ( true )
220222 // The input header we would like to generate bindings for.
221223 . header ( "build/wrapper.h" )
Original file line number Diff line number Diff line change 2020
2121const char * NGX_RS_MODULE_SIGNATURE = NGX_MODULE_SIGNATURE ;
2222
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+
2327// `--prefix=` results in not emitting the declaration
2428#ifndef NGX_PREFIX
2529#define NGX_PREFIX ""
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ pub use queue::*;
3636#[ cfg( ngx_feature = "stream" ) ]
3737pub use stream:: * ;
3838
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+
3947impl ngx_command_t {
4048 /// Creates a new empty [`ngx_command_t`] instance.
4149 ///
You can’t perform that action at this time.
0 commit comments