mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:07:35 +00:00
Userland: Fix 64-bit portability issues
This commit is contained in:
parent
fdbe66a7b4
commit
b613817bca
15 changed files with 59 additions and 30 deletions
|
@ -267,8 +267,14 @@ int main(int argc, char** argv)
|
|||
return Crash::Failure::UnexpectedError;
|
||||
|
||||
u8* bad_esp = bad_stack + 2048;
|
||||
#ifndef __LP64__
|
||||
asm volatile("mov %%eax, %%esp" ::"a"(bad_esp));
|
||||
asm volatile("pushl $0");
|
||||
#else
|
||||
asm volatile("movq %%rax, %%rsp" ::"a"(bad_esp));
|
||||
asm volatile("pushq $0");
|
||||
#endif
|
||||
|
||||
return Crash::Failure::DidNotCrash;
|
||||
}).run(run_type);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -71,9 +71,9 @@ int main(int argc, char** argv)
|
|||
printf("%10s ", human_readable_size((total_block_count - free_block_count) * block_size).characters());
|
||||
printf("%10s ", human_readable_size(free_block_count * block_size).characters());
|
||||
} else {
|
||||
printf("%10" PRIu64 " ", total_block_count);
|
||||
printf("%10" PRIu64 " ", total_block_count - free_block_count);
|
||||
printf("%10" PRIu64 " ", free_block_count);
|
||||
printf("%10" PRIu64 " ", (uint64_t)total_block_count);
|
||||
printf("%10" PRIu64 " ", (uint64_t)(total_block_count - free_block_count));
|
||||
printf("%10" PRIu64 " ", (uint64_t)free_block_count);
|
||||
}
|
||||
|
||||
printf("%s", mount_point.characters());
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
@ -151,7 +152,7 @@ int print_space_usage(const String& path, const DuOption& du_option, int max_dep
|
|||
return 0;
|
||||
}
|
||||
|
||||
long long size = path_stat.st_size;
|
||||
off_t size = path_stat.st_size;
|
||||
if (du_option.apparent_size) {
|
||||
const auto block_size = 512;
|
||||
size = path_stat.st_blocks * block_size;
|
||||
|
@ -164,7 +165,7 @@ int print_space_usage(const String& path, const DuOption& du_option, int max_dep
|
|||
size = size / block_size + (size % block_size != 0);
|
||||
|
||||
if (du_option.time_type == DuOption::TimeType::NotUsed)
|
||||
printf("%lld\t%s\n", size, path.characters());
|
||||
printf("%" PRIi64 "\t%s\n", size, path.characters());
|
||||
else {
|
||||
auto time = path_stat.st_mtime;
|
||||
switch (du_option.time_type) {
|
||||
|
@ -178,7 +179,7 @@ int print_space_usage(const String& path, const DuOption& du_option, int max_dep
|
|||
}
|
||||
|
||||
const auto formatted_time = Core::DateTime::from_timestamp(time).to_string();
|
||||
printf("%lld\t%s\t%s\n", size, formatted_time.characters(), path.characters());
|
||||
printf("%" PRIi64 "\t%s\t%s\n", size, formatted_time.characters(), path.characters());
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -68,7 +68,7 @@ static NonnullOwnPtr<HashMap<void*, X86::Instruction>> instrument_code()
|
|||
if (section.name() != ".text")
|
||||
return IterationDecision::Continue;
|
||||
|
||||
X86::SimpleInstructionStream stream((const u8*)((u32)lib.file->data() + section.offset()), section.size());
|
||||
X86::SimpleInstructionStream stream((const u8*)((uintptr_t)lib.file->data() + section.offset()), section.size());
|
||||
X86::Disassembler disassembler(stream);
|
||||
for (;;) {
|
||||
auto offset = stream.offset();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
#include <inttypes.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -313,7 +314,7 @@ static bool print_filesystem_object(const String& path, const String& name, cons
|
|||
if (flag_human_readable) {
|
||||
printf(" %10s ", human_readable_size(st.st_size).characters());
|
||||
} else {
|
||||
printf(" %10lld ", st.st_size);
|
||||
printf(" %10" PRIu64 " ", (uint64_t)st.st_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <grp.h>
|
||||
#include <inttypes.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -28,7 +29,7 @@ static int stat(const char* file, bool should_follow_links)
|
|||
if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))
|
||||
printf(" Device: %u,%u\n", major(st.st_rdev), minor(st.st_rdev));
|
||||
else
|
||||
printf(" Size: %lld\n", st.st_size);
|
||||
printf(" Size: %" PRIi64 "\n", st.st_size);
|
||||
printf(" Links: %u\n", st.st_nlink);
|
||||
printf(" Blocks: %u\n", st.st_blocks);
|
||||
printf(" UID: %u", st.st_uid);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
#include <inttypes.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -87,7 +88,7 @@ int main()
|
|||
if (stat(tty.characters(), &st) == 0) {
|
||||
auto idle_time = now - st.st_mtime;
|
||||
if (idle_time >= 0) {
|
||||
builder.appendf("%llds", idle_time);
|
||||
builder.appendf("%" PRIi64 "s", idle_time);
|
||||
idle_string = builder.to_string();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue