minix/commands/simple/newroot.c
Thomas Veerman c2ffe723d1 - Moved (u)mount prototypes from unistd.h to sys/mount.h.
- Prepared mount system call to accept multiple mount flags
   instead of just read_only (however, it remains backwards
   compatible).
 - Updated the man mount(2) to reflect new header file usage. 
 - Updated badblocks, newroot, mount, and umount commands to use the
   new header file.
2009-08-12 19:57:37 +00:00

32 lines
475 B
C

/*
newroot.c
Replace the current root with a new one
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
int main(int argc, char *argv[])
{
int r;
char *dev;
if (argc != 2)
{
fprintf(stderr, "Usage: newroot <block-special>\n");
exit(1);
}
dev= argv[1];
r= mount(dev, "/", 0 /* !ro */, NULL, NULL);
if (r != 0)
{
fprintf(stderr, "newroot: mount failed: %s\n", strerror(errno));
exit(1);
}
return 0;
}