1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/conf/dstest_host_readdir.cfg Tue Aug 03 16:56:56 2021 +0200
1.3 @@ -0,0 +1,23 @@
1.4 +-- vim:set ft=lua:
1.5 +
1.6 +local L4 = require("L4");
1.7 +
1.8 +local l = L4.default_loader;
1.9 +
1.10 +local server = l:new_channel();
1.11 +
1.12 +l:startv({
1.13 + caps = {
1.14 + server = server:svr(),
1.15 + },
1.16 + log = { "server", "r" },
1.17 + },
1.18 + "rom/dstest_host_server", "10");
1.19 +
1.20 +l:startv({
1.21 + caps = {
1.22 + server = server,
1.23 + },
1.24 + log = { "client", "g" },
1.25 + },
1.26 + "rom/dstest_host_readdir", "rom");
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/conf/dstest_host_readdir.list Tue Aug 03 16:56:56 2021 +0200
2.3 @@ -0,0 +1,25 @@
2.4 +entry dstest_host_readdir
2.5 +roottask moe rom/dstest_host_readdir.cfg
2.6 +module dstest_host_readdir.cfg
2.7 +module l4re
2.8 +module ned
2.9 +module dstest_host_readdir
2.10 +module dstest_host_server
2.11 +module lib4re-c.so
2.12 +module lib4re-c-util.so
2.13 +module lib4re.so
2.14 +module lib4re-util.so
2.15 +module libc_be_l4refile.so
2.16 +module libc_be_l4re.so
2.17 +module libc_be_socket_noop.so
2.18 +module libc_support_misc.so
2.19 +module libdl.so
2.20 +module libipc.so
2.21 +module libl4sys-direct.so
2.22 +module libl4sys.so
2.23 +module libl4util.so
2.24 +module libld-l4.so
2.25 +module libpthread.so
2.26 +module libstdc++.so
2.27 +module libsupc++.so
2.28 +module libuc_c.so
3.1 --- a/tests/Makefile Tue Aug 03 00:05:43 2021 +0200
3.2 +++ b/tests/Makefile Tue Aug 03 16:56:56 2021 +0200
3.3 @@ -6,6 +6,7 @@
3.4 dstest_ext2fs_client \
3.5 dstest_file_client \
3.6 dstest_host_client \
3.7 + dstest_host_readdir \
3.8 dstest_pipe_client \
3.9 dstest_test_client
3.10
3.11 @@ -21,6 +22,8 @@
3.12
3.13 SRC_CC_dstest_host_client = dstest_host_client.cc
3.14
3.15 +SRC_CC_dstest_host_readdir = dstest_host_readdir.cc
3.16 +
3.17 SRC_CC_dstest_pipe_client = dstest_pipe_client.cc
3.18
3.19 SRC_CC_dstest_test_client = dstest_test_client.cc
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/tests/dstest_host_readdir.cc Tue Aug 03 16:56:56 2021 +0200
4.3 @@ -0,0 +1,56 @@
4.4 +/*
4.5 + * Test directory reading.
4.6 + *
4.7 + * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
4.8 + *
4.9 + * This program is free software; you can redistribute it and/or
4.10 + * modify it under the terms of the GNU General Public License as
4.11 + * published by the Free Software Foundation; either version 2 of
4.12 + * the License, or (at your option) any later version.
4.13 + *
4.14 + * This program is distributed in the hope that it will be useful,
4.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.17 + * GNU General Public License for more details.
4.18 + *
4.19 + * You should have received a copy of the GNU General Public License
4.20 + * along with this program; if not, write to the Free Software
4.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
4.22 + * Boston, MA 02110-1301, USA
4.23 + */
4.24 +
4.25 +#include <dirent.h>
4.26 +#include <stdio.h>
4.27 +
4.28 +
4.29 +
4.30 +int main(int argc, char *argv[])
4.31 +{
4.32 + if (argc < 2)
4.33 + {
4.34 + printf("Need directory name.\n");
4.35 + return 1;
4.36 + }
4.37 +
4.38 + /* Obtain directory name. */
4.39 +
4.40 + char *filename = argv[1];
4.41 + DIR *dir = opendir(filename);
4.42 +
4.43 + if (dir == NULL)
4.44 + {
4.45 + printf("Could not obtain directory: %s\n", filename);
4.46 + return 1;
4.47 + }
4.48 +
4.49 + struct dirent *dirent;
4.50 +
4.51 + while ((dirent = readdir(dir)) != NULL)
4.52 + printf("> %s\n", dirent->d_name);
4.53 +
4.54 + printf("Directory shown.\n");
4.55 +
4.56 + return 0;
4.57 +}
4.58 +
4.59 +// vim: tabstop=2 expandtab shiftwidth=2