LibC: Make it compile on 64-bit

It won't actually work on 64-bit yet, but let's do our future selves
a favor and make it compile.
This commit is contained in:
Andreas Kling 2021-02-25 16:08:02 +01:00
parent 8714f389f9
commit eb08a0edd5
Notes: sideshowbarker 2024-07-18 21:56:10 +09:00
4 changed files with 15 additions and 15 deletions

View file

@ -35,7 +35,7 @@ extern "C" {
void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset, size_t alignment, const char* name)
{
Syscall::SC_mmap_params params { (uintptr_t)addr, size, alignment, prot, flags, fd, offset, { name, name ? strlen(name) : 0 } };
ssize_t rc = syscall(SC_mmap, &params);
ptrdiff_t rc = syscall(SC_mmap, &params);
if (rc < 0 && -rc < EMAXERRNO) {
errno = -rc;
return MAP_FAILED;
@ -56,7 +56,7 @@ void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t
void* mremap(void* old_address, size_t old_size, size_t new_size, int flags)
{
Syscall::SC_mremap_params params { (uintptr_t)old_address, old_size, new_size, flags };
ssize_t rc = syscall(SC_mremap, &params);
ptrdiff_t rc = syscall(SC_mremap, &params);
if (rc < 0 && -rc < EMAXERRNO) {
errno = -rc;
return MAP_FAILED;
@ -95,7 +95,7 @@ int madvise(void* address, size_t size, int advice)
void* allocate_tls(size_t size)
{
int rc = syscall(SC_allocate_tls, size);
ptrdiff_t rc = syscall(SC_allocate_tls, size);
if (rc < 0 && -rc < EMAXERRNO) {
errno = -rc;
return MAP_FAILED;

View file

@ -132,7 +132,7 @@ hostent* gethostbyname(const char* name)
i32 message_id;
i32 name_length;
} request_header = {
sizeof(request_header) - sizeof(request_header.message_size) + name_length,
(u32)(sizeof(request_header) - sizeof(request_header.message_size) + name_length),
lookup_server_endpoint_magic,
1,
(i32)name_length,

View file

@ -512,61 +512,61 @@ extern "C" int vsscanf(const char* input, const char* format, va_list ap)
dbgln("Invalid conversion specifier {} in scanf!", (int)conversion_specifier);
VERIFY_NOT_REACHED();
case Decimal:
if (!read_element<int, ReadKind::Normal> {}(length_modifier, input_lexer, &ap))
if (!read_element<int, ReadKind::Normal> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case Integer:
if (!read_element<int, ReadKind::Infer> {}(length_modifier, input_lexer, &ap))
if (!read_element<int, ReadKind::Infer> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case Octal:
if (!read_element<unsigned, ReadKind::Octal> {}(length_modifier, input_lexer, &ap))
if (!read_element<unsigned, ReadKind::Octal> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case Unsigned:
if (!read_element<unsigned, ReadKind::Normal> {}(length_modifier, input_lexer, &ap))
if (!read_element<unsigned, ReadKind::Normal> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case Hex:
if (!read_element<unsigned, ReadKind::Hex> {}(length_modifier, input_lexer, &ap))
if (!read_element<unsigned, ReadKind::Hex> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case Floating:
if (!read_element<float, ReadKind::Normal> {}(length_modifier, input_lexer, &ap))
if (!read_element<float, ReadKind::Normal> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case String:
if (!read_element<char*, ReadKind::Normal> {}(length_modifier, input_lexer, &ap))
if (!read_element<char*, ReadKind::Normal> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case UseScanList:
if (!read_element<char*, ReadKind::Normal> { scanlist, invert_scanlist }(length_modifier, input_lexer, &ap))
if (!read_element<char*, ReadKind::Normal> { scanlist, invert_scanlist }(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case Character:
if (!read_element<char, ReadKind::Normal> {}(length_modifier, input_lexer, &ap))
if (!read_element<char, ReadKind::Normal> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;
break;
case Pointer:
if (!read_element<void*, ReadKind::Normal> {}(length_modifier, input_lexer, &ap))
if (!read_element<void*, ReadKind::Normal> {}(length_modifier, input_lexer, (va_list*)&ap))
format_lexer.consume_all();
else
++elements_matched;

View file

@ -73,7 +73,7 @@ int futex(uint32_t* userspace_address, int futex_op, uint32_t value, const struc
.userspace_address = userspace_address,
.futex_op = futex_op,
.val = value,
.val2 = (uint32_t)timeout,
.val2 = (FlatPtr)timeout,
.userspace_address2 = userspace_address2,
.val3 = value3
};