From patchwork Thu Oct 10 10:27:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Pratt X-Patchwork-Id: 98655 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CB253857710 for ; Thu, 10 Oct 2024 10:27:52 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by sourceware.org (Postfix) with ESMTPS id E5E8F3857C7A for ; Thu, 10 Oct 2024 10:27:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E5E8F3857C7A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=pm.me ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E5E8F3857C7A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.70.40.133 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728556057; cv=none; b=JyMx/KN6phvHRxE8wVZ2DXNIdea4xmNWAx/3+fl5oLV3rEI9GjsXmW7KsXwVLVu42jatI4g/q80LEHMTmL3QOdpk9ItmRvt69AqWJUuelYaDZ5LkuOWYGJ16HidwCmvKIn8OhyzKyPta216JLyeq+PPJD8jc4x5PT+ECEzeURMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728556057; c=relaxed/simple; bh=mVod5Pwt36/zh94jrwrc3eNTYv1WFG+9I7KOZ5+KhVU=; h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version; b=KC/F7Z0H/oivKure0ouXy384R5Rn+B79/2Tp75cLfxH7hDkb+0bLkfC9AqnS8Ymdncnn0+lecmNNWH4nVZ3L2eOzmXl76NRleV7jenluRsdyN5U+mQQ8+6wYoDUmqjGiEp5mrEidTGZDxvUbJdPCVZdl5jqqcTCa9tbfl7gZStE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1728556049; x=1728815249; bh=rTgSsf0ZjvQs5adEeqz+uPldJIH2pzt5mORT7xKusrg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=RRjRtyZ/e3CPwygqrPrWtkHgQjbnje40I5s4n8ipTIxCR1Khz69ODR1B+ux/Vnfra IOBce28qgbmiZNUiNFij/4Iviva4uyG+9391yRpu5lbpVynDgNAmzekyiNaVUo7A3Y FChROYhhQDALrbSflP35ddAilFClnupcJ/boJgsfqvHqOpUPQwmCHLu0g8TcLf9hpz 1lDe0Hy1DMvm0kmwLSygGdfXyll2YlZYkc4Xy6z4zaO/ZH76HKLLw2iHrtXgCYxay3 qd02AYdTFljouw2PEa4kSHafQFmIRfuGFfU21iWOTxLCyZd4MxUnmDb3N40j+SaXY9 2DZ16lp80etsw== Date: Thu, 10 Oct 2024 10:27:23 +0000 To: elfutils-devel@sourceware.org From: Michael Pratt Cc: Michael Pratt Subject: [PATCH 5/6] Remove usage of "unlocked" variant of stdio print functions Message-ID: <20241010102559.9162-6-mcpratt@pm.me> In-Reply-To: <20241010102559.9162-1-mcpratt@pm.me> References: <20241010102559.9162-1-mcpratt@pm.me> Feedback-ID: 27397442:user:proton X-Pm-Message-ID: 0acabf80ff9d3535b9e18144faac2d311293bf0f MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org These Linux Standard Base functions are not available on all systems that are capable of building Linux and ELFs. The difference is negligible for simple printing to stdout. POSIX also states for the similar putc_unlocked(): These functions can safely be used in a multi-threaded program if and only if they are called while the invoking thread owns the (FILE *) object, as is the case after a successful call to the flockfile() or ftrylockfile() functions. and These unlocked versions can be safely used only within explicitly locked program regions, using exported locking primitives. and this was never done. There is inconsistent use of fputc_unlocked() mixed with putc_unlocked() and putchar_unlocked(), so consistently use the safer fputc() instead. Signed-off-by: Michael Pratt --- libasm/asm_align.c | 4 +- libcpu/i386_parse.y | 4 +- libebl/eblobjnote.c | 4 +- src/nm.c | 20 +++++----- src/objdump.c | 24 ++++++------ src/readelf.c | 90 ++++++++++++++++++++++----------------------- src/size.c | 8 ++-- src/strings.c | 20 +++++----- tests/showptable.c | 8 ++-- 9 files changed, 91 insertions(+), 91 deletions(-) diff --git a/libasm/asm_align.c b/libasm/asm_align.c index 3a976756..19ec9a13 100644 --- a/libasm/asm_align.c +++ b/libasm/asm_align.c @@ -60,13 +60,13 @@ asm_align (AsmScn_t *asmscn, GElf_Word value) fprintf (asmscn->ctx->out.file, "%02hhx\n", asmscn->pattern->bytes[0]); else { - fputc_unlocked ('"', asmscn->ctx->out.file); + fputc ('"', asmscn->ctx->out.file); for (size_t cnt = 0; cnt < asmscn->pattern->len; ++cnt) fprintf (asmscn->ctx->out.file, "\\x%02hhx", asmscn->pattern->bytes[cnt]); - fputs_unlocked ("\"\n", asmscn->ctx->out.file); + fputs ("\"\n", asmscn->ctx->out.file); } return 0; } diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y index 459684c6..5c91e520 100644 --- a/libcpu/i386_parse.y +++ b/libcpu/i386_parse.y @@ -1158,7 +1158,7 @@ instrtable_out (void) EMIT_SUFFIX (w1); EMIT_SUFFIX (W1); - fputc_unlocked ('\n', outfile); + fputc ('\n', outfile); for (int i = 0; i < 3; ++i) { @@ -1333,7 +1333,7 @@ instrtable_out (void) b = b->next; } - fputc_unlocked ('\n', outfile); + fputc ('\n', outfile); } fputs ("};\n", outfile); } diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c index ad3f49de..da69e99c 100644 --- a/libebl/eblobjnote.c +++ b/libebl/eblobjnote.c @@ -648,10 +648,10 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type, for (size_t cnt = 1; cnt < descsz / 4; ++cnt) { if (cnt > 1) - putchar_unlocked ('.'); + fputc ('.', stdout); printf ("%" PRIu32, buf[cnt]); } - putchar_unlocked ('\n'); + fputc ('\n', stdout); } if (descsz / 4 > FIXED_TAG_BYTES) free (buf); diff --git a/src/nm.c b/src/nm.c index 3675f59b..06f1a072 100644 --- a/src/nm.c +++ b/src/nm.c @@ -439,7 +439,7 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, Elf_Arhdr *arhdr = NULL; size_t arhdr_off = 0; /* Note: 0 is no valid offset. */ - fputs_unlocked (_("\nArchive index:\n"), stdout); + fputs (_("\nArchive index:\n"), stdout); while (arsym->as_off != 0) { @@ -825,8 +825,8 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname, /* If we have to precede the line with the file name. */ if (print_file_name) { - fputs_unlocked (fullname, stdout); - putchar_unlocked (':'); + fputs (fullname, stdout); + fputc (':', stdout); } /* Convert the address. */ @@ -972,8 +972,8 @@ show_symbols_bsd (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx, /* If we have to precede the line with the file name. */ if (print_file_name) { - fputs_unlocked (fullname, stdout); - putchar_unlocked (':'); + fputs (fullname, stdout); + fputc (':', stdout); } bool is_tls = GELF_ST_TYPE (syms[cnt].sym.st_info) == STT_TLS; @@ -1046,8 +1046,8 @@ show_symbols_bsd (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx, } if (color_mode) - fputs_unlocked (color_off, stdout); - putchar_unlocked ('\n'); + fputs (color_off, stdout); + fputc ('\n', stdout); } #ifdef USE_DEMANGLE @@ -1104,9 +1104,9 @@ show_symbols_posix (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx, /* If we have to precede the line with the file name. */ if (print_file_name) { - fputs_unlocked (fullname, stdout); - putchar_unlocked (':'); - putchar_unlocked (' '); + fputs (fullname, stdout); + fputc (':', stdout); + fputc (' ', stdout); } printf ("%s %c%s", symstr, diff --git a/src/objdump.c b/src/objdump.c index d43c1dd6..e081db64 100644 --- a/src/objdump.c +++ b/src/objdump.c @@ -580,12 +580,12 @@ show_full_content (Ebl *ebl, const char *fname, uint32_t shstrndx) printf ("%02hhx%02hhx%02hhx%02hhx ", cp[inner], cp[inner + 1], cp[inner + 2], cp[inner + 3]); - fputc_unlocked (' ', stdout); + fputc (' ', stdout); for (size_t inner = 0; inner < 16; ++inner) - fputc_unlocked (isascii (cp[inner]) && isprint (cp[inner]) + fputc (isascii (cp[inner]) && isprint (cp[inner]) ? cp[inner] : '.', stdout); - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); } printf (" %04zx ", cnt); @@ -601,14 +601,14 @@ show_full_content (Ebl *ebl, const char *fname, uint32_t shstrndx) for (inner = 2 * (16 - inner) + (16 - inner + 3) / 4 + 1; inner > 0; --inner) - fputc_unlocked (' ', stdout); + fputc (' ', stdout); for (inner = 0; inner < remaining; ++inner) - fputc_unlocked (isascii (cp[inner]) && isprint (cp[inner]) + fputc (isascii (cp[inner]) && isprint (cp[inner]) ? cp[inner] : '.', stdout); - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); } } @@ -640,12 +640,12 @@ disasm_output (char *buf, size_t buflen, void *arg) printf ("%8" PRIx64 ": ", (uint64_t) info->addr); if (info->bytes_color != NULL) - fputs_unlocked (info->bytes_color, stdout); + fputs (info->bytes_color, stdout); size_t cnt; for (cnt = 0; cnt < (size_t) MIN (info->cur - info->last_end, 8); ++cnt) printf (" %02" PRIx8, info->last_end[cnt]); if (info->bytes_color != NULL) - fputs_unlocked (color_off, stdout); + fputs (color_off, stdout); printf ("%*s %.*s\n", (int) (8 - cnt) * 3 + 1, "", (int) buflen, buf); @@ -663,12 +663,12 @@ disasm_output (char *buf, size_t buflen, void *arg) printf ("%8" PRIx64 ": ", (uint64_t) info->addr); if (info->bytes_color != NULL) - fputs_unlocked (info->bytes_color, stdout); + fputs (info->bytes_color, stdout); for (; cnt < (size_t) (info->cur - info->last_end); ++cnt) printf (" %02" PRIx8, info->last_end[cnt]); if (info->bytes_color != NULL) - fputs_unlocked (color_off, stdout); - putchar_unlocked ('\n'); + fputs (color_off, stdout); + fputc ('\n', stdout); info->addr += info->cur - info->last_end - 8; } diff --git a/src/readelf.c b/src/readelf.c index 21cacd7b..a524a64b 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -1127,7 +1127,7 @@ print_file_type (unsigned short int e_type) static void print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) { - fputs_unlocked (_("ELF Header:\n Magic: "), stdout); + fputs (_("ELF Header:\n Magic: "), stdout); for (size_t cnt = 0; cnt < EI_NIDENT; ++cnt) printf (" %02hhx", ehdr->e_ident[cnt]); @@ -1154,7 +1154,7 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) printf (_(" ABI Version: %hhd\n"), ehdr->e_ident[EI_ABIVERSION]); - fputs_unlocked (_(" Type: "), stdout); + fputs (_(" Type: "), stdout); print_file_type (ehdr->e_type); const char *machine = dwelf_elf_e_machine_string (ehdr->e_machine); @@ -1196,9 +1196,9 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) printf (_(" (%" PRIu32 " in [0].sh_info)"), (uint32_t) shdr->sh_info); else - fputs_unlocked (_(" ([0] not available)"), stdout); + fputs (_(" ([0] not available)"), stdout); } - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); printf (_(" Size of section header entries: %" PRId16 " %s\n"), ehdr->e_shentsize, _("(bytes)")); @@ -1213,9 +1213,9 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) printf (_(" (%" PRIu32 " in [0].sh_size)"), (uint32_t) shdr->sh_size); else - fputs_unlocked (_(" ([0] not available)"), stdout); + fputs (_(" ([0] not available)"), stdout); } - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); if (unlikely (ehdr->e_shstrndx == SHN_XINDEX)) { @@ -1406,7 +1406,7 @@ There are %zd section headers, starting at offset %#" PRIx64 ":\n\ } } - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); } @@ -1552,22 +1552,22 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) && shdr->sh_addr >= relro_from && shdr->sh_addr + shdr->sh_size <= relro_to) { - fputs_unlocked (" [RELRO:", stdout); + fputs (" [RELRO:", stdout); in_relro = true; } else if (has_relro && in_relro && shdr->sh_addr >= relro_to) { - fputs_unlocked ("]", stdout); + fputs ("]", stdout); in_relro = false; } else if (has_relro && in_relro && shdr->sh_addr + shdr->sh_size > relro_to) - fputs_unlocked ("] p_type == PT_LOAD && (phdr->p_flags & PF_W) == 0) { if (!in_ro) { - fputs_unlocked (" [RO:", stdout); + fputs (" [RO:", stdout); in_ro = true; } } @@ -1592,12 +1592,12 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) { if ((phdr2->p_flags & PF_W) == 0 && !in_ro) { - fputs_unlocked (" [RO:", stdout); + fputs (" [RO:", stdout); in_ro = true; } else if ((phdr2->p_flags & PF_W) != 0 && in_ro) { - fputs_unlocked ("]", stdout); + fputs ("]", stdout); in_ro = false; } } @@ -1610,16 +1610,16 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) if (has_relro && in_relro && shdr->sh_addr + shdr->sh_size > relro_to) { - fputs_unlocked (">", stdout); + fputs (">", stdout); in_relro = false; } } } if (in_relro || in_ro) - fputs_unlocked ("]", stdout); + fputs ("]", stdout); /* Finish the line. */ - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); } } @@ -1788,8 +1788,8 @@ print_flags (int class, GElf_Xword d_val, const struct flags *flags, if (d_val & flags[cnt].mask) { if (!first) - putchar_unlocked (' '); - fputs_unlocked (flags[cnt].str, stdout); + fputc (' ', stdout); + fputs (flags[cnt].str, stdout); d_val &= ~flags[cnt].mask; first = false; } @@ -1797,11 +1797,11 @@ print_flags (int class, GElf_Xword d_val, const struct flags *flags, if (d_val != 0) { if (!first) - putchar_unlocked (' '); + fputc (' ', stdout); printf ("%#0*" PRIx64, class == ELFCLASS32 ? 10 : 18, d_val); } - putchar_unlocked ('\n'); + fputc ('\n', stdout); } @@ -1909,7 +1909,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) phdr->p_offset); } - fputs_unlocked (_(" Type Value\n"), stdout); + fputs (_(" Type Value\n"), stdout); /* if --use-dynamic option is enabled, use the string table to get the related library info. */ @@ -1953,7 +1953,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) case DT_BIND_NOW: case DT_TEXTREL: /* No further output. */ - fputc_unlocked ('\n', stdout); + fputc ('\n', stdout); break; case DT_NEEDED: @@ -2147,7 +2147,7 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) elf_strptr (ebl->elf, shstrndx, shdr->sh_name), shdr->sh_offset, nentries); - fputs_unlocked (class == ELFCLASS32 + fputs (class == ELFCLASS32 ? _("\ Offset Type Value Name\n") : _("\ @@ -2336,7 +2336,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) elf_strptr (ebl->elf, shstrndx, shdr->sh_name), shdr->sh_offset, nentries); - fputs_unlocked (class == ELFCLASS32 + fputs (class == ELFCLASS32 ? _("\ Offset Type Value Addend Name\n") : _("\ @@ -2795,7 +2795,7 @@ process_symtab (Ebl *ebl, unsigned int nsyms, Elf64_Word idx, } } - putchar_unlocked ('\n'); + fputc ('\n', stdout); } } @@ -2877,7 +2877,7 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) (unsigned int) shdr->sh_link, elf_strptr (ebl->elf, shstrndx, glink->sh_name)); - fputs_unlocked (class == ELFCLASS32 + fputs (class == ELFCLASS32 ? _("\ Num: Value Size Type Bind Vis Ndx Name\n") : _("\ @@ -3553,12 +3553,12 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { ssize_t n; case 0: - fputs_unlocked (_(" 0 *local* "), + fputs (_(" 0 *local* "), stdout); break; case 1: - fputs_unlocked (_(" 1 *global* "), + fputs (_(" 1 *global* "), stdout); break; @@ -3575,7 +3575,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) break; } } - putchar_unlocked ('\n'); + fputc ('\n', stdout); } @@ -3623,7 +3623,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx, uint64_t success = 0; /* xgettext:no-c-format */ - fputs_unlocked (_("\ + fputs (_("\ Length Number % of total Coverage\n"), stdout); printf (_(" 0 %6" PRIu32 " %5.1f%%\n"), counts[0], (counts[0] * 100.0) / nbucket); @@ -4045,7 +4045,7 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr) if (unlikely (*p++ != 'A')) return; - fputs_unlocked (_(" Owner Size\n"), stdout); + fputs (_(" Owner Size\n"), stdout); /* Loop over the sections. */ while (left (data, p) >= 4) @@ -7138,7 +7138,7 @@ print_encoding_base (const char *pfx, unsigned int fde_encoding) if (w & 0x70) { if (w != fde_encoding) - fputc_unlocked (' ', stdout); + fputc (' ', stdout); w = print_relinfo (w); } @@ -9678,7 +9678,7 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, { get_uleb128 (u128, linep, lineendp); if (n != standard_opcode_lengths[opcode]) - putc_unlocked (',', stdout); + fputc (',', stdout); printf (" %u", u128); } @@ -10431,7 +10431,7 @@ print_debug_macinfo_section (Dwfl_Module *dwflmod __attribute__ ((unused)), \nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), elf_ndxscn (scn), section_name (ebl, shdr), (uint64_t) shdr->sh_offset); - putc_unlocked ('\n', stdout); + fputc ('\n', stdout); /* There is no function in libdw to iterate over the raw content of the section but it is easy enough to do. */ @@ -10593,7 +10593,7 @@ print_debug_macro_section (Dwfl_Module *dwflmod __attribute__ ((unused)), \nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), elf_ndxscn (scn), section_name (ebl, shdr), (uint64_t) shdr->sh_offset); - putc_unlocked ('\n', stdout); + fputc ('\n', stdout); /* Get the source file information for all CUs. Uses same datastructure as macinfo. But uses offset field to directly @@ -10746,15 +10746,15 @@ print_debug_macro_section (Dwfl_Module *dwflmod __attribute__ ((unused)), goto invalid_data; args--; if (args > 0) - putchar_unlocked (','); + fputc (',', stdout); } } else printf (_(" no arguments.")); - putchar_unlocked ('\n'); + fputc ('\n', stdout); } } - putchar_unlocked ('\n'); + fputc ('\n', stdout); int level = 1; if (readp + 1 > readendp) @@ -10923,14 +10923,14 @@ print_debug_macro_section (Dwfl_Module *dwflmod __attribute__ ((unused)), if (args > 0) printf (", "); } - putchar_unlocked ('\n'); + fputc ('\n', stdout); } if (readp + 1 > readendp) goto invalid_data; opcode = *readp++; if (opcode == 0) - putchar_unlocked ('\n'); + fputc ('\n', stdout); } } } @@ -11266,7 +11266,7 @@ print_debug_frame_hdr_section (Dwfl_Module *dwflmod __attribute__ ((unused)), /* +4 because of the 4 byte header of the section. */ (uint64_t) shdr->sh_offset + 4 + eh_frame_ptr); - putchar_unlocked ('\n'); + fputc ('\n', stdout); } uint64_t fde_count = 0; @@ -11444,7 +11444,7 @@ print_debug_exception_table (Dwfl_Module *dwflmod __attribute__ ((unused)), else if (ar_disp != 0) puts (" -> ???"); else - putchar_unlocked ('\n'); + fputc ('\n', stdout); ++u; } while (readp < action_table_end); @@ -13098,19 +13098,19 @@ handle_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, nregloc == 0 ? nhdr->n_descsz : 0, items, nitems); if (colno != 0) - putchar_unlocked ('\n'); + fputc ('\n', stdout); colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset, reglocs, nregloc); if (colno != 0) - putchar_unlocked ('\n'); + fputc ('\n', stdout); } static void handle_notes_data (Ebl *ebl, const GElf_Ehdr *ehdr, GElf_Off start, Elf_Data *data) { - fputs_unlocked (_(" Owner Data size Type\n"), stdout); + fputs (_(" Owner Data size Type\n"), stdout); if (data == NULL) goto bad_note; diff --git a/src/size.c b/src/size.c index ff8ca075..2985bc09 100644 --- a/src/size.c +++ b/src/size.c @@ -411,7 +411,7 @@ show_sysv (Elf *elf, const char *prefix, const char *fname, maxlen = MAX (maxlen, (int) strlen (name)); } - fputs_unlocked (fname, stdout); + fputs (fname, stdout); if (prefix != NULL) printf (_(" (ex %s)"), prefix); printf (":\n%-*s %*s %*s\n", @@ -483,7 +483,7 @@ show_sysv_one_line (Elf *elf) continue; if (! first) - fputs_unlocked (" + ", stdout); + fputs (" + ", stdout); first = false; printf ((radix == radix_hex ? "%" PRIx64 "(%s)" @@ -555,7 +555,7 @@ show_bsd (Elf *elf, const char *prefix, const char *fname, fname); if (prefix != NULL) printf (_(" (ex %s)"), prefix); - fputs_unlocked ("\n", stdout); + fputs ("\n", stdout); total_textsize += textsize; total_datasize += datasize; @@ -607,7 +607,7 @@ show_segments (Elf *elf, const char *fullname) continue; if (! first) - fputs_unlocked (" + ", stdout); + fputs (" + ", stdout); first = false; printf (radix == radix_hex ? "%" PRIx64 "(%c%c%c)" diff --git a/src/strings.c b/src/strings.c index 69d09ccf..fe0f3a48 100644 --- a/src/strings.c +++ b/src/strings.c @@ -345,8 +345,8 @@ process_chunk_mb (const char *fname, const unsigned char *buf, off_t to, /* We found a match. */ if (unlikely (fname != NULL)) { - fputs_unlocked (fname, stdout); - fputs_unlocked (": ", stdout); + fputs (fname, stdout); + fputs (": ", stdout); } if (unlikely (radix != radix_none)) @@ -357,7 +357,7 @@ process_chunk_mb (const char *fname, const unsigned char *buf, off_t to, if (unlikely (*unprinted != NULL)) { - fputs_unlocked (*unprinted, stdout); + fputs (*unprinted, stdout); free (*unprinted); *unprinted = NULL; } @@ -366,8 +366,8 @@ process_chunk_mb (const char *fname, const unsigned char *buf, off_t to, assume the file data is encoded in UCS-2/UTF-16 or UCS-4/UTF-32 respectively we could convert the string. But there is no such guarantee. */ - fwrite_unlocked (start, 1, buf - start, stdout); - putc_unlocked ('\n', stdout); + fwrite (start, 1, buf - start, stdout); + fputc ('\n', stdout); } start = ++buf; @@ -413,8 +413,8 @@ process_chunk (const char *fname, const unsigned char *buf, off_t to, /* We found a match. */ if (likely (fname != NULL)) { - fputs_unlocked (fname, stdout); - fputs_unlocked (": ", stdout); + fputs (fname, stdout); + fputs (": ", stdout); } if (likely (radix != radix_none)) @@ -425,12 +425,12 @@ process_chunk (const char *fname, const unsigned char *buf, off_t to, if (unlikely (*unprinted != NULL)) { - fputs_unlocked (*unprinted, stdout); + fputs (*unprinted, stdout); free (*unprinted); *unprinted = NULL; } - fwrite_unlocked (start, 1, buf - start, stdout); - putc_unlocked ('\n', stdout); + fwrite (start, 1, buf - start, stdout); + fputc ('\n', stdout); } start = ++buf; diff --git a/tests/showptable.c b/tests/showptable.c index a794b0e8..3d0552fe 100644 --- a/tests/showptable.c +++ b/tests/showptable.c @@ -111,11 +111,11 @@ main (int argc, char *argv[]) (unsigned long long int) phdr->p_memsz, (unsigned long long int) phdr->p_align); - putc_unlocked ((phdr->p_flags & PF_X) ? 'X' : ' ', stdout); - putc_unlocked ((phdr->p_flags & PF_W) ? 'W' : ' ', stdout); - putc_unlocked ((phdr->p_flags & PF_R) ? 'R' : ' ', stdout); + fputc ((phdr->p_flags & PF_X) ? 'X' : ' ', stdout); + fputc ((phdr->p_flags & PF_W) ? 'W' : ' ', stdout); + fputc ((phdr->p_flags & PF_R) ? 'R' : ' ', stdout); - putc_unlocked ('\n', stdout); + fputc ('\n', stdout); if (phdr->p_type == PT_INTERP) {