Hacker News new | past | comments | ask | show | jobs | submit login

We don't have that compatibility. Even BSDs and GNU/Linux on x86 have completely different calling conventions (ordinary C ABI vs registers + ptr to memory).

Edit: also Linux is made with completely moronic way to return errors (it uses some negative values as errors).




Using the high bit to indicate an error result isn't unknown on other OSes either - see NTSTATUS on Windows, and HRESULT in COM.


This has nothing to do neither with high bit nor with NTSTATUS. For Linux, some values are errors, all others are normal results. lseek cannot return large value for example. At all.


Please explain better ways for a syscall to return an error that negative status, and explain how OS other than Linux get it right.


Its Linux so you don't even need to look at a different OS. Each architecture is different. PowerPC returns the return value and error code in different registers which is very clean.


By setting cpu flag for example. Pretty standard way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: