summaryrefslogtreecommitdiffstats
path: root/daemon/guestfsd.c
Commit message (Collapse)AuthorAgeFilesLines
* daemon: Make sysroot_len be size_t instead of int.Richard W.M. Jones2011-05-191-1/+1
|
* daemon: Introduce "pulse mode" progress events.Richard W.M. Jones2011-04-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new form of progress event, where we don't know how much of the operation has taken place, but we nevertheless want to send back some indication of activity. Some progress bar indicators directly support this, eg. GtkProgressBar where it is known as "pulse mode". A pulse mode progress message is a special backwards-compatible form of the ordinary progress message. No change is required in callers, unless they want to add support for pulse mode. The daemon sends: - zero or more progress messages with position = 0, total = 1 - a single final progress message with position = total = 1 Note that the final progress message may not be sent if the call fails and returns an error. This is consistent with the behaviour of ordinary progress messages. The daemon allows two types of implementation. Either you can just call notify_progress (0, 1); ...; notify_progress (1, 1) as usual. Or you can call the functions pulse_mode_start, pulse_mode_end and/or pulse_mode_cancel (see documentation in daemon/daemon.h). For this second form of call, the guarantee is very weak: it *just* says the daemon is still capable of doing something, and it doesn't imply that if there is a subprocess that it is doing anything. However this does make it very easy to add pulse mode progress messages to all sorts of existing calls that depend on long-running external commands. To do: add a third variant that monitors a subprocess and only sends back progress messages if it's doing something, where "doing something" might indicate it's using CPU time or it's printing output.
* daemon: When running commands, restart select if we receive a signal.Richard W.M. Jones2011-04-011-0/+4
|
* daemon: Reset SIGPIPE to default before running subprocesses.Richard W.M. Jones2011-04-011-0/+1
|
* daemon: Ignore return value from chdir.Richard W.M. Jones2011-02-031-1/+1
| | | | This updates commit 7eb012f3710bb554d5fc2c4229036901b0b5ad90.
* daemon: Remove -f (don't fork) option.Richard W.M. Jones2011-02-031-30/+3
| | | | This option was not being used.
* daemon: Allow -r option to run daemon standalone.Richard W.M. Jones2011-02-031-2/+14
| | | | | | | | This changes several aspects of the daemon. Currently: * sysroot will be "" (ie. operate directly on /) * CHROOT_IN/CHROOT_OUT are disabled * autosync doesn't try to unmount everything
* daemon: change to root directoryRichard W.M. Jones2011-02-031-0/+2
| | | | Ensure the daemon always starts with current directory == root.
* daemon: Add perror to two exit paths to make errors clearer.Richard W.M. Jones2011-01-271-1/+4
|
* docs: Obsolete HACKING file, move content into guestfs(3) man page.Richard W.M. Jones2010-12-191-1/+2
| | | | | | Add a new section called "EXTENDING LIBGUESTFS" to the guestfs manual page which contains all the information previously in "HACKING".
* daemon: Set O_CLOEXEC flag on the virtio-serial file descriptor.Richard Jones2010-08-271-1/+7
|
* Use virtio-serial, remove other vmchannel methods.Richard Jones2010-08-241-133/+6
| | | | | | | | | | | | | This adds support for virtio-serial, and removes all other vmchannel methods. Virtio-serial is faster than other methods, and is now widely available. I tested this by using the guestfs_upload API on an 83 MB file: before: 6.12 seconds (14.1 MB/sec) after: 4.20 seconds (20.6 MB/sec) (note this is with the current 8K chunk size)
* Change to using ext2-based, cached supermin appliance.Richard Jones2010-08-231-0/+26
| | | | | | | | | | | | This changes the method used to build the supermin appliance to use the new ext2-based appliance supported by latest febootstrap. The appliance can also be cached, so we avoid rebuilding it each time it is used. Mailing list discussion goes into the rationale and details: https://www.redhat.com/archives/libguestfs/2010-August/msg00028.html Requires febootstrap >= 2.8.
* mkfs-b: Check that blocksize parameter is > 0 and a power of 2.Richard Jones2010-06-031-0/+7
|
* daemon: count_strings function returns size_tRichard Jones2010-06-021-2/+2
|
* daemon: Use 'error' instead of 'perror' before calling 'abort'.Richard Jones2010-05-071-4/+5
|
* daemon: Use parens around code section for safety.Richard Jones2010-05-071-1/+2
|
* daemon: Fix for commands working on absolute symbolic links (RHBZ#579608).Richard Jones2010-05-071-4/+99
| | | | | | | | | | | | | | | | The original idea (suggested by Al Viro) was to fork and chroot into the sysroot and read the file from there. Because of the separate process being chrooted, absolute links would be resolved correctly. The slightly modified idea is to open the file in the daemon process (but temporarily chrooted, so symlinks resolve correctly), fork, and have the subprocess just be responsible for copying the file. (Strictly speaking we don't need to fork, but this implementation is simpler). This commit just includes the changes needed to the command*() functions in daemon/guestfsd.c and adds an absolute symlink to the test ISO for testing it. Later commits will fix the broken daemon commands themselves.
* daemon: Change command to abort() on resource problems.Richard Jones2010-05-071-7/+12
| | | | | | | | | | | | | The comment in the code describes it thus: /* Note: abort is used in a few places along the error paths early * in this function. This is because (a) cleaning up correctly is * very complex at these places and (b) abort is used when a * resource problem is indicated which would be due to much more * serious issues - eg. memory or file descriptor leaks. We * wouldn't expect fork(2) or pipe(2) to fail in normal * circumstances. */
* Change network configuration to use macros.Richard Jones2010-05-041-4/+9
| | | | | | | | | | | | | Change the network configuration so everything is set using some macros at the top of src/guestfs.c. Also, rename the macros used in the daemon so they are not the same. It was a very long time since these sets of macros had to match the ones defined in src/guestfs.c, despite what the comment said. Note that this commit should not change the semantics of the program at all.
* Fix upload losing synchronization if root not mounted (RHBZ#576879).Richard Jones2010-04-171-15/+9
| | | | | | | | | | | | Modify the generator so that it can correctly handle early cancellation for Pathname|Device|.. parameters. This fixes the upload command, but consequently we need to fix the parameters for tar_in and t?z_in commands. This should also mean that 'win:' can now be used as the second argument of tar_in and t?z_in commands in guestfish, whereas previously this wouldn't have worked. Adds a regression test for the original problem.
* daemon: Set TERM=dumb inside the daemon.Richard Jones2010-03-301-0/+1
| | | | | | | | | | | | | | | Since commit 977edb3185fe8f we have been passing TERM from the library into the appliance (for the benefit of virt-rescue). However this changes the output of parted, which I would argue is a bug in parted: TERM=xterm /sbin/parted -m -- /dev/sda unit b print 2>&1 | hexdump -C 00000000 1b 5b 3f 31 30 33 34 68 42 59 54 3b 0a 2f 64 65 |.[?1034hBYT;./de| Notice the escape-sequence junk before the official "BYT;" header. By setting TERM=dumb we avoid this.
* Const-correctness fix.Jim Meyering2010-03-261-1/+1
|
* appliance: Set $PATH instead of hard-coding paths to binaries everywhere.Richard Jones2010-03-261-3/+25
| | | | | | Change the appliance so PATH includes common directories. Thus we don't need to hard-code paths to binaries (eg. "/sbin/fdisk") everywhere.
* daemon: Add a trim utility function.Richard Jones2010-03-181-0/+22
| | | | | This function trims the whitespace from around a string. It does this in-place, so it can be called for malloc'd strings.
* daemon: Work around udevsettle issue (RHBZ#548121).Richard Jones2009-12-181-21/+9
|
* daemon: program_name must be defined for Gnulib error module.Richard Jones2009-11-261-0/+3
|
* daemon/Win32: use gnulib modules connect, socket and symlinkat (for readlinkat).Richard Jones2009-11-261-0/+25
|
* daemon: Indent C macros to reflect nesting level.Richard Jones2009-11-261-5/+5
|
* daemon/Win32: Win32 can't fork message moved to separate function (Jim Meyering)Richard Jones2009-11-261-5/+11
|
* daemon/Win32: Supply MAX macro for challenged platforms.Richard Jones2009-11-251-0/+4
|
* daemon/Win32: Windows can't daemonize.Richard Jones2009-11-251-0/+5
|
* daemon/Win32: Windows replacement for umask.Richard Jones2009-11-251-0/+8
|
* daemon/Win32: Replace setenv with Win32 equivalent.Richard Jones2009-11-251-0/+7
|
* daemon/Win32: Use xdr_u_int for PortableXDR compatibility.Richard Jones2009-11-251-1/+1
| | | | PortableXDR didn't support xdr_uint32_t. xdr_u_int is the same type.
* daemon/Win32: Don't bother blocking SIGPIPE on Win32.Richard Jones2009-11-251-0/+2
|
* daemon/Win32: Use gnulib getaddrinfo module.Richard Jones2009-11-251-0/+5
|
* daemon/Win32: Use gnulib modules for first porting to Win32.Richard Jones2009-11-201-9/+0
|
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-201-13/+13
| | | | | | | | | | | | | | | Convert all uses automatically, via these two commands: git grep -l '\<exit *(1)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/' git grep -l '\<exit *(0)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/' * .x-sc_prohibit_magic_number_exit: New file. Edit (RWMJ): Don't change Java code.
* daemon/Win32: Don't include missing headers.Richard Jones2009-11-201-3/+15
| | | | | This is a partial fix for code in guestfsd.c where many of these header files are missing on Win32.
* daemon/RHEL: Choose correct udev settle script.Richard Jones2009-11-181-1/+21
| | | | | | | | | On RHEL/CentOS 5.4, udevadm settle command does not work. This didn't affect us before, but now that we're using parted for partitioning, we *do* need to wait for udev to settle (because parted isn't waiting for this, unlike sfdisk). This commit chooses the correct program to run.
* use STREQ, not strcmp: part 1Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strcmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *== *0/STREQ$1/g'
* change strncmp() == 0 to STREQLEN()Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strncmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *== *0\b/STREQLEN$1/g'
* change strncmp(...) != 0 to STRNEQLEN(...)Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strncmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *!= *0/STRNEQLEN$1/g'
* indent with spaces, not TABsJim Meyering2009-11-091-14/+14
| | | | | | | | | | | * HACKING: Expand indentation TABs. * configure.ac: Likewise. * daemon/daemon.h: Likewise. * daemon/guestfsd.c: Likewise. * fuse/guestmount.c: Likewise. * hivex/LICENSE: Likewise. * src/generator.ml: Likewise. * tools/virt-win-reg: Likewise.
* Fix prototype of commandv to match prototype of commandrv.Richard Jones2009-11-091-2/+3
|
* daemon: Always reflect command stderr to stderr when debugging.Richard W.M. Jones2009-11-091-9/+16
| | | | | | | | | | When debugging (ie. LIBGUESTFS_DEBUG=1 & verbose flag set in daemon) always reflect any stderr output from commands that we run to stderr of the daemon, so it is visible. Previously if stderror == NULL in command*, stderr output was just eaten and discarded which meant useful error messages could be lost.
* daemon: Add flags argument to command*() functions.Richard W.M. Jones2009-11-091-12/+36
| | | | | | | | | | | | | | | | This adds new variations of the command*() functions which take a 'flags' argument. Currently the only flag available is defined as follows: COMMAND_FLAG_FOLD_STDOUT_ON_STDERR: For broken external commands that send error messages to stdout (hello, parted) but that don't have any useful stdout information, use this flag to capture the error messages in the *stderror buffer. If using this flag, you should pass stdoutput as NULL because nothing could ever be captured in that buffer. This patch also adds some documentation for command*() function.
* daemon: When running external commands, open stdin as /dev/nullRichard Jones2009-11-041-0/+1
| | | | | | | | Previously when we ran external commands from the daemon, stdin (ie. fd 0) was closed. This caused a problem when running the external hexdump command which seems to break if stdin is closed. This patch opens stdin on /dev/null.
* avoid use of all ctype macrosJim Meyering2009-09-241-2/+2
| | | | | | | | | | | | | | | | | | | | * cfg.mk (disable_temporarily): Don't disable sc_avoid_ctype_macros. * fish/tilde.c: Remove unnecessary inclusion of ctype.h. * bootstrap: Add gnulib's c-ctype module to the list. * daemon/m4/gnulib-cache.m4: Likewise. * daemon/ext2.c: Include "c-ctype.h", not <ctype.h>. Use c_isspace, etc, rather than isspace. * daemon/guestfsd.c: Likewise. * daemon/lvm.c: Likewise. * daemon/proto.c: Likewise. * fish/fish.c: Likewise. * fish/tilde.c: Likewise. * src/generator.ml: Likewise. * src/guestfs.c: Likewise. * examples/to-xml.c: Likewise. * examples/Makefile.am (to_xml_CPPFLAGS): Add -I$(top_srcdir)/gnulib/lib so inclusion of "c-ctype.h" works. (to_xml_CPPFLAGS): Rename from to_xml_CFLAGS.