README.md
1 # Sample service for testing
2 This is a sample service that can be used for testing init.
3
4 ## Design
5 The service includes a `.rc` file that allows starting it from init.
6
7 service test_service /system/bin/test_service CapAmb 0000000000003000
8 class main
9 user system
10 group system
11 capabilities NET_ADMIN NET_RAW
12 disabled
13 oneshot
14
15 The service accepts any even number of arguments on the command line
16 (i.e. any number of pairs of arguments.)
17 It will attempt to find the first element of each pair of arguments in
18 `/proc/self/status`, and attempt to exactly match the second element of the pair
19 to the relevant line of `proc/self/status`.
20
21 ### Example
22 In the above case, the service will look for lines containing `CapAmb`:
23
24 cat /proc/self/status
25 ...
26 CapAmb: 0000000000003000
27
28 And then attempt to exactly match the token after `:`, `0000000000003000`,
29 with the command-line argument.
30 If they match, the service exits successfully. If not, the service will exit
31 with an error.
32
33 ## Usage
34 mmma -j <jobs> system/core/init/testservice
35 adb root
36 adb remount
37 adb sync
38 adb reboot
39 adb root
40 adb shell start test_service
41 adb logcat -b all -d | grep test_service
42
43 Look for an exit status of 0.
44