summaryrefslogtreecommitdiff
path: root/inotail.c
AgeCommit message (Collapse)AuthorFilesLines
2007-03-03inotail.c: Cleanup before releaseTobias Klauser1-17/+9
2007-02-05inotail.c: Some more branch predictionTobias Klauser1-6/+6
2007-02-05inotail.c: Better checking of -n/-c argumentsTobias Klauser1-10/+12
Also change n_lines/n_bytes to an unsigned long Additionally remove some spurious memset()'s
2007-02-03inotail.c: Remember last printed headerTobias Klauser1-1/+5
Prevents inotail from printing the header with the name of the file everytime it changes.
2007-01-22inotail.c: Set new file size _after_ read/write in handle_inotify_event()Tobias Klauser1-13/+10
This works around the problem when receving multiple inotify events for _one_ write to the file. This was a problem in the bordercase where the string written to the file was larger than 4096 chars, the last sizeof(string) - 4096 chars were repeated. Still have to check why there are _two_ IN_MODIFY events for _one_ write. But at least it does not affect inotail anymore. Also fix a dumb thinko in watch_files(): Move the ev_idx only one event forward, not n_files * INOTIFY_BUFLEN.
2007-01-22inotail.c: Gaaah! buf is on the stack now.Tobias Klauser1-2/+1
2007-01-21inotail.c: Use strcmp rather than strncmpTobias Klauser1-2/+2
We're compare against a constant string
2007-01-21inotail.c: Inline some functions and initialize files pointer in mainTobias Klauser1-3/+3
2007-01-20inotail.c: Adjust block size according to return value of readTobias Klauser1-3/+4
...and use proper types
2007-01-20inotail.c: Better handling of errors on inotify_init()Tobias Klauser1-1/+4
2007-01-20inotail.c: Simplify iterating through inotify eventsTobias Klauser1-13/+17
2007-01-15inotail.c: One more ssize_tTobias Klauser1-1/+1
2007-01-10inotail.c: Minor cleanupsTobias Klauser1-3/+3
Make one more read(2) return value ssize_t and do not initialize n_files to 0
2007-01-05inotail.c: Print version information to stdoutTobias Klauser1-1/+1
2007-01-05inotail.c: Make tail_pipe() return ssize_tTobias Klauser1-2/+2
read() returns ssize_t and we were casting it to signed int which might be smaller on some architectures.
2007-01-04inotail.c: Make it clear that we're handling one file when tailing stdinTobias Klauser1-1/+1
2007-01-04inotail.c: Fix an off-by-one error in lines_to_offset_from_end()Tobias Klauser1-1/+1
buf[block_size] is obviously _not_ in buf itself.
2007-01-04inotail.c: Make n_ignored globalTobias Klauser1-15/+24
It was getting more and more complicated and errorprone with handling n_ignored as local variable.
2006-12-28inotail.c: Use consistent nomenclature for struct file_struct pointersTobias Klauser1-29/+29
f for pointers to one struct file_struct files for pointers to an array of struct file_struct
2006-12-28inotail.c: Add and use ignore_file() functionTobias Klauser1-7/+9
2006-12-28inotail.c: Handle return value of inotify_add_watch()Tobias Klauser1-2/+8
2006-12-23inotail.c: Print usage to stdoutTobias Klauser1-1/+1
2006-12-23inotail.c: Keep tailing moved files by fdTobias Klauser1-1/+1
As a side effect of the recent change to not reopen files while watching (commit 1ddefac3dfe654f23fc944df5d7c52a078692012) it's possible now to follow moved files by their open fd.
2006-12-21inotail.c: Don't open files over and over againTobias Klauser1-11/+19
Up to now files were closed after processing each inotify event which seems to be quite a bit of overhead. The fds are now kept open and are only closed in case of errors.
2006-12-18inotail.c: Minor cleanups and addition of an unlikely()Tobias Klauser1-7/+4
2006-12-15inotail.c: return instead of breakTobias Klauser1-5/+2
2006-12-14inotail.c: Move some macros to inotail.hTobias Klauser1-7/+0
Some typos and useless blank lines are also fixed.
2006-12-14inotail.c: Move a variable to the block where it's usedTobias Klauser1-2/+1
2006-12-14inotail.c: Save 2 LOCTobias Klauser1-4/+2
2006-12-08inotail.c: Yet another user for IS_PIPELIKETobias Klauser1-1/+1
2006-12-08inotail.c: Merge S_ISFIFO and S_ISSOCK to IS_PIPELIKETobias Klauser1-2/+5
2006-11-16inotail.c: Reorder lines_to_offset* functionsTobias Klauser1-31/+37
Make lines_to_offset() just a wrapper function to check whether to tail from begin or from end of the file. The real work is done in lines_to_offset_from_begin() and lines_to_offset_from_end()
2006-11-09Dynamically allocate memory for the inotify event bufferTobias Klauser1-4/+7
By using malloc(3) depending on the number of files we have, the memory footprint can be reduced. Before this change, the buffer size was 32 * sizeof(struct inotify_event) which was an overhead when just tailing some few files. Now the memory is allocated depending on the number of files to tail. I know of no occassion where I received more than one event at a time per file, so the '2 *' can probably be dropped too.
2006-11-08Document -n/-c +N featureTobias Klauser1-7/+10
That should make inotail POSIX tail compatible
2006-11-08Spelling fixes and some small code reorderingTobias Klauser1-8/+6
2006-10-26inotail.c: Support inotail -n +<num>Tobias Klauser1-4/+51
Add function lines_to_offset_from_begin() to allow tailing relative to the begin of the file. Also handle the case where the argument for '-c' or 'n' is '+0'. Like GNU tail (and according to its source also tail in UNIX) print the whole file in this case.
2006-10-25Various change to allow tailing bytes relative to the beginTobias Klauser1-7/+10
"Simplyfy" and inline bytes_to_offset, extend it to support tailing relative to begin of file. Boolean relative makes no sense, make it a char containing 0 for relative to end and 1 for relative to begin.
2006-10-24inotail.c: Introduce relative tailingTobias Klauser1-6/+9
The global variable 'relative' states whether we're tailing relative to the end (R_END, default) or the begin of the file. Also do some minor comment reformatting.
2006-10-21Unify wording all over the treeTobias Klauser1-2/+2
According to the Linux source it's: * s/linux/Linux/ * s/Kernel/kernel/ * s/Inotify/inotify/ (except at the beginning of a sentence)
2006-10-20inotail.c: Add basic support for +/-<num> to -c/-nTobias Klauser1-2/+6
2006-10-20inotail.c: More n_units cleanupTobias Klauser1-6/+6
Make n_units unsigned and rename some more variables to the appropriate form.
2006-10-20inotail.c: rename n_lines to n_unitsTobias Klauser1-5/+5
2006-10-17inotail.c: Better error handling in tail_file()Tobias Klauser1-9/+14
Close fd on any error, rename rc variable to cleanly state what it's for.
2006-10-16inotail.c: Make pretty_name() an inlineTobias Klauser1-1/+1
2006-10-05Better file type checking and more meaningful return valuesTobias Klauser1-3/+12
2006-09-27Move inotify event handling into own functionTobias Klauser1-50/+53
2006-09-26Add unlikely macroTobias Klauser1-2/+1
And use it for a really unlikely case
2006-09-26Add check for the case that no file produced the inotify eventTobias Klauser1-2/+5
This could use an unlikely()
2006-09-20Just tail everything in tail_pipe() for nowv0.1Tobias Klauser1-1/+8
2006-09-20Use getopt for command option parsingTobias Klauser1-24/+30