1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/pkg/landfall-examples/vcon_test/Makefile Sun May 20 16:54:18 2018 +0200
1.3 @@ -0,0 +1,8 @@
1.4 +PKGDIR ?= ..
1.5 +L4DIR ?= $(PKGDIR)/../..
1.6 +
1.7 +TARGET = ex_vcon_test
1.8 +SRC_CC = vcon_test.cc
1.9 +REQUIRES_LIBS = libio l4re_c-util
1.10 +
1.11 +include $(L4DIR)/mk/prog.mk
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/pkg/landfall-examples/vcon_test/vcon_test.cc Sun May 20 16:54:18 2018 +0200
2.3 @@ -0,0 +1,46 @@
2.4 +/*
2.5 + * Test a Vcon interface.
2.6 + *
2.7 + * (c) 2018 Paul Boddie <paul@boddie.org.uk>
2.8 + *
2.9 + * This program is free software; you can redistribute it and/or
2.10 + * modify it under the terms of the GNU General Public License as
2.11 + * published by the Free Software Foundation; either version 2 of
2.12 + * the License, or (at your option) any later version.
2.13 + *
2.14 + * This program is distributed in the hope that it will be useful,
2.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.17 + * GNU General Public License for more details.
2.18 + *
2.19 + * You should have received a copy of the GNU General Public License
2.20 + * along with this program; if not, write to the Free Software
2.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
2.22 + * Boston, MA 02110-1301, USA
2.23 + */
2.24 +
2.25 +#include <l4/re/env>
2.26 +#include <l4/sys/vcon>
2.27 +#include <l4/util/util.h>
2.28 +
2.29 +#include <string.h>
2.30 +
2.31 +static const char *buffer = "Hello world!";
2.32 +
2.33 +int main(int argc, char *argv[])
2.34 +{
2.35 + const char *cap = argc < 2 ? "term" : argv[1];
2.36 +
2.37 + /* Obtain a reference to the virtual console. */
2.38 +
2.39 + L4::Cap<L4::Vcon> vcon = L4Re::Env::env()->get_cap<L4::Vcon>(cap);
2.40 + if (!vcon.is_valid()) return 1;
2.41 +
2.42 + while (1)
2.43 + {
2.44 + vcon->write(buffer, strlen(buffer));
2.45 + l4_sleep(1000);
2.46 + }
2.47 +
2.48 + return 0;
2.49 +}