summaryrefslogtreecommitdiffstats
path: root/daemon/proto.c
Commit message (Collapse)AuthorAgeFilesLines
* Update FSF address.Matthew Booth2011-11-081-1/+1
|
* protocol: Fix case where download can fail for small files.Richard W.M. Jones2011-08-181-0/+6
| | | | | | | | | | | | | There is another case where downloads of small files could fail if the library side (writer) fails. In this case the library would send back a cancellation, but it would be received after the daemon had finished sending the whole file (because the file is small enough). The daemon would reenter the main loop and immediately get an unexpected cancel message, causing the daemon to die. This commit also makes test-cancellation-download-librarycancels.sh more robust. We use Monte-Carlo testing with a range of file sizes. Small file sizes should trigger the error case.
* daemon: Remove some less useful debugging messages.Richard W.M. Jones2011-05-081-7/+1
| | | | | | | | Remove some debug messages which were basically left over from when the code was being developed. However we leave debug messages where it is printing an external command that is about to be executed, since those are useful.
* daemon: Introduce "pulse mode" progress events.Richard W.M. Jones2011-04-011-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Improve protocol debug messages.Richard Jones2011-03-181-18/+26
| | | | | | | | This adds 'guestfsd: ...' prefix before each message, and also puts a message at the top of the main loop just after a new message has been received. The intent is to make it simpler to follow the protocol.
* daemon: Print error for invalid chunk.cancel field.Richard W.M. Jones2011-03-181-0/+7
| | | | | | | The chunk.cancel field should always be [0|1]. If it is not then something has gone badly wrong -- probably loss of synchronization. If this occurs print a debug message and return error from receive_file function.
* proto: Improve debug messages.Richard W.M. Jones2011-03-181-1/+2
|
* generator: Code to handle optional arguments in daemon functions.Richard W.M. Jones2010-12-021-8/+0
| | | | | | | | Previously we only supported optional arguments for library functions (commit 14490c3e1aac61c6ac90f28828896683f64f0dc9). This extends that work so that optional arguments can also be passed through to the daemon.
* protocol: Handle progress notification messages during FileIn.Richard W.M. Jones2010-12-011-0/+1
| | | | | | | If the daemon sends progress notification messages while we are uploading FileIn parameters, these are received in check_for_daemon_cancellation_or_eof. Modify this library function so that it turns these messages into callbacks.
* protocol: Upload progress messages and optional arguments.Richard W.M. Jones2010-12-011-0/+28
| | | | | | | | Two unrelated changes to the protocol to support progress messages during uploads, and optional arguments. Note that this makes an incompatible change to the protocol, and this is reflected in the protocol version field (3 -> 4).
* daemon: Send back the errno as a string.Richard W.M. Jones2010-11-031-1/+6
| | | | | | | | This changes the protocol again so that if the errno is available, it is converted to a string (like "EIO") and sent back over the protocol to the library. In this commit the library just discards the string.
* daemon: Don't use ../src path to include generator_protocol.hRichard W.M. Jones2010-11-031-1/+1
| | | | | This file is already hard-linked into the current directory, so the relative path is not required.
* Implement progress messages in the daemon and library.Richard Jones2010-08-311-5/+91
| | | | | | | | | | | | This implements progress notification messages in the daemon, and adds a callback in the library to handle them. No calls are changed so far, so in fact no progress messages can be generated by this commit. For more details, see: https://www.redhat.com/archives/libguestfs/2010-July/msg00003.html https://www.redhat.com/archives/libguestfs/2010-July/msg00024.html
* Change protocol to send Linux errno from daemon to library.Richard Jones2010-08-241-4/+5
| | | | | | | This changes the protocol so that the Linux errno (if available) is sent back to the library. Note that the errno is not yet made available to callers, since it is not clear how best to present this Linux-specific number.
* Fix FileIn cmds losing synch if both ends send cancel messages (RHBZ#576879).Richard Jones2010-05-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | During a FileIn command (eg. upload, tar-in) if both sides experience errors, then both sides could send cancel messages, the result being lost synchronization. The reason for the lost synch was because the daemon was ignoring this case and sending an error message back which the library side (which had cancelled) was not expecting. Fix this by checking in the daemon for the case where the library also cancels during daemon cancellation, and not sending an error messages. This also includes an enhanced regression test which checks for this case. This extends the original fix in commit 5922d7084d6b43f0a1a15b664c7082dfeaf584d0. More details can be found here: https://bugzilla.redhat.com/show_bug.cgi?id=576879#c5
* Code cleanups related to RHBZ#580246.Richard Jones2010-04-081-4/+13
| | | | | | | | | | | | | | This includes various code cleanups: (a) A regression test for RHBZ#580246. (b) Use write instead of fwrite to write out the tar file. This is just because the error handling of write seems to be better specified and easier to use. (c) Use size_t instead of int for length. (d) Clearer debug messages when in verbose mode.
* Fix the error message when reply body is too large (RHBZ#509597).Richard Jones2010-03-271-1/+1
|
* daemon error handling: Define a new function reply_with_perror_errno.Richard Jones2009-12-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This allows you to save the errno from a previous call and pass it to reply_with_perror. For example, original code: r = some_system_call (); err = errno; do_cleanup (); errno = err; if (r == -1) { reply_with_perror ("failed"); return -1; } can in future be changed to: r = some_system_call (); err = errno; do_cleanup (); if (r == -1) { reply_with_perror_errno (err, "failed"); return -1; }
* daemon error handling: Clear errno before calling stub functions.Richard Jones2009-12-041-1/+16
| | | | | | This just ensures that we accurately report errors, even if our error path code doesn't set errno. We won't end up with a bogus errno left over from a previous call.
* daemon/Win32: Use xdr_u_int for PortableXDR compatibility.Richard Jones2009-11-251-7/+7
| | | | PortableXDR didn't support xdr_uint32_t. xdr_u_int is the same type.
* daemon/Win32: Use gnulib modules for first porting to Win32.Richard Jones2009-11-201-0/+1
|
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-201-15/+15
| | | | | | | | | | | | | | | 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.
* 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.
* Fix code which looked for leaked FDs between each command.Richard Jones2009-09-171-4/+4
| | | | | | This code was not checking the return value from system() so it failed if uncommented. Add ignore_value() around the call to system. However, leave the code still disabled.
* Daemon: fix handling of errors from xread and xwrite.Richard Jones2009-09-171-7/+11
| | | | | | If xread or xwrite returns -1, that indicates an error and we should exit. Note that xread/xwrite has already printed the error message.
* Fix verbose packet dumping functions.Richard Jones2009-09-171-3/+3
| | | | | | | | | | Add the configure parameter --enable-packet-dump so that this code can be enabled without editing the source. This code is normally commented out, because it is too verbose unless you happen to be debugging the underlying protocol. Because it is normally commented out, I found it had bit-rotted slightly. This commit also fixes the obvious problems.
* 'len' should be an unsigned 32 bit int.Richard Jones2009-09-171-1/+1
| | | | | This only happened to work by accident before because 'unsigned len' happens to be 32 bit on all platforms we support.
* daemon: diagnose socket write failureJim Meyering2009-08-201-5/+9
| | | | | | | | | * daemon/proto.c (send_chunk): Don't ignore socket-write error. * daemon/proto.c (send_file_end): Return "int", not void, so we can propagate send_chunk failure to caller. * daemon/daemon.h (send_file_end): Update prototype. * daemon/tar.c (do_tar_out, do_tgz_out): Update uses of send_file_end. * daemon/upload.c (do_download): Likewise.
* guestfsd: don't ignore failed write-to-socketJim Meyering2009-08-171-1/+1
| | | | | * daemon/proto.c (reply): Fix typo that would cause us to ignore failed write-to-socket.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-24/+24
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* Don't die if reply message is oversized (RHBZ#509597).Richard Jones2009-07-051-2/+7
|
* remove trailing blanksJim Meyering2009-07-031-1/+1
|
* Add list of function_names to the daemon.Richard W.M. Jones2009-07-021-2/+4
| | | | | Messages which include the proc_nr can now also include the name of the actual function being called.
* In verbose mode, daemon will display the time elapsed for each command.Richard W.M. Jones2009-07-021-0/+19
|
* Carefully check return values from xwrite.Richard Jones2009-04-261-4/+18
|
* Fix file descriptor leak in daemon.Richard Jones2009-04-201-0/+8
|
* Implement upload and download commands.Richard Jones2009-04-201-24/+226
|
* Separate out the high-level API actions.Richard Jones2009-04-181-1/+1
| | | | | | - Split out the high-level API actions so that they are in a separate file, and use the defined guestfs C API, instead of fiddling around with internal structures.
* Added test suite.Richard Jones2009-04-111-4/+4
|
* pvs/vgs/lvs commands working now.Richard Jones2009-04-071-1/+1
|
* Parses return values and returned errors properly.Richard Jones2009-04-031-2/+1
|
* Makes a series of non-trivial calls.Richard Jones2009-04-031-3/+197
|
* Daemon and library are mostly talking to each other now.Richard Jones2009-04-031-0/+59