Page MenuHomeFreeBSD

echo(1): Replace errexit() with err(3)

Authored by christos on Oct 14 2021, 10:36 PM.
Referenced Files
Unknown Object (File)
Mon, Oct 30, 9:33 AM
Unknown Object (File)
Sep 23 2023, 2:57 AM
Unknown Object (File)
Sep 23 2023, 2:54 AM
Unknown Object (File)
Sep 22 2023, 6:51 PM
Unknown Object (File)
Sep 22 2023, 11:39 AM
Unknown Object (File)
Sep 17 2023, 10:40 AM
Unknown Object (File)
Sep 7 2023, 9:15 PM
Unknown Object (File)
Sep 6 2023, 10:27 AM



errexit() was supposed to be used in order to avoid
linking-in stdio, but err(3) is used in other parts of
the code already, so there's no reason to keep errexit().

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

christos added reviewers: hselasky, imp.

Is this a revert of a previous commit? Then it should be mentioned.

Is this a revert of a previous commit? Then it should be mentioned.

After a quick search through the commit history, I guess not.

Did you try "git blame bin/echo/echo.c" ?

Look at this:

commit 91b7d6dc5871f532b1a86ee76389a9bc348bdf58
Author: Diomidis Spinellis <>
Date:   Sat Oct 11 20:34:43 2003 +0000

    - Check and report write(2) errors.
    - Issue a single writev(2) call instead of multiple write(2)s.
      This change improves the inefficiencies introduced when echo
      went on an stdio diet.
    The following figures are for echoing 1000 arguments.
    original stdio-based echo:
            0.01 real         0.01 user         0.00 sys
            0.05 real         0.00 user         0.04 sys
            0.01 real         0.00 user         0.00 sys

    svn path=/head/; revision=121010

So errexit() was introduced when they wanted to avoid using
stdio. Now err(3) was already being used, so is this really a revert?
Also this cannot be a performance issue -- both errexit() and err(3)
would only get called once after all.

Include whole file in diff.

Looks good. Let's see how it goes.

This revision is now accepted and ready to land.Nov 9 2021, 8:58 PM
This revision was automatically updated to reflect the committed changes.