summaryrefslogtreecommitdiffstats
path: root/src/guestfs-internal.h
Commit message (Collapse)AuthorAgeFilesLines
* inspection: Read libosinfo database in order to inspect OS install ↵Richard W.M. Jones2012-11-291-0/+30
| | | | CD/DVD/ISOs (RHBZ#803650, RHBZ#805417).
* inspection: Implement "openbsd" type and distro.Richard W.M. Jones2012-11-291-0/+2
|
* appliance: Pass lpj=... on the appliance command line (thanks Marcelo Tosatti).Richard W.M. Jones2012-11-241-1/+5
| | | | | | | | | | | | | | | | | | | | | Try to get the host's loops_per_jiffy value and pass this on the command line to the guest. In theory this should avoid the appliance having to recalculate this value in a VM with TCG (which is generally error-prone). This should avoid timing issues. We only do this when we are certain that the guest will be TCG. Currently we only have enough information to do this from the libvirt attach-method. So mostly this will only affect people using Fedora in a VM. The host loops_per_jiffy value is not exported by the kernel. It is only printed by the kernel early during boot, so if boot messages have "scrolled off" the kernel ring buffer, it won't be available. Some operating systems save early kernel messages in /var/log/dmesg but (a) Fedora 18+ seem to have abandoned this file and (b) on Ubuntu this file is unreadable for spurious "security" reasons. I have submitted a patch to make lpj available through /proc/cpuinfo.
* launch: Refactor duplicate code which constructs the appliance command line.Richard W.M. Jones2012-11-231-0/+1
| | | | Move this into a common file.
* lib: Split up huge src/guestfs.c into logical compilation units.Richard W.M. Jones2012-11-121-17/+22
| | | | | | | | | | | | | | | | | | | This file had grown by accretion to include: - code related to handles (now in src/handle.c) - safe allocation (src/alloc.c) - debug, errors, warnings (src/errors.c) - private data (src/private-data.c) - miscellaneous functions (src/canonical-name.c, src/utils.c) This commit also removes about a dozen #include files which were probably not really used. This is just code motion.
* lib: Add new C API calls: guestfs_push_error_handler,Richard W.M. Jones2012-11-091-2/+12
| | | | | | | | | | | | | | | | | guestfs_pop_error_handler. The addition of these calls makes it much simpler to temporarily disable or ignore errors: guestfs_push_error_handler (g, NULL, NULL); guestfs_mkdir (g, "/foo"); /* We don't care if this fails. */ guestfs_pop_error_handler (g); Note these calls are used by the C API only. They are not necessary in other languages, because those map errors to exceptions. The subsequent commits change existing code to use push/pop instead of laboriously saving and restoring the error handler.
* lib: Rework temporary and cache directory code.Richard W.M. Jones2012-11-091-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New APIs: set-tmpdir, get-tmpdir, set-cachedir, get-cachedir. The current code has evolved over time and has a number of problems: (a) A single environment variable ($TMPDIR) controls the location of several directories. (b) It's hard for the library user to predict which directory libguestfs will use, unless the user simulates the same internal steps that libguestfs performs. This commit fixes these issues. (a) Now three environment variables control the location of all small temporary files, and the appliance cache: For temporary files: $LIBGUESTFS_TMPDIR or $TMPDIR or /tmp. For the appliance cache: $LIBGUESTFS_CACHEDIR or $TMPDIR or /var/tmp. The user can also set these directories explicitly through API calls (guestfs_set_tmpdir and guestfs_set_cachedir). (b) The user can also retrieve the actual directories that libguestfs will use, by calling guestfs_get_tmpdir and guestfs_get_cachedir. These functions are also used internally. This commit also: - reworks the internal tmpdir code - removes the internal (undocumented) guestfs_tmpdir call (replacing it with calls to the documented guestfs_get_tmpdir API instead) - changes the ./run script to set LIBGUESTFS_TMPDIR and LIBGUESTFS_CACHEDIR - adds a test - fixes a few places like libguestfs-make-fixed-appliance which depended on $TMPDIR
* generator: actions: Move 3 helper functions to a separate file.Richard W.M. Jones2012-11-021-0/+6
| | | | This is just code motion.
* lib: Change guestfs___remove_tmpdir function to use command mini-library.Richard W.M. Jones2012-10-181-1/+1
|
* lib: Add a new 'command' mini-library for running external commands.Richard W.M. Jones2012-10-181-0/+18
| | | | | | | | | | | | | This is a wrapper or mini-library for running external command, loosely based on libvirt's virCommand interface. Amongst the advantages are: - Can redirect errors into the error log (RHBZ#713678). - Can redirect output into a callback function. - Handles shell quoting properly. - Safely resets signal handlers, closes file descriptors, etc. - Single place where we can implement other improvements in future.
* New APIs: guestfs_create_flags, guestfs_parse_environment,Richard W.M. Jones2012-10-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | guestfs_parse_environment_list. Add a new function for creating a handle: guestfs_h *guestfs_create_flags (unsigned flags [, ...]); This variant lets you supply flags and extra arguments, although extra arguments are not used at the moment. Of particular interest is the ability to separate the creation of the handle from the parsing of environment variables like LIBGUESTFS_DEBUG. guestfs_create does both together, which prevents us from propagating errors from parsing environment variables back to the caller (guestfs_create has always printed any errors on stderr and then just ignored them). If you are interested in these errors, you can now write: g = guestfs_create_flags (GUESTFS_CREATE_NO_ENVIRONMENT); if (!g) exit (EXIT_FAILURE); r = guestfs_parse_environment (g); if (!r) exit (EXIT_FAILURE); Also you can *omit* the call to guestfs_parse_environment, which creates a handle unaffected by the environment (which was not possible before). This commit also includes new (backwards compatible) changes to the OCaml, Perl, Python, Ruby and Java constructors that let you use the flags.
* New APIs: Model libvirt authentication events through the API.Richard W.M. Jones2012-10-131-0/+15
| | | | | | | | | | | | | | | | | | | | | This commit models libvirt authentication events through the API, adding one new event (GUESTFS_EVENT_LIBVIRT_AUTH) and several new APIs: guestfs_set_libvirt_supported_credentials guestfs_get_libvirt_requested_credentials guestfs_get_libvirt_requested_credential_prompt guestfs_get_libvirt_requested_credential_challenge guestfs_get_libvirt_requested_credential_defresult guestfs_set_libvirt_requested_credential See the documentation and example which shows how to use the new API. This commit also changes existing calls to virConnectOpen* within the library so that the new API is used. Also included is an example (but not a test, because it's hard to see how to automatically test the libvirt API).
* launch: libvirt: Make handle data conditional on HAVE_LIBVIRT.Richard W.M. Jones2012-10-131-2/+8
| | | | | | This means that we can use virConnectPtr and virDomainPtr instead of using void* types. In the case where libvirt support is disabled or not present, effectively nothing changes.
* lib: Pointer arg to safe_memdup function should be const.Richard W.M. Jones2012-10-131-1/+1
|
* Add support for hotplugging (removing disks).Richard W.M. Jones2012-10-091-0/+1
| | | | | | | | New API: remove-drive. Note because of a bug in fuser, this only works with psmisc >= 22.20. This also updates the hotplugging tests.
* Add support for hotplugging (adding disks) to the libvirt attach-method.Richard W.M. Jones2012-10-081-0/+3
| | | | | | | | | | | | | When libvirt is used, we can allow disks to be hotplugged. guestfs_add_drive can be called after launch to hot-add a disk. When a disk is hot-added, we first ask libvirt to add the disk to the appliance, then we make an internal call into the appliance to get it to wait for the disk to appear (ie. udev_settle ()). Hot-added disks are tracked in the g->drives array. This also adds a test.
* launch: Add add_drive 'label' option.Richard W.M. Jones2012-10-081-0/+1
| | | | | | | | | | | | | | | | | | | | | New API: list-disk-labels Allow the user to pass an optional disk label when adding a drive. This is passed through to qemu / libvirt using the disk serial field, and from there to the appliance which exposes it through udev, creating a special alias of the device /dev/disk/guestfs/<label>. Partitions are named /dev/disk/guestfs/<label><partnum>. virtio-blk and virtio-scsi limit the serial field to 20 bytes. We further limit the name to maximum 20 ASCII characters in [a-zA-Z]. list-devices and list-partitions are not changed: these calls still return raw block device names. However a new call, list-disk-labels, returns a hash table allowing callers to map between disk labels, and block device and partition names. This commit also includes a test.
* launch: Make g->drives into an array (was a linked list).Richard W.M. Jones2012-10-081-8/+29
| | | | Using an array simplifies the implementation of hotplugging.
* launch: Add private data pointer to the struct drive.Richard W.M. Jones2012-10-061-0/+3
| | | | This can be used by the attach-method, eg. for libvirt-only data.
* Update SuSE Linux detection.Olaf Hering2012-09-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update SuSE Linux detection. Up to now everything with a /etc/SuSE-release file was treated as openSuSE. With this change SLES based distributions such as "SUSE Linux Enterprise Server", "SUSE Linux Enterprise Desktop" and "Novell Linux Desktop" will show up as "sles". The 'opensuse' detection was updated to handle older openSuSE releases as well as the well known SuSE Linux releases, starting from 6.0. Everything else with a /etc/SuSE-release file will show up as "suse-based". Here is a collection of release files: ==> Dist/6.0/etc/SuSE-release <== SuSE Linux 6.0 (i386) VERSION = 6.0 ==> Dist/6.1/etc/SuSE-release <== SuSE Linux 6.1 (i386) VERSION = 6.1 ==> Dist/6.2/etc/SuSE-release <== SuSE Linux 6.2 (i386) VERSION = 6.2 ==> Dist/6.3/etc/SuSE-release <== SuSE Linux 6.3 (i386) VERSION = 6.3 ==> Dist/6.4/etc/SuSE-release <== SuSE Linux 6.4 (i386) VERSION = 6.4 ==> Dist/7.0/etc/SuSE-release <== SuSE Linux 7.0 (i386) VERSION = 7.0 ==> Dist/7.1/etc/SuSE-release <== SuSE Linux 7.1 (i386) VERSION = 7.1 ==> Dist/7.2/etc/SuSE-release <== SuSE Linux 7.2 (i386) VERSION = 7.2 ==> Dist/7.3/etc/SuSE-release <== SuSE Linux 7.3 (i386) VERSION = 7.3 ==> Dist/8.0/etc/SuSE-release <== SuSE Linux 8.0 (i386) VERSION = 8.0 ==> Dist/8.1/etc/SuSE-release <== SuSE Linux 8.1 (i386) VERSION = 8.1 ==> Dist/8.2/etc/SuSE-release <== SuSE Linux 8.2 (x86-64) VERSION = 8.2 ==> Dist/9.0/etc/SuSE-release <== SuSE Linux 9.0 (x86-64) VERSION = 9.0 ==> Dist/9.1/etc/SuSE-release <== SuSE Linux 9.1 (x86-64) VERSION = 9.1 ==> Dist/9.2/etc/SuSE-release <== SuSE Linux 9.2 (x86-64) VERSION = 9.2 ==> Dist/9.3/etc/SuSE-release <== SuSE Linux 9.3 (x86-64) VERSION = 9.3 ==> Dist/10.0/etc/SuSE-release <== SUSE LINUX 10.0 (X86-64) OSS VERSION = 10.0 ==> Dist/10.1-remastered/etc/SuSE-release <== SUSE LINUX 10.1 (X86-64) VERSION = 10.1 ==> Dist/10.1/etc/SuSE-release <== SUSE Linux 10.1 (X86-64) Beta8 VERSION = 10.1 ==> Dist/10.2/etc/SuSE-release <== openSUSE 10.2 (X86-64) VERSION = 10.2 ==> Dist/10.3/etc/SuSE-release <== openSUSE 10.3 (X86-64) VERSION = 10.3 ==> Dist/11.0/etc/SuSE-release <== openSUSE 11.0 (X86-64) VERSION = 11.0 ==> Dist/11.1/etc/SuSE-release <== openSUSE 11.1 (x86_64) VERSION = 11.1 ==> Dist/11.2/etc/SuSE-release <== openSUSE 11.2 (x86_64) VERSION = 11.2 ==> Dist/11.3/etc/SuSE-release <== openSUSE 11.3 (x86_64) VERSION = 11.3 ==> Dist/11.4/etc/SuSE-release <== openSUSE 11.4 (x86_64) VERSION = 11.4 CODENAME = Celadon ==> Dist/12.1/etc/SuSE-release <== openSUSE 12.1 (x86_64) VERSION = 12.1 CODENAME = Asparagus ==> Dist/12.2/etc/SuSE-release <== openSUSE 12.2 (x86_64) VERSION = 12.2 CODENAME = Mantis ==> Dist/sles8/etc/SuSE-release <== SuSE SLES-8 (AMD64) VERSION = 8.1 ==> Dist/sles9/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 ==> Dist/sles9sp2/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 2 ==> Dist/sles9sp3/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 3 ==> Dist/sles9sp4/etc/SuSE-release <== SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 4 ==> Dist/sled10/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 ==> Dist/sled10sp1/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 1 ==> Dist/sled10sp2/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 2 ==> Dist/sled10sp3/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 3 ==> Dist/sled10sp4/etc/SuSE-release <== SUSE Linux Enterprise Desktop 10 (x86_64) VERSION = 10 PATCHLEVEL = 4 ==> Dist/sled11/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 0 ==> Dist/sled11sp1/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 1 ==> Dist/sled11sp2/etc/SuSE-release <== SUSE Linux Enterprise Desktop 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 ==> Dist/sles10/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 ==> Dist/sles10sp1/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 1 ==> Dist/sles10sp2/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 2 ==> Dist/sles10sp3/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 3 ==> Dist/sles10sp4/etc/SuSE-release <== SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 4 ==> Dist/sles11/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 0 ==> Dist/sles11sp1/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 1 ==> Dist/sles11sp2/etc/SuSE-release <== SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 Signed-off-by: Olaf Hering <olaf@aepfle.de>
* launch: Make the "launched failed" message more explanatory.Richard W.M. Jones2012-09-201-0/+1
| | | | | | | Since this is the most common error seen by people who have installation problems, buggy qemu, etc, and since no one reads the FAQ, describe in this error message what resources are available to debug launch problems.
* syntax: Remove definitions of O_CLOEXEC, except in examples (thanks Jim ↵Richard W.M. Jones2012-09-171-4/+0
| | | | | | | Meyering). The gnulib <fcntl.h> replacement header will now define this symbol if it's not defined already.
* shutdown: Add 'check_for_errors' hint along the shutdown path.Richard W.M. Jones2012-09-041-1/+2
| | | | | | | | This hint tells the backend whether anyone cares about errors when the appliance is shut down. Currently this only has any effect on the libvirt backend, where it controls whether or not we use the VIR_DOMAIN_DESTROY_GRACEFUL flag.
* guestfs-internal.h: Organize functions by file.Richard W.M. Jones2012-08-311-45/+75
| | | | | | | | | | | This is almost just code motion. While doing this I discovered two prototypes for functions which no longer exist: * guestfs___launch_appliance * guestfs___launch_unix so these prototypes have been removed. The rest are rearranged more logically.
* launch: appliance: app.virtio_scsi must not be bool.Richard W.M. Jones2012-08-301-1/+1
| | | | | | This is used to store values 0..3, so it mustn't be a bool. Ooops. RHEL 5's gcc revealed this bug.
* Update inspection and example programs to use new hivex* APIs (RHBZ#852394).Richard W.M. Jones2012-08-291-8/+0
| | | | | | | | | | | | | | | | | | | | | | | I tested this by comparing the output of virt-inspector over Windows guests before and after the change, which was identical: $ md5sum `ls -1 /tmp/*.before /tmp/*.after` c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.after c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.before eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.after eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.before d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.after d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.before 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.after 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.before a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.after a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.before 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.after 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.before fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.after fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.before 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.after 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.before
* launch: Add utility function guestfs___lazy_make_tmpdir.Richard W.M. Jones2012-08-151-0/+1
| | | | | | This lets us create g->tmpdir lazily earlier if needed. This commit is just code motion.
* lib: Add 'g->unique' to handle, for making unique IDs.Richard W.M. Jones2012-08-151-0/+6
|
* New internal APIs: internal-test-set-output, internal-test-close-output.Richard W.M. Jones2012-08-151-0/+3
| | | | | | | | These internal (testing) APIs allow the bindtests output to be sent to some other place than stdout. This is necessary for Erlang, since stdout is used to communicate with the Erlang interpreter.
* Mac OS X: #define UNIX_PATH_MAX 104Masami HIRATA2012-07-241-0/+4
| | | | | | See http://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man4/unix.4.html Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
* launch: Make get-pid and max-disks APIs into virtual methods of the current ↵Richard W.M. Jones2012-07-231-0/+3
| | | | attach-method.
* launch: Add libvirt backend.Richard W.M. Jones2012-07-221-0/+6
| | | | | | | | | | | | Complete the attach-method libvirt backend. This backend uses libvirt to create a transient KVM domain to run the appliance. Note that this still will only work with local libvirt URIs since the <kernel>, <initrd> and appliance links in the libvirt XML refer to local files, and virtio serial only works locally (limitation of libvirt). Remote support will be added later.
* Add attach-method "libvirt" or "libvirt:<URI>".Richard W.M. Jones2012-07-211-1/+5
| | | | | With this commit, you can set the attach method to libvirt, but calling launch will give an error.
* launch: Make 'drive_name' into a common function.Richard W.M. Jones2012-07-211-0/+1
| | | | This is just code motion.
* launch: Abstract attach method operations.Richard W.M. Jones2012-07-201-9/+27
| | | | | | g->attach_ops points to a structure which contains the operations supported by each attach method backend (ie. appliance, unix, etc.).
* launch: Move the command line building code entirely into launch-appliance.c.Richard W.M. Jones2012-07-201-1/+1
| | | | | Although we still use the handle as convenient temporary storage.
* launch: Move guestfs_config API and build list of qemu parameters in handle.Richard W.M. Jones2012-07-201-0/+10
| | | | | | Move and rewrite guestfs_config so it accumulates a list of qemu parameters in the handle. These are added to the appliance at launch time (with attach method == unix:... you'll now get an error).
* launch: Move launch timing / messages code into launch.c.Richard W.M. Jones2012-07-201-2/+3
|
* lib: Use bool (from <stdbool.h>) for a few fields in the handle.Richard W.M. Jones2012-07-201-10/+12
|
* lib: Rearrange fields in guestfs handle.Richard W.M. Jones2012-07-201-39/+38
| | | | Arrange the fields more logically. This is just code motion.
* lib: Split launch.c into separate files.Richard W.M. Jones2012-07-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | launch-appliance.c contains the code associated with the 'appliance' attach-method. Mostly. In fact there are a few APIs which don't fit so nicely: - config: deprecated API which fiddles with the qemu command line directly - max-disks: depends on the qemu implementation (virtio-scsi or not) - debug-drives: used for testing only launch-unix.c contains the code associated with 'unix:<path>'. launch.c is the common code for launching, along with a few other APIs such as guestfs_add_drive_opts. This commit also reduces the number of headers to just those which are required.
* Rename qemu option cache=off to cache=none.Richard W.M. Jones2012-07-021-1/+1
| | | | | Note that qemu treats these identically, so this change has no functional effect.
* lib: Remove obsolete NETWORK, ROUTER definitions in header file.Richard W.M. Jones2012-06-251-21/+0
| | | | These haven't been used since we switched over to virtio-serial.
* appliance: Add support for virtio-scsi.Richard W.M. Jones2012-06-121-0/+3
| | | | This requires febootstrap >= 3.15.
* Record output of qemu -device '?'.Richard W.M. Jones2012-06-121-0/+1
| | | | | This allows us to find out what qemu devices are supported at runtime.
* configure: Allow systemtap/DTrace userspace probes to be disabled.Richard W.M. Jones2012-05-111-2/+2
| | | | | | | | | './configure --disable-probes' will disable these probes. Otherwise they are autodetected as before. The <sys/sdt.h> produces lots of errors when you try to compile with these probes enabled under clang, so it is necessary to provide a way to disable them for clang users.
* Remove "convenience header" "gettext.h" and use <libintl.h> instead.Richard W.M. Jones2012-05-011-6/+2
| | | | | | | | | | | | gettextize provides a local file called "gettext.h". Remove this and use <libintl.h> from glibc headers instead. Most of this change is mechanical: #include <libintl.h> in every C file which uses any gettext function. But also we remove the gettext.h file, and adjust the "_" macros. Note that this effectively removes the ./configure --disable-nls option, although we don't know if that ever worked.
* lib: Remove the BUSY state.Richard W.M. Jones2012-04-261-3/+1
| | | | | | | | | | | | | | | Originally this state was intended so that in some way you could find out if the appliance was running a command. However there was never a thread-safe way to access the state of the handle, so in effect you could never do anything useful safely with this information. This commit completely removes the BUSY state. The only visible change is to the guestfs_is_busy API. Previously you could never call this safely from another thread. If you called it from the same thread it would always return false (since the current thread can't be running a libguestfs command at that point by definition). Now it always returns false.
* New APIs: mount-local, mount-local-run, umount-local (FUSE support in the API).Richard W.M. Jones2012-03-291-0/+15
| | | | | | | | | | Add FUSE support directly to the API. Instead of needing to use the external 'guestmount' command, you can mount the libguestfs filesystem space on a local mountpoint using an API call from any language. Note that although mount-local-run is marked as Cancellable, the current implementation does not support it, but it would be relatively simple to add it.
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.