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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Florian Weimer <fweimer@xxxxxxxxxx>, 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



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux