diff --git a/libc/kernel/arch-mips/asm/fcntl.h b/libc/kernel/arch-mips/asm/fcntl.h index 73de4ad3a..996f996d0 100644 --- a/libc/kernel/arch-mips/asm/fcntl.h +++ b/libc/kernel/arch-mips/asm/fcntl.h @@ -47,8 +47,8 @@ struct flock { short l_type; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ short l_whence; - off_t l_start; - off_t l_len; + __kernel_off_t l_start; + __kernel_off_t l_len; long l_sysid; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __kernel_pid_t l_pid; diff --git a/libc/kernel/arch-mips/asm/sn/kldir.h b/libc/kernel/arch-mips/asm/sn/kldir.h index 6c663ca5e..ef41013c3 100644 --- a/libc/kernel/arch-mips/asm/sn/kldir.h +++ b/libc/kernel/arch-mips/asm/sn/kldir.h @@ -79,7 +79,7 @@ #ifndef __ASSEMBLY__ typedef struct kldir_ent_s { u64 magic; - off_t offset; + __kernel_off_t offset; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ unsigned long pointer; size_t size; diff --git a/libc/kernel/arch-mips/asm/stat.h b/libc/kernel/arch-mips/asm/stat.h index a8fee786b..0b581b250 100644 --- a/libc/kernel/arch-mips/asm/stat.h +++ b/libc/kernel/arch-mips/asm/stat.h @@ -34,7 +34,7 @@ struct stat { gid_t st_gid; unsigned st_rdev; long st_pad2[2]; - off_t st_size; + __kernel_off_t st_size; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ long st_pad3; time_t st_atime; @@ -91,7 +91,7 @@ struct stat { unsigned int st_rdev; unsigned int st_pad1[3]; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ - off_t st_size; + __kernel_off_t st_size; unsigned int st_atime; unsigned int st_atime_nsec; unsigned int st_mtime; diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py index 01569fc80..1a5471a83 100755 --- a/libc/kernel/tools/clean_header.py +++ b/libc/kernel/tools/clean_header.py @@ -66,6 +66,9 @@ def cleanupFile( path, original_path): if arch and arch in kernel_default_arch_macros: macros.update(kernel_default_arch_macros[arch]) + if arch and arch in kernel_arch_token_replacements: + blocks.replaceTokens( kernel_arch_token_replacements[arch] ) + blocks.optimizeMacros( macros ) blocks.optimizeIf01() blocks.removeVarsAndFuncs( statics ) diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py index 6c7efd689..da024815a 100644 --- a/libc/kernel/tools/defaults.py +++ b/libc/kernel/tools/defaults.py @@ -48,6 +48,11 @@ kernel_default_arch_macros = { "mips": {"CONFIG_32BIT":"1"}, } +kernel_arch_token_replacements = { + "arm": {}, + "x86": {}, + "mips": {"off_t":"__kernel_off_t"}, + } # Replace tokens in the output according to this mapping kernel_token_replacements = { "asm": "__asm__",