Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kernel-doc: fix syscall wrapper processing

Fix kernel-doc processing of SYSCALL wrappers.

The SYSCALL wrapper patches played havoc with kernel-doc for
syscalls. Syscalls that were scanned for DocBook processing
reported warnings like this one, for sys_tgkill:

Warning(kernel/signal.c:2285): No description found for parameter 'tgkill'
Warning(kernel/signal.c:2285): No description found for parameter 'pid_t'
Warning(kernel/signal.c:2285): No description found for parameter 'int'

because the macro parameters all "look like" function parameters,
although they are not:

/**
* sys_tgkill - send signal to one specific thread
* @tgid: the thread group ID of the thread
* @pid: the PID of the thread
* @sig: signal to be sent
*
* This syscall also checks the @tgid and returns -ESRCH even if the PID
* exists but it's not belonging to the target process anymore. This
* method solves the problem of threads exiting and PIDs getting reused.
*/
SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig)
{
...

This patch special-cases the handling SYSCALL_DEFINE* function
prototypes by expanding them to
long sys_foobar(type1 arg1, type1 arg2, ...)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Randy Dunlap and committed by
Linus Torvalds
b4870bc5 f40b45a2

+39 -1
+39 -1
scripts/kernel-doc
··· 1827 1827 $state = 0; 1828 1828 } 1829 1829 1830 + sub syscall_munge() { 1831 + my $void = 0; 1832 + 1833 + $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs 1834 + ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { 1835 + if ($prototype =~ m/SYSCALL_DEFINE0/) { 1836 + $void = 1; 1837 + ## $prototype = "long sys_$1(void)"; 1838 + } 1839 + 1840 + $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name 1841 + if ($prototype =~ m/long (sys_.*?),/) { 1842 + $prototype =~ s/,/\(/; 1843 + } elsif ($void) { 1844 + $prototype =~ s/\)/\(void\)/; 1845 + } 1846 + 1847 + # now delete all of the odd-number commas in $prototype 1848 + # so that arg types & arg names don't have a comma between them 1849 + my $count = 0; 1850 + my $len = length($prototype); 1851 + if ($void) { 1852 + $len = 0; # skip the for-loop 1853 + } 1854 + for (my $ix = 0; $ix < $len; $ix++) { 1855 + if (substr($prototype, $ix, 1) eq ',') { 1856 + $count++; 1857 + if ($count % 2 == 1) { 1858 + substr($prototype, $ix, 1) = ' '; 1859 + } 1860 + } 1861 + } 1862 + } 1863 + 1830 1864 sub process_state3_function($$) { 1831 1865 my $x = shift; 1832 1866 my $file = shift; ··· 1873 1839 elsif ($x =~ /([^\{]*)/) { 1874 1840 $prototype .= $1; 1875 1841 } 1842 + 1876 1843 if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { 1877 1844 $prototype =~ s@/\*.*?\*/@@gos; # strip comments. 1878 1845 $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. 1879 1846 $prototype =~ s@^\s+@@gos; # strip leading spaces 1880 - dump_function($prototype,$file); 1847 + if ($prototype =~ /SYSCALL_DEFINE/) { 1848 + syscall_munge(); 1849 + } 1850 + dump_function($prototype, $file); 1881 1851 reset_state(); 1882 1852 } 1883 1853 }