aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore
Commit message (Collapse)AuthorAgeFilesLines
* xenstore: New function xs_path_is_subpathIan Jackson2012-01-132-0/+24
| | | | | | | | | This utility function compares two paths, textually and reports whether one is a subpath (a child path) of the other. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxenstore: Provide xs_check_watchIan Jackson2011-12-123-13/+94
| | | | | | | | | | | | | | Event-driven programs want to wait until the xs_fileno triggers for reading, and then repeatedly call xs_check_watch. Also xs_read_watch exposes a useless "num" out parameter, which should always (if things aren't going hideously wrong) be at least 2 and which the caller shouldn't be interested in. So xs_check_watch doesn't have one of those. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstore: xenbus cannot be opened read-onlyDaniel De Graaf2011-11-221-10/+8
| | | | | | | | | In order to read keys from xenstore, the xenstore libraries need to write the request to the xenbus socket. This means that the socket cannot be opened read-only. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools/build: Introduce {PREPEND,APPEND}_{LIB,INCLUDES}Roger Pau Monne2011-11-141-5/+5
| | | | | | | | | | | | | | | | | | | | | | | Create two new variables called APPEND_ and PREPEND_ to add compile flags at the beginning or at the end of the search path. Added a new semantic for user defined compile flags, here is the list of possible options: PREPEND_LIB: add libraries to the search path before xen (before xen installation folders). PREPEND_INCLUDES: add headers to the search path before xen (before xen installation folders). APPEND_LIB: add libraries to the search path at the end (after all xen installation folders have been added). APPEND_INCLUDES: add libraries to the search path at the end (after all xen installation folders have been added). EXTRA_INCLUDES and EXTRA_LIB can still be used, and they will have the same effect as PREPEND_INCLUDES and PREPEND_LIB. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstored: Fix processing of zero-length messagesDaniel De Graaf2011-11-011-1/+0
| | | | | | | | | | | When a message with zero length is sent to xenstore, the body of the message was not processed until the socket or ring had more data to read; this will cause deadlocks if the requestor is waiting on a response to continue. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstored: allow guest to shutdown all its watches/transactionsOlaf Hering2011-09-153-0/+17
| | | | | | | | | | | | | | | | During kexec all old watches have to be removed, otherwise the new kernel will receive unexpected events. Allow a guest to reset itself and cleanup all of its watches and transactions. Add a new XS_RESET_WATCHES command to do the reset on behalf of the guest. (Changes by iwj: specify the argument to be a single nul byte. Permit read-only clients to use the new command.) Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Revert 23757:f5176c177b99 "xenstored: allow guests to reintroduce themselves"Ian Jackson2011-08-091-14/+7
| | | | | | | This patch seems to have been applied by mistake, despite adverse comments on the list and a lack of an appropriate ack. Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstored: allow guests to reintroduce themselvesOlaf Hering2011-08-091-7/+14
| | | | | | | | | During kexec all old watches have to be removed, otherwise the new kernel will receive unexpected events. Allow a guest to introduce itself and cleanup all of its watches. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* tools: Remove $(CFLAGS) from links lines.Ian Campbell2011-03-311-5/+5
| | | | | | | | The relevant variable in these circumstances is called $(LDFLAGS). Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: xenstored: make usage info of xenstored accurateJuergen Gross2011-03-311-1/+1
| | | | | | | | The usage printed for xenstored was not in sync with the parameters defined in the code. Signed-off-by: juergen.gross@ts.fujitsu.com Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: blktap2: copy xenstore/hashtable.h into blktap2Ian Campbell2011-03-313-0/+18
| | | | | | | | | | | | | hashtable.c has already been copied, forked and modified, there doesn't seem much point in avoiding the same for the header until someone feels motivated to properly refactor. Add comments to the various duplicated files cross-referencing each other for future reference and as a barrier to forking again... Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: consistently use $({CFLAGS,LDLIBS}_libxenstore) instead of open coding.Ian Campbell2011-03-211-2/+2
| | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* build: Make XEN_ROOT an absolute path.Keir Fraser2011-03-171-1/+1
| | | | | | | | Otherwise make can search the path relative to certain standard paths such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in Config.mk suffers from this). Signed-off-by: Keir Fraser <keir@xen.org>
* libxc: convert evtchn interfaces to use an opaque handle typeIan Campbell2010-12-233-12/+8
| | | | | | | | | | | | This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also fix some references to "struct xc_interface" which should have been simply "xc_interface" in tools/xenpaging, and update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: set implicit path for socket connectionsIan Campbell2010-12-161-1/+1
| | | | | | | | | | | | | | For now assume all such connections come from domain 0. Failure to do this breaks various scripts which assume that they operate relative to the domains "home directory". This matches the behaviour of the ocaml xenstored. Thanks to report from Olaf Hering. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: new XS_OPEN_SOCKETONLY flag; honour "-s" on tools' cmdlineIan Jackson2010-12-143-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "-s" option to xenstore-ls is used by the xencommons startup script to check whether xenstored is already running, before starting it. Since 22498:a40455ae9ad3, "-s" has been a no-op, and libxenstore will always fall back to using xenbus. The combined effect is that the xencommons script deadlocks: xenstore-ls hangs waiting for xenstored, which isn't started by xencommons because xencommons is waiting for xenstore-ls. In this patch, we: * Introduce a new XS_OPEN_SOCKETONLY flag which disables the fallback behaviour; * Make the xenstore command line tools use the new xs_open call rather than the old, deprecated xs_open_* calls (which are now identical). * Plumb the xenstore command line tools "-s" option to set the XS_OPEN_SOCKETONLY flag. * Change the type of the XS_OPEN_* flags so that they naturally have type unsigned long. The "-s" option to xenstore-ls et al, and the XS_OPEN_SOCKETONLY flag, are intended for use by toolstack infrastructure and should not normally be used by higher-level code. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Adds an open xenstore connection function which tries to use the xenbusStefano Stabellini2010-12-132-8/+50
| | | | | | | | | | interface (xs_domain_open) when the socket interface (xs_daemon_opn) fails. Signed-off-by: Mihir Nanavati <mihirn@cs.ubc.ca> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* xenstore: add xenstore-watch command line clientIan Campbell2010-10-212-4/+47
| | | | | | | | | | | | | | | | | | | # xenstore-watch x | while read w ; do > echo "watch fired on $w" > echo "value" $(xenstore-read $w) > echo > done # xenstore-write x/y/z 42 output from while loop: watch fired on x/t/z value 42 [ also add line to .hgignore - iwj ] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstored: return EINVAL for attempt to watch invalid pathIan Campbell2010-10-211-1/+1
| | | | | | | errno is essentially random at this point. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools/xenstore: libxenstore: fix threading bug which cause xend startup hangIan Jackson2010-09-101-10/+34
| | | | | | | | | | | | | | | | | | | | | | If a multithreaded caller creates a thread which calls xs_read_watch, before it has set any watches with xs_watch, the thread in xs_read_watch will enter read_message and sit reading the xenstored fd without the appropriate locks held. Other threads can then concurrently read the xenstored fd, which naturally does not work very well. Symptoms of this bug which I have been able to reproduce include failure of xend startup to finish, due to a deadlock; results could also include reading corrupted data from xenstore. In this patch we arrange for xs_read_watch to always rely on the reader thread created by xs_watch. If no watches have been set, then xs_read_watch will block until one has been. If the library is compiled non-threaded xs_read_watch unconditionally does the reading in the current thread. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* tools/xenstore: correctly handle errors from read_messageDaniel De Graaf2010-09-011-17/+31
| | | | | | | | | | | | | | | | | | The return value of read_message needs to be checked in order to avoid waiting forever for a message if there is an error on the communication channel with xenstore. Currently, this is only checked if USE_PTHREAD is defined (by checking for read thread exit), and that path is prone to deadlock if request_mutex is held while waiting. Since the failure of read_message leaves the socket in an undefined state, close the socket and force all threads waiting on a read to return. This also fixes xs_read_watch in the case where a read thread is not running (in particular, this will happen if !USE_PTHREAD) by having it read from the communication channel in the same way as read_reply. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* split LDLIBS from LDFLAGS to fix link errors in recent toolchainsStefano Stabellini2010-08-111-2/+2
| | | | | | | | | | | | | | | | Linker command lines are order-sensitive. Move linker options -Lfoo -lfoo from LDFLAGS to LDLIBS and place this new variable after the objects to link. This resolves build errors in xenpagin and blktap with recent toolchains. rename SHLIB_CFLAGS to SHLIB_LDFLAGS rename LDFLAGS_* to LDLIBS_* move LDFLAGS usage after CFLAGS in CC calls remove stale comments in xenpaging Makefile Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools/xenstore: add XS_RESTRICT operation to C xenstore client libs.Ian Jackson2010-07-062-0/+17
| | | | | | | | | The OCaml xenstored supports the XS_RESTRICT operation, which deprivileges a dom0 xenstore connection so it can only affect one domain's entries. Add the relevant definitions to the C libraries so that callers can use it. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* libxc: eliminate static variables, use xentoollog; API changeKeir Fraser2010-05-281-5/+6
| | | | | | | | | | | | | | | | | | | | This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: Make sure that libxs reports an error if xenstored dropsKeir Fraser2010-05-271-3/+33
| | | | | | | the connection, rather than getting stuck forever. Patch from: Steven Smith <steven.smith@eu.citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* xenstore: Fix cleanup_pop() definition for some (buggy) pthread.h headers.Keir Fraser2010-05-131-2/+8
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xs: avoid pthread_join deadlock in xs_daemon_closeKeir Fraser2010-05-121-4/+4
| | | | | | | | | | Doing a pthread_cancel and join on the reader thread while holding all the request/reply/watch mutexes can deadlock if the thread needs to take any of those mutexes to exit. Kill off the reader thread before taking any mutexes (which should be redundant if we're single-threaded at that point). Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
* xs: make sure mutexes are cleaned up and memory freed if the read thread is ↵Keir Fraser2010-05-121-16/+30
| | | | | | | | | cancelled If the read thread is terminated with pthread cancel, it must make sure all memory is freed and mutexes are unlocked. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
* xenstored: Always build and install.Keir Fraser2010-05-071-4/+4
| | | | | | It coexists quite happily with oxenstored. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* ocaml: remove hook to external repository.Keir Fraser2010-05-061-5/+0
| | | | Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
* xenstore,libxl: cleanup of xenstore connections across fork()Keir Fraser2010-04-122-19/+36
| | | | | | | | | | | | | | | Provide a new function xs_daemon_destroy_postfork which can be called by a libxenstore user who has called fork, to close the fd for the connection to xenstored and free the memory, without trying to do anything to any threads which libxenstore may have created. Use this new function in libxl_fork, to avoid accidental use of a xenstore connection in both parent and child. Also, fix the doc comment for libxl_spawn_spawn to have the success return codes the right way round. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstore: Resolve gcc4.5 type errorKeir Fraser2010-03-061-1/+1
| | | | | | | Without this, gcc 4.5 complains with, error: case value '3' not in enumerated type 'const enum xs_perm_type' Signed-off-by: Charles Arnold <carnold@novell.com>
* xenstore: Fix memory leak in command 'xenstore rm'Keir Fraser2009-12-211-2/+4
| | | | | | | | When option '-t' is used to do tidy remove, routine xs_directory() will be called in order to check there are brother directories or not. The returned pointer should be passed to free() after this check. Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
* xenstore: Fix the method of get options and the usageKeir Fraser2009-12-181-6/+7
| | | | | | | | | Add long option '--flat' correspond to short option '-f', and let it just can be used for subcommand 'ls' (because in fact it's useless for subcommand 'read' and 'list'). And fix the usage of subcommands 'ls', 'list' and 'chmod'. Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
* Remove redundant semicolonsKeir Fraser2009-07-011-1/+1
| | | | Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@jp.fujitsu.com>
* ocaml-xenstored: Allow to build ocaml xenstored instead of C versionKeir Fraser2009-05-191-2/+9
| | | | | | | | To use, set CONFIG_OCAML_XENSTORED=y at build time. Then the build system will automatically download the remote repo to tools/ocaml-xenstored. Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
* xenstore: Add brief notice regarding xenstore protocol limits to xs.h.Keir Fraser2009-04-301-0/+5
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xenstore: Don't hardcode install pathKeir Fraser2009-03-201-2/+2
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Move the suspend event channel function to libxc, it will use theKeir Fraser2009-03-182-0/+26
| | | | | | /var/lib/xen/suspend_evtchn_lock.d to protect the access. Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
* xenstored: fix use-after free bugKeir Fraser2009-03-011-2/+4
| | | | | | | | | | | Problem: Handling requests for one connection can not only zap the connection itself, due to socket disconnects for example. It can also zap *other* connections, due to domain release requests. Especially it can zap the connection we have saved a pointer to in the "next" variable. From: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Use -MMD -MF in tools/* rather than -Wp,-M...Keir Fraser2009-01-121-6/+2
| | | | | | | | | | | | | | | | | | | | | | If you use -MMD -MF then the correct .o filename is written to the .*.d file as the compiler driver arranges everything. This was done in 19010:275abe1c5d24 for the hypervisor. In this patch we do the same elsewhere in the xen-unstable tree, particularly tools/. Specifically: * Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS. * Remove -Wp,-MD... from every other Makefile * Remove setting of DEPS from every other Makefile * Ensure that every Makefile says -include $(DEPS) * Ensure that every Makefile's clean target removes $(DEPS) Some Makefiles were already halfway there, but often for a different variable name eg PROG_DEP. The variable name is now standardised in Rules.mk as DEPS. I have done a test build with this change, on Debian etch. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: Fix a memory leak in 'xs_is_domain_introduced'.Keir Fraser2008-09-111-2/+5
| | | | Signed-off-by: Konrad Rzeszutek <konrad@virtualiron.com>
* tools: Declare functions static where they should be, and provideKeir Fraser2008-07-154-21/+4
| | | | | | proper prototypes for others as required. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* xenstore: Fix error path broken by c/s 17816Keir Fraser2008-06-101-2/+2
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* xenstore: cleanupsKeir Fraser2008-06-102-8/+21
| | | | | | | | | | Attached patch uses calloc() for hash allocation. This makes sure, the allocated memory is always initialized. Also cleanup error handling a bit. On *BSD avoid conflicts with BSD list macros. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Fix xenstore-client.c compileKeir Fraser2008-05-011-2/+3
| | | | | | | errx() is not necessarily defined as a never-returns function. Fix lookup_mode() to account for this. Signed-off-by: John Levon <john.levon@sun.com>
* xemnstored: Fix xenstored abort when connection dropped.Keir Fraser2008-05-011-9/+21
| | | | | | | | | | | | | If a connection is dropped with pending input and output data then the connection will be dereferenced by both handle_input and handle_output resulting in a double free when the main loop dereferences the connection. Fix this issue by taking/releasing a reference over the calls to handle_input and handle_output separately and checking the result of talloc_free to see if the connection went away. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: Place return statement in the correct place to fix the build.Keir Fraser2008-04-091-2/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xenstore: fix canonicalize for metanodesKeir Fraser2008-04-092-2/+2
| | | | Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* xenstore: fix Solaris compile with newer GCC versionsKeir Fraser2008-04-091-0/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>