Page MenuHomeFreeBSD

fix tail -f on stdin
Needs ReviewPublic

Authored by swills on Mon, Jun 7, 4:39 AM.

Details

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 39858
Build 36747: arc lint + arc unit

Event Timeline

swills requested review of this revision.Mon, Jun 7, 4:39 AM
swills created this revision.

Can you provide some more context?

Can you provide some more context?

Sure, so tail -f < /tmp/file used to work, but doesn't currently. This fixes it.

Hym its works for me.

# tail -f < pdfork.c 
        printf("%d\n", pid);
        fd2 = dup(fd);
...
tail/tail.c
214

Maybe we can take this code and make a function from it, and below init it with single file, and here with whole argv and argc?

273

Missing error checking.

274

Missing error checking.

swills added inline comments.
tail/tail.c
214

Might be better to do that in a separate review.

Hym its works for me.

# tail -f < pdfork.c 
        printf("%d\n", pid);
        fd2 = dup(fd);
...

What version of FreeBSD are you using there? For me, it doesn't work on 14-CURRENT without these changes.

Hym its works for me.

# tail -f < pdfork.c 
        printf("%d\n", pid);
        fd2 = dup(fd);
...

What version of FreeBSD are you using there? For me, it doesn't work on 14-CURRENT without these changes.

I should clarify, tail works, but tail -f doesn't. That is, tail -f returns the last few lines of the file and exits. With this change, tail -f continues running and also shows any new lines added to the end of the file.