#define PLANCK_FEATURE_MOUNT 1 #include /* * `::builtin:mount [options]` -- PID 1 mounts it with one mount(2). * For a box that would otherwise start a shell and a mount program at boot for a single line: nothing is exec'd, * so no other binary enters the page cache before the first login. */ static void planck_mount_builtin(const char *args) { char buf[MAX_CMD]; char *word[4] = { 0, 0, 0, 0 }; char *p; int n = 0; strncpy(buf, args, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; for (p = buf; *p && n < 4; ) { while (*p == ' ') *p++ = 0; if (!*p) break; word[n++] = p; while (*p && *p != ' ') p++; } if (n < 3 || mount(word[1], word[2], word[0], 0, word[3]) < 0) log_msg("mount: FAILED (want ` [options]`)"); }