blob: 28c9d1cfd9bef4c0d5f4d3b779f4a15f8cbf8654 (
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
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <u.h>
#include <libc.h>
#include <fcall.h>
#include <fs.h>
#include <ctype.h>
Fsys*
nsmount(char *name, char *aname)
{
char *addr, *ns;
int fd;
Fsys *fs;
ns = getns();
if(ns == nil)
return nil;
addr = smprint("unix!%s/%s", ns, name);
free(ns);
if(addr == nil)
return nil;
fd = dial(addr, 0, 0, 0);
if(fd < 0){
werrstr("dial %s: %r", addr);
return nil;
}
fcntl(fd, F_SETFL, FD_CLOEXEC);
fs = fsmount(fd, aname);
if(fs == nil){
close(fd);
return nil;
}
return fs;
}
|