30static int mknod_wrapper(
int dirfd,
const char *path,
const char *link,
36 res = openat(dirfd, path, O_CREAT | O_EXCL | O_WRONLY, mode);
39 }
else if (S_ISDIR(mode)) {
40 res = mkdirat(dirfd, path, mode);
41 }
else if (S_ISLNK(mode) && link != NULL) {
42 res = symlinkat(link, dirfd, path);
43 }
else if (S_ISFIFO(mode)) {
44 res = mkfifoat(dirfd, path, mode);
46 }
else if (S_ISSOCK(mode)) {
47 struct sockaddr_un su;
50 if (strlen(path) >=
sizeof(su.sun_path)) {
54 fd = socket(AF_UNIX, SOCK_STREAM, 0);
61 su.sun_family = AF_UNIX;
62 strncpy(su.sun_path, path,
sizeof(su.sun_path));
63 res = bindat(dirfd, fd, (
struct sockaddr*)&su,
72 res = mknodat(dirfd, path, mode, rdev);