From 0117c4fbc79e5212378257dda24362a5d0b6f965 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 29 Dec 2013 22:51:52 +0100 Subject: [PATCH] Improve ix86 and x86_64 data types ABI. Increase gid_t to an unsigned 64-bit integer. Increase id_t to an unsigned 64-bit integer. Increase pid_t to a signed 64-bit integer. Increase time_t to a signed 64-bit integer. Increase uid_t to an unsigned 64-bit integer. Note: This is an incompatible ABI change. --- kernel/descriptor.cpp | 1 - kernel/include/sortix/__/types.h | 10 +++++----- libc/x64/fork.S | 4 ++-- libc/x86/fork.S | 8 ++++---- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/kernel/descriptor.cpp b/kernel/descriptor.cpp index deb95903..99e05592 100644 --- a/kernel/descriptor.cpp +++ b/kernel/descriptor.cpp @@ -177,7 +177,6 @@ int Descriptor::chmod(ioctx_t* ctx, mode_t mode) int Descriptor::chown(ioctx_t* ctx, uid_t owner, gid_t group) { - if ( owner < 0 || group < 0 ) { errno = EINVAL; return -1; } return vnode->chown(ctx, owner, group); } diff --git a/kernel/include/sortix/__/types.h b/kernel/include/sortix/__/types.h index bd94fb89..d74d1487 100644 --- a/kernel/include/sortix/__/types.h +++ b/kernel/include/sortix/__/types.h @@ -46,9 +46,9 @@ typedef __uintptr_t __dev_t; /* TODO: __fsblksize_t */ -typedef int __gid_t; +typedef __uint64_t __gid_t; -typedef int __id_t; +typedef __uint64_t __id_t; typedef __uintmax_t __ino_t; @@ -62,7 +62,7 @@ typedef __intmax_t __off_t; #define __OFF_MIN __INTMAX_MIN #define __OFF_MAX __INTMAX_MAX -typedef int __pid_t; +typedef __intptr_t __pid_t; /* TODO: __size_t */ @@ -72,13 +72,13 @@ typedef __SSIZE_TYPE__ __ssize_t; typedef long __suseconds_t; -typedef long __time_t; +typedef __int64_t __time_t; typedef __uintptr_t __timer_t; /* TODO: trace*_t */ -typedef int __uid_t; +typedef __uint64_t __uid_t; typedef unsigned int __useconds_t; diff --git a/libc/x64/fork.S b/libc/x64/fork.S index 7933c79b..42c36271 100644 --- a/libc/x64/fork.S +++ b/libc/x64/fork.S @@ -51,14 +51,14 @@ __call_tfork_with_regs: pushq %rcx pushq %rbx pushq $0 # rax, result of sfork is 0 for the child. - pushq $after_fork # rip, child will start execution from here. + pushq $.Lafter_fork # rip, child will start execution from here. # Call tfork with a nice pointer to our structure. Note that %rdi contains # the flag parameter that this function accepted. movq %rsp, %rsi call tfork -after_fork: +.Lafter_fork: # The value in %rax determines whether we are child or parent. There is no # need to clean up the stack from the above pushes, leaveq sets %rsp to %rbp # which does that for us. diff --git a/libc/x86/fork.S b/libc/x86/fork.S index e3ba4af6..7cc7aa62 100644 --- a/libc/x86/fork.S +++ b/libc/x86/fork.S @@ -44,8 +44,8 @@ __call_tfork_with_regs: pushl %edx pushl %ecx pushl %ebx - pushl $0 # rax, result of sfork is 0 for the child. - pushl $after_fork # rip, child will start execution from here. + pushl $0 # eax, result of sfork (0 for the child). + pushl $.Lafter_fork # rip, child will start execution from here. # Call tfork with a nice pointer to our structure. Note that %edi contains # the flag parameter that this function accepted. @@ -53,8 +53,8 @@ __call_tfork_with_regs: pushl %edx call tfork -after_fork: - # The value in %eax determines whether we are child or parent. There is no +.Lafter_fork: + # The value in %eax: determines whether we are child or parent. There is no # need to clean up the stack from the above pushes, leavel sets %esp to %ebp # which does that for us. leavel