Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp806429rdd; Tue, 9 Jan 2024 23:13:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4EWPQRB6PFJnR0XLswkLcgEiO2yT3n+OAYLqZyUo5/fZpMYltJEw7OyR+hAl23g95DF2B X-Received: by 2002:a05:6a00:c8c:b0:6d9:9984:66d9 with SMTP id a12-20020a056a000c8c00b006d9998466d9mr594346pfv.37.1704870786675; Tue, 09 Jan 2024 23:13:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704870786; cv=none; d=google.com; s=arc-20160816; b=zYgqhxdxSmqmeIaQwaLQfmbFCBU3Vl2+cRfDqmMa3M8mwCtZIr9/HFrW+snzx0nl40 DjzDqPYuoMqcHEFqbzm6/k40SxfRIuaJ3kkb7NuN8V+93BYIifMVdnRqWosWmtUb+YVi 2xJr5wWEMhEuhKH+2P6UZRY1o9TDtu8bCIKwB3bDjLD+0vvKQiRJiJ64P33u1g9XFg6h xLSY8z20e4Sc34K8i6RD/mJkxZvDGIDILpSDvhBVQ+Mxy5e3O8qWCR3pctB42NfYktY4 jSNkw+NGv7p9UPkZmxFga0F4Cx6yGk4JsVwfBCDGd4hyO/tuguBampnr2h7KqN4DFYtR 9QGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=KQoKDFOcEOVRbZgK8gCymZ+usJe8n8yoKm6aHtXRldo=; fh=Hl4Vgg1/izMUIy5pt/0TiUUe0cTCufrnuxTA+ifueIY=; b=dZ0mJeuvbugaXBaRTp+BvLisLeUiziuMTb4mf9jNPgyXvGx0bLxrqo6q7j9859pd2C 90z+rD1Ti/oR2VmJgcAaYn2I38sE6upZxXmhqM+S3i4GK0JLW3q7SSk7Lc7VzVgfwd8L kRy5WNo+aCw6J3ZPzBHFVgU0AD+d0CB8YEVAOVhcJqRXtugZLUfHVYnE5/KTxnPoh6dF S6h93smuFCD5LMA3H3dEe42WuEQcPB9sXKz/51GD+c/+02zcOZYcxenOJmhj98BkYs56 elp38IQcyjIcwSDTT2FAkyLFtSpzZZPz9B5tH15/Yz6Hyo16J7TaBAeM4Oy/TCI8VF7Q u+AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21769-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21769-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o22-20020a639216000000b005b95ccd1b4dsi3017515pgd.82.2024.01.09.23.13.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 23:13:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21769-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21769-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21769-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1907CB21815 for ; Wed, 10 Jan 2024 07:13:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B7B338DE8; Wed, 10 Jan 2024 07:12:51 +0000 (UTC) Received: from h3cspam02-ex.h3c.com (smtp.h3c.com [60.191.123.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE53639FEF; Wed, 10 Jan 2024 07:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=h3c.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=h3c.com Received: from mail.maildlp.com ([172.25.15.154]) by h3cspam02-ex.h3c.com with ESMTP id 40A7BA94013595; Wed, 10 Jan 2024 15:11:10 +0800 (GMT-8) (envelope-from hu.yadi@h3c.com) Received: from DAG6EX02-IMDC.srv.huawei-3com.com (unknown [10.62.14.11]) by mail.maildlp.com (Postfix) with ESMTP id DD8812004BA6; Wed, 10 Jan 2024 15:15:29 +0800 (CST) Received: from localhost.localdomain (10.99.206.12) by DAG6EX02-IMDC.srv.huawei-3com.com (10.62.14.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.27; Wed, 10 Jan 2024 15:11:11 +0800 From: Hu Yadi To: , , , , CC: , , , , <514118380@qq.com>, , "Hu.Yadi" Subject: [PATCH] selftests/landlock:Fix two build issues Date: Wed, 10 Jan 2024 15:08:54 +0800 Message-ID: <20240110070854.7077-1-hu.yadi@h3c.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BJSMTP02-EX.srv.huawei-3com.com (10.63.20.133) To DAG6EX02-IMDC.srv.huawei-3com.com (10.62.14.11) X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL:h3cspam02-ex.h3c.com 40A7BA94013595 From: "Hu.Yadi" Two issues comes up while building selftest/landlock: the first one is as to gettid net_test.c: In function ‘set_service’: net_test.c:91:45: warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration] "_selftests-landlock-net-tid%d-index%d", gettid(), ^~~~~~ getgid net_test.c:(.text+0x4e0): undefined reference to `gettid' the second is compiler error gcc -Wall -O2 -isystem fs_test.c -lcap -o /home/linux/tools/testing/selftests/landlock/fs_test fs_test.c:4575:9: error: initializer element is not constant .mnt = mnt_tmp, ^~~~~~~ this patch is to fix them Signed-off-by: Hu.Yadi Suggested-by: Jiao Reviewed-by:Berlin --- tools/testing/selftests/landlock/fs_test.c | 5 ++++- tools/testing/selftests/landlock/net_test.c | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c index 18e1f86a6234..93eb40a09073 100644 --- a/tools/testing/selftests/landlock/fs_test.c +++ b/tools/testing/selftests/landlock/fs_test.c @@ -4572,7 +4572,10 @@ FIXTURE_VARIANT(layout3_fs) /* clang-format off */ FIXTURE_VARIANT_ADD(layout3_fs, tmpfs) { /* clang-format on */ - .mnt = mnt_tmp, + .mnt = { + .type = "tmpfs", + .data = "size=4m,mode=700", + }, .file_path = file1_s1d1, }; diff --git a/tools/testing/selftests/landlock/net_test.c b/tools/testing/selftests/landlock/net_test.c index 929e21c4db05..8fb357de8c55 100644 --- a/tools/testing/selftests/landlock/net_test.c +++ b/tools/testing/selftests/landlock/net_test.c @@ -18,7 +18,6 @@ #include #include #include - #include "common.h" const short sock_port_start = (1 << 10); @@ -88,7 +87,7 @@ static int set_service(struct service_fixture *const srv, case AF_UNIX: srv->unix_addr.sun_family = prot.domain; sprintf(srv->unix_addr.sun_path, - "_selftests-landlock-net-tid%d-index%d", gettid(), + "_selftests-landlock-net-tid%ld-index%d", syscall(SYS_gettid), index); srv->unix_addr_len = SUN_LEN(&srv->unix_addr); srv->unix_addr.sun_path[0] = '\0'; -- 2.23.0