search for: guestfs_int_perrorf

Displaying 15 results from an estimated 15 matches for "guestfs_int_perrorf".

2017 Feb 14
2
Re: [PATCH v3 04/10] lib/osinfo.c: Extract xml processing into a callback
...An extra line has been added to this comment. > +#ifndef GUESTFS_PRIVATE > +void guestfs_int_debug (guestfs_h *g, const char *fs, ...) > +{ > + va_list args; > + > + va_start (args, fs); > + vfprintf (stderr, fs, args); > + va_end (args); > +} > + > +void > +guestfs_int_perrorf (guestfs_h *g, const char *fs, ...) > +{ > + va_list args; > + CLEANUP_FREE char *msg = NULL; > + int err; > + > + va_start (args, fs); > + err = vasprintf (&msg, fs, args); > + va_end (args); > + > + if (err < 0) return; > + > + perror(msg); >...
2017 Jun 27
0
[PATCH v3 3/5] threads: Use thread-local storage for errors.
...error_data'. + * + * When it is NULL, it means the stack is empty (in that thread) and + * the default handler (default_error_cb) is installed. + * + * As soon as the current thread calls guestfs_set_error_handler, + * guestfs_push_error_handler, or an error is set in the handle (calls + * like guestfs_int_perrorf and so on), the key is created and + * initialized with a pointer to a real 'struct error_data'. + * + * All the 'struct error_data' structures associated with one handle + * are linked together in a linked list, so that we are able to free + * them when the handle is closed. (The...
2015 Jun 06
0
[PATCH 3/5] threads: Use thread-local storage for errors.
...error_data'. + * + * When it is NULL, it means the stack is empty (in that thread) and + * the default handler (default_error_cb) is installed. + * + * As soon as the current thread calls guestfs_set_error_handler, + * guestfs_push_error_handler, or an error is set in the handle (calls + * like guestfs_int_perrorf and so on), the key is created and + * initialized with a pointer to a real 'struct error_data'. + * + * All the 'struct error_data' structures associated with one handle + * are linked together in a linked list, so that we are able to free + * them when the handle is closed. (The...
2015 Jun 16
5
[PATCH threads v2 0/5] Add support for thread-safe handle.
Previous discussion here: https://www.redhat.com/archives/libguestfs/2015-June/thread.html#00048 v2: - Use a cleanup handler to release the lock. - Rebase to upstream. Note I have not fixed the problem(s) with error handling (patch 3).
2017 Feb 14
0
Re: [PATCH v3 04/10] lib/osinfo.c: Extract xml processing into a callback
...fndef GUESTFS_PRIVATE > > +void guestfs_int_debug (guestfs_h *g, const char *fs, ...) > > +{ > > +  va_list args; > > + > > +  va_start (args, fs); > > +  vfprintf (stderr, fs, args); > > +  va_end (args); > > +} > > + > > +void > > +guestfs_int_perrorf (guestfs_h *g, const char *fs, ...) > > +{ > > +  va_list args; > > +  CLEANUP_FREE char *msg = NULL; > > +  int err; > > + > > +  va_start (args, fs); > > +  err = vasprintf (&msg, fs, args); > > +  va_end (args); > > + > > +  if (err...
2017 Jun 27
9
[PATCH v3 0/5] threads: Add support for thread-safe handle.
Previously posted in 2015: v1: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html v2: https://www.redhat.com/archives/libguestfs/2015-June/msg00118.html I have rebased and tidied up the patches, fixing a few spelling mistakes, but they are broadly the same as before. I also ran all the tests, which pass. As with the previous versions, this makes a change to the API, where you
2015 Jun 06
7
[PATCH 0/5] Add support for thread-safe handle.
This patch isn't ready to go upstream. In fact, I think we might do a quick 1.30 release soon, and save this patch, and also the extensive changes proposed for the test suite[1], to after 1.30. Currently it is not safe to use the same handle from multiple threads, unless you implement your own mutexes. See: http://libguestfs.org/guestfs.3.html#multiple-handles-and-multiple-threads These
2017 Feb 10
0
[PATCH v3 04/10] lib/osinfo.c: Extract xml processing into a callback
...static void free_osinfo_db_entry (struct osinfo *); -#define XMLSTREQ(a,b) (xmlStrEqual((a),(b)) == 1) +#ifndef GUESTFS_PRIVATE +void guestfs_int_debug (guestfs_h *g, const char *fs, ...) +{ + va_list args; + + va_start (args, fs); + vfprintf (stderr, fs, args); + va_end (args); +} + +void +guestfs_int_perrorf (guestfs_h *g, const char *fs, ...) +{ + va_list args; + CLEANUP_FREE char *msg = NULL; + int err; + + va_start (args, fs); + err = vasprintf (&msg, fs, args); + va_end (args); + + if (err < 0) return; + + perror(msg); +} +#endif /* GUESTFS_PRIVATE */ /* Given one or more fields f...
2015 Jun 06
0
[PATCH 2/5] threads: Acquire and release the lock around each public guestfs_* API.
...} + +static int +unlocked_last_errno (guestfs_h *g) +{ + return g->last_errnum; } int guestfs_last_errno (guestfs_h *g) { - return g->last_errnum; + int r; + + ACQUIRE_LOCK (g); + r = unlocked_last_errno (g); + RELEASE_LOCK (g); + return r; } static void @@ -164,36 +186,64 @@ guestfs_int_perrorf (guestfs_h *g, const char *fs, ...) void guestfs_set_out_of_memory_handler (guestfs_h *g, guestfs_abort_cb cb) { + ACQUIRE_LOCK (g); g->abort_cb = cb; + RELEASE_LOCK (g); +} + +static guestfs_abort_cb +unlocked_get_out_of_memory_handler (guestfs_h *g) +{ + return g->abort_cb; } g...
2017 Jul 21
6
[PATCH v3 REPOST 0/5] threads: Add support for thread-safe handle.
Previously posted in 2015: v1: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html v2: https://www.redhat.com/archives/libguestfs/2015-June/msg00118.html This series was posted about 4 weeks ago: v3: https://www.redhat.com/archives/libguestfs/2017-June/msg00287.html There is no change in this series except I rebased it against current upstream head and retested. Last time there
2017 Feb 10
0
[PATCH v3 05/10] lib: extract osinfo DB traversing API
...ck callback, void *opaque); -static int read_osinfo_db_xml (guestfs_h *g, const char *pathname, void *data); -static void free_osinfo_db_entry (struct osinfo *); +#include "osinfo.h" #ifndef GUESTFS_PRIVATE void guestfs_int_debug (guestfs_h *g, const char *fs, ...) @@ -109,82 +79,6 @@ guestfs_int_perrorf (guestfs_h *g, const char *fs, ...) } #endif /* GUESTFS_PRIVATE */ -/* Given one or more fields from the header of a CD/DVD/ISO, look up - * the media in the libosinfo database and return our best guess for - * the operating system. - * - * This returns: - * -1 => a fatal error ('error...
2017 Feb 10
15
[PATCH v3 00/10] Introducing virt-builder-repository
Hi guys, Here is a v3 of the series, including changes to answer Richard's comments. Cédric Bosdonnat (10): mllib: factorize code to add Checksum.get_checksum function Move xml and xpath_helpers OCAML code to mllib mllib: add Xml.parse_file helper lib/osinfo.c: Extract xml processing into a callback lib: extract osinfo DB traversing API mllib: ocaml wrapper for lib/osinfo
2017 Feb 07
0
[PATCH v2 3/7] mllib: expose libosinfo DB reading functions in mllib
...->iso_application_id || - !match (g, isoinfo->iso_application_id, osinfo_db[i].re_application_id)) - continue; - } + va_start (args, fs); + vfprintf (stderr, fs, args); + va_end (args); +} - debug (g, "osinfo: mapped disk to database entry %zu", i); +void +guestfs_int_perrorf (guestfs_h *g, const char *fs, ...) +{ + va_list args; + CLEANUP_FREE char *msg = NULL; + int err; - if (osinfo_ret) - *osinfo_ret = &osinfo_db[i]; - return 1; - } + va_start (args, fs); + err = vasprintf (&msg, fs, args); + va_end (args); - debug (g, "osinfo: no...
2017 Feb 07
11
[PATCH v2 0/7] Introducing virt-builder-repository
Hi all, Here is a new version of the virt-builder-repository series taking care of Pino's comments. It has also been rebased on recent master. Cédric Bosdonnat (7): mllib: factorize code to add Checksum.get_checksum function Move xml and xpath_helpers OCAML code to mllib mllib: expose libosinfo DB reading functions in mllib builder: rename docs test script builder: add
2015 Feb 14
2
[PATCH 0/2] Change guestfs__*
libguestfs has used double and triple underscores in identifiers. These aren't valid for global names in C++. (http://stackoverflow.com/a/228797) These large but completely mechanical patches change the illegal identifiers to legal ones. Rich.