summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2009-10-31 09:53:05 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2009-10-31 09:53:05 +0800
commitbb946136c2109a23c60945b8ef9b2191547375d9 (patch)
tree20da7f3cb4d3a626708582ef1517059280888b8f
parent695ed033f6ad9f6b78cbb522f97904da66dff6df (diff)
milkway: add poll implementation stubs
-rw-r--r--configure.ac2
-rw-r--r--milkway/Makefile.am12
-rw-r--r--milkway/milkway.h1
-rw-r--r--milkway/mw-poll-imp.c58
-rw-r--r--milkway/mw-poll-imp.h32
-rw-r--r--milkway/mw-poll-select-private.h52
-rw-r--r--milkway/mw-poll-select.c124
-rw-r--r--milkway/mw-poll-sys-private.h52
-rw-r--r--milkway/mw-poll-sys.c116
-rw-r--r--milkway/mw-poll-win32-private.h52
-rw-r--r--milkway/mw-poll-win32.c99
-rw-r--r--milkway/mw-source.c19
-rw-r--r--milkway/mw-source.h19
13 files changed, 636 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 4e7c1c7..074da3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,6 +193,8 @@ AC_CHECK_HEADER(fenv.h,
dnl check for misc headers and functions
AC_CHECK_HEADERS([libgen.h byteswap.h signal.h setjmp.h fenv.h])
AC_CHECK_FUNCS([vasnprintf link ctime_r drand48 flockfile ffs])
+AC_CHECK_HEADERS([sys/poll.h sys/select.h])
+AC_CHECK_FUNCS([poll select])
dnl check for win32 headers (this detects mingw as well)
AC_CHECK_HEADERS([windows.h], have_windows=yes, have_windows=no)
diff --git a/milkway/Makefile.am b/milkway/Makefile.am
index 622a4e5..f42bae2 100644
--- a/milkway/Makefile.am
+++ b/milkway/Makefile.am
@@ -25,7 +25,8 @@ milkway_headers = \
mw-list.h \
mw-slist.h \
mw-source.h \
- mw-poll.h
+ mw-poll.h \
+ mw-poll-imp.h
libmilkway_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined
libmilkway_la_LIBADD = @DEP_LIBS@ $(PTHREAD_LIBS)
@@ -58,7 +59,14 @@ libmilkway_la_SOURCES = \
mw-list.c \
mw-slist.c \
mw-source.c \
- mw-poll.c
+ mw-poll.c \
+ mw-poll-sys-private.h \
+ mw-poll-sys.c \
+ mw-poll-select-private.h \
+ mw-poll-select.c \
+ mw-poll-win32-private.h \
+ mw-poll-win32.c \
+ mw-poll-imp.c
milkwayincludedir = $(includedir)/milkway/milkway
milkwayinclude_HEADERS = $(milkway_headers)
diff --git a/milkway/milkway.h b/milkway/milkway.h
index fd29224..d93f51e 100644
--- a/milkway/milkway.h
+++ b/milkway/milkway.h
@@ -29,6 +29,7 @@
#include <milkway/mw-bitops.h>
#include <milkway/mw-byteorder.h>
#include <milkway/mw-atomic.h>
+#include <milkway/mw-strutil.h>
#include <milkway/mw-crypt.h>
#include <milkway/mw-checksum.h>
#include <milkway/mw-hexlify.h>
diff --git a/milkway/mw-poll-imp.c b/milkway/mw-poll-imp.c
new file mode 100644
index 0000000..117709b
--- /dev/null
+++ b/milkway/mw-poll-imp.c
@@ -0,0 +1,58 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "milkwayint.h"
+#include "milkway/mw-poll-imp.h"
+
+#include "mw-poll-sys-private.h"
+#include "mw-poll-select-private.h"
+#include "mw-poll-win32-private.h"
+
+typedef mw_poll_t* (*poll_creator_t)(void);
+
+mw_poll_t*
+mw_poll_get_imp (mw_error_t **reterr)
+{
+ static poll_creator_t creators[] = {
+#ifndef MW_OS_WINDOWS
+#ifdef HAVE_POLL
+ mw_poll_sys_new,
+#endif
+#ifdef HAVE_SELECT
+ mw_poll_select_new,
+#endif
+#else
+ mw_poll_win32_new,
+#endif
+ NULL
+ };
+ unsigned i;
+
+ for (i = 0; creators[i]; i++) {
+ mw_poll_t *poll;
+
+ poll = creators[i]();
+ if (poll)
+ return poll;
+ }
+
+ mw_error_set(reterr, "poll", MW_NOT_SUPPORTED,
+ "no poll implementation");
+ return NULL;
+}
diff --git a/milkway/mw-poll-imp.h b/milkway/mw-poll-imp.h
new file mode 100644
index 0000000..d31b718
--- /dev/null
+++ b/milkway/mw-poll-imp.h
@@ -0,0 +1,32 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef MW_POLL_IMP_H
+#define MW_POLL_IMP_H
+
+#include <milkway/mw-poll.h>
+
+MW_BEGIN_DECLS
+
+mw_public mw_poll_t*
+mw_poll_get_imp (mw_error_t **reterr);
+
+MW_END_DECLS
+
+#endif
diff --git a/milkway/mw-poll-select-private.h b/milkway/mw-poll-select-private.h
new file mode 100644
index 0000000..8b424c6
--- /dev/null
+++ b/milkway/mw-poll-select-private.h
@@ -0,0 +1,52 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef MW_POLL_SELECT_PRIVATE_H
+#define MW_POLL_SELECT_PRIVATE_H
+
+#ifdef __APPLE__
+#undef HAVE_POLL
+#endif
+
+#ifdef HAVE_POLL
+
+#include <milkway/mw-poll.h>
+
+typedef struct mw_poll_select_type mw_poll_select_type_t;
+typedef struct mw_poll_select mw_poll_select_t;
+
+#define MW_POLL_SELECT_TYPE mw_poll_select_get_type()
+
+struct mw_poll_select_type {
+ mw_poll_type_t base;
+};
+
+struct mw_poll_select {
+ mw_poll_t base;
+};
+
+mw_private mw_poll_t*
+mw_poll_select_new(void);
+
+mw_private mw_poll_select_type_t*
+mw_poll_select_get_type(void);
+
+#endif
+
+#endif
diff --git a/milkway/mw-poll-select.c b/milkway/mw-poll-select.c
new file mode 100644
index 0000000..6e26f6d
--- /dev/null
+++ b/milkway/mw-poll-select.c
@@ -0,0 +1,124 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "milkwayint.h"
+#include "mw-poll-select-private.h"
+
+#include <time.h>
+#include <stdlib.h>
+
+#ifdef HAVE_SELECT
+
+/* The following implementation of poll() comes from the GNU C Library.
+ * Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
+ */
+
+#include <string.h> /* for bzero on BSD systems */
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif /* HAVE_SYS_SELECT_H */
+
+#ifdef MW_OS_BEOS
+#undef NO_FD_SET
+#endif /* G_OS_BEOS */
+
+#ifndef NO_FD_SET
+# define SELECT_MASK fd_set
+#else /* !NO_FD_SET */
+# ifndef _AIX
+typedef long fd_mask;
+# endif /* _AIX */
+# ifdef _IBMR2
+# define SELECT_MASK void
+# else /* !_IBMR2 */
+# define SELECT_MASK int
+# endif /* !_IBMR2 */
+#endif /* !NO_FD_SET */
+
+static mw_poll_select_t*
+mw_poll_select_init(mw_poll_select_t *self,
+ mw_poll_select_type_t *type)
+{
+ if (!mw_poll_init(&self->base, &type->base))
+ return NULL;
+
+ return self;
+}
+
+mw_poll_t*
+mw_poll_select_new(void)
+{
+ mw_poll_select_t *self = mw_object_alloc(MW_POLL_SELECT_TYPE);
+ if (!self)
+ return NULL;
+ return (mw_poll_t*)mw_poll_select_init(self, MW_POLL_SELECT_TYPE);
+}
+
+static mw_bool_t
+mw_poll_select_add_fd(mw_poll_t *super,
+ mw_pollfd_t *fd,
+ mw_error_t **reterr)
+{
+ mw_poll_select_t *self = (mw_poll_select_t*)super;
+
+ return MW_TRUE;
+}
+
+static mw_bool_t
+mw_poll_select_remove_fd(mw_poll_t *super,
+ mw_pollfd_t *fd,
+ mw_error_t **reterr)
+{
+ mw_poll_select_t *self = (mw_poll_select_t*)super;
+
+ return MW_TRUE;
+}
+
+static mw_bool_t
+mw_poll_select_poll(mw_poll_t *super,
+ int timeout)
+{
+ mw_poll_select_t *self = (mw_poll_select_t*)super;
+
+ return MW_FALSE;
+}
+
+static void
+mw_poll_select_finalize(mw_object_t *super)
+{
+ mw_poll_select_t *self = (mw_poll_select_t*)super;
+
+
+ MW_SUPER_TYPE_BASE(super, MW_POLL_SELECT_TYPE)->finalize(super);
+}
+
+static void
+mw_poll_select_type_init(mw_poll_select_type_t *self)
+{
+ self->base.base.finalize = mw_poll_select_finalize;
+ self->base.add_fd = mw_poll_select_add_fd;
+ self->base.remove_fd = mw_poll_select_remove_fd;
+ self->base.poll = mw_poll_select_poll;
+}
+
+MW_DEFINE_GET_TYPE(mw_poll_select, mw_poll_select_type_t,
+ MW_POLL_TYPE, "MWPollSelect", 0);
+
+#endif
diff --git a/milkway/mw-poll-sys-private.h b/milkway/mw-poll-sys-private.h
new file mode 100644
index 0000000..f190030
--- /dev/null
+++ b/milkway/mw-poll-sys-private.h
@@ -0,0 +1,52 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef MW_POLL_SYS_PRIVATE_H
+#define MW_POLL_SYS_PRIVATE_H
+
+#ifdef __APPLE__
+#undef HAVE_POLL
+#endif
+
+#ifdef HAVE_POLL
+
+#include <milkway/mw-poll.h>
+
+typedef struct mw_poll_sys_type mw_poll_sys_type_t;
+typedef struct mw_poll_sys mw_poll_sys_t;
+
+#define MW_POLL_SYS_TYPE mw_poll_sys_get_type()
+
+struct mw_poll_sys_type {
+ mw_poll_type_t base;
+};
+
+struct mw_poll_sys {
+ mw_poll_t base;
+};
+
+mw_private mw_poll_t*
+mw_poll_sys_new(void);
+
+mw_private mw_poll_sys_type_t*
+mw_poll_sys_get_type(void);
+
+#endif
+
+#endif
diff --git a/milkway/mw-poll-sys.c b/milkway/mw-poll-sys.c
new file mode 100644
index 0000000..a97b867
--- /dev/null
+++ b/milkway/mw-poll-sys.c
@@ -0,0 +1,116 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "milkwayint.h"
+#include "mw-poll-sys-private.h"
+
+#include <time.h>
+#include <stdlib.h>
+
+#ifdef HAVE_POLL
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
+#ifdef HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# undef events /* AIX 4.1.5 & 4.3.2 define this for SVR3,4 compatibility */
+# undef revents /* AIX 4.1.5 & 4.3.2 define this for SVR3,4 compatibility */
+
+#endif /* HAVE_SYS_POLL_H */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#include <errno.h>
+
+/* SunOS has poll, but doesn't provide a prototype. */
+# if defined (sun) && !defined (__SVR4)
+extern int poll (struct pollfd *fds, unsigned int nfsd, int timeout);
+# endif /* !sun */
+
+static mw_poll_sys_t*
+mw_poll_sys_init(mw_poll_sys_t *self,
+ mw_poll_sys_type_t *type)
+{
+ if (!mw_poll_init(&self->base, &type->base))
+ return NULL;
+
+ return self;
+}
+
+mw_poll_t*
+mw_poll_sys_new(void)
+{
+ mw_poll_sys_t *self = mw_object_alloc(MW_POLL_SYS_TYPE);
+ if (!self)
+ return NULL;
+ return (mw_poll_t*)mw_poll_sys_init(self, MW_POLL_SYS_TYPE);
+}
+
+static mw_bool_t
+mw_poll_sys_add_fd(mw_poll_t *super,
+ mw_pollfd_t *fd,
+ mw_error_t **reterr)
+{
+ mw_poll_sys_t *self = (mw_poll_sys_t*)super;
+
+ return MW_TRUE;
+}
+
+static mw_bool_t
+mw_poll_sys_remove_fd(mw_poll_t *super,
+ mw_pollfd_t *fd,
+ mw_error_t **reterr)
+{
+ mw_poll_sys_t *self = (mw_poll_sys_t*)super;
+
+ return MW_TRUE;
+}
+
+static mw_bool_t
+mw_poll_sys_poll(mw_poll_t *super,
+ int timeout)
+{
+ mw_poll_sys_t *self = (mw_poll_sys_t*)super;
+
+ return MW_FALSE;
+}
+
+static void
+mw_poll_sys_finalize(mw_object_t *super)
+{
+ mw_poll_sys_t *self = (mw_poll_sys_t*)super;
+
+
+ MW_SUPER_TYPE_BASE(super, MW_POLL_SYS_TYPE)->finalize(super);
+}
+
+static void
+mw_poll_sys_type_init(mw_poll_sys_type_t *self)
+{
+ self->base.base.finalize = mw_poll_sys_finalize;
+ self->base.add_fd = mw_poll_sys_add_fd;
+ self->base.remove_fd = mw_poll_sys_remove_fd;
+ self->base.poll = mw_poll_sys_poll;
+}
+
+MW_DEFINE_GET_TYPE(mw_poll_sys, mw_poll_sys_type_t,
+ MW_POLL_TYPE, "MWPollSys", 0);
+
+#endif
diff --git a/milkway/mw-poll-win32-private.h b/milkway/mw-poll-win32-private.h
new file mode 100644
index 0000000..6dd59c0
--- /dev/null
+++ b/milkway/mw-poll-win32-private.h
@@ -0,0 +1,52 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef MW_POLL_WIN32_PRIVATE_H
+#define MW_POLL_WIN32_PRIVATE_H
+
+#ifdef __APPLE__
+#undef HAVE_POLL
+#endif
+
+#ifdef MW_OS_WINDOWS
+
+#include <milkway/mw-poll.h>
+
+typedef struct mw_poll_win32_type mw_poll_win32_type_t;
+typedef struct mw_poll_win32 mw_poll_win32_t;
+
+#define MW_POLL_WIN32_TYPE mw_poll_win32_get_type()
+
+struct mw_poll_win32_type {
+ mw_poll_type_t base;
+};
+
+struct mw_poll_win32 {
+ mw_poll_t base;
+};
+
+mw_private mw_poll_t*
+mw_poll_win32_new(void);
+
+mw_private mw_poll_win32_type_t*
+mw_poll_win32_get_type(void);
+
+#endif
+
+#endif
diff --git a/milkway/mw-poll-win32.c b/milkway/mw-poll-win32.c
new file mode 100644
index 0000000..f35c92d
--- /dev/null
+++ b/milkway/mw-poll-win32.c
@@ -0,0 +1,99 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "milkwayint.h"
+#include "mw-poll-sys-private.h"
+
+#include <time.h>
+#include <stdlib.h>
+
+#ifdef MW_OS_WINDOWS
+
+#include <windows.h>
+
+static mw_poll_win32_t*
+mw_poll_win32_init(mw_poll_win32_t *self,
+ mw_poll_win32_type_t *type)
+{
+ if (!mw_poll_init(&self->base, &type->base))
+ return NULL;
+
+ return self;
+}
+
+mw_poll_t*
+mw_poll_win32_new(void)
+{
+ mw_poll_win32_t *self = mw_object_alloc(MW_POLL_WIN32_TYPE);
+ if (!self)
+ return NULL;
+ return (mw_poll_t*)mw_poll_win32_init(self, MW_POLL_WIN32_TYPE);
+}
+
+static mw_bool_t
+mw_poll_win32_add_fd(mw_poll_t *super,
+ mw_pollfd_t *fd,
+ mw_error_t **reterr)
+{
+ mw_poll_win32_t *self = (mw_poll_win32_t*)super;
+
+ return MW_TRUE;
+}
+
+static mw_bool_t
+mw_poll_win32_remove_fd(mw_poll_t *super,
+ mw_pollfd_t *fd,
+ mw_error_t **reterr)
+{
+ mw_poll_win32_t *self = (mw_poll_win32_t*)super;
+
+ return MW_TRUE;
+}
+
+static mw_bool_t
+mw_poll_win32_poll(mw_poll_t *super,
+ int timeout)
+{
+ mw_poll_win32_t *self = (mw_poll_win32_t*)super;
+
+ return MW_FALSE;
+}
+
+static void
+mw_poll_win32_finalize(mw_object_t *super)
+{
+ mw_poll_win32_t *self = (mw_poll_win32_t*)super;
+
+
+ MW_SUPER_TYPE_BASE(super, MW_POLL_WIN32_TYPE)->finalize(super);
+}
+
+static void
+mw_poll_win32_type_init(mw_poll_win32_type_t *self)
+{
+ self->base.base.finalize = mw_poll_win32_finalize;
+ self->base.add_fd = mw_poll_win32_add_fd;
+ self->base.remove_fd = mw_poll_win32_remove_fd;
+ self->base.poll = mw_poll_win32_poll;
+}
+
+MW_DEFINE_GET_TYPE(mw_poll_win32, mw_poll_win32_type_t,
+ MW_POLL_TYPE, "MWPollWin32", 0);
+
+#endif
diff --git a/milkway/mw-source.c b/milkway/mw-source.c
index 7b860bd..aa9d7df 100644
--- a/milkway/mw-source.c
+++ b/milkway/mw-source.c
@@ -1,3 +1,22 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "milkwayint.h"
#include "milkway/mw-source.h"
diff --git a/milkway/mw-source.h b/milkway/mw-source.h
index 2e29ba0..a94332e 100644
--- a/milkway/mw-source.h
+++ b/milkway/mw-source.h
@@ -1,3 +1,22 @@
+/* Milkway
+ *
+ * Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef MW_SOURCE_H
#define MW_SOURCE_H