lkml.org 
[lkml]   [2022]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 27/42] tools/nolibc/sys: make getpgrp(), getpid(), gettid() not set errno
    Date
    These syscalls never fail so there is no need to extract and set errno
    for them.

    Signed-off-by: Willy Tarreau <w@1wt.eu>
    ---
    tools/include/nolibc/sys.h | 24 +++---------------------
    1 file changed, 3 insertions(+), 21 deletions(-)

    diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
    index 539af457a91b..ef017cc0a580 100644
    --- a/tools/include/nolibc/sys.h
    +++ b/tools/include/nolibc/sys.h
    @@ -458,13 +458,7 @@ pid_t sys_getpgrp(void)
    static __attribute__((unused))
    pid_t getpgrp(void)
    {
    - pid_t ret = sys_getpgrp();
    -
    - if (ret < 0) {
    - SET_ERRNO(-ret);
    - ret = -1;
    - }
    - return ret;
    + return sys_getpgrp();
    }


    @@ -481,13 +475,7 @@ pid_t sys_getpid(void)
    static __attribute__((unused))
    pid_t getpid(void)
    {
    - pid_t ret = sys_getpid();
    -
    - if (ret < 0) {
    - SET_ERRNO(-ret);
    - ret = -1;
    - }
    - return ret;
    + return sys_getpid();
    }


    @@ -504,13 +492,7 @@ pid_t sys_gettid(void)
    static __attribute__((unused))
    pid_t gettid(void)
    {
    - pid_t ret = sys_gettid();
    -
    - if (ret < 0) {
    - SET_ERRNO(-ret);
    - ret = -1;
    - }
    - return ret;
    + return sys_gettid();
    }


    --
    2.35.1
    \
     
     \ /
      Last update: 2022-02-07 17:49    [W:4.377 / U:0.836 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site