summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2009-04-03 04:08:41 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2009-04-03 04:08:41 -0400
commit9cdb80aa2b160511098f7e3765ab7f20f543621c (patch)
treea38ab221c142810c5feecdd4a8dfb09257560096
parent3806d124039b145e3efaf1e74767f00678ed1386 (diff)
Slightly reduce memory use in epoll
-rw-r--r--epoll.c15
-rw-r--r--libnul.h2
2 files changed, 8 insertions, 9 deletions
diff --git a/epoll.c b/epoll.c
index dd285b3..3306d6d 100644
--- a/epoll.c
+++ b/epoll.c
@@ -5,15 +5,10 @@ typedef struct FdInfo FdInfo;
struct FdInfo
{
- /* FIXME: we might want to compress this struct at some point.
- * Though, if we have 100000 fd's, it's only 1.6 MB, which is
- * almost nothing for that many clients, Still, cache use
- * would improve.
- */
- gboolean valid;
- gboolean disabled;
- nul_poll_event_type_t mask;
- gpointer data;
+ gpointer data;
+ unsigned int mask : 16;
+ unsigned int valid : 1;
+ unsigned int disabled : 1;
};
struct nul_poll_t
@@ -42,6 +37,8 @@ nul_poll_add_fd (nul_poll_t *nul_poll,
gpointer data)
{
g_return_if_fail (!nul_poll_has_fd (nul_poll, fd));
+
+ mask &= (NUL_POLL_RESERVED - 1);
while (fd >= nul_poll->n_fd_infos)
nul_poll->n_fd_infos *= 2;
diff --git a/libnul.h b/libnul.h
index 6331348..86665d0 100644
--- a/libnul.h
+++ b/libnul.h
@@ -191,6 +191,8 @@ typedef enum
NUL_POLL_HANGUP = 1 << 2,
NUL_POLL_ERROR = 1 << 3,
NUL_POLL_PRIORITY = 1 << 4,
+
+ NUL_POLL_RESERVED = 1 << 5 /* This and higher bits are reserved */
} nul_poll_event_type_t;
typedef struct