Add mount

This commit is contained in:
K. Lange 2018-02-28 15:04:46 +09:00 committed by Kevin Lange
parent fe05f1e1f3
commit fe7f798506
3 changed files with 44 additions and 1 deletions

View File

@ -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

14
libc/mount.c Normal file
View File

@ -0,0 +1,14 @@
#include <syscall.h>
#include <errno.h>
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;
}

29
mount.c Normal file
View File

@ -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 <stdio.h>
#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;
}