OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 9 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
10 | 10 |
11 /* | 11 /* |
12 * This function handles the nacl_helper_bootstrap arguments r_debug | 12 * This function handles the nacl_helper_bootstrap arguments r_debug |
13 * and reserved_at_zero and updates argc and argv to act as though | 13 * and reserved_at_zero and updates argc and argv to act as though |
14 * these arguments were not passed. For example, the command | 14 * these arguments were not passed. For example, the command |
15 * | 15 * |
16 * nacl_helper_bootstrap program \ | 16 * nacl_helper_bootstrap program --r_debug=0xXXXXXXXXXXXXXXXX \ |
17 * --r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXX program_arg | 17 * --reserved_at_zero=0xXXXXXXXXXXXXXXXX program_arg |
18 * | 18 * |
19 * will result in the following argc and argv structure for program after | 19 * will result in the following argc and argv structure for program after |
20 * running throughg the bootstrapper: | 20 * running throughg the bootstrapper: |
21 * | 21 * |
22 * argc: 4 | 22 * argc: 4 |
23 * argv[0]: program | 23 * argv[0]: program |
24 * argv[1]: --r_debug=0xXXXXXXXXXXXXXXXX | 24 * argv[1]: --r_debug=0xXXXXXXXXXXXXXXXX |
25 * argv[2]: --reserved_at_zero=0xXXXXXXXX | 25 * argv[2]: --reserved_at_zero=0xXXXXXXXXXXXXXXXX |
26 * argv[3]: program_arg | 26 * argv[3]: program_arg |
27 * | 27 * |
28 * After program calls NaClHandleBootstrapArgs, the argc and argv structure | 28 * After program calls NaClHandleBootstrapArgs, the argc and argv structure |
29 * will be: | 29 * will be: |
30 * | 30 * |
31 * argc: 2 | 31 * argc: 2 |
32 * argv[0]: program | 32 * argv[0]: program |
33 * argv[1]: program_arg | 33 * argv[1]: program_arg |
34 * | 34 * |
35 * argc_p is the pointer to the argc variable passed to main. | 35 * argc_p is the pointer to the argc variable passed to main. |
(...skipping 21 matching lines...) Expand all Loading... |
57 0 == strncmp(argv[1], kAtZeroSwitch, sizeof(kAtZeroSwitch) - 1)) { | 57 0 == strncmp(argv[1], kAtZeroSwitch, sizeof(kAtZeroSwitch) - 1)) { |
58 NaClHandleReservedAtZero(&argv[1][sizeof(kAtZeroSwitch) - 1]); | 58 NaClHandleReservedAtZero(&argv[1][sizeof(kAtZeroSwitch) - 1]); |
59 --argc; | 59 --argc; |
60 ++argv; | 60 ++argv; |
61 } | 61 } |
62 | 62 |
63 *argc_p = argc; | 63 *argc_p = argc; |
64 *argv_p = argv; | 64 *argv_p = argv; |
65 (*argv_p)[0] = argv0; | 65 (*argv_p)[0] = argv0; |
66 } | 66 } |
OLD | NEW |