lkml.org 
[lkml]   [2023]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 1/4] tools/nolibc: sys.h: add __syscall() and __sysret() helpers
Date
From: Zhangjin Wu
> Sent: 06 June 2023 09:10
>
> most of the library routines share the same code model, let's add two
> helpers to simplify the coding and shrink the code lines too.
>
...
> +/* Syscall return helper, set errno as -ret when ret < 0 */
> +static inline __attribute__((always_inline)) long __sysret(long ret)
> +{
> + if (ret < 0) {
> + SET_ERRNO(-ret);
> + ret = -1;
> + }
> + return ret;
> +}

If that right?
I thought that that only the first few (1024?) negative values
got used as errno values.

Do all Linux architectures even use negatives for error?
I thought at least some used the carry flag.
(It is the historic method of indicating a system call failure.)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2023-06-08 16:38    [W:0.231 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site