| 75 | ****************************************************************************/ |
| 76 | |
| 77 | static int exec_internal(FAR const char *filename, |
| 78 | FAR char * const *argv, FAR char * const *envp, |
| 79 | FAR const struct symtab_s *exports, int nexports, |
| 80 | FAR const posix_spawn_file_actions_t *actions, |
| 81 | FAR const posix_spawnattr_t *attr, bool spawn) |
| 82 | { |
| 83 | FAR struct binary_s *bin; |
| 84 | int pid; |
| 85 | int ret; |
| 86 | #ifndef CONFIG_BINFMT_LOADABLE |
| 87 | struct binary_s sbin; |
| 88 | |
| 89 | bin = &sbin; |
| 90 | memset(bin, 0, sizeof(*bin)); |
| 91 | #else |
| 92 | |
| 93 | /* Allocate the load information */ |
| 94 | |
| 95 | bin = kmm_zalloc(sizeof(struct binary_s)); |
| 96 | if (bin == NULL) |
| 97 | { |
| 98 | berr("ERROR: Failed to allocate binary_s\n"); |
| 99 | ret = -ENOMEM; |
| 100 | goto errout; |
| 101 | } |
| 102 | #endif |
| 103 | |
| 104 | /* Load the module into memory */ |
| 105 | |
| 106 | ret = load_module(bin, filename, exports, nexports); |
| 107 | if (ret < 0) |
| 108 | { |
| 109 | berr("ERROR: Failed to load program '%s': %d\n", filename, ret); |
| 110 | goto errout_with_bin; |
| 111 | } |
| 112 | |
| 113 | /* Update the spawn attribute */ |
| 114 | |
| 115 | if (attr) |
| 116 | { |
| 117 | if (attr->priority > 0) |
| 118 | { |
| 119 | bin->priority = attr->priority; |
| 120 | } |
| 121 | |
| 122 | if (attr->stacksize > 0) |
| 123 | { |
| 124 | bin->stacksize = attr->stacksize; |
| 125 | } |
| 126 | |
| 127 | #ifndef CONFIG_BUILD_KERNEL |
| 128 | if (attr->stackaddr != NULL) |
| 129 | { |
| 130 | bin->stackaddr = attr->stackaddr; |
| 131 | } |
| 132 | #endif |
| 133 | } |
| 134 |
no test coverage detected