[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] daemon/Win32: Use gnulib modules for first porting to Win32.



Quite a victory for Gnulib here.  I was able to port a large part
of the daemon just by adding some modules and fixing a few headers.

The remaining issues which are *not* fixed are:

* No chroot on Windows.

* No sync(2) call.

* No posix_fallocate call.

* No futimes call.

* No pread call.

* No custom printf format specifiers.

* Quite a few problems in guestfsd.c, eg. code to run external commands.

* No readlinkat call (use Gnulib {a,x}readlinkat instead?)

* No xdr_uint32_t in PortableXDR.

* Missing external commands.

* Test it.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
>From d8b143eab59cb8250040dd5fe5f51197b883c7cc Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones redhat com>
Date: Fri, 20 Nov 2009 11:48:51 +0000
Subject: [PATCH] daemon/Win32: Use gnulib modules for first porting to Win32.

---
 daemon/.gitignore         |   31 ++++++++++++++++++++++++++++++-
 daemon/configure.ac       |    3 ---
 daemon/daemon.h           |    1 +
 daemon/guestfsd.c         |    9 ---------
 daemon/m4/gnulib-cache.m4 |   13 ++++++++++++-
 daemon/proto.c            |    1 +
 6 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/daemon/.gitignore b/daemon/.gitignore
index d5dc335..a55d996 100644
--- a/daemon/.gitignore
+++ b/daemon/.gitignore
@@ -3,6 +3,7 @@ lib
 link-warning.h
 m4/00gnulib.m4
 m4/alloca.m4
+m4/arpa_inet_h.m4
 m4/canonicalize-lgpl.m4
 m4/chdir-long.m4
 m4/chown.m4
@@ -26,12 +27,16 @@ m4/fclose.m4
 m4/fcntl-safer.m4
 m4/fcntl_h.m4
 m4/fdopendir.m4
+m4/float_h.m4
 m4/fnmatch.m4
 m4/getcwd-abort-bug.m4
 m4/getcwd-path-max.m4
 m4/getcwd.m4
+m4/getdelim.m4
 m4/getgroups.m4
+m4/getline.m4
 m4/getlogin_r.m4
+m4/gettimeofday.m4
 m4/getpagesize.m4
 m4/getugroups.m4
 m4/glibc21.m4
@@ -41,8 +46,11 @@ m4/gnulib-comp.m4
 m4/gnulib-tool.m4
 m4/hash.m4
 m4/include_next.m4
+m4/inet_pton.m4
 m4/inline.m4
+m4/intmax_t.m4
 m4/inttostr.m4
+m4/inttypes_h.m4
 m4/lchown.m4
 m4/localcharset.m4
 m4/locale-fr.m4
@@ -57,44 +65,64 @@ m4/mbrtowc.m4
 m4/mbsinit.m4
 m4/mbsrtowcs.m4
 m4/mbstate_t.m4
-m4/mgetgroups.m4
 m4/memchr.m4
 m4/mempcpy.m4
 m4/memrchr.m4
+m4/mgetgroups.m4
 m4/mkdir.m4
+m4/mkdtemp.m4
 m4/mmap-anon.m4
 m4/mode_t.m4
 m4/multiarch.m4
+m4/netdb_h.m4
+m4/netinet_in_h.m4
 m4/onceonly.m4
 m4/open.m4
 m4/openat.m4
 m4/pathmax.m4
+m4/perror.m4
 m4/priv-set.m4
+m4/rawmemchr.m4
 m4/readlink.m4
 m4/realloc.m4
 m4/rmdir.m4
 m4/save-cwd.m4
+m4/select.m4
+m4/size_max.m4
 m4/sleep.m4
+m4/sockets.m4
+m4/socklen.m4
+m4/sockpfaf.m4
 m4/stat-time.m4
 m4/stat.m4
 m4/stdbool.m4
 m4/stddef_h.m4
+m4/stdint_h.m4
 m4/stdint.m4
 m4/stdio_h.m4
 m4/stdlib_h.m4
+m4/strchrnul.m4
 m4/strdup.m4
 m4/strerror.m4
 m4/string_h.m4
 m4/strndup.m4
 m4/strnlen.m4
 m4/symlink.m4
+m4/sys_ioctl_h.m4
+m4/sys_select_h.m4
+m4/sys_socket_h.m4
 m4/sys_stat_h.m4
+m4/sys_time_h.m4
+m4/sys_wait_h.m4
+m4/tempname.m4
 m4/time_h.m4
 m4/unistd-safer.m4
 m4/unistd_h.m4
 m4/unlink.m4
 m4/unlinkdir.m4
 m4/usleep.m4
+m4/vasnprintf.m4
+m4/vasprintf.m4
 m4/warnings.m4
 m4/wchar.m4
 m4/wchar_t.m4
@@ -103,6 +131,7 @@ m4/wctype.m4
 m4/wint_t.m4
 m4/xalloc.m4
 m4/xgetcwd.m4
+m4/xsize.m4
 m4/xstrndup.m4
 mingw32-config.cache
 tests
diff --git a/daemon/configure.ac b/daemon/configure.ac
index 92776c2..a1f54a3 100644
--- a/daemon/configure.ac
+++ b/daemon/configure.ac
@@ -179,11 +179,8 @@ AC_CHECK_FUNCS([\
 dnl Headers.
 AC_CHECK_HEADERS([\
 	attr/xattr.h \
-	netdb.h \
 	printf.h \
 	sys/inotify.h \
-	sys/select.h \
-	sys/wait.h \
 	sys/xattr.h])
 
 dnl For modified printf, we need glibc either (old-style)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index ac68479..120c86c 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -19,6 +19,7 @@
 #ifndef GUESTFSD_DAEMON_H
 #define GUESTFSD_DAEMON_H
 
+#include <stdio.h>
 #include <stdarg.h>
 #include <errno.h>
 #include <unistd.h>
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 4b91660..7f9edd1 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -32,18 +32,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <signal.h>
-
-#ifdef HAVE_NETDB_H
 #include <netdb.h>
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
-#endif
-
-#ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
-#endif
 
 #ifdef HAVE_PRINTF_H
 #include <printf.h>
diff --git a/daemon/m4/gnulib-cache.m4 b/daemon/m4/gnulib-cache.m4
index 3c5b85d..619b89b 100644
--- a/daemon/m4/gnulib-cache.m4
+++ b/daemon/m4/gnulib-cache.m4
@@ -15,17 +15,28 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl c-ctype glob hash ignore-value manywarnings openat warnings
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl c-ctype getline glob hash ignore-value manywarnings mkdtemp netdb openat readlink select sleep strchrnul strndup sys_select sys_wait vasprintf warnings
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   c-ctype
+  getline
   glob
   hash
   ignore-value
   manywarnings
+  mkdtemp
+  netdb
   openat
+  readlink
+  select
+  sleep
+  strchrnul
+  strndup
+  sys_select
+  sys_wait
+  vasprintf
   warnings
 ])
 gl_AVOID([])
diff --git a/daemon/proto.c b/daemon/proto.c
index a0d3736..050d74d 100644
--- a/daemon/proto.c
+++ b/daemon/proto.c
@@ -25,6 +25,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sys/param.h>		/* defines MIN */
+#include <sys/select.h>
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 
-- 
1.6.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]