feat: adapt semios filesystem layout

Signed-off-by: sisungo <[email protected]>
This commit is contained in:
2026-07-18 21:20:39 +08:00
parent 4360d2fd2e
commit d65988fcf0
7 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ typedef struct __res_state {
#define __RES 19960801
#ifndef _PATH_RESCONF
#define _PATH_RESCONF "/etc/resolv.conf"
#define _PATH_RESCONF "/var/config/network/resolv.conf"
#endif
struct res_sym {
+1 -1
View File
@@ -69,7 +69,7 @@
#define ICONV_ERR_ILLEGAL_OPCODE -4
#define ICONV_ERR_MEMORY_OVERFLOW -5
#define ICONV_CHARSET_PATH_PREFIX "/etc/iconv/"
#define ICONV_CHARSET_PATH_PREFIX "/share/iconv/"
static const uint8_t vm_binary_magic[4] = { 'S', 'I', 'C', 'V' };
+3 -3
View File
@@ -47,7 +47,7 @@ static void reverse_hosts(char *buf, const unsigned char *a, unsigned scopeid, i
char line[512], *p, *z;
unsigned char _buf[1032], atmp[16];
struct address iplit;
FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
FILE _f, *f = __fopen_rb_ca("/var/config/network/hosts", &_f, _buf, sizeof _buf);
if (!f) return;
if (family == AF_INET) {
memcpy(atmp+12, a, 4);
@@ -71,7 +71,7 @@ static void reverse_hosts(char *buf, const unsigned char *a, unsigned scopeid, i
if (memcmp(a, iplit.addr, 16) || iplit.scopeid != scopeid)
continue;
for (; *p && isspace(*p); p++);
for (z=p; *z && !isspace(*z); z++);
*z = 0;
@@ -116,7 +116,7 @@ static int dns_parse_callback(void *c, int rr, const void *data, int len, const
data, c, 256) <= 0)
*(char *)c = 0;
return 0;
}
int getnameinfo(const struct sockaddr *restrict sa, socklen_t sl,
+1 -1
View File
@@ -52,7 +52,7 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati
size_t l = strlen(name);
int cnt = 0, badfam = 0, have_canon = 0;
unsigned char _buf[1032];
FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
FILE _f, *f = __fopen_rb_ca("/var/config/network/hosts", &_f, _buf, sizeof _buf);
if (!f) switch (errno) {
case ENOENT:
case ENOTDIR:
+1 -1
View File
@@ -18,7 +18,7 @@ int __get_resolv_conf(struct resolvconf *conf, char *search, size_t search_sz)
conf->attempts = 2;
if (search) *search = 0;
f = __fopen_rb_ca("/etc/resolv.conf", &_f, _buf, sizeof _buf);
f = __fopen_rb_ca("/var/config/network/resolv.conf", &_f, _buf, sizeof _buf);
if (!f) switch (errno) {
case ENOENT:
case ENOTDIR:
+3 -3
View File
@@ -132,7 +132,7 @@ static void do_tzset()
"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
s = getenv("TZ");
if (!s) s = "/etc/localtime";
if (!s) s = "/var/config/localtime";
if (!*s) s = __utc;
if (old_tz && !strcmp(s, old_tz)) return;
@@ -163,7 +163,7 @@ static void do_tzset()
|| !strcmp(dummy_name, "UTC")
|| !strcmp(dummy_name, "GMT")))
posix_form = 1;
}
}
/* Non-suid can use an absolute tzfile pathname or a relative
* pathame beginning with "."; in secure mode, only the
@@ -171,7 +171,7 @@ static void do_tzset()
if (!posix_form) {
if (*s == ':') s++;
if (*s == '/' || *s == '.') {
if (!libc.secure || !strcmp(s, "/etc/localtime"))
if (!libc.secure || !strcmp(s, "/var/config/localtime"))
map = __map_file(s, &map_size);
} else {
size_t l = strlen(s);
+4 -3
View File
@@ -11,8 +11,7 @@ fn main() {
let dst = args.next().expect("please specify output file");
let mut octos = Vec::new();
let src_content = std::fs::read_to_string(&src)
.expect("cannot read source file");
let src_content = std::fs::read_to_string(&src).expect("cannot read source file");
let mut current_tag = None;
for (nline, line) in src_content.lines().enumerate() {
let line = line.trim();
@@ -129,7 +128,9 @@ fn do_arg(s: &str, content: &mut [u8; 8], cursor: &mut usize) -> Option<(usize,
_ => panic!("unknown radix"),
};
*cursor = 8;
*content = u64::from_str_radix(&digit[1..], radix).unwrap().to_be_bytes();
*content = u64::from_str_radix(&digit[1..], radix)
.unwrap()
.to_be_bytes();
None
} else if let Some(reg_id) = s.strip_prefix("&r") {
content[*cursor] = reg_id.parse::<u8>().unwrap();