Skip to contentSkip to conversation

document clone3 and struct clone_args

PATCH New Christian Brauner 1 participant 3 messages Oct 1, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover document clone3 and struct clone_args

Hey,

This adds missing kernel-docs for the clone3() syscall and its argument struct clone_args. I somehow failed to add this right away.

I intend to include this in my rc2 pull request.

Thanks!
Christian

Christian Brauner (2):
fork: add kernel-doc for clone3
sched: add kernel-doc for struct clone_args

 include/uapi/linux/sched.h | 26 ++++++++++++++++++++++++--
 kernel/fork.c              | 11 +++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/2 fork: add kernel-doc for clone3

Add kernel-doc for the clone3() syscall.

---
 kernel/fork.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
kernel/fork.c +11 -0
index 5a0fd518e04e..c819cce9bdd0 100644
@@ -2590,6 +2590,17 @@ static bool clone3_args_valid(const struct kernel_clone_args *kargs)
 	return true;
 }
 
+/**
+ * clone3 - create a new process with specific properties
+ * @uargs: argument structure
+ * @size:  size of @uargs
+ *
+ * clone3() is the extensible successor to clone()/clone2().
+ * It takes a struct as argument that is versioned by its size.
+ *
+ * Return: On success, a positive PID for the child process.
+ *         On error, a negative errno number.
+ */
 SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size)
 {
 	int err;
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/2 sched: add kernel-doc for struct clone_args

In reply to Christian Brauner

Add kernel-doc for struct clone_args for the clone3() syscall.

---
 include/uapi/linux/sched.h | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
include/uapi/linux/sched.h +24 -2
index 851ff1feadd5..3d8f03bfd428 100644
@@ -34,8 +34,30 @@
 #define CLONE_IO		0x80000000	/* Clone io context */
 
 #ifndef __ASSEMBLY__
-/*
- * Arguments for the clone3 syscall
+/**
+ * struct clone_args - arguments for the clone3 syscall
+ * @flags:       Flags for the new process as listed above.
+ *               All flags are valid except for CSIGNAL and
+ *               CLONE_DETACHED.
+ * @pidfd:       If CLONE_PIDFD is set, a pidfd will be
+ *               returned in this argument.
+ * @child_tid:   If CLONE_CHILD_SETTID is set, the TID of the
+ *               child process will be returned in the child's
+ *               memory.
+ * @parent_tid:  If CLONE_PARENT_SETTID is set, the TID of
+ *               the child process will be returned in the
+ *               parent's memory.
+ * @exit_signal: The exit_signal the parent process will be
+ *               sent when the child exits.
+ * @stack:       Specify the location of the stack for the
+ *               child process.
+ * @stack_size:  The size of the stack for the child process.
+ * @tls:         If CLONE_SETTLS is set, the tls descriptor
+ *               is set to tls.
+ *
+ * The structure is versioned by size and thus extensible.
+ * New struct members must go at the end of the struct and
+ * must be properly 64bit aligned.
  */
 struct clone_args {
 	__aligned_u64 flags;
Signature · 1 line
2.23.0