summaryrefslogtreecommitdiffstats
path: root/daemon/guestfsd.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-32/+32
| | | | | | | | | | | 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 : $_'
* build: reenable "syntax-check" rule: sc_const_long_optionJim Meyering2009-08-031-1/+1
| | | | | | | * cfg.mk (disable_temporarily): Remove sc_const_long_option. * daemon/guestfsd.c (main): Declare long_options to be "const". * fish/fish.c (main): Likewise. * test-tool/test-tool.c (main): Likewise.
* Replace shell_quote function with %Q and %R printf specifiers.Richard Jones2009-07-281-26/+78
| | | | | | | %Q => simple shell quoted string %R => path will be prefixed by /sysroot eg. snprintf (cmd, sizeof cmd, "cat %R", path); system (cmd);
* Make /sysroot path configurable.Richard Jones2009-07-181-0/+23
| | | | | | | | | Currently /sysroot is hard-coded throughout the daemon code. This patch turns the path into a variable so that we can change it in future, for example to allow standalone mode to be implemented. This patch was tested by running all the C API tests successfully.
* avoid leak upon failed reallocJim Meyering2009-07-031-8/+12
| | | | | * daemon/guestfsd.c (commandrv): Free original buffer (rather than leaking it) if realloc fails.
* remove trailing blanksJim Meyering2009-07-031-1/+1
|
* Call 'udevadm settle' after operations which add/remove device nodes.Richard W.M. Jones2009-07-011-0/+13
| | | | | | | | | | | | | Because udev operates asynchronously, we found errors which were caused by a previous command (eg. sfdisk or pvremove) creating or removing a device, and that change not having happened by the time the next command was run. This patch adds calls to '/sbin/udevadm settle' after any commands which can add or remove device nodes. If udev is not being used or not available, this should have no effect. The command fails and this is silently ignored.
* Change to use virtio_blk (virtio block device) by default.Richard W.M. Jones2009-07-011-1/+1
| | | | | | | | | | | | | virtio_blk is the fast, virt-native block device driver supported by qemu and KVM. Note that virtio_blk device names are called /dev/vd*. Existing scripts should continue working because device name translation will silently change device names of the form /dev/sd* to /dev/vd* as required. See also: http://libguestfs.org/guestfs.3.html#block_device_naming
* Generated code for mknod, mkfifo, mknod_b, mknod_c, umask.Richard W.M. Jones2009-06-301-0/+3
|
* Check return value from waitpid call in command*() functions.Richard W.M. Jones2009-06-201-2/+6
|
* Implement device name translation. Remove device name hacks in tests.Richard Jones2009-06-101-0/+49
|
* In daemon, set PATH, SHELL and LANG environment variables.Richard Jones2009-05-221-0/+8
|
* Refactor line splitting code in the daemon, and fix it so it works.Richard Jones2009-05-121-0/+54
|
* Fix leak in realloc failure (Jim Meyering).Richard Jones2009-05-071-16/+14
|
* Add generated code for 'fsck' command.Richard Jones2009-04-301-4/+61
|