aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore
Commit message (Collapse)AuthorAgeFilesLines
* xenstore: check socket path length before copying itMatthew Daley2013-09-251-0/+4
| | | | | | Coverity-ID: 1055997 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstored: fix faulty check for bad handle in domain_initMatthew Daley2013-09-251-1/+1
| | | | | | | Coverity-ID: 1054975 Coverity-ID: 1055196 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstored: handle unlikely failure better in ask_parentsMatthew Daley2013-09-251-1/+3
| | | | | | Coverity-ID: 1055277 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstored: fix possible, but unlikely, stack overflowMatthew Daley2013-09-131-1/+1
| | | | | | | | | ...when reading xenbus port from xenfs. Coverity-ID: 1055741 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: Bump some library sonamesIan Jackson2013-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | libxc (libxenctrl, libxenguest): New claim_enabled field in struct xc_dom_image; New nr_outstanding_pages field in struct xc_dominfo; New fields in struct xc_hvm_build_args (xenguest.h). libxl: new fields in dominfo domain_build_info device_vfb device_vkb device_disk etc. etc. etc. libxlu #includes libxl headers so needs to inherit its new soname Use Xen version for new sonames since we don't in fact guarantee ABI (as opposed to API) stability across releases. xenstore (libxenstore): New flag XS_UNWATCH_FILTER, so bump minor version only. This was the result of reviewing the output from: git-checkout staging cd tools git-diff RELEASE-4.2.2 `find -name \*.h` Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: create pidfile in init-xenstore-domainDaniel De Graaf2013-05-012-2/+15
| | | | | | | | | | | | Since libxl checks for the existance of /var/run/xenstored.pid in order to ensure xenstore is running, create this file when starting the xenstore stub domain. This also changes the Makefile to enable the creation of the init-xenstore-domain tool during tools compilation, since the existing Makefile incorrectly added to the ALL_TARGETS list when compiling the stubdom, when this variable is not used. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* Switch to poll() in cxenstored's IO loopWei Liu2013-04-112-60/+133
| | | | | | | | | | | | | | | | | Poll() can support more file descriptors than select(). We've done this for xenconsoled, now do this for cxenstored as well. The code is taken from xenconsoled and modified to adapt to cxenstored. Note that poll() semantic is a bit different from select(). In Linux, if a fd is set in IN/OUT fd_set and error occurs inside select(), this fd is still considered readable / writable, and it is set in the returned IN/OUT fd_set. So in later handle_input / handle_output, the connection will eventually be talloc_free'ed(). After switching to poll(), we should take care of any error right away, making the code clearer. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxenstore: filter watch events in libxenstore when we unwatchJulien Grall2012-12-172-8/+97
| | | | | | | | | | | | | | | | | | | | XenStore puts in queued watch events via a thread and notifies the user. Sometimes xs_unwatch is called before all related message is read. The use case is non-threaded libevent, we have two event A and B: - Event A will destroy something and call xs_unwatch; - Event B is used to notify that a node has changed in XenStore. As the event is called one by one, event A can be handled before event B. So on next xs_watch_read the user could retrieve an unwatch token and a segfault occured if the token store the pointer of the structure (ie: "backend:0xcafe"). To avoid problem with previous application using libXenStore, this behaviour will only be enabled if XS_UNWATCH_FILTER is given to xs_open. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Julien Grall <julien.grall@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore-chmod: handle arbitrary number of perms rather than MAX_PERMS constantChunyan Liu2012-11-271-21/+17
| | | | | | | | | | | Constant MAX_PERMS 16 is too small to use in some occasions, e.g. if there are more than 16 domU(s) on one hypervisor (it's easy to achieve) and one wants to do xenstore-chmod PATH to all domU(s). So, remove MAX_PERMS limitation and make it as arbitrary number of perms. Signed-off-by: Chunyan Liu <cyliu@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* tools: Remove the vtpm process modelMatthew Fioravante2012-11-133-3/+0
| | | | | | | | | Remove the old vtpm process model. It doesn't work very well and is no longer supported. Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* tools: bump SONAMEs for changes during 4.2 development cycle.Ian Campbell2012-09-251-1/+1
| | | | | | | | | | | We mostly did this as we went along, only a couple of minor number bumps were missed http://marc.info/?l=xen-devel&m=134366054929255&w=2: - Bumped libxl from 1.0.0 -> 1.0.1 - Bumped libxenstore from 3.0.1 -> 3.0.2 Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* Fix libxenstore memory leak when USE_PTHREAD is not definedAndres Lagar-Cavilla2012-09-171-4/+13
| | | | | | | | | | | Redefine usage of pthread_cleanup_push and _pop, to explicitly call free for heap objects in error paths. By the way, set a suitable errno value for an error path that had none. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xenstore: set read_thread stacksizeSimon Rowe2012-06-071-1/+16
| | | | | | | | | | xs_watch() creates a thread to wake watchers using default attributes. The stacksize can be quite large (8 MB on Linux), applications that link against xenstore end up having a larger memory footprint than necessary. Signed-off-by: Simon Rowe <simon.rowe@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: block signals in watch wakeup threadSimon Rowe2012-06-071-0/+7
| | | | | | | | | | The thread created to wakeup watchers is not intended to handle signals (and a later patch will reduce it's stack size which makes it unsuitable for doing so). Signed-off-by: Simon Rowe <simon.rowe@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstore: fix crash on platforms with no gntdev driver implementation.Christoph Egger2012-05-291-2/+2
| | | | | | | | | Fix pointer checks introduced in changeset 24757:aae516b78fce. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* nstore: rename public xenstore headersIan Campbell2012-05-1416-21/+30
| | | | | | | | | | | | | | | | | | | | | | The xenstore header xs.h is producing conflicts with other software[1]. xs is a too short identifier and does not matche the library. Renaming the headers to xenstore.h and xenstore_lib.h is the easiest way to make them easy recognizable and prevent furthe problems. [1]: http://bugs.debian.org/668550 [ Also update QEMU_TAG, to bring in corresponding change to qemu-xen-traditional. -iwj ] Signed-off-by: Bastian Blank <waldi@debian.org> 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> --HG-- rename : tools/xenstore/xs.h => tools/xenstore/xenstore.h rename : tools/xenstore/xs_lib.h => tools/xenstore/xenstore_lib.h
* xenstore: Portability: do not build init-xenstore-domain if stubdom disabledChristoph Egger2012-03-011-1/+2
| | | | | | | | Build stubxenstore only when building stubdomains. Fixes build failure on platforms w/o the relevant ioctl. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenstored: Add stub domain builderDaniel De Graaf2012-02-092-3/+102
| | | | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: add --priv-domid parameterDaniel De Graaf2012-02-093-1/+7
| | | | | | | | | | | | This parameter identifies an alternative service domain which has superuser access to the xenstore database, which is currently required to set up a new domain's xenstore entries. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: use domain_is_unprivileged instead of checking conn->idDaniel De Graaf2012-02-092-7/+7
| | | | | | | | | | | This centralizes all the permission checking for privileged domains in preparation for allowing domains other than dom0 to be privileged. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: add --event parameter for bootstrappingDaniel De Graaf2012-02-094-3/+13
| | | | | | | | | | | | When xenstored is run in a minios domain, it needs a bootstrap connection to dom0 so that additional domain introduce messages can be sent to it. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: support running in minios stubdomDaniel De Graaf2012-02-097-82/+195
| | | | | | | | | | | | | A previous versions of this patch has been sent to xen-devel. See http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01655.html Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: add --internal-db flagDaniel De Graaf2012-02-091-6/+14
| | | | | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: support for tdb_copy with TDB_INTERNALAlex Zeffertt2012-02-091-0/+35
| | | | | | | | | | | | | | The tdb_copy function should honor the TDB_INTERNAL flag for in-memory databases; this is required to run in mini-os which does not use a filesystem. Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: add NO_SOCKETS compilation optionAlex Zeffertt2012-02-091-5/+23
| | | | | | | | | | | | | Add option for compiling xenstored without unix sockets to support running on mini-OS Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: refactor socket setup codeDaniel De Graaf2012-02-091-39/+46
| | | | | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* xenstored: use grant references instead of map_foreign_rangeAlex Zeffertt2012-02-091-6/+48
| | | | | | | | | | | | | | | | | | | | make xenstored use grantref rather than map_foreign_range (which can only be used by privileged domains) This patch modifies the xenstore daemon to use xc_gnttab_map_grant_ref instead of xc_map_foreign_range where available. Previous versions of this patch have been sent to xen-devel. See http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00610.html http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01492.html Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* 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>