From: shaver Date: Sat, 14 Dec 2002 23:09:35 +0000 (+0000) Subject: Updating from HEAD, in preparation for landing. X-Git-Tag: v1_7_100~1^248~143 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d55fa6c379f521a19fc984de2bd4c19501647a61;p=fs%2Flustre-release.git Updating from HEAD, in preparation for landing. --- diff --git a/lustre/tests/runslabinfo b/lustre/tests/runslabinfo index 48d6602..eba407d 100755 --- a/lustre/tests/runslabinfo +++ b/lustre/tests/runslabinfo @@ -1,5 +1,5 @@ #!/bin/sh while sleep 1 ; do - egrep "ll_|ldlm|filp|dentry|inode|portals|size-[0-9]* " /proc/slabinfo echo '-----------------------' + egrep "ll_|ldlm|filp|dentry|inode|portals|size-[0-9]* " /proc/slabinfo done diff --git a/lustre/tests/setuid.c b/lustre/tests/setuid.c deleted file mode 100644 index 04dba5e..0000000 --- a/lustre/tests/setuid.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char ** argv) -{ - int rc, fsuid; - - if (argc < 2) { - printf("Usage %s fsuid\n", argv[0]); - return 1; - } - - fsuid = strtoul(argv[2], NULL, 0); - rc = setfsuid(fsuid); - if (rc) { - printf("mknod(%s) error: %s\n", argv[1], strerror(errno)); - } - return rc; -} diff --git a/lustre/tests/toexcl.c b/lustre/tests/toexcl.c index da13217..7f099e8 100644 --- a/lustre/tests/toexcl.c +++ b/lustre/tests/toexcl.c @@ -5,20 +5,73 @@ #include #include #include +#include + +void +usage (char *argv0, int help) +{ + char *progname = strrchr(argv0, '/'); + + if (progname == NULL) + progname = argv0; + + fprintf (help ? stdout : stderr, + "Usage: %s [-e] file\n", progname); + + if (!help) + { + fprintf (stderr, " or try '-h' for help\n"); + exit (1); + } + + printf ("Create the given file with O_EXCL...\n"); + printf (" -e expect EEXIST\n"); + printf (" -h print help"); + printf (" Exit status is 0 on success, 1 on failure\n"); +} int main(int argc, char **argv) { int rc; - - if (argc != 2) { - printf("usage: %s name\n", argv[0]); + int want_eexist = 0; + + while ((rc = getopt (argc, argv, "eh")) != -1) + switch (rc) + { + case 'e': + want_eexist = 1; + break; + case 'h': + usage (argv[1], 1); + return (0); + default: + usage (argv[0], 0); + } + + if (optind != argc - 1) { + usage (argv[0], 0); return 1; } - rc = open(argv[1], O_CREAT|O_EXCL, 0644); + rc = open(argv[optind], O_CREAT|O_EXCL, 0644); if (rc == -1) - printf("open failed: %s\n", strerror(errno)); - else - printf("open success.\n"); - return 0; + { + if (want_eexist && errno == EEXIST) + { + printf("open failed: %s (expected)\n", strerror(errno)); + return (0); + } + printf("open failed: %s\n", strerror(errno)); + return (1); + } else { + if (want_eexist) + { + printf("open success (expecting EEXIST).\n"); + return (1); + } + printf("open success.\n"); + return (0); + } + + return ((rc == 0) ? 0 : 1); }