These FDs are the return value from socket().  Under the hood, they are
data FDs.  There are a bunch of things that can be cleaned up now that
we get a callback when the app closes the FD.

Rebuild glibc.

Signed-off-by: Barret Rhoden <[email protected]>
---
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.c       | 4 ++++
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.h       | 1 +
 tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/socket.c  | 5 +++++
 3 files changed, 10 insertions(+)

diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.c 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.c
index c40149a42f9e..924551cf40af 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.c
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.c
@@ -187,6 +187,10 @@ Rock *_sock_newrock(int fd)
        return r;
 }
 
+void _sock_fd_closed(int fd)
+{
+}
+
 /* For a ctlfd and a few other settings, it opens and returns the corresponding
  * datafd.  This will close cfd for you. */
 int
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.h 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.h
index a45f22b37e10..d0a62065fcab 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.h
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/plan9_sockets.h
@@ -63,6 +63,7 @@ struct Rock {
 
 extern Rock *_sock_findrock(int, struct stat *);
 extern Rock *_sock_newrock(int);
+extern void _sock_fd_closed(int fd);
 extern void _sock_srvname(char *, char *);
 extern int _sock_srv(char *, int);
 extern int _sock_data(int, char *, int, int, int, Rock **);
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/socket.c 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/socket.c
index 39e38bdb13dd..e81f6aac0176 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/socket.c
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/socket.c
@@ -15,6 +15,8 @@
 #include <string.h>
 #include <fcntl.h>
 #include <sys/stat.h>
+#include <sys/close_cb.h>
+#include <ros/common.h>
 
 /* bsd extensions */
 #include <sys/uio.h>
@@ -34,6 +36,9 @@ int __socket(int domain, int type, int protocol)
        int pfd[2];
        char *net;
        char msg[128];
+       static struct close_cb _sock_close_cb = {.func = _sock_fd_closed};
+
+       run_once(register_close_cb(&_sock_close_cb));
 
        switch (domain) {
                case PF_INET:
-- 
2.6.0.rc2.230.g3dd15c0

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to