diff options
| author | Mark Wielaard <[email protected]> | 2018-06-03 09:28:10 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-06-04 18:53:43 +0200 |
| commit | e635a79cda230b646f70951d7e1f17325443e84d (patch) | |
| tree | 6c3e16856580dd2febdf42b3d07c56c79dabc721 /src | |
| parent | 4ebab8e470f38f2203c9adf57000993e318c433f (diff) | |
readelf: Call __fsetlocking (stdout, FSETLOCKING_BYCALLER).
We only call printf on stdout from one thread, so we don't need internal
stdio locking for stdout.
On my machine eu-readelf -N --debug-dump=info libxul.so > /dev/null
goes from 65 seconds to 63 seconds.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/readelf.c | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cc12d836..19f42107 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2018-06-04 Mark Wielaard <[email protected]> + + * readelf.c (main): Call __fsetlocking (stdout, FSETLOCKING_BYCALLER). + 2018-05-31 Mark Wielaard <[email protected]> * readelf.c (print_debug_units): Print the dwo name and id when diff --git a/src/readelf.c b/src/readelf.c index 0725313e..a578b276 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -35,6 +35,8 @@ #include <locale.h> #include <stdarg.h> #include <stdbool.h> +#include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> #include <strings.h> @@ -310,6 +312,9 @@ static void dump_archive_index (Elf *, const char *); int main (int argc, char *argv[]) { + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + /* Set locale. */ setlocale (LC_ALL, ""); |
