summaryrefslogtreecommitdiffstats
path: root/daemon/guestfsd.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Flexible guestfs_vmchannel parameter for future appliances.Richard Jones2009-09-221-34/+137
| | | | | | | | | | | | | | | | | | | | | | This reimplements parts of commit da0a4f8d1f6ddd302ceba028d87c6e009589e503 in a different, but compatible way. We pass guestfs_vmchannel=tcp:<ip>:<port> on the command line. This is intended to be used as follows (now and in future versions): tcp:10.0.2.4:6666 for guestfwd vmchannel tcp:10.0.2.2:<port> for future "no vmchannel" implementation /dev/vcon4 for future virtio-console vmchannel* It also accepts the old-style guestfs=10.0.2.4:6666 parameter which is sent by older libraries, and turns this transparently into the correct format above. If no guestfs_vmchannel is passed, then this defaults to the guestfwd vmchannel which older libraries would expect. * Maybe this last one should be dev:/dev/vcon4 or file:/dev/vcon4, but we don't need to decide that now.
* Rearrange and tidy up code in guestfsd.cRichard Jones2009-09-221-30/+74
| | | | | | | | | | | | | | | This just tidies up the main() function in the daemon. There is no longer a huge fixed-sized buffer used for the kernel command line. Variables are moved closer to where they are used. Some local variables turned out to be unused - these are removed. Finally the part that reads the kernel command line is moved into a separate function. There is only minimal functional change here (it now prints out the kernel command line). Literal '4' replaced with 'sizeof' expression, at Jim Meyering's suggestion during patch review.
* Remove explicit guestfs=10.0.2.4:6666 kernel command line parameter.Richard Jones2009-09-171-57/+21
| | | | | | | | | | Since we control the appliance tightly, we can just specify that it will always use a particular host and port, and we don't need to pass it on the command line each time. Also the VMCHANNEL_* constants are only relevant to the particular guestfwd vmchannel implementation, so we rename them as GUESTFWD_*.
* Daemon: fix handling of errors from xread and xwrite.Richard Jones2009-09-171-1/+2
| | | | | | If xread or xwrite returns -1, that indicates an error and we should exit. Note that xread/xwrite has already printed the error message.
* Remove redundant macro.Richard W.M. Jones2009-08-171-2/+0
|
* guestfsd.c: don't perform arithmetic on void pointersJim Meyering2009-08-171-2/+4
| | | | * daemon/guestfsd.c (xread, xwrite): Use char* pointers instead.
* adjust const "**" pointers to avoid warningsJim Meyering2009-08-171-10/+10
| | | | | | Also, ... * src/generator.ml: Add DeviceList type, and propagate that change out to all calling/interface code.
* appliance: Replace LANG=C with LC_ALL=CRichard Jones2009-08-131-1/+1
|
* guestfsd.c: correct s/IS_DEVICE/RESOLVE_DEVICE/ in another commentJim Meyering2009-08-131-1/+1
|
* build: avoid warnings in daemon/guestfsd.cJim Meyering2009-08-101-2/+2
| | | | | * daemon/guestfsd.c (print_arginfo, print_shell_quote): Mark each "info" parameter as unused.