From patchwork Fri Nov 4 19:01:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 59955 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB31C3858032 for ; Fri, 4 Nov 2022 19:01:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB31C3858032 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667588513; bh=buS1lWL805YydjDHYqz8twFaFsmIee4PaudAdu3a/a0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Ivx4deSmnbhYupmf+reApmUyZWSPCPoxfWvEMGY+zT17we2Luo3RnI3B1UDLaYQmz C8blK4iyGqldFHiYDB2xqjdW5hpGpJgcrwWe1QyJ+A5bhOtfCXxT8sky69tQJik+j9 7JlYLPbwtBr5GUpeiL1Byn+7DrQXO9qL8s7IRWWc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id DFDF43858423 for ; Fri, 4 Nov 2022 19:01:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DFDF43858423 Received: by mail-oi1-x232.google.com with SMTP id m204so6113987oib.6 for ; Fri, 04 Nov 2022 12:01:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=buS1lWL805YydjDHYqz8twFaFsmIee4PaudAdu3a/a0=; b=UVsCH/IgFzA9HZZR3A5jLrgpqt/EMov56XE2ZVLXes8HtkaExHWwbTTqyr2jBNsr9C mZ+lUX3UCfvAJEKzCo5mshBrAmKOgdHUNbs8yJzUDXZezYVUTgRjOhLtHYj6FpfKBmQ1 Zp2nIuM3czjAnOEjzMCDLEGadpYza4caPjI4/SL3/SSYR6F8pDA1Ld8FRmIJ2M5gF5LG Aehd4RD8taUN0Ia3US3eCDGKaVK1kJZ8DdWkCzg9dQaKkSVhB7amxJy89wSHtusepUxv HITOJDkMmNYZkhGcQCi8d7IoSQnY2qd9yECB6sRKgXm8pp7u2akjRA3v3MklLJGK6j2/ AwDQ== X-Gm-Message-State: ACrzQf1U1ACE4dzS2fj0ng8Brvc9WkEWYSEIMZuNHRPDkSnJD5SCLF69 6SE6/TvQl4Uj0m6uxcR+PgP4JxRCyOziXDpg X-Google-Smtp-Source: AMsMyM4SXA5CsYu4WOV7Xc/fyKpNWTFYV5TbVgKEgUQQPIt8gr0OTZnoxukBGae2dQxx+m91eCXPEA== X-Received: by 2002:aca:b546:0:b0:35a:51fc:20fb with SMTP id e67-20020acab546000000b0035a51fc20fbmr4822819oif.85.1667588480062; Fri, 04 Nov 2022 12:01:20 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:a9f4:f725:94bd:4cc1:1762]) by smtp.gmail.com with ESMTPSA id 24-20020aca1018000000b0035763a9a36csm1764713oiq.44.2022.11.04.12.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 12:01:19 -0700 (PDT) To: libc-alpha@sourceware.org, Szabolcs Nagy , "H . J . Lu" Subject: [PATCH v2 02/11] linux: Extend internal clone3 documentation Date: Fri, 4 Nov 2022 16:01:03 -0300 Message-Id: <20221104190112.2566409-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221104190112.2566409-1-adhemerval.zanella@linaro.org> References: <20221104190112.2566409-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Cc: Christian Brauner Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Different than kernel, clone3 returns EINVAL for NULL struct clone_args or function pointer. This is similar to clone interface that return EINVAL for NULL function argument. It also clean up the Linux clone3.h interface, since it not currently exported. Checked on x86_64-linux-gnu. Reviewed-by: Szabolcs Nagy --- include/clone_internal.h | 24 +++++++++++++++++++----- sysdeps/unix/sysv/linux/clone3.h | 10 +--------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/include/clone_internal.h b/include/clone_internal.h index 4b23ef33ce..73b8114df4 100644 --- a/include/clone_internal.h +++ b/include/clone_internal.h @@ -1,10 +1,24 @@ -#ifndef _CLONE3_H -#include_next +#ifndef _CLONE_INTERNAL_H +#define _CLONE_INTERNAL_H -extern __typeof (clone3) __clone3; +#include -/* The internal wrapper of clone/clone2 and clone3. If __clone3 returns - -1 with ENOSYS, fall back to clone or clone2. */ +/* The clone3 syscall provides a superset of the functionality of the clone + interface. The kernel might extend __CL_ARGS struct in the future, with + each version with a diffent __SIZE. If the child is created, it will + start __FUNC function with __ARG arguments. + + Different than kernel, the implementation also returns EINVAL for an + invalid NULL __CL_ARGS or __FUNC (similar to __clone). + + This function is only implemented if the ABI defines HAVE_CLONE3_WRAPPER. +*/ +extern int __clone3 (struct clone_args *__cl_args, size_t __size, + int (*__func) (void *__arg), void *__arg); + +/* The internal wrapper of clone/clone2 and clone3. Different than __clone3, + it will align the stack if required. If __clone3 returns -1 with ENOSYS, + fall back to clone or clone2. */ extern int __clone_internal (struct clone_args *__cl_args, int (*__func) (void *__arg), void *__arg); diff --git a/sysdeps/unix/sysv/linux/clone3.h b/sysdeps/unix/sysv/linux/clone3.h index 889014a6a9..7c7e2cdcb0 100644 --- a/sysdeps/unix/sysv/linux/clone3.h +++ b/sysdeps/unix/sysv/linux/clone3.h @@ -1,4 +1,4 @@ -/* The wrapper of clone3. +/* The clone3 kernel interface definitions. Copyright (C) 2021-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -23,8 +23,6 @@ #include #include -__BEGIN_DECLS - /* The unsigned 64-bit and 8-byte aligned integer type. */ typedef __U64_TYPE __aligned_uint64_t __attribute__ ((__aligned__ (8))); @@ -58,10 +56,4 @@ struct clone_args __aligned_uint64_t cgroup; }; -/* The wrapper of clone3. */ -extern int clone3 (struct clone_args *__cl_args, size_t __size, - int (*__func) (void *__arg), void *__arg); - -__END_DECLS - #endif /* clone3.h */