diff --git a/include/sys/syscall.h b/include/sys/syscall.h index c86135a3a12d364ea941cdc3c5240e0a4970742b..901941aa4688e781d56fbff8c00aecc56230e92a 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -4,7 +4,7 @@ extern "C" { #endif -long __syscall_ret(long); +long __syscall_ret(unsigned long); long __syscall(long, ...); long syscall(long, ...); diff --git a/include/time.h b/include/time.h index 5b1ea91fed3d6d21283937e7a17dcd0eda2d2309..557c8f4b6deab8fb3b32fb121272f7ee88bcc5a8 100644 --- a/include/time.h +++ b/include/time.h @@ -85,7 +85,6 @@ int clock_settime (clockid_t, const struct timespec *); int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *); int clock_getcpuclockid (pid_t, clockid_t *); -/* FIXME..?? */ struct sigevent; int timer_create (clockid_t, struct sigevent *, timer_t *); int timer_delete (timer_t); diff --git a/src/internal/syscall_ret.c b/src/internal/syscall_ret.c index 4f159e0b528fd05eb6cde5ae6ec688d667b20e51..e4a1bdbe03f3cd0c1c64c355fcf0fc2ad592c0ba 100644 --- a/src/internal/syscall_ret.c +++ b/src/internal/syscall_ret.c @@ -3,9 +3,9 @@ long __syscall_ret(unsigned long r) { - if (r >= (unsigned long)-1 - 4096) { - errno = -(long)r; + if (r > -4096UL) { + errno = -r; return -1; } - return (long)r; + return r; } diff --git a/src/linux/sbrk.c b/src/linux/sbrk.c index 5fab74be29c83d729c5718d13f5106a1cd9be41d..36437653bb9085b02908f402403e59cee7bd637c 100644 --- a/src/linux/sbrk.c +++ b/src/linux/sbrk.c @@ -1,7 +1,7 @@ -#include +#include #include "syscall.h" -void *sbrk(ptrdiff_t inc) +void *sbrk(intptr_t inc) { unsigned long cur = syscall(SYS_brk, 0); if (inc && syscall(SYS_brk, cur+inc) != cur+inc) return (void *)-1; diff --git a/src/time/__asctime.c b/src/time/__asctime.c index d31f63477a5591127e4311505800bfe7a4c4e604..7cc4f503ffc2c5662f8779d2f8c1e992726c1267 100644 --- a/src/time/__asctime.c +++ b/src/time/__asctime.c @@ -1,6 +1,7 @@ #include #include #include +#include "atomic.h" const char *__langinfo(nl_item); @@ -21,7 +22,7 @@ char *__asctime(const struct tm *tm, char *buf) * application developers that they may not be so lucky * on other implementations (e.g. stack smashing..). */ - *(volatile int*)0 = 0; + a_crash(); } return buf; } diff --git a/src/unistd/setpgid.c b/src/unistd/setpgid.c index 4a5a3d6b3797cea7e24e2e45b484f7b464f417d6..061606951d4f170ad9bf80b31ee3414a12c64bac 100644 --- a/src/unistd/setpgid.c +++ b/src/unistd/setpgid.c @@ -1,7 +1,7 @@ #include #include "syscall.h" -pid_t setpgid(pid_t pid, pid_t pgid) +int setpgid(pid_t pid, pid_t pgid) { return syscall(SYS_setpgid, pid, pgid); }