Page MenuHomeFreeBSD

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

Authored by christos on Oct 14 2021, 10:36 PM.
Tags
None
Referenced Files
F80145603: D32501.diff
Thu, Mar 28, 1:22 PM
Unknown Object (File)
Fri, Mar 15, 12:25 PM
Unknown Object (File)
Fri, Mar 15, 12:24 PM
Unknown Object (File)
Fri, Mar 15, 12:24 PM
Unknown Object (File)
Mon, Mar 11, 4:19 PM
Unknown Object (File)
Mon, Mar 11, 4:19 PM
Unknown Object (File)
Fri, Mar 8, 2:17 AM
Unknown Object (File)
Thu, Mar 7, 7:58 AM
Subscribers

Details

Summary

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

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

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 <dds@FreeBSD.org>
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
    before:
            0.05 real         0.00 user         0.04 sys
    after:
            0.01 real         0.00 user         0.00 sys

Notes:
    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.