From owner-dev-commits-src-all@freebsd.org Mon Mar 8 08:20:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87907569A4E; Mon, 8 Mar 2021 08:20:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DvB8y3Qydz3pSS; Mon, 8 Mar 2021 08:20:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6475925771; Mon, 8 Mar 2021 08:20:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1288K2d9006195; Mon, 8 Mar 2021 08:20:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1288K2Fs006192; Mon, 8 Mar 2021 08:20:02 GMT (envelope-from git) Date: Mon, 8 Mar 2021 08:20:02 GMT Message-Id: <202103080820.1288K2Fs006192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: e0fd837a30bd - main - stress2: open(2) tests with BENEATH flags. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0fd837a30bd9e6b0046db9d459fce8b2fc89cce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 08:20:02 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=e0fd837a30bd9e6b0046db9d459fce8b2fc89cce commit e0fd837a30bd9e6b0046db9d459fce8b2fc89cce Author: Peter Holm AuthorDate: 2021-03-08 08:08:58 +0000 Commit: Peter Holm CommitDate: 2021-03-08 08:19:37 +0000 stress2: open(2) tests with BENEATH flags. Update tests to reflect the changes of "open(2): Remove O_BENEATH and AT_BENEATH" in 20e91ca36a56. --- tools/test/stress2/misc/beneath.sh | 11 +++-------- tools/test/stress2/misc/beneath2.sh | 4 ++-- tools/test/stress2/misc/beneath3.sh | 2 +- tools/test/stress2/misc/beneath4.sh | 24 ++++++++++++------------ 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/tools/test/stress2/misc/beneath.sh b/tools/test/stress2/misc/beneath.sh index 6c2f71a7e992..5f61dbd5e383 100755 --- a/tools/test/stress2/misc/beneath.sh +++ b/tools/test/stress2/misc/beneath.sh @@ -27,7 +27,7 @@ # SUCH DAMAGE. # -# Test of open(2) with the O_BENEATH flag. +# Test of open(2) with the O_RESOLVE_BENEATH flag. # userret: returning with the following locks held: # shared lockmgr ufs (ufs) r = 0 (0xfffff804ec0d2a48) locked @ @@ -46,11 +46,6 @@ cat > $top/beneath.c < #include -#ifndef O_BENEATH -#define O_BENEATH 0x00400000 /* Fail if not under cwd */ -#define AT_BENEATH 0x1000 /* Fail if not under dirfd */ -#endif - int main(int argc, char *argv[]) { @@ -61,7 +56,7 @@ main(int argc, char *argv[]) for (i = 1; i < argc; i++) { name = argv[i]; alarm(120); - fd = open(name, O_RDONLY | O_BENEATH); + fd = open(name, O_RDONLY | O_RESOLVE_BENEATH); if (fd == -1) { fprintf(stderr, "open(\"%s\") failed, error %d %s\n", name, errno, strerror(errno)); @@ -69,7 +64,7 @@ main(int argc, char *argv[]) fprintf(stderr, "open(\"%s\") succeeded\n", name); close(fd); } - error = fstatat(AT_FDCWD, name, &st, AT_BENEATH); + error = fstatat(AT_FDCWD, name, &st, AT_RESOLVE_BENEATH); if (error == -1){ fprintf(stderr, "stat(\"%s\") failed, error %d %s\n", name, errno, strerror(errno)); diff --git a/tools/test/stress2/misc/beneath2.sh b/tools/test/stress2/misc/beneath2.sh index 93a937c054ff..a89cd8deb1e1 100755 --- a/tools/test/stress2/misc/beneath2.sh +++ b/tools/test/stress2/misc/beneath2.sh @@ -27,7 +27,7 @@ # SUCH DAMAGE. # -# O_BENEATH test with a relative path, which is a symbolic link pointing +# O_RESOLVE_BENEATH test with a relative path, which is a symbolic link pointing # to an absolute path. # "panic: Assertion (ndp->ni_lcf & NI_LCF_LATCH) != 0 failed at @@ -93,7 +93,7 @@ main(int argc, char *argv[]) exit(1); } file = argv[1]; - if ((fd = open(file, O_RDONLY | O_BENEATH)) != 0 && + if ((fd = open(file, O_RDONLY | O_RESOLVE_BENEATH)) != 0 && errno != ENOTCAPABLE) err(1, "open(%s)", file); diff --git a/tools/test/stress2/misc/beneath3.sh b/tools/test/stress2/misc/beneath3.sh index 52dc37a7f873..46f370899ee8 100755 --- a/tools/test/stress2/misc/beneath3.sh +++ b/tools/test/stress2/misc/beneath3.sh @@ -84,7 +84,7 @@ main(void) char file[] = "/.."; errno = 0; - fd = open(file, O_CREAT | O_RDONLY | O_BENEATH); + fd = open(file, O_CREAT | O_RDONLY | O_RESOLVE_BENEATH); if (fd != -1 || errno != ENOTCAPABLE) err(1, "open(%s) returns %d", file, fd); diff --git a/tools/test/stress2/misc/beneath4.sh b/tools/test/stress2/misc/beneath4.sh index d9ee71a8f222..f1a5c8817662 100755 --- a/tools/test/stress2/misc/beneath4.sh +++ b/tools/test/stress2/misc/beneath4.sh @@ -69,7 +69,7 @@ main(int argc, char *argv[]) sscanf(argv[3], "%x", &flag); exp = atoi(argv[4]); #if 0 - if ((flag & (AT_BENEATH | AT_RESOLVE_BENEATH)) == 0) { + if ((flag & AT_RESOLVE_BENEATH) == 0) { fprintf(stderr, "Flag must be %#x or %#x\n", AT_BENEATH, AT_RESOLVE_BENEATH); return (1); @@ -105,17 +105,17 @@ top=$dir/a cd $here s=0 -ls -lR $dir -echo AT_BENEATH -$dir/beneath4 $top a 0x1000 0 || s=1 -$dir/beneath4 $top b 0x1000 2 || s=1 -$dir/beneath4 $top c 0x1000 0 || s=1 -$dir/beneath4 $top d 0x1000 0 || s=1 -$dir/beneath4 $top e 0x1000 2 || s=1 -$dir/beneath4 $top fifo 0x1000 0 || s=1 -$dir/beneath4 $top $top/../../beneath4.d/a/a 0x1000 93 || s=1 -$dir/beneath4 $top $top/.. 0x1000 93 || s=1 -$dir/beneath4 $top ../a 0x1000 0 || s=1 +#ls -lR $dir +#echo AT_BENEATH +#$dir/beneath4 $top a 0x1000 0 || s=1 +#$dir/beneath4 $top b 0x1000 2 || s=1 +#$dir/beneath4 $top c 0x1000 0 || s=1 +#$dir/beneath4 $top d 0x1000 0 || s=1 +#$dir/beneath4 $top e 0x1000 2 || s=1 +#$dir/beneath4 $top fifo 0x1000 0 || s=1 +#$dir/beneath4 $top $top/../../beneath4.d/a/a 0x1000 93 || s=1 +#$dir/beneath4 $top $top/.. 0x1000 93 || s=1 +#$dir/beneath4 $top ../a 0x1000 0 || s=1 printf "\nAT_RESOLVE_BENEATH\n" $dir/beneath4 $top a 0x2000 0 || s=1