Rebuild glibc.

Signed-off-by: Barret Rhoden <[email protected]>
---
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sys/user_fd.h     | 1 +
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/user_fd.c         | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sys/user_fd.h 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sys/user_fd.h
index dc0a80273467..e0c3e25e024b 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sys/user_fd.h
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sys/user_fd.h
@@ -29,6 +29,7 @@
  * you have the right type of FD. */
 struct user_fd {
        int                                                     magic;
+       int                                                     fd;
        void (*close)(struct user_fd *);
 };
 
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/user_fd.c 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/user_fd.c
index 4e16c98ecad9..10afc59fab12 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/user_fd.c
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/user_fd.c
@@ -27,6 +27,8 @@ static size_t nr_ufds = 0;
 int ufd_get_fd(struct user_fd *ufd)
 {
        struct user_fd **new_ufds;
+       int fd;
+
        if (!ufds) {
                nr_ufds = 1 << (sizeof(int) * 8 - LOG2_UP(NR_FILE_DESC_MAX) - 
1);
                /* Two things: instead of worrying about growing and reallocing 
(which
@@ -45,8 +47,11 @@ int ufd_get_fd(struct user_fd *ufd)
         * start in different areas, or maintain a 'last used' hint FD. */
        for (int i = 0; i < nr_ufds; i++) {
                if (!ufds[i]) {
-                       if (atomic_cas_ptr((void**)&ufds[i], 0, ufd))
-                               return i + USER_FD_BASE;
+                       if (atomic_cas_ptr((void**)&ufds[i], 0, ufd)) {
+                               fd = i + USER_FD_BASE;
+                               ufds[i]->fd = fd;
+                               return fd;
+                       }
                }
        }
        __set_errno(ENFILE);
-- 
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