stress2: open(2) tests with BENEATH flags.
Update tests to reflect the changes of "open(2): Remove O_BENEATH and
AT_BENEATH" in 20e91ca36a
.
This commit is contained in:
parent
2b82c94acf
commit
e0fd837a30
@ -27,7 +27,7 @@
|
|||||||
# SUCH DAMAGE.
|
# 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:
|
# userret: returning with the following locks held:
|
||||||
# shared lockmgr ufs (ufs) r = 0 (0xfffff804ec0d2a48) locked @
|
# shared lockmgr ufs (ufs) r = 0 (0xfffff804ec0d2a48) locked @
|
||||||
@ -46,11 +46,6 @@ cat > $top/beneath.c <<EOF
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef O_BENEATH
|
|
||||||
#define O_BENEATH 0x00400000 /* Fail if not under cwd */
|
|
||||||
#define AT_BENEATH 0x1000 /* Fail if not under dirfd */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -61,7 +56,7 @@ main(int argc, char *argv[])
|
|||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
name = argv[i];
|
name = argv[i];
|
||||||
alarm(120);
|
alarm(120);
|
||||||
fd = open(name, O_RDONLY | O_BENEATH);
|
fd = open(name, O_RDONLY | O_RESOLVE_BENEATH);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
fprintf(stderr, "open(\"%s\") failed, error %d %s\n",
|
fprintf(stderr, "open(\"%s\") failed, error %d %s\n",
|
||||||
name, errno, strerror(errno));
|
name, errno, strerror(errno));
|
||||||
@ -69,7 +64,7 @@ main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "open(\"%s\") succeeded\n", name);
|
fprintf(stderr, "open(\"%s\") succeeded\n", name);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
error = fstatat(AT_FDCWD, name, &st, AT_BENEATH);
|
error = fstatat(AT_FDCWD, name, &st, AT_RESOLVE_BENEATH);
|
||||||
if (error == -1){
|
if (error == -1){
|
||||||
fprintf(stderr, "stat(\"%s\") failed, error %d %s\n",
|
fprintf(stderr, "stat(\"%s\") failed, error %d %s\n",
|
||||||
name, errno, strerror(errno));
|
name, errno, strerror(errno));
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
# SUCH DAMAGE.
|
# 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.
|
# to an absolute path.
|
||||||
|
|
||||||
# "panic: Assertion (ndp->ni_lcf & NI_LCF_LATCH) != 0 failed at
|
# "panic: Assertion (ndp->ni_lcf & NI_LCF_LATCH) != 0 failed at
|
||||||
@ -93,7 +93,7 @@ main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
file = argv[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)
|
errno != ENOTCAPABLE)
|
||||||
err(1, "open(%s)", file);
|
err(1, "open(%s)", file);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ main(void)
|
|||||||
char file[] = "/..";
|
char file[] = "/..";
|
||||||
|
|
||||||
errno = 0;
|
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)
|
if (fd != -1 || errno != ENOTCAPABLE)
|
||||||
err(1, "open(%s) returns %d", file, fd);
|
err(1, "open(%s) returns %d", file, fd);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ main(int argc, char *argv[])
|
|||||||
sscanf(argv[3], "%x", &flag);
|
sscanf(argv[3], "%x", &flag);
|
||||||
exp = atoi(argv[4]);
|
exp = atoi(argv[4]);
|
||||||
#if 0
|
#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",
|
fprintf(stderr, "Flag must be %#x or %#x\n",
|
||||||
AT_BENEATH, AT_RESOLVE_BENEATH);
|
AT_BENEATH, AT_RESOLVE_BENEATH);
|
||||||
return (1);
|
return (1);
|
||||||
@ -105,17 +105,17 @@ top=$dir/a
|
|||||||
|
|
||||||
cd $here
|
cd $here
|
||||||
s=0
|
s=0
|
||||||
ls -lR $dir
|
#ls -lR $dir
|
||||||
echo AT_BENEATH
|
#echo AT_BENEATH
|
||||||
$dir/beneath4 $top a 0x1000 0 || s=1
|
#$dir/beneath4 $top a 0x1000 0 || s=1
|
||||||
$dir/beneath4 $top b 0x1000 2 || s=1
|
#$dir/beneath4 $top b 0x1000 2 || s=1
|
||||||
$dir/beneath4 $top c 0x1000 0 || s=1
|
#$dir/beneath4 $top c 0x1000 0 || s=1
|
||||||
$dir/beneath4 $top d 0x1000 0 || s=1
|
#$dir/beneath4 $top d 0x1000 0 || s=1
|
||||||
$dir/beneath4 $top e 0x1000 2 || s=1
|
#$dir/beneath4 $top e 0x1000 2 || s=1
|
||||||
$dir/beneath4 $top fifo 0x1000 0 || 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/../../beneath4.d/a/a 0x1000 93 || s=1
|
||||||
$dir/beneath4 $top $top/.. 0x1000 93 || s=1
|
#$dir/beneath4 $top $top/.. 0x1000 93 || s=1
|
||||||
$dir/beneath4 $top ../a 0x1000 0 || s=1
|
#$dir/beneath4 $top ../a 0x1000 0 || s=1
|
||||||
|
|
||||||
printf "\nAT_RESOLVE_BENEATH\n"
|
printf "\nAT_RESOLVE_BENEATH\n"
|
||||||
$dir/beneath4 $top a 0x2000 0 || s=1
|
$dir/beneath4 $top a 0x2000 0 || s=1
|
||||||
|
Loading…
Reference in New Issue
Block a user