1.1 --- a/tests/dstest_file_monitor.cc Thu Jan 27 23:45:17 2022 +0100
1.2 +++ b/tests/dstest_file_monitor.cc Sun Feb 06 18:05:23 2022 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Test directory monitoring operations.
1.6 *
1.7 - * Copyright (C) 2020, 2021 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2020, 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -34,35 +34,9 @@
1.13
1.14
1.15
1.16 -static file_t *open_object(char *filename, flags_t flags, bool have_uid, sys_uid_t uid)
1.17 -{
1.18 - /* With a user, open a user-specific file opener. */
1.19 -
1.20 - if (have_uid)
1.21 - {
1.22 - l4_cap_idx_t opener = client_open_for_user((user_t) {uid, uid, 0022});
1.23 -
1.24 - if (l4_is_invalid_cap(opener))
1.25 - {
1.26 - printf("Could not obtain opener for file.\n");
1.27 - return NULL;
1.28 - }
1.29 -
1.30 - /* Invoke the open method to receive the reference. */
1.31 -
1.32 - return client_open_using(filename, flags, opener);
1.33 - }
1.34 - else
1.35 - {
1.36 - return client_open(filename, flags);
1.37 - }
1.38 -}
1.39 -
1.40 -
1.41 -
1.42 /* Open files in the directory given by filename. */
1.43
1.44 -static void open_files(const char *filename, bool have_uid, sys_uid_t uid)
1.45 +static void open_files(const char *filename)
1.46 {
1.47 char *buffer = (char *) calloc(strlen(filename) + 10, sizeof(char));
1.48
1.49 @@ -76,7 +50,7 @@
1.50 {
1.51 sprintf(buffer, "%s/file%02d", filename, i);
1.52
1.53 - open_object(buffer, O_CREAT | O_RDWR, have_uid, uid);
1.54 + client_open(buffer, O_CREAT | O_RDWR);
1.55 sleep(1);
1.56 }
1.57 }
1.58 @@ -115,17 +89,15 @@
1.59 {
1.60 if (argc < 2)
1.61 {
1.62 - printf("Need a directory name and an optional user identifier (if used with a filesystem).\n");
1.63 + printf("Need a directory name.\n");
1.64 return 1;
1.65 }
1.66
1.67 char *filename = argv[1];
1.68 - bool have_uid = (argc > 2) && strlen(argv[2]);
1.69 - sys_uid_t uid = have_uid ? atoi(argv[2]) : 0;
1.70
1.71 printf("Opening %s...\n", filename);
1.72
1.73 - file_t *directory = open_object(filename, O_DIRECTORY, have_uid, uid);
1.74 + file_t *directory = client_open(filename, O_DIRECTORY);
1.75
1.76 if (directory == NULL)
1.77 {
1.78 @@ -137,7 +109,7 @@
1.79
1.80 std::thread *activities[2];
1.81
1.82 - activities[0] = new std::thread(open_files, filename, have_uid, uid);
1.83 + activities[0] = new std::thread(open_files, filename);
1.84 activities[1] = new std::thread(monitor_files, directory);
1.85
1.86 for (int i = 0; i < 2; i++)