lkml.org 
[lkml]   [2023]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 4/4] tools/nolibc: sys.h: apply __syscall() helper
Date
From: Zhangjin Wu
> Sent: 07 June 2023 06:39
...
> As a summary, will use 'sysret()' and something like:
>
> static __attribute__((unused))
> int chdir(const char *path)
> {
> return sysret(chdir(path));
> }
>
> to renew the syscall helper patchset, Thanks you very much.

While I'm all for using 'cpp-magic' to abstract and (hopefully)
simplify things. Token-pasting the sys_ here doesn't seem to gain
anything.
Anyone grepping the code for 'sys_chdir' is also going to
wonder where it is used.

There might be scope for something like:
#define syscall_wrapper(func, type) \
static __attribute__((unused)) \
int func(type *arg) \
{ \
return sysret(sys_#func(arg)); \
}
and then:
syscall_wrapper(chdir, const char *)
would expand to the code above.

I think you'd need separate defines for each number of arguments.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

\
 
 \ /
  Last update: 2023-06-10 18:35    [W:0.065 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site