Commit Graph
95 Commits
Author SHA1 Message Date
Andrew Wood d51c57379a When cross-compiling, we cannot run a test program to check whether a siginfo_t provides the signal sender PID, so we fall back to assuming that it does, and also check that SA_SIGINFO is declared so compilation will not fail on systems without it (#120). 2024-12-03 21:04:58 +00:00
Andrew Wood dccc7345ab New option "--extra-display" (#3, #4). 2024-12-01 19:39:59 +00:00
Andrew Wood 0d7c9ac091 Address splint warnings. 2024-12-01 16:05:17 +00:00
Andrew Wood aee34fce32 Address splint warnings when debugging is turned off. 2024-12-01 15:55:48 +00:00
Andrew Wood c29d306d10 Additional configure.ac cleanups. 2024-12-01 15:42:59 +00:00
Andrew Wood 106a673ba8 Test at compile time whether siginfo_t is usable for --remote (#119). 2024-12-01 15:26:59 +00:00
Andrew Wood 0d618efd0d Remove pointless EOF lines from all sources. 2024-11-30 16:40:50 +00:00
Andrew Wood 856da09741 Add a circular buffer of line positions so that in line mode we can work out how many lines are in the unconsumed portion of the output pipe buffer. 2024-10-05 23:04:18 +01:00
Andrew Wood bfe301ae1c Preserve errno after the output write, and if the output pipe is closed, propagate this to the main loop so it does not wait forever for the pipe buffer to empty. 2024-10-05 17:05:14 +01:00
Andrew Wood d9a0041870 New --store-and-forward option (#100), including refactoring several areas to allow PV to run in two passes, and the ability to look at the output pipe buffer utilisation to more accurately reflect the total data transferred to the receiving end, rather than just the total amount written to the output buffer. 2024-10-05 16:21:59 +01:00
Andrew Wood c548d1f2d8 Add a "--gauge" option which alters the progress bar to show the current rate as a percentage of the max rate seen, if the size is unknown (#46). 2024-10-04 22:15:14 +01:00
Andrew Wood cd696e60ab Make pv__calc_percentage() into pv_percentage() in number.c instead of a static function in display.c, so it can be used in multiple places in future. 2024-10-04 17:15:18 +01:00
Andrew Wood 9bd5a518ea New option "--stats", to show a line of statistics about the transfer once it has ended (issue #49). 2024-10-04 15:12:22 +01:00
Andrew Wood 65d568c283 Refactor display and calculation functions to separate them out more cleanly, move more information into the state structure instead of repeating it as function parameters, and fix a memory leak in the whole-PID mode of --watchfd. 2024-10-04 13:27:17 +01:00
Andrew Wood f803f29158 Move transfer rate calculations into their own function, and make pv__format stand alone, to maintain separation of concerns. 2024-10-04 11:54:47 +01:00
Andrew Wood 954c2d32c1 Move calculated values out of state.display into a new structure, state.calc, to separate out the display portion from the calculation portion; and move history_interval into state.control, as it is a control parameter set at the start. 2024-10-04 11:08:01 +01:00
Andrew Wood 545769885d Raise a SIGCONT to the whole process group after receiving a SIGTTOU, so that pipelines can be resumed in the background (for example "pv /dev/zero | cat > /dev/null" can now be suspended and put into the background - if we do not send that signal then "cat" remains stopped, as mentioned in issue #56). 2024-10-04 10:24:08 +01:00
Andrew Wood e84f47abc8 Refactor handling of TTOU so that instead of shuffling stderr to another file descriptor and using /dev/null when backgrounded, we set a flag to suspend terminal output, and perform all terminal writes through a new pv_tty_write function which checks that flag. 2024-10-03 23:03:31 +01:00
Andrew Wood 52a720ec33 Improve the readability of the code that handles SIGTTOU. 2024-10-03 22:08:11 +01:00
Andrew Wood 23bd296aeb Re-order structure members to minimise padding / holes, after analysis with "pahole" on a 64-bit system. 2024-10-03 21:25:41 +01:00
Andrew Wood 60936080da Move the "--size @FILE" file size reading into its own function for clarity; standardise its error message format to "program: file: message: detail"; uniquely name variables; refuse to accept a directory as a file; and with this option, try reading the size of a block device from sysfs if we can, to avoid requiring read permissions on the device. 2024-08-06 23:17:15 +01:00
Andrew Wood 01e0290d6e More replacement of hard-coded exit status bitmask values with named constants. 2024-06-08 21:57:36 +01:00
Andrew Wood 1c61154206 Replace hard-coded exit status bitmask values with named constants. 2024-06-08 21:49:46 +01:00
Martin Dørum 30763684b7 add -o/--output option 2024-06-08 14:31:19 +02:00
Andrew Wood b375041790 Correct issues #34, #86, #87 - progress output stopping when writing output data blocks - by adding a SIGALRM handler, since ignoring the signal prevents it from interrupting writes; and use setitimer() where available, instead of alarm(), to provide sufficient granularity to handle the case where the --interval is not a whole number of seconds. 2024-04-21 13:54:01 +01:00
Andrew Wood 1ad9c321bc Adjust copyright years. 2024-03-19 22:19:42 +00:00
Andrew Wood c9dede08d4 Adjust the decimal units flag variable name from "si" to "decimal_units" so it does not overlap with other words like "size" and "signal"; add man page entry and adjust the "-L" man page entry; and allow this flag to also change how input prefixes are processed. 2024-03-19 22:17:43 +00:00
kevinruddy fe8137521a Support for decimal SI units 2024-03-19 16:57:57 -04:00
Andrew Wood e446782c1f Addressed more issues raised by splint, and refactored out state_array so that state is part of info_array and each state is allocated and deallocated properly instead of referencing pointers multiple times. 2023-10-22 16:23:53 +01:00
Andrew Wood d06374a0f1 Addressed more issues raised by splint and flawfinder. 2023-10-22 00:08:35 +01:00
Andrew Wood 9a9c117411 Addressed more issues raised by flawfinder. 2023-10-18 23:10:29 +01:00
Andrew Wood 3fdf8d5a69 Improved comments. 2023-10-16 22:47:02 +01:00
Andrew Wood b4d6c5ed2a Addressed more issues raised by splint, and improved variable names and comments. 2023-10-15 23:42:04 +01:00
Andrew Wood d8e0674da0 Move locally scoped variables from "switch" statement into outer "for" loop, to avoid triggering a crash in the "splint" code analyser. 2023-10-15 22:29:37 +01:00
Andrew Wood b0df2e53a8 Replace str_* in state structure with an array of components of enumerated types, to avoid pointers everywhere in the format array and to allow for later expansion which will separate "string length" from "displayed width" to allow for wide character support. 2023-10-14 17:18:20 +01:00
Andrew Wood 94ffdaf60d Group state structure into sub-structures to allow future changes to watchpid code that will do a better job of duplicating the relevant parts of the internal state for each fd. 2023-10-14 01:23:54 +01:00
Andrew Wood 03d42555e7 Addressed more issues raised by splint. 2023-10-14 00:04:24 +01:00
Andrew Wood 41b223a757 Addressed more issues raised by splint. 2023-10-13 23:31:28 +01:00
Andrew Wood e864eca78d Only check for the IPC functions we are still using. 2023-10-01 15:16:31 +01:00
Andrew Wood 0e1750835e Rewrite of "--remote", to use a temporary file for information exchange instead of a SysV IPC message queue, to correct the fault where "make check -j32" would fail due to every PV exit removing the message queue. 2023-10-01 01:20:16 +01:00
Andrew Wood e5cc71b4d2 Switched licensing to GPLv3+. 2023-09-24 21:09:52 +01:00
Andrew Wood 2033c6085f Addressed more issues raised by splint. 2023-09-23 21:53:31 +01:00
Andrew Wood 780b65a648 More type corrections. 2023-09-16 23:14:16 +01:00
Andrew Wood 20b8c9700a Rename the functions to better describe what they do, remove single-letter variable names, add more explanatory comments, remove "_t" suffix from typedef as per FreeBSD style guide. 2023-09-16 00:55:40 +01:00
Andrew Wood 252213fbc2 Addressed more issues raised by splint, and corrected some type confusion between off_t and size_t / ssize_t. 2023-09-14 22:19:49 +01:00
Andrew Wood e696b737e3 Addressed more issues raised by splint. 2023-09-13 23:50:20 +01:00
Andrew Wood 153285bec0 Use off_t for file sizes, size_t for buffer sizes. 2023-09-13 23:17:53 +01:00
Andrew Wood 8a2ddac50e Type consistency corrections - use booleans for boolean operations, use size_t for byte counts. 2023-09-12 23:42:23 +01:00
Andrew Wood 052c182278 Adjustments in line with "autoscan" recommendations. 2023-09-12 21:26:24 +01:00
Andrew Wood df67cee38a Addressed more issues raised by splint. 2023-09-11 23:06:57 +01:00