Richard W.M. Jones
2010-Mar-21 19:33 UTC
[Libguestfs] [PATCH 0/4] Another four patches to get guestfish working
With these, I was able to compile guestfish. 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
Richard W.M. Jones
2010-Mar-21 19:34 UTC
[Libguestfs] [PATCH 1/4] Mac OS X: provide alternate implementation of posix_fallocate.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html -------------- next part -------------->From 78ae8a9c13debf40f6a55efeb69ef1287907b2e4 Mon Sep 17 00:00:00 2001From: Richard Jones <rich at koneko.home.annexia.org> Date: Sun, 21 Mar 2010 19:13:43 +0000 Subject: [PATCH 1/4] Mac OS X: provide alternate implementation of posix_fallocate. --- configure.ac | 3 +++ fish/alloc.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index b13eaf9..cfad704 100644 --- a/configure.ac +++ b/configure.ac @@ -134,6 +134,9 @@ AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.]) dnl Headers. AC_CHECK_HEADERS([errno.h sys/types.h sys/un.h sys/wait.h sys/socket.h endian.h byteswap.h]) +dnl Functions. +AC_CHECK_FUNCS([posix_fallocate]) + dnl Build the daemon? AC_MSG_CHECKING([if we should build the daemon]) AC_ARG_ENABLE([daemon], diff --git a/fish/alloc.c b/fish/alloc.c index ad2dccc..28c990f 100644 --- a/fish/alloc.c +++ b/fish/alloc.c @@ -54,12 +54,31 @@ do_alloc (const char *cmd, int argc, char *argv[]) return -1; } +#ifdef HAVE_POSIX_FALLOCATE if (posix_fallocate (fd, 0, size) == -1) { perror ("fallocate"); close (fd); unlink (argv[0]); return -1; } +#else + /* Slow emulation of posix_fallocate on platforms which don't have it. */ + char buffer[BUFSIZ]; + memset (buffer, 0, sizeof buffer); + + size_t remaining = size; + while (remaining > 0) { + size_t n = remaining > sizeof buffer ? sizeof buffer : remaining; + ssize_t r = write (fd, buffer, n); + if (r == -1) { + perror ("write"); + close (fd); + unlink (argv[0]); + return -1; + } + remaining -= r; + } +#endif if (close (fd) == -1) { perror (argv[0]); -- 1.6.4.1
Richard W.M. Jones
2010-Mar-21 19:34 UTC
[Libguestfs] [PATCH 2/4] Mac OS X: implement readline functions.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top -------------- next part -------------->From 86da1108bccaefdfec04f5ec868569cf658050b7 Mon Sep 17 00:00:00 2001From: Richard Jones <rich at koneko.home.annexia.org> Date: Sun, 21 Mar 2010 19:15:40 +0000 Subject: [PATCH 2/4] Mac OS X: implement readline functions. OS X has an older version of readline with some differences in the names of functions. --- configure.ac | 7 ++++++- fish/fish.c | 4 ++++ src/generator.ml | 15 ++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index cfad704..086b00c 100644 --- a/configure.ac +++ b/configure.ac @@ -440,7 +440,12 @@ AS_IF([test "x$with_readline" != xno], AC_MSG_FAILURE( [--with-readline was given, but test for readline failed]) fi - ], -lncurses)]) + ], -lncurses) + old_LIBS="$LIBS" + LIBS="$LIBS $LIBREADLINE" + AC_CHECK_FUNCS([append_history completion_matches rl_completion_matches]) + LIBS="$old_LIBS" + ]) dnl For i18n. AM_GNU_GETTEXT([external]) diff --git a/fish/fish.c b/fish/fish.c index 32d6f9f..2411f72 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -1304,7 +1304,11 @@ cleanup_readline (void) } close (fd); +#ifdef HAVE_APPEND_HISTORY (void) append_history (nr_history_lines, histfile); +#else + (void) write_history (histfile); +#endif } #endif } diff --git a/src/generator.ml b/src/generator.ml index ba883ea..551b6bc 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -7459,7 +7459,16 @@ generator (const char *text, int state) #endif /* HAVE_LIBREADLINE */ -char **do_completion (const char *text, int start, int end) +#ifdef HAVE_RL_COMPLETION_MATCHES +#define RL_COMPLETION_MATCHES rl_completion_matches +#else +#ifdef HAVE_COMPLETION_MATCHES +#define RL_COMPLETION_MATCHES completion_matches +#endif +#endif /* else just fail if we don't have either symbol */ + +char ** +do_completion (const char *text, int start, int end) { char **matches = NULL; @@ -7467,9 +7476,9 @@ char **do_completion (const char *text, int start, int end) rl_completion_append_character = ' '; if (start == 0) - matches = rl_completion_matches (text, generator); + matches = RL_COMPLETION_MATCHES (text, generator); else if (complete_dest_paths) - matches = rl_completion_matches (text, complete_dest_paths_generator); + matches = RL_COMPLETION_MATCHES (text, complete_dest_paths_generator); #endif return matches; -- 1.6.4.1
Richard W.M. Jones
2010-Mar-21 19:35 UTC
[Libguestfs] [PATCH 3/4] Mac OS X: setlocale function requires <locale.h> header file.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw -------------- next part -------------->From 8dedd3e80628ec3e665ac90bd5a3e1489a3c1e28 Mon Sep 17 00:00:00 2001From: Richard Jones <rich at koneko.home.annexia.org> Date: Sun, 21 Mar 2010 19:30:25 +0000 Subject: [PATCH 3/4] Mac OS X: setlocale function requires <locale.h> header file. --- fish/fish.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fish/fish.c b/fish/fish.c index 2411f72..2022ee3 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -28,6 +28,7 @@ #include <assert.h> #include <sys/types.h> #include <sys/wait.h> +#include <locale.h> #ifdef HAVE_LIBREADLINE #include <readline/readline.h> -- 1.6.4.1
Richard W.M. Jones
2010-Mar-21 19:35 UTC
[Libguestfs] [PATCH 4/4] Mac OS X: Detect bindtextdomain.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html -------------- next part -------------->From ada2751a9601aa596d9f6737202f44df4a218a89 Mon Sep 17 00:00:00 2001From: Richard Jones <rich at koneko.home.annexia.org> Date: Sun, 21 Mar 2010 19:30:52 +0000 Subject: [PATCH 4/4] Mac OS X: Detect bindtextdomain. These are missing on Mac OS X. I think you would need to install a gettext package to get these. --- configure.ac | 2 +- fish/fish.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 086b00c..4a492b2 100644 --- a/configure.ac +++ b/configure.ac @@ -135,7 +135,7 @@ dnl Headers. AC_CHECK_HEADERS([errno.h sys/types.h sys/un.h sys/wait.h sys/socket.h endian.h byteswap.h]) dnl Functions. -AC_CHECK_FUNCS([posix_fallocate]) +AC_CHECK_FUNCS([bindtextdomain posix_fallocate]) dnl Build the daemon? AC_MSG_CHECKING([if we should build the daemon]) diff --git a/fish/fish.c b/fish/fish.c index 2022ee3..5fbf290 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -141,8 +141,10 @@ main (int argc, char *argv[]) atexit (close_stdout); setlocale (LC_ALL, ""); +#ifdef HAVE_BINDTEXTDOMAIN bindtextdomain (PACKAGE, LOCALEBASEDIR); textdomain (PACKAGE); +#endif enum { HELP_OPTION = CHAR_MAX + 1 }; -- 1.6.4.1
Maybe Matching Threads
- [PATCH febootstrap 0/8] Add support for building an ext2-based appliance
- [PATCH 0/4] In guestfish allow <! for inline execution
- [PATCH 0/7] Prepare for adding write support to hivex (windows registry) library
- [PATCH 0/10] Miscellaneous patches to fix some compile problems on Mac OS X
- [PATCH 0/13 v2] Prepare for adding write support to hivex (Windows registry) library