Page MenuHomeFreeBSD

(almost) rewrite tcopy(1) to teach it new tricks.
ClosedPublic

Authored by phk on Jul 27 2025, 9:23 AM.
Referenced Files
Unknown Object (File)
Wed, Sep 24, 7:00 AM
Unknown Object (File)
Wed, Sep 24, 2:28 AM
Unknown Object (File)
Sun, Sep 21, 2:03 AM
Unknown Object (File)
Wed, Sep 17, 7:47 AM
Unknown Object (File)
Aug 29 2025, 6:46 AM
Unknown Object (File)
Aug 13 2025, 12:17 PM
Unknown Object (File)
Jul 29 2025, 8:39 AM
Unknown Object (File)
Jul 28 2025, 6:31 PM
Subscribers
None

Details

Summary

This is almost a rewrite of tcopy(1) to add new functionality.

This is a continuation of D51442, where Warner's comment made me decide to go all in and rewrite the "tape dev" code as C++ classes for clarity.

I also changed the url to open-simh and removed the prompt characters from the examples as Alexander suggested.

I made SIMH-TAPFILE the default for non-tape-devices, and added -r instead of -t.

I added -l logfile option.

I appended duration and throughput to the "total" line.

I added SIGINFO support.

The exit status was and still are all over the place. I have used EX_* in new code, but left the old alone. Given that the exit status was undocumented before, I feel it would be safe to sanitize it all to EX_* values, but would like feedback on this point ?

In -c mode the two tape drives are rewound sequentially, and short of spawning a pthread, there seems to be no way to do it in parallel ?

(Please ignore the 'tst' and 'flint' targets added to the make file, I'll remove them before committing.)

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

phk requested review of this revision.Jul 27 2025, 9:23 AM
phk created this revision.
phk edited the summary of this revision. (Show Details)

Looks mostly sane and the issues I remember flagging before have been corrected.

usr.bin/tcopy/tcopy.cc
44

In new code, it's been suggested that we include the cXXXXX variant for many of these things... Is there a reason to not do that? Or is this not 'new code' but old C code transported into a C++ class hierarchy? if the latter, never mind

432

Can we use __unused in the function definition prototype instead? Here and elsewhere?

465

Extra newlines before this line, need one after.

560

Do we need to fflush(stderr) since this is a signal handler? Also, any concern about using stdio in a signal handler? Or is that only on pedantically POSIX systems.. I forget.

574

char* -> char *

This revision is now accepted and ready to land.Aug 4 2025, 6:20 PM

Committed with a few more cleanups.