From 5d18cf33b7d8045e24091e717d1697d10acd4e28 Mon Sep 17 00:00:00 2001
From: Mike Kaplinskiy <mike.kaplinskiy@gmail.com>
Date: Sun, 12 Jul 2009 15:42:18 -0400
Subject: server: add make_fd_pseudo to unset the unix fd

---
 server/fd.c   |    7 +++++++
 server/file.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/server/fd.c b/server/fd.c
index a57001a..e0a6443 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1530,6 +1530,13 @@ void set_fd_user( struct fd *fd, const struct fd_ops *user_ops, struct object *u
     fd->user   = user;
 }
 
+/* unsets the unix fd so closing this fd does nothing */
+void make_fd_pseudo( struct fd *fd )
+{
+    fd->unix_fd = -1;
+    /* FIXME: anything else? */
+}
+
 /* open() wrapper that returns a struct fd with no fd user set */
 struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int access,
                     unsigned int sharing, unsigned int options )
diff --git a/server/file.h b/server/file.h
index aef40f7..0c236c0 100644
--- a/server/file.h
+++ b/server/file.h
@@ -58,6 +58,7 @@ extern struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned i
                            unsigned int sharing, unsigned int options );
 extern struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops,
                                        int unix_fd, struct object *user, unsigned int options );
+extern void make_fd_pseudo( struct fd *fd );
 extern void *get_fd_user( struct fd *fd );
 extern void set_fd_user( struct fd *fd, const struct fd_ops *ops, struct object *user );
 extern unsigned int get_fd_options( struct fd *fd );
-- 
1.6.3.3

