From patchwork Thu Jan 12 13:58:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 63098 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 24B5A38543AC for ; Thu, 12 Jan 2023 14:00:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24B5A38543AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673532004; bh=ArS7Htt9pTHonptfMMtTrkvyIo6TsDzG6pfd/mCygog=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=C600YC1T8XX8ukfvpK/NP4knyqZ2fSo4Ph/ufZjTE6fM9QcSS2//nTawX+OSZmcdz Jw91jlBZ8k1gAUA/dxF0ebrY88j3syGl1hpTFVdfHhqlhr9VM46TIPC3Ej/46xDCLy /bCF34KCmqVpkvTFEzFlw0uqbVXMFEYBYryuwBKs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by sourceware.org (Postfix) with ESMTPS id BAD363854387 for ; Thu, 12 Jan 2023 13:59:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAD363854387 Received: by mail-oo1-xc29.google.com with SMTP id m23-20020a4abc97000000b004bfe105c580so4829502oop.4 for ; Thu, 12 Jan 2023 05:59:02 -0800 (PST) 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ArS7Htt9pTHonptfMMtTrkvyIo6TsDzG6pfd/mCygog=; b=e9frZPb0g5GquKayVE/QJxfOXA+f7rLBhiBHecCcrMQargTWWAmsqCiwlN2gFxmADL r5xP3d1lDCQk2D6vK/aONjdzmBK5yNXH+Xs56UOR2BLO+F8BnM7OrgrgBqoKF356FeY9 K2Z3b/GHYw7vHOtjJVWh86sLL1CUgNx+NJKTZtOR41OxkKp7mj+5lExmQX1AWKpYkyt5 lQCfEGFEzA/ngqq3cidqJVSzve0oFP9dYeLGEkgX1YIuXaZD8/BirUue+cKI/5357MPj gUApAIMXPIN1VGZQ1oxCDesRD28qj9rDfHLzXjI0DyPL+CQIt9R91zCbDsRlzPg6sl8l /ZtQ== X-Gm-Message-State: AFqh2kqy8bC9Ht/KFkZ+33Q8WMlHZiCab0xmlQu/fYU7jx/yHnrBKWMd u2vk5CTTyR04MX6R46+XiRUOssMFmtYdzzOm0lI= X-Google-Smtp-Source: AMrXdXuFqpxQOl8UNdZVGlF3RVDI//1QiwESPVHAglNg2vOmtUmbXL5RCTMDlkeWBPKW7lG1GJhMGg== X-Received: by 2002:a4a:8883:0:b0:4f2:58d:693f with SMTP id j3-20020a4a8883000000b004f2058d693fmr2681728ooa.1.1673531941435; Thu, 12 Jan 2023 05:59:01 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c0:a93a:bf1c:dea8:4fd2:4310]) by smtp.gmail.com with ESMTPSA id m26-20020a4abc9a000000b004a0aac2d28fsm8335402oop.35.2023.01.12.05.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 05:59:00 -0800 (PST) To: libc-alpha@sourceware.org, Carlos O'Donell Subject: [PATCH v4 2/6] linux: Extend internal clone3 documentation Date: Thu, 12 Jan 2023 10:58:49 -0300 Message-Id: <20230112135853.3786675-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112135853.3786675-1-adhemerval.zanella@linaro.org> References: <20230112135853.3786675-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 Netto Reply-To: Adhemerval Zanella 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: Carlos O'Donell --- 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 42055ea981..e4d642e521 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-2023 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 */