Page MenuHomeFreeBSD

include: Use printf(1) instead of shell loops for header symlinks
ClosedPublic

Authored by arichardson on Dec 22 2020, 3:57 PM.
Tags
None
Referenced Files
F81659360: D27723.id81756.diff
Fri, Apr 19, 2:26 PM
F81648765: D27723.diff
Fri, Apr 19, 11:05 AM
Unknown Object (File)
Wed, Apr 10, 1:42 AM
Unknown Object (File)
Mar 11 2024, 6:37 AM
Unknown Object (File)
Mar 11 2024, 6:37 AM
Unknown Object (File)
Mar 11 2024, 6:37 AM
Unknown Object (File)
Mar 11 2024, 6:37 AM
Unknown Object (File)
Mar 7 2024, 10:15 PM
Subscribers
None

Details

Summary

Using a shell for loop means we have to spawn a separate install(1)
process for each header that is symlinked. This patch uses printf(1) to
generate an argument list that has been prefixed with the correct number
of ../ and then uses a single install(1) invocation.

This reduces the number of execve() calls during make includes from 2442
(with D27622) to 1382. Running make symlinks in include/ now spawns 214
processes instead of 1276 without this patch.

Test Plan

find ${WORLDTMP}/usr/include -xtype l only prints sys/nvpair.h but that was already broken before due to the openenzfs typo introduced in rS364746. I'll commit a fix for the typo once git is writable.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35617
Build 32516: arc lint + arc unit

Event Timeline

arichardson created this revision.

printf(1) reusing the format string is a cute trick, I hadn't realized it did that.

This revision is now accepted and ready to land.Dec 30 2020, 9:31 PM
This revision now requires review to proceed.Jan 6 2021, 5:46 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 7 2021, 11:08 AM
This revision was automatically updated to reflect the committed changes.