search for: gl_lock_

Displaying 4 results from an estimated 4 matches for "gl_lock_".

Did you mean: gl_lock_t
2018 Feb 10
0
Re: [PATCH] Add a cache for iconv_t handles to hive_t
...AM +0100, Hilko Bengen wrote: > * Richard W.M. Jones: > > >> +threadlib > >> ' > > > > Probably better to keep these sorted. > > When I rebuilt from scratch, it turned out that threadlib was not > enough. Using the "lock" module with the gl_lock_{init,lock,unlock} > instead of glthread_lock_{init,lock,unlock} as described in lock.h seems > correct, though. I have pushed that change. > > > I wonder if there's a way we can avoid hard-coding ‘4’ here, which > > AIUI is the size of the enum type. Maybe adding an extra...
2018 Feb 09
3
[PATCH] Add a cache for iconv_t handles to hive_t
It was brought to my attention that dumping a registry hive causes a lot of time spent in disk I/O activity because iconv_open() and iconv_close() are called for every key. Every iconv_open() call causes /usr/lib/.../gconv/$ENCODING.so to be opened and mapped. The iconv_t handles are now cached in the hive_h struct; they are opened on-demand and re-used. On my ~10 year old Lenovo T60, I have
2018 Feb 09
0
Re: [PATCH] Add a cache for iconv_t handles to hive_t
...You'll probably need to rerun ./bootstrap after this. (2) Read ‘.gnulib/modules/threadlib’ and follow the instructions for modifying configure.ac and Makefile.am. (3) Replace #include <pthread.h> -> #include "glthread/lock.h". (4) Replace any calls to pthread_mutex_* with gl_lock_*. It's probably not necessary to check return codes, unless they need to be recursive in which case use gl_recursive_lock_* instead. > #ifdef HAVE_MMAP > #include <sys/mman.h> > #else > @@ -62,6 +65,32 @@ header_checksum (const hive_h *h) > > #define HIVEX_OPEN_M...
2018 Feb 09
2
[PATCH] Add a cache for iconv_t handles to hive_t
...))) == 0) +typedef enum { + utf8_to_latin1 = 0, + latin1_to_utf8, + utf8_to_utf16le, + utf16le_to_utf8, +} recode_type; + struct hive_h { char *filename; int fd; @@ -79,6 +88,11 @@ struct hive_h { /* Internal data for mmap replacement */ void *p_winmap; #endif + + struct { + gl_lock_t mutex; + iconv_t *handle; + } iconv_cache[4]; }; /* Format of registry blocks. NB. All fields are little endian. */ @@ -282,17 +296,16 @@ extern void _hivex_free_offset_list (offset_list *list); extern size_t * _hivex_return_offset_list (offset_list *list); extern void _hivex_print_offse...