diff --git a/Makefile b/Makefile index 8950012a..3363a0d4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -APPS=init hello sh ls terminal uname compositor drawlines background session kdebug cat yutani-test sysinfo hostname yutani-query env +APPS=init hello sh ls terminal uname compositor drawlines background session kdebug cat yutani-test sysinfo hostname yutani-query env mount CC=i686-pc-toaru-gcc AR=i686-pc-toaru-ar diff --git a/libc/mount.c b/libc/mount.c new file mode 100644 index 00000000..32988e7f --- /dev/null +++ b/libc/mount.c @@ -0,0 +1,14 @@ +#include +#include + +int mount(char * source, char * target, char * type, unsigned long flags, void * data) { + int r = syscall_mount(source, target, type, flags, data); + + if (r < 0) { + errno = -r; + return -1; + } + + return r; +} + diff --git a/mount.c b/mount.c new file mode 100644 index 00000000..99263dc8 --- /dev/null +++ b/mount.c @@ -0,0 +1,29 @@ +/* vim: tabstop=4 shiftwidth=4 noexpandtab + * This file is part of ToaruOS and is released under the terms + * of the NCSA / University of Illinois License - see LICENSE.md + * Copyright (C) 2014 Kevin Lange + * + * mount + * + * Mount a filesystem. + */ + +#include + +#ifndef mount +extern int mount(char * source, char * target, char * type, unsigned long flags, void * data); +#endif + +int main(int argc, char ** argv) { + if (argc < 4) { + fprintf(stderr, "Usage: %s type device mountpoint\n", argv[0]); + return 1; + } + + if (mount(argv[2], argv[3], argv[1], 0, NULL) < 0) { +// perror("mount"); + return 1; + } + + return 0; +}