linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] restart_syscall.2: SYNOPSIS: Fix restart_syscall() return type
@ 2020-11-23 20:34 Alejandro Colomar
  2020-11-23 21:53 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Colomar @ 2020-11-23 20:34 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, linux-kernel, libc-alpha

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

$ grep -rn 'SYSCALL_DEFINE.*(restart_syscall'
kernel/signal.c:2891:SYSCALL_DEFINE0(restart_syscall)

$ sed -n 2891,2895p kernel/signal.c
SYSCALL_DEFINE0(restart_syscall)
{
	struct restart_block *restart = &current->restart_block;
	return restart->fn(restart);
}

$ grep -rn 'struct restart_block {'
include/linux/restart_block.h:25:struct restart_block {

$ sed -n 25,56p include/linux/restart_block.h
struct restart_block {
	long (*fn)(struct restart_block *);
	union {
		/* For futex_wait and futex_wait_requeue_pi */
		struct {
			u32 __user *uaddr;
			u32 val;
			u32 flags;
			u32 bitset;
			u64 time;
			u32 __user *uaddr2;
		} futex;
		/* For nanosleep */
		struct {
			clockid_t clockid;
			enum timespec_type type;
			union {
				struct __kernel_timespec __user *rmtp;
				struct old_timespec32 __user *compat_rmtp;
			};
			u64 expires;
		} nanosleep;
		/* For poll */
		struct {
			struct pollfd __user *ufds;
			int nfds;
			int has_timeout;
			unsigned long tv_sec;
			unsigned long tv_nsec;
		} poll;
	};
};

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man2/restart_syscall.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man2/restart_syscall.2 b/man2/restart_syscall.2
index e7d96bd4d..21cc2df1d 100644
--- a/man2/restart_syscall.2
+++ b/man2/restart_syscall.2
@@ -34,7 +34,7 @@
 .SH NAME
 restart_syscall \- restart a system call after interruption by a stop signal
 .SH SYNOPSIS
-.B int restart_syscall(void);
+.B long restart_syscall(void);
 .PP
 .IR Note :
 There is no glibc wrapper for this system call; see NOTES.
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] restart_syscall.2: SYNOPSIS: Fix restart_syscall() return type
  2020-11-23 20:34 [PATCH] restart_syscall.2: SYNOPSIS: Fix restart_syscall() return type Alejandro Colomar
@ 2020-11-23 21:53 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-11-23 21:53 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: mtk.manpages, linux-man, linux-kernel, libc-alpha

Hi Alex,

On 11/23/20 9:34 PM, Alejandro Colomar wrote:
> The Linux kernel uses 'long' instead of 'int' for the return type.
> As glibc provides no wrapper, use the same types the kernel uses.
> 
> $ grep -rn 'SYSCALL_DEFINE.*(restart_syscall'
> kernel/signal.c:2891:SYSCALL_DEFINE0(restart_syscall)
> 
> $ sed -n 2891,2895p kernel/signal.c
> SYSCALL_DEFINE0(restart_syscall)
> {
> 	struct restart_block *restart = &current->restart_block;
> 	return restart->fn(restart);
> }
> 
> $ grep -rn 'struct restart_block {'
> include/linux/restart_block.h:25:struct restart_block {
> 
> $ sed -n 25,56p include/linux/restart_block.h
> struct restart_block {
> 	long (*fn)(struct restart_block *);
> 	union {
> 		/* For futex_wait and futex_wait_requeue_pi */
> 		struct {
> 			u32 __user *uaddr;
> 			u32 val;
> 			u32 flags;
> 			u32 bitset;
> 			u64 time;
> 			u32 __user *uaddr2;
> 		} futex;
> 		/* For nanosleep */
> 		struct {
> 			clockid_t clockid;
> 			enum timespec_type type;
> 			union {
> 				struct __kernel_timespec __user *rmtp;
> 				struct old_timespec32 __user *compat_rmtp;
> 			};
> 			u64 expires;
> 		} nanosleep;
> 		/* For poll */
> 		struct {
> 			struct pollfd __user *ufds;
> 			int nfds;
> 			int has_timeout;
> 			unsigned long tv_sec;
> 			unsigned long tv_nsec;
> 		} poll;
> 	};
> };
> 
> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

Thanks! Patch applied.

Cheers,

Michael

> ---
>  man2/restart_syscall.2 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man2/restart_syscall.2 b/man2/restart_syscall.2
> index e7d96bd4d..21cc2df1d 100644
> --- a/man2/restart_syscall.2
> +++ b/man2/restart_syscall.2
> @@ -34,7 +34,7 @@
>  .SH NAME
>  restart_syscall \- restart a system call after interruption by a stop signal
>  .SH SYNOPSIS
> -.B int restart_syscall(void);
> +.B long restart_syscall(void);
>  .PP
>  .IR Note :
>  There is no glibc wrapper for this system call; see NOTES.
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-23 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 20:34 [PATCH] restart_syscall.2: SYNOPSIS: Fix restart_syscall() return type Alejandro Colomar
2020-11-23 21:53 ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).