summaryrefslogtreecommitdiff
blob: 866bcf6bd6b18f881a3ac67aea47cfb532cf63fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* Simple prog to mount /proc inside a VPS.
 * Can be statically compiled with dietlibc:
 * diet -Os gcc -static -s -o mount.proc mount.proc.c
 *
 * By Kir Kolyshkin <kir-at-sw-dot-ru>.
 * Licensed under GNU GPL version 2.
 */

#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>

/* Taken from /usr/src/linux/include/fs.h */
#define MS_POSIXACL     (1<<16) /* VFS does not apply the umask */
#define MS_ACTIVE       (1<<30)
#define MS_NOUSER       (1<<31)

int main(void)
{
	/* "Normal" mount uses the same flags, so should we... */
	unsigned long flags = MS_POSIXACL|MS_ACTIVE|MS_NOUSER|0xec0000;
	
	mkdir("/proc", 0755);
	return mount("none", "/proc", "proc", flags, 0);
}