Skip to content

Commit

Permalink
posix_spawn: Move dependencies to Kconfig
Browse files Browse the repository at this point in the history
`posix_spawn` depends on these configurations:
- !BINFMT_DISABLE
- !DISABLE_MOUNTPOINT
- BOARDCTL
- BOARDCTL_APP_SYMTAB
- ELF
- FS_ROMFS

Check them in compile time may waste some time if the dependencies are not met,
move them to Kconfig to avoid this.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
  • Loading branch information
no1wudi authored and xiaoxiang781216 committed Nov 14, 2024
1 parent 3c4ddd2 commit 9f859e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 32 deletions.
6 changes: 6 additions & 0 deletions examples/posix_spawn/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
config EXAMPLES_POSIXSPAWN
tristate "posix_spawn Unit Test"
default n
depends on !BINFMT_DISABLE
depends on !DISABLE_MOUNTPOINT
depends on BOARDCTL
depends on BOARDCTL_APP_SYMTAB
depends on ELF
depends on FS_ROMFS
---help---
Enable the posix_spawn() unit test

Expand Down
32 changes: 0 additions & 32 deletions examples/posix_spawn/spawn_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,38 +45,6 @@
* Pre-processor Definitions
****************************************************************************/

/* Check configuration. This is not all of the configuration settings that
* are required -- only the more obvious.
*/

#ifdef CONFIG_BINFMT_DISABLE
# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!"
#endif

#ifndef CONFIG_ELF
# error "You must select CONFIG_ELF in your configuration file"
#endif

#ifndef CONFIG_FS_ROMFS
# error "You must select CONFIG_FS_ROMFS in your configuration file"
#endif

#ifdef CONFIG_DISABLE_MOUNTPOINT
# error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file"
#endif

#ifdef CONFIG_BINFMT_DISABLE
# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file"
#endif

#ifndef CONFIG_BOARDCTL
# error "This configuration requires CONFIG_BOARDCTL"
#endif

#ifndef CONFIG_BOARDCTL_APP_SYMTAB
# error "You must enable the symobol table interface with CONFIG_BOARDCTL_APP_SYMTAB"
#endif

/* Describe the ROMFS file system */

#define SECTORSIZE 512
Expand Down

0 comments on commit 9f859e9

Please sign in to comment.