This repository was archived by the owner on Mar 7, 2021. It is now read-only.
File tree 7 files changed +27
-20
lines changed
7 files changed +27
-20
lines changed Original file line number Diff line number Diff line change 1
- sudo : required
1
+ matrix :
2
+ include :
3
+ - dist : trusty
4
+ - dist : xenial
2
5
3
6
language : rust
4
7
rust :
@@ -21,8 +24,7 @@ install:
21
24
else
22
25
cargo install --force cargo-xbuild
23
26
fi
24
- - rustup component add rust-src
25
- - rustup component add rustfmt
27
+ - rustup component add rust-src rustfmt
26
28
27
29
script :
28
30
- ./tests/run_tests.py
Original file line number Diff line number Diff line change @@ -34,13 +34,12 @@ const INCLUDED_VARS: &[&str] = &[
34
34
"KERN_INFO" ,
35
35
"VERIFY_WRITE" ,
36
36
] ;
37
- /// These structs must be opaque because they're both packed
38
- /// and aligned, which is not yet supported by rust. See
39
- /// https://github.com/rust-lang/rust/issues/59154 and
40
- /// https://github.com/rust-lang/rust-bindgen/issues/1538
41
37
const OPAQUE_TYPES : & [ & str ] = & [
42
- "^xregs_state$" ,
43
- "^desc_struct$" ,
38
+ // This needs to be opaque because it's both packed and aligned, which rustc
39
+ // doesn't support yet. See https://github.com/rust-lang/rust/issues/59154
40
+ // and https://github.com/rust-lang/rust-bindgen/issues/1538
41
+ "desc_struct" ,
42
+ "xregs_state" ,
44
43
] ;
45
44
46
45
fn main ( ) {
@@ -58,7 +57,8 @@ fn main() {
58
57
. output ( )
59
58
. unwrap ( )
60
59
. stdout ,
61
- ) . unwrap ( ) ;
60
+ )
61
+ . unwrap ( ) ;
62
62
63
63
builder = builder. clang_arg ( "--target=x86_64-linux-kernel-module" ) ;
64
64
for arg in shlex:: split ( & output) . unwrap ( ) {
Original file line number Diff line number Diff line change 1
1
obj-m := examplesysctl.o
2
2
examplesysctl-objs := target/x86_64-linux-kernel-module/debug/libexample_sysctl.a
3
3
EXTRA_LDFLAGS += --entry=init_module
4
+ KDIR ?= /lib/modules/$(shell uname -r) /build
4
5
5
6
all :
6
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR )
7
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR )
7
8
8
9
clean :
9
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR ) clean
10
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR ) clean
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ ifneq ($(KERNELRELEASE),)
2
2
obj-m := helloworld.o
3
3
helloworld-objs := libhello_world.o
4
4
EXTRA_LDFLAGS += --entry=init_module
5
+ KDIR ?= /lib/modules/$(shell uname -r) /build
5
6
6
7
$(M ) /libhello_world.o : target/x86_64-linux-kernel-module/debug/libhello_world.a
7
8
$(LD ) -r -o $@ --whole-archive $^
8
9
else
9
10
all :
10
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR )
11
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR )
11
12
12
13
clean :
13
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR ) clean
14
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR ) clean
14
15
endif
15
-
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ impl SysctlStorage for atomic::AtomicBool {
56
56
57
57
pub struct Sysctl < T : SysctlStorage > {
58
58
inner : Box < T > ,
59
+ // Responsible for keeping the ctl_table alive.
59
60
_table : Box < [ bindings:: ctl_table ] > ,
60
61
header : * mut bindings:: ctl_table_header ,
61
62
}
@@ -127,7 +128,8 @@ impl<T: SysctlStorage> Sysctl<T> {
127
128
extra2: ptr:: null_mut( ) ,
128
129
} ,
129
130
unsafe { mem:: zeroed( ) } ,
130
- ] . into_boxed_slice ( ) ;
131
+ ]
132
+ . into_boxed_slice ( ) ;
131
133
132
134
let result =
133
135
unsafe { bindings:: register_sysctl ( path. as_ptr ( ) as * const i8 , table. as_mut_ptr ( ) ) } ;
Original file line number Diff line number Diff line change 1
1
obj-m := staticfilesystem.o
2
2
staticfilesystem-objs := target/x86_64-linux-kernel-module/debug/libstatic_filesystem.a
3
3
EXTRA_LDFLAGS += --entry=init_module
4
+ KDIR ?= /lib/modules/$(shell uname -r) /build
4
5
5
6
all :
6
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR )
7
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR )
7
8
8
9
clean :
9
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR ) clean
10
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR ) clean
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ ifneq ($(KERNELRELEASE),)
2
2
obj-m := testmodule.o
3
3
testmodule-objs := $(TEST_LIBRARY_OBJECT )
4
4
EXTRA_LDFLAGS += --entry=init_module
5
+ KDIR ?= /lib/modules/$(shell uname -r) /build
5
6
6
7
$(M ) /$(TEST_LIBRARY_OBJECT ) : target/x86_64-linux-kernel-module/debug/$(TEST_LIBRARY_ARCHIVE )
7
8
$(LD ) -r -o $@ --whole-archive $^
8
9
else
9
10
all :
10
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR )
11
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR )
11
12
12
13
clean :
13
- $(MAKE ) -C /lib/modules/ $( shell uname -r) /build M=$(CURDIR ) clean
14
+ $(MAKE ) -C $( KDIR ) M=$(CURDIR ) clean
14
15
endif
You can’t perform that action at this time.
0 commit comments