Skip to contentSkip to conversation

set_tid_address.2: SYNOPSIS: Fix set_tid_address() return type

PATCH In review Alejandro Colomar 2 participants 2 messages Nov 23, 2020 – Nov 24, 2020 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 set_tid_address.2: SYNOPSIS: Fix set_tid_address() return type

The Linux kernel uses 'pid_t' instead of 'long' for the return type. As glibc provides no wrapper, use the same types the kernel uses.

$ sed -n 34,36p man-pages/man2/set_tid_address.2
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
$ grep -rn 'SYSCALL_DEFINE.*set_tid_address' linux/
linux/kernel/fork.c:1632:
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
$ sed -n 1632,1638p linux/kernel/fork.c
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
{
	current->clear_child_tid = tidptr;
	return task_pid_vnr(current);
}
$ grep -rn 'task_pid_vnr(struct' linux/
linux/include/linux/sched.h:1374:
static inline pid_t task_pid_vnr(struct task_struct *tsk)
---
 man2/set_tid_address.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man2/set_tid_address.2 +1 -1
index 380efcdd8..b18b8efef 100644
@@ -29,7 +29,7 @@ set_tid_address \- set pointer to thread ID
 .nf
 .B #include <linux/unistd.h>
 .PP
-.BI "long set_tid_address(int *" tidptr );
+.BI "pid_t set_tid_address(int *" tidptr );
 .fi
 .PP
 .IR Note :
Signature · 1 line
2.29.2
#1 lore raw

Hi Alex,

Quoted 17 lines · Alejandro Colomar

The Linux kernel uses 'pid_t' instead of 'long' for the return type. As glibc provides no wrapper, use the same types the kernel uses.

$ sed -n 34,36p man-pages/man2/set_tid_address.2
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
$ grep -rn 'SYSCALL_DEFINE.*set_tid_address' linux/
linux/kernel/fork.c:1632:
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
$ sed -n 1632,1638p linux/kernel/fork.c
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
{
	current->clear_child_tid = tidptr;
Quoted 8 lines
	return task_pid_vnr(current);
}
$ grep -rn 'task_pid_vnr(struct' linux/
linux/include/linux/sched.h:1374:
static inline pid_t task_pid_vnr(struct task_struct *tsk)

Thanks! Patch applied.

Cheers,

Michael

Quoted 18 lines
---
 man2/set_tid_address.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man2/set_tid_address.2 +1 -1
index 380efcdd8..b18b8efef 100644
@@ -29,7 +29,7 @@ set_tid_address \- set pointer to thread ID
 .nf
 .B #include <linux/unistd.h>
 .PP
-.BI "long set_tid_address(int *" tidptr );
+.BI "pid_t set_tid_address(int *" tidptr );
 .fi
 .PP
 .IR Note :
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/