Codebase list pseudo / c69e6fe
Generate a patch for the extra commit applied. Andrew Shadura 8 years ago
2 changed file(s) with 95 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 From b4da1dfc79a38d318305342fc23255340f913456 Mon Sep 17 00:00:00 2001
1 From: Peter Seebach <peter.seebach@windriver.com>
2 Date: Thu, 10 Mar 2016 15:52:28 -0600
3 Subject: [PATCH] add wrapper for bind
4
5 Since the pseudo socket is actually created by a call to bind, the
6 bind call could create a file, which means it needs to record a
7 database entry.
8 ---
9 ChangeLog.txt | 3 +++
10 ports/unix/guts/bind.c | 36 ++++++++++++++++++++++++++++++++++++
11 ports/unix/wrapfuncs.in | 1 +
12 pseudo_wrappers.c | 2 ++
13 4 files changed, 42 insertions(+)
14 create mode 100644 ports/unix/guts/bind.c
15
16 diff --git a/ChangeLog.txt b/ChangeLog.txt
17 index eb72127..0dc2b08 100644
18 --- a/ChangeLog.txt
19 +++ b/ChangeLog.txt
20 @@ -1,3 +1,6 @@
21 +2016-03-10:
22 + * (seebs) make bind work (so userspace NFS server can handle pseudo)
23 +
24 2016-02-09:
25 * (seebs) 1.7.5 release
26
27 diff --git a/ports/unix/guts/bind.c b/ports/unix/guts/bind.c
28 new file mode 100644
29 index 0000000..46164be
30 --- /dev/null
31 +++ b/ports/unix/guts/bind.c
32 @@ -0,0 +1,36 @@
33 +/*
34 + * Copyright (c) 2016 Wind River Systems; see
35 + * guts/COPYRIGHT for information.
36 + *
37 + * int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
38 + * int rc = -1;
39 + */
40 +
41 + /* I'm not trying to handle broken umasks for this operation right
42 + * now. Be good!
43 + */
44 + rc = real_bind(sockfd, addr, addrlen);
45 + /* we have created a thing! we need to record it in the
46 + * database.
47 + */
48 + if (addr && addr->sa_family == AF_UNIX && rc >= 0) {
49 + struct sockaddr_un *addr_un = (struct sockaddr_un *) addr;
50 + /* Linux supports a special hackery where the name starts
51 + * with a nul byte, I don't care about those
52 + * probably.
53 + */
54 + if (addr_un->sun_path[0]) {
55 + /* we have to find the path, which is
56 + * relative to cwd, so we can create the database
57 + * entry.
58 + */
59 + char *path = pseudo_root_path(__func__, __LINE__, AT_FDCWD, addr_un->sun_path, AT_SYMLINK_NOFOLLOW);
60 + PSEUDO_STATBUF buf;
61 + base_stat(path, &buf);
62 + pseudo_client_op(OP_MKNOD, 0, -1, -1, path, &buf);
63 + }
64 + }
65 +
66 +/* return rc;
67 + * }
68 + */
69 diff --git a/ports/unix/wrapfuncs.in b/ports/unix/wrapfuncs.in
70 index 5f30ae6..1245593 100644
71 --- a/ports/unix/wrapfuncs.in
72 +++ b/ports/unix/wrapfuncs.in
73 @@ -68,3 +68,4 @@ int syncfs(int fd); /* async_skip=0 */
74 int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags); /* async_skip=0 */
75 int msync(void *addr, size_t length, int flags); /* async_skip=0 */
76 mode_t umask(mode_t mask);
77 +int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
78 diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
79 index 34d7f23..9acb65d 100644
80 --- a/pseudo_wrappers.c
81 +++ b/pseudo_wrappers.c
82 @@ -28,6 +28,8 @@
83 #include <signal.h>
84
85 #include <sys/types.h>
86 +#include <sys/socket.h>
87 +#include <sys/un.h>
88 #include <unistd.h>
89 #include <fcntl.h>
90 #include <sys/stat.h>
91 --
92 2.7.4
93
00 0000-manpage.patch
1 0001-add-wrapper-for-bind.patch