expose cmdline for /dev/cmdline later

This commit is contained in:
2026-10-13 23:59:28 +02:00
parent c5c3acc520
commit deec8099cb
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -9,6 +9,11 @@ extern const struct cmdline_option* __ld_cmdline_start[];
extern const struct cmdline_option* __ld_cmdline_end[]; extern const struct cmdline_option* __ld_cmdline_end[];
static char cmdline_buf[0x1000]; static char cmdline_buf[0x1000];
static char cmdline_raw[0x1000];
const char* cmdline_get() {
return cmdline_raw;
}
void cmdline_parse_buf( void cmdline_parse_buf(
char* cmdline_buf, char* cmdline_buf,
@@ -112,5 +117,6 @@ void cmdline_parse(const char* cmdline) {
const size_t len = strnlen(cmdline, sizeof(cmdline_buf) - 1); const size_t len = strnlen(cmdline, sizeof(cmdline_buf) - 1);
memcpy(cmdline_buf, cmdline, len); memcpy(cmdline_buf, cmdline, len);
memcpy(cmdline_raw, cmdline, len);
cmdline_parse_buf(cmdline_buf, len, __ld_cmdline_start, __ld_cmdline_end); cmdline_parse_buf(cmdline_buf, len, __ld_cmdline_start, __ld_cmdline_end);
} }
+2
View File
@@ -50,6 +50,8 @@ struct cmdline_option {
// Parses the command line and invokes all options. // Parses the command line and invokes all options.
void cmdline_parse(const char* cmdline); void cmdline_parse(const char* cmdline);
const char* cmdline_get();
void cmdline_parse_buf( void cmdline_parse_buf(
char* buf, char* buf,
size_t len, size_t len,