[PATCH v5 00/35] SYNOPSIS: Use syscall(SYS_...); and fix '#include's

Jakub Wilk jwilk@jwilk.net
Mon Apr 12 06:39:09 GMT 2021


* Florian Weimer <fweimer@redhat.com>, 2021-04-12, 08:17:
>>    SYNOPSIS
>>        #include <asm/prctl.h>        /* Definition of ARCH_* constants */
>>        #include <sys/syscall.h>      /* Definition of SYS_* constants */
>>        #include <unistd.h>
>>
>>        int syscall(SYS_arch_prctl, int code, unsigned long addr);
>>        int syscall(SYS_arch_prctl, int code, unsigned long *addr);
>>
>>        Note: glibc provides no wrapper for arch_prctl(), necessitating
>>        the use of syscall(2).
>>
>> Without something like this, the reader may be puzzled at the use of
>> syscall().
>>
>> What do you think?
>
>Would it be possible to use real C syntax?

Seconded.

>  int code;
>  unsigned long addr;
>  int result;
>  result = syscall (SYS_arch_prctl, code, addr);
>  result = syscall (SYS_arch_prctl, code, &addr);
>
>Or perhaps omit the result variable:
>
>  int code;
>  unsigned long addr;
>  syscall (SYS_arch_prctl, code, addr);

Or, more succinctly, put the types in comments:

   syscall(SYS_arch_prctl, /* int */ code, /* unsigned long */ addr);

-- 
Jakub Wilk


More information about the Libc-alpha mailing list