diff options
-rw-r--r-- | ChangeLog.txt | 3 | ||||
-rw-r--r-- | ports/unix/guts/bind.c | 30 | ||||
-rw-r--r-- | ports/unix/wrapfuncs.in | 1 | ||||
-rw-r--r-- | pseudo_wrappers.c | 2 |
4 files changed, 36 insertions, 0 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index ede9969..a511e27 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +2016-03-10: + * (seebs) make bind work (so userspace NFS server can handle pseudo) + 2016-03-09: * (seebs) workaround for bash redefining getenv/unsetenv/etc. diff --git a/ports/unix/guts/bind.c b/ports/unix/guts/bind.c new file mode 100644 index 0000000..93e4749 --- /dev/null +++ b/ports/unix/guts/bind.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Wind River Systems; see + * guts/COPYRIGHT for information. + * + * int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) + * int rc = -1; + */ + + rc = real_bind(sockfd, addr, addrlen); + /* we have created a thing! we need to record it in the + * database. + */ + if (addr && addr->sa_family == AF_UNIX && rc >= 0) { + struct sockaddr_un *addr_un = (struct sockaddr_un *) addr; + /* Linux supports a special hackery where the name starts + * with a nul byte, I don't care about those + * probably. + */ + if (addr_un->sun_path[0]) { + char *path = pseudo_root_path(__func__, __LINE__, AT_FDCWD, addr_un->sun_path, AT_SYMLINK_NOFOLLOW); + PSEUDO_STATBUF buf; + base_fstat(rc, &buf); + /* we don't really care that much whether this works, I suspect */ + pseudo_client_op(OP_MKNOD, 0, -1, -1, path, &buf); + } + } + +/* return rc; + * } + */ diff --git a/ports/unix/wrapfuncs.in b/ports/unix/wrapfuncs.in index 5f30ae6..1245593 100644 --- a/ports/unix/wrapfuncs.in +++ b/ports/unix/wrapfuncs.in @@ -68,3 +68,4 @@ int syncfs(int fd); /* async_skip=0 */ int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags); /* async_skip=0 */ int msync(void *addr, size_t length, int flags); /* async_skip=0 */ mode_t umask(mode_t mask); +int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c index 4a38bef..d1b0fca 100644 --- a/pseudo_wrappers.c +++ b/pseudo_wrappers.c @@ -28,6 +28,8 @@ #include <signal.h> #include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> |