History log of /openbsd-current/usr.bin/tail/forward.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.33 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.32 04-Jan-2019 martijn

Don't reopen file if its stdin.

From leo_tck at volny dot cz
OK millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.31 05-Jul-2016 jsg

Modify code added in rev 1.30 to use the correct variable instead of a
different uninitialised one.

ok martijn@


Revision tags: OPENBSD_5_9_BASE
# 1.30 25-Jan-2016 martijn

Fix a crash as found by sthen@

tested and OK sthen@
OK with minor tweak schwarze@


# 1.29 21-Nov-2015 tedu

better fixes for running tail without -f. from Martijn van Duren


# 1.28 20-Nov-2015 tedu

quick hack to fix "tail +n", reported broken by Mikolaj Kucharski.
this doesn't attempt to repair all cases, but restoring basic functionality
is a first step.


# 1.27 19-Nov-2015 tedu

another try to allow tailing multiple files. maybe it works?
commit now to allow people to test.
from Martijn van Duren


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.26 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.25 13-Nov-2008 landry

Backout previous commit, there are still some issues with it.
ok sthen@


# 1.24 17-Oct-2008 landry

Permit tail -f to follow multiple files, useful when you want to monitor
several logfiles in a single terminal. split forward() and move the
corresponding -rewritten- code to follow().
Closes PR 5092.

ok millert@ gilles@ sobrado@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.23 22-Oct-2007 deraadt

use EV_SET() instead of doing it by hand; Iruata Souza


# 1.22 29-Sep-2007 otto

unneeded includes and whitespace police; from Igor Zinovik


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.21 24-Mar-2006 kjell

ANSIfy. Ok ray@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.20 12-Mar-2004 otto

If kqueue is not available, revert back to old behavior. Unbreaks tail -f
on NFS and other filesystems not supporting kqueues.
ok tedu@ millert@


# 1.19 01-Mar-2004 otto

Unbreak file truncation handling. Resolves PR 3689.
ok tdeval@ millert@


# 1.18 16-Feb-2004 otto

make -b and -c work with large offsets; tweak from millert@
ok henning@ itojun@ millert@


Revision tags: OPENBSD_3_4_BASE
# 1.17 14-Jul-2003 otto

typo in comment. ok henning@


# 1.16 01-Jul-2003 henning

rewrite to not use mmap(2). solves a bunch of issues:
- No more I/O related SEGVs (PR 2337?).
- Performance linear to size of output, not input file size, even for very large files.
Same for -r.
- Reverse tail also works for very large files.
- Very large values of n possible, even for very large files. Same for -r.

work by Otto Moerbeek <otto@drijf.net>
tested by and ok millert@ and myself


# 1.15 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_3_0_BASE
# 1.12 18-Aug-2001 art

Use kqueue for -f.


Revision tags: OPENBSD_2_9_BASE
# 1.11 21-Nov-2000 art

When doing tail -f from stdin don't reopen a local file named stdin.


Revision tags: OPENBSD_2_8_BASE
# 1.10 12-Oct-2000 art

MAP_FAILED, not -1


# 1.9 23-Jun-2000 ericj

Get rid of repeating error messages; From netbsd millert@ ok


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 04-Aug-1999 mickey

supply particular mapping type to the mmap(2) instead of bogus 0


Revision tags: OPENBSD_2_5_BASE
# 1.7 03-Feb-1999 millert

Fix broken conversion of private err() function and make ierr() and oerr()
back into functions, not macros. Also make functions that call mmap()
return an int so we can fall back to non-mmap (slow) version on mmap failure.
Noticable effects:
o when you tail multiple files, if one of the files doesn't exist or
is otherwise broken, keep on going to the next file.
o it is now possible to tail files > 2gig, though it will be *very* slow
since tail will be unable to use mmap()


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.6 30-May-1997 millert

In -f mode notice when the file has been replace or truncated and
deal. Useful for tail'ing log files that get rotated.


# 1.5 29-May-1997 kstailey

why select(2) when you can sleep(3) cheap?


Revision tags: OPENBSD_2_1_BASE
# 1.4 12-Jan-1997 millert

Fix core dump and use libc err(3) instead of private one (which had
slightly different semantics). Also clean up some gcc -Wall'isms.


Revision tags: OPENBSD_2_0_BASE
# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 23-Feb-1996 niklas

From NetBSD:
Don't rely on select() not to modify the timeval argument. Also,
simplify the code by passing in NULL rather than an empty fd_set to
indicate no file descriptors.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.32 04-Jan-2019 martijn

Don't reopen file if its stdin.

From leo_tck at volny dot cz
OK millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.31 05-Jul-2016 jsg

Modify code added in rev 1.30 to use the correct variable instead of a
different uninitialised one.

ok martijn@


Revision tags: OPENBSD_5_9_BASE
# 1.30 25-Jan-2016 martijn

Fix a crash as found by sthen@

tested and OK sthen@
OK with minor tweak schwarze@


# 1.29 21-Nov-2015 tedu

better fixes for running tail without -f. from Martijn van Duren


# 1.28 20-Nov-2015 tedu

quick hack to fix "tail +n", reported broken by Mikolaj Kucharski.
this doesn't attempt to repair all cases, but restoring basic functionality
is a first step.


# 1.27 19-Nov-2015 tedu

another try to allow tailing multiple files. maybe it works?
commit now to allow people to test.
from Martijn van Duren


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.26 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.25 13-Nov-2008 landry

Backout previous commit, there are still some issues with it.
ok sthen@


# 1.24 17-Oct-2008 landry

Permit tail -f to follow multiple files, useful when you want to monitor
several logfiles in a single terminal. split forward() and move the
corresponding -rewritten- code to follow().
Closes PR 5092.

ok millert@ gilles@ sobrado@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.23 22-Oct-2007 deraadt

use EV_SET() instead of doing it by hand; Iruata Souza


# 1.22 29-Sep-2007 otto

unneeded includes and whitespace police; from Igor Zinovik


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.21 24-Mar-2006 kjell

ANSIfy. Ok ray@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.20 12-Mar-2004 otto

If kqueue is not available, revert back to old behavior. Unbreaks tail -f
on NFS and other filesystems not supporting kqueues.
ok tedu@ millert@


# 1.19 01-Mar-2004 otto

Unbreak file truncation handling. Resolves PR 3689.
ok tdeval@ millert@


# 1.18 16-Feb-2004 otto

make -b and -c work with large offsets; tweak from millert@
ok henning@ itojun@ millert@


Revision tags: OPENBSD_3_4_BASE
# 1.17 14-Jul-2003 otto

typo in comment. ok henning@


# 1.16 01-Jul-2003 henning

rewrite to not use mmap(2). solves a bunch of issues:
- No more I/O related SEGVs (PR 2337?).
- Performance linear to size of output, not input file size, even for very large files.
Same for -r.
- Reverse tail also works for very large files.
- Very large values of n possible, even for very large files. Same for -r.

work by Otto Moerbeek <otto@drijf.net>
tested by and ok millert@ and myself


# 1.15 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_3_0_BASE
# 1.12 18-Aug-2001 art

Use kqueue for -f.


Revision tags: OPENBSD_2_9_BASE
# 1.11 21-Nov-2000 art

When doing tail -f from stdin don't reopen a local file named stdin.


Revision tags: OPENBSD_2_8_BASE
# 1.10 12-Oct-2000 art

MAP_FAILED, not -1


# 1.9 23-Jun-2000 ericj

Get rid of repeating error messages; From netbsd millert@ ok


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 04-Aug-1999 mickey

supply particular mapping type to the mmap(2) instead of bogus 0


Revision tags: OPENBSD_2_5_BASE
# 1.7 03-Feb-1999 millert

Fix broken conversion of private err() function and make ierr() and oerr()
back into functions, not macros. Also make functions that call mmap()
return an int so we can fall back to non-mmap (slow) version on mmap failure.
Noticable effects:
o when you tail multiple files, if one of the files doesn't exist or
is otherwise broken, keep on going to the next file.
o it is now possible to tail files > 2gig, though it will be *very* slow
since tail will be unable to use mmap()


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.6 30-May-1997 millert

In -f mode notice when the file has been replace or truncated and
deal. Useful for tail'ing log files that get rotated.


# 1.5 29-May-1997 kstailey

why select(2) when you can sleep(3) cheap?


Revision tags: OPENBSD_2_1_BASE
# 1.4 12-Jan-1997 millert

Fix core dump and use libc err(3) instead of private one (which had
slightly different semantics). Also clean up some gcc -Wall'isms.


Revision tags: OPENBSD_2_0_BASE
# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 23-Feb-1996 niklas

From NetBSD:
Don't rely on select() not to modify the timeval argument. Also,
simplify the code by passing in NULL rather than an empty fd_set to
indicate no file descriptors.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.31 05-Jul-2016 jsg

Modify code added in rev 1.30 to use the correct variable instead of a
different uninitialised one.

ok martijn@


Revision tags: OPENBSD_5_9_BASE
# 1.30 25-Jan-2016 martijn

Fix a crash as found by sthen@

tested and OK sthen@
OK with minor tweak schwarze@


# 1.29 21-Nov-2015 tedu

better fixes for running tail without -f. from Martijn van Duren


# 1.28 20-Nov-2015 tedu

quick hack to fix "tail +n", reported broken by Mikolaj Kucharski.
this doesn't attempt to repair all cases, but restoring basic functionality
is a first step.


# 1.27 19-Nov-2015 tedu

another try to allow tailing multiple files. maybe it works?
commit now to allow people to test.
from Martijn van Duren


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.26 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.25 13-Nov-2008 landry

Backout previous commit, there are still some issues with it.
ok sthen@


# 1.24 17-Oct-2008 landry

Permit tail -f to follow multiple files, useful when you want to monitor
several logfiles in a single terminal. split forward() and move the
corresponding -rewritten- code to follow().
Closes PR 5092.

ok millert@ gilles@ sobrado@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.23 22-Oct-2007 deraadt

use EV_SET() instead of doing it by hand; Iruata Souza


# 1.22 29-Sep-2007 otto

unneeded includes and whitespace police; from Igor Zinovik


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.21 24-Mar-2006 kjell

ANSIfy. Ok ray@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.20 12-Mar-2004 otto

If kqueue is not available, revert back to old behavior. Unbreaks tail -f
on NFS and other filesystems not supporting kqueues.
ok tedu@ millert@


# 1.19 01-Mar-2004 otto

Unbreak file truncation handling. Resolves PR 3689.
ok tdeval@ millert@


# 1.18 16-Feb-2004 otto

make -b and -c work with large offsets; tweak from millert@
ok henning@ itojun@ millert@


Revision tags: OPENBSD_3_4_BASE
# 1.17 14-Jul-2003 otto

typo in comment. ok henning@


# 1.16 01-Jul-2003 henning

rewrite to not use mmap(2). solves a bunch of issues:
- No more I/O related SEGVs (PR 2337?).
- Performance linear to size of output, not input file size, even for very large files.
Same for -r.
- Reverse tail also works for very large files.
- Very large values of n possible, even for very large files. Same for -r.

work by Otto Moerbeek <otto@drijf.net>
tested by and ok millert@ and myself


# 1.15 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_3_0_BASE
# 1.12 18-Aug-2001 art

Use kqueue for -f.


Revision tags: OPENBSD_2_9_BASE
# 1.11 21-Nov-2000 art

When doing tail -f from stdin don't reopen a local file named stdin.


Revision tags: OPENBSD_2_8_BASE
# 1.10 12-Oct-2000 art

MAP_FAILED, not -1


# 1.9 23-Jun-2000 ericj

Get rid of repeating error messages; From netbsd millert@ ok


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 04-Aug-1999 mickey

supply particular mapping type to the mmap(2) instead of bogus 0


Revision tags: OPENBSD_2_5_BASE
# 1.7 03-Feb-1999 millert

Fix broken conversion of private err() function and make ierr() and oerr()
back into functions, not macros. Also make functions that call mmap()
return an int so we can fall back to non-mmap (slow) version on mmap failure.
Noticable effects:
o when you tail multiple files, if one of the files doesn't exist or
is otherwise broken, keep on going to the next file.
o it is now possible to tail files > 2gig, though it will be *very* slow
since tail will be unable to use mmap()


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.6 30-May-1997 millert

In -f mode notice when the file has been replace or truncated and
deal. Useful for tail'ing log files that get rotated.


# 1.5 29-May-1997 kstailey

why select(2) when you can sleep(3) cheap?


Revision tags: OPENBSD_2_1_BASE
# 1.4 12-Jan-1997 millert

Fix core dump and use libc err(3) instead of private one (which had
slightly different semantics). Also clean up some gcc -Wall'isms.


Revision tags: OPENBSD_2_0_BASE
# 1.3 26-Jun-1996 deraadt

rcsid


# 1.2 23-Feb-1996 niklas

From NetBSD:
Don't rely on select() not to modify the timeval argument. Also,
simplify the code by passing in NULL rather than an empty fd_set to
indicate no file descriptors.


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision