Hi Florian,
On 4/21/21 7:41 AM, Florian Weimer wrote:
* Alejandro Colomar:
Or, more succinctly, put the types in comments:
syscall(SYS_arch_prctl, /* int */ code, /* unsigned long */ addr);
I'm not sure. I see the point in doing this, but I think I prefer my
version, because it has less noise. But I might be a bit biased :)
Not everyone is deeply familiar with C syntax. Anyone who uses the
example literally will be disappointed.
I've been thinking about this for some days. Although this syntax has
become very familiar to me with time, I agree that the first times I saw
it, it looked somewhat weird. Each of the three variants (yours,
Jakub's, and mine (which is actually not mine, but one already present
in some pages)) has some good advantages and some disadvantages.
But the manual pages have been using the syntax I proposed, for those
cases where a constant is to be used always, so in doubt, as I'm right
now, I'll opt for that one.
Also, those system calls without a wrapper are probably rare enough so
that people that need them probably know enough of C to understand the
syntax. I, for example, first had to use one of those, membarrier(2),
after around 7 years of C programming. I remember being surprised by
not having the prototype and having to declare it myself (the SYNOPSIS
was a bit buggy by that time). But by completely reading the page and
especially the EXAMPLES section, I think one can learn how to use it.
Reading syscall(2) also helps.
I'll keep my proposed syntax.
Nevertheless, thanks for suggesting alternatives, and giving your
reasons. I'll keep thinking about it and see if I come with something
better.
Thanks,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
Senior SW Engineer; http://www.alejandro-colomar.es/