aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_aoutils.c
Commit message (Collapse)AuthorAgeFilesLines
* libxl: react correctly to bootloader pty master POLLHUPIan Jackson2012-08-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Receive POLLHUP on the bootloader master pty is not an error. Hopefully it means that the bootloader has exited and therefore the pty slave side has no process group any more. (At least NetBSD indicates POLLHUP on the master in this case.) So send the bootloader SIGTERM; if it has already exited then this has no effect (except that on some versions of NetBSD it erroneously returns ESRCH and we print a harmless warning) and we will then collect the bootloader's exit status and be satisfied. However, we remember that we have done this so that if we got POLLHUP for some other reason than that the bootloader exited we report something resembling a useful message. In order to implement this we need to provide a way for users of datacopier to handle POLLHUP rather than treating it as fatal. We rename bootloader_abort to bootloader_stop since it now no longer only applies to error situations. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: Do not pass NULL as gc_opt; introduce NOGCIan Jackson2012-06-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 25182:6c3345d7e9d9 the practice of passing NULL to gc-using memory allocation functions was introduced. However, the arrangements there were not correct as committed, because the error handling and logging depends on getting a ctx from the gc - so an allocation error would in fact result in libxl dereferencing NULL. Instead, provide a special dummy gc in the ctx, called `nogc_gc'. It is marked out specially by having alloc_maxsize==-1, which is otherwise invalid. Functions which need to actually look into the gc use the new test function gc_is_real (whose purpose is mainly clarity of the code) to check whether the gc is the dummy one, and do nothing if it is. And we provide a helper macro NOGC which uses the in-scope real gc to find the ctx and hence the dummy gc (and which replaces the previous #define NOGC NULL). Change all callers which pass 0 or NULL to an allocation function to use NOGC or &ctx->nogc_gc, as applicable in the context. We add a comment near the definition of LIBXL_INIT_GC pointing out that it isn't any more the only place a libxl__gc struct is initialised, for the benefit of anyone changing the contents of gc's in the future. Also, actually document that libxl__ptr_add is legal with ptr==NULL, and change a couple of calls not to check for NULL argument. Reported-by: Bamvor Jian Zhang <bjzhang@suse.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Bamvor Jian Zhang <bjzhang@suse.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: datacopier: provide "prefix data" facilityIan Jackson2012-06-281-0/+22
| | | | | | | | This will be used to write the qemu data banner to the save/migration stream. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix build on platforms where openpty's parameters are not const.Christoph Egger2012-05-171-2/+2
| | | | | | | | | | | | | | | | | | | Such as NetBSD. Fixes this build error: libxl_aoutils.c: In function 'libxl__openptys': libxl_aoutils.c:281:13: error: passing argument 4 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct termios *' but argument is of type 'const struct termios *' libxl_aoutils.c:281:13: error: passing argument 5 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct winsize *' but argument is of type 'const struct winsize *' Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: log bootloader outputIan Jackson2012-05-111-0/+10
| | | | | | | | | | | | This involves adding a new log feature to libxl__datacopier, and then using it. If the bootloader exits nonzero we print the log filename in a log message from libxl. 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>
* libxl: provide libxl__openpty_*Ian Jackson2012-05-111-0/+127
| | | | | | | | | | General facility for ao operations to open ptys. This will be used by the bootloader machinery. 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>
* libxl: provide libxl__datacopier_*Ian Jackson2012-05-111-0/+189
General facility for ao operations to shovel data between fds. This will be used by the bootloader machinery. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Changes in v7: * assert that the ao is non-null on _init. Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>