202 Commits
Author SHA1 Message Date
Andrew Wood d28d2f3155 Address the splint warning due to not recognising strlcat(). 2026-03-08 11:23:08 +00:00
Andrew Wood 9566e7d7ea Run through "make indent" for consistency. 2026-03-08 11:21:38 +00:00
Andrew Wood c39601bbb2 Datestamp updates. 2026-03-08 11:20:54 +00:00
Andrew Wood e3fcc6ae71 Commit to release date. 2026-03-08 11:19:21 +00:00
Andrew Wood 9c18fecb98 Acknowledge #179. 2026-03-08 11:10:10 +00:00
Andrew Wood 521391a495 Version bump. 2026-03-07 23:23:35 +00:00
Andrew Wood f65caacfca Version bump, and note the change to "--size @x" (#179). 2026-03-07 23:23:13 +00:00
Andrew Wood 0a27a85b4a Update the copyright years. 2026-03-07 23:20:20 +00:00
Andrew Wood d186d618e3 Look up the right maxfds value to use with nftw() for the current system (#179). 2026-03-07 23:15:09 +00:00
Andrew Wood ae97565e13 Message line number updates. 2026-03-07 23:14:23 +00:00
Andrew Wood d028d5165c Make the gettext macros behave on Debian 13. 2026-03-07 22:34:28 +00:00
Andrew Wood e17f64fce7 Allow "--size @dir" to read the size of all files under "dir" (#179). 2026-03-07 22:23:10 +00:00
Andrew Wood e4bc770054 Timestamp update. 2025-12-15 20:11:17 +00:00
Andrew Wood a890e8e0c8 Update version and release date. 2025-12-15 20:09:56 +00:00
Andrew Wood 3af38221ee Correct the process title truncation. 2025-12-12 23:12:03 +00:00
Andrew Wood 579aebf6a7 Date update. 2025-11-22 15:08:13 +00:00
Andrew Wood d91bf78cac Timestamp update. 2025-11-22 15:08:00 +00:00
Andrew Wood 6e45fe0f8d Update translations count for Finnish. 2025-11-22 15:07:31 +00:00
Andrew Wood 8d7ced4195 Merge pull request 'Translations update from Codeberg Translate' (#175) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/175
2025-11-22 16:07:08 +01:00
artnayandCodeberg Translate cae6049edd Translated using Weblate (Finnish)
Currently translated at 43.5% (61 of 140 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fi/
2025-11-22 15:06:06 +00:00
Andrew Wood 1293f70575 Link to the Debian bug as well, and commit to a release date. 2025-11-22 15:03:53 +00:00
Andrew Wood ff412009da Version bump for #174. 2025-11-21 23:27:47 +00:00
Andrew Wood 10bc46af6e Suppress by source file name rather than function name, since in an LTO build the function name is optimised out (#174). 2025-11-21 23:26:52 +00:00
Andrew Wood 1e5fae3b7b Note the Finnish translations. 2025-11-21 05:53:21 +00:00
Andrew Wood a6f72cf985 Merge pull request 'Translations update from Codeberg Translate' (#173) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/173
2025-11-21 06:46:29 +01:00
artnayandCodeberg Translate e617b92f2b Translated using Weblate (Finnish)
Currently translated at 24.2% (34 of 140 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fi/
2025-11-21 05:43:17 +00:00
Andrew Wood b24771d224 Added empty Georgian language file as requested. 2025-11-20 21:18:50 +00:00
Andrew Wood 6de160192a Renamed to something more specific. 2025-11-15 15:37:43 +00:00
Andrew Wood 72774e34ff Timestamp update. 2025-11-12 15:03:02 +00:00
Andrew Wood 4ab9536733 Set the release date. 2025-11-12 14:56:16 +00:00
Andrew Wood bd9af0421c Note the fix for --watchfd with multiple arguments (#170). 2025-11-12 14:32:49 +00:00
Andrew Wood 7ba474509c Version bump. 2025-11-12 14:32:39 +00:00
Andrew Wood ac13765fa5 Test --watchfd with more than one argument (#170). 2025-11-12 14:31:57 +00:00
Andrew Wood ca7997fe7d Use the new watchfd_count to size the array, not the one we just zeroed, otherwise multiple --watchfd arguments result in a memory error (#170) 2025-11-12 14:31:22 +00:00
Andrew Wood 22b729f9ea Datestamp update. 2025-11-09 22:27:57 +00:00
Andrew Wood 864895f8f2 Commit to release date. 2025-11-07 23:08:21 +00:00
Andrew Wood 5d185398ac Position updates. 2025-10-31 19:48:12 +00:00
Andrew Wood 94b8b8625f Bump minor version, since there is a new feature. 2025-10-31 19:47:07 +00:00
Andrew Wood 282823f660 Correct the stub functions used when PV_REMOTE_CONTROL is not set. 2025-10-30 22:54:02 +00:00
Andrew Wood a5fd8d662e Version bump, and mention the fix to timer behaviour when "--watchfd" is paused and resumed (#169). 2025-10-30 21:18:26 +00:00
Andrew Wood 2904eacefe Use the per-fd stoppage time rather than the global one (#169). 2025-10-29 21:31:23 +00:00
Andrew Wood 5d538da63a Add the stoppage time to the each of currently watched fds' counters (#169). 2025-10-29 21:30:43 +00:00
Andrew Wood fdfceb79c6 Add a TODO marker for next planned steps. 2025-10-28 23:34:42 +00:00
Andrew Wood 5aff62414a Add a total stoppage time counter to the per-fd watchfd structure (#169). 2025-10-28 23:34:26 +00:00
Andrew Wood c7a6f85dd2 Remove unnecessary splint annotation. 2025-10-28 21:39:54 +00:00
Andrew Wood 22e9e00f63 Move the array of watchfd item information into the main state, instead of being local to the watchfd loop, so that in future we can add stoppage time to individual fd info and it will be accessible to the signal handler (#169). 2025-10-27 20:41:32 +00:00
Andrew Wood 60ca91209a Rename structure members for clarity - "tstp_time" becomes "when_tstp_arrived", and "toffset" becomes "total_stoppage_time". 2025-10-27 19:20:22 +00:00
Andrew Wood 8c440b5417 Move remote.c, line position updates, and new strings for --query / --remote option parsing. 2025-10-26 13:19:43 +00:00
Andrew Wood 07e6255e7e Version bump, and mention the new "--query" option (#101). 2025-10-26 13:14:28 +00:00
Andrew Wood 82283ee434 Remove the TODO now it is done. 2025-10-26 12:56:28 +00:00
Andrew Wood 42cf7ed628 Move the remote control code into the pv library. 2025-10-26 12:55:15 +00:00
Andrew Wood b1cac9b78d Record all old-style formatting options, and the full string for the extra display spec, in the control structure; make pv_remote_set only use internal pv state structures so it can be part of the internal pv library where it belongs, and not need to know about main()'s options array. 2025-10-26 12:53:51 +00:00
Andrew Wood 528889888c Always calculate the elapsed transfer time every time around the loop, even if not displaying anything; and take -W into account so the elapsed time doesn't start ticking up until the first byte or line transferred, even if not displaying anything - so that -Q will report the right thing when querying a "pv -n" (#101). 2025-10-26 12:06:32 +00:00
Andrew Wood e6e6ab3b6d Consolidate repeated code into new pv__elapsed_transfer_time function. 2025-10-26 11:49:35 +00:00
Andrew Wood d2d3ec1cde Add a TODO marker for the next step. 2025-10-26 01:35:53 +01:00
Andrew Wood f518257bc9 Consolidate repeated code into new pv__show_stats function. 2025-10-25 22:49:33 +01:00
Andrew Wood 96a411671c Consolidate repeated code into new pv__resize_display_on_signal function. 2025-10-25 00:43:59 +01:00
Andrew Wood f07a7b1c87 Correct the noise interrupting the display of the original pv if the querying pv is terminated. Correct the transfer of size information to main() so that ETA can still be shown. (#101) 2025-10-24 09:24:31 +01:00
Andrew Wood 7598b4d46c Add pv_query_loop() to run a main loop watching another pv (#101). 2025-10-24 09:00:10 +01:00
Andrew Wood 15ed99eee7 Implement --query message send/receive (#101). 2025-10-23 23:27:34 +01:00
Andrew Wood 4df6fbf6f7 Mention that the --query PID needs to be owned by the same user (#101). 2025-10-23 22:02:59 +01:00
Andrew Wood f125f41428 Correct the comment naming pv__target_bufsize, which should be control.target_buffer_size. 2025-10-23 21:26:34 +01:00
Andrew Wood 2e9fc77ccd Add -Q to the remote check comments (#101). 2025-10-22 17:55:43 +01:00
Andrew Wood 590a3535d8 Don't keep PV_REMOTE_QUERY separate from PV_REMOTE_CONTROL after all since they will need to work together; extend pv_remote_check() so it will check for both -R and -Q signals (#101). 2025-10-21 23:39:17 +01:00
Andrew Wood b34bba8b4a Remove unused pv_remote_init, pv_remote_fini functions; add initial stubs for -Q (#101). 2025-10-21 23:17:23 +01:00
Andrew Wood 4f82525c39 Correct the comment at the end of the conditional. 2025-10-21 23:03:30 +01:00
Andrew Wood a2191ff270 Mention --query where --remote was mentioned, since it has the same requirements (#101). 2025-10-21 23:01:46 +01:00
Andrew Wood 8361ed1fe2 Rename signal.sender to signal.sender_usr2 so it is specific to SIGUSR2 (#101). 2025-10-21 22:15:23 +01:00
Andrew Wood 9bd96614b3 Add an action type for query mode, and more TODOs to plan how it will work (#101). 2025-10-21 22:11:10 +01:00
Andrew Wood d27672b7a3 Declare pv_open_controlfile so it can be used for the query action (#101). 2025-10-21 22:10:38 +01:00
Andrew Wood 36d82e313a Rename pv__control_file to pv_open_controlfile, and move it in with the other file functions so it can be used by both the remote-control and the remote-query code (#101). 2025-10-21 22:09:44 +01:00
Andrew Wood 8b3b61e2d3 Separate the data transfer modifier options from the alternative operating mode options. 2025-10-21 21:13:27 +01:00
Andrew Wood 60067ed4ea Define whether --query should be available, based on the same criteria as --remote for now (#101). 2025-10-21 20:59:32 +01:00
Andrew Wood de71cc2389 Prevent the use of any non-option arguments with -R or -Q (#101). 2025-10-21 20:48:44 +01:00
Andrew Wood 3f1782a573 Draft manual entry, help text, and option parsing for "--query" option (#101). 2025-10-20 21:17:59 +01:00
Andrew Wood fc379727cc Add empty unreleased line for next changes. 2025-10-19 23:47:28 +01:00
Andrew Wood 0b687edfbe Remove the obsolete build-package script, and the scripts for the release process and lab testing (which are now maintained separately at https://codeberg.org/ivarch/scripts), and add a release config file for the new release script under the same location. 2025-10-19 00:20:03 +01:00
Andrew Wood 546074853e Datestamp update. 2025-10-18 19:35:10 +01:00
Andrew Wood 7deef78ea5 Set the release date. 2025-10-18 19:32:44 +01:00
Andrew Wood a38e05e749 Datestamp update. 2025-10-18 17:09:30 +01:00
Andrew Wood 493634e26c Cover more of the features in the description. 2025-10-17 23:49:08 +01:00
Andrew Wood f96a43e366 Line number updates. 2025-10-17 23:22:33 +01:00
Andrew Wood b434c858a2 Version and datestamp bump. 2025-10-17 23:21:52 +01:00
Andrew Wood 30e30f0196 Note and acknowledge the change (#81). 2025-10-17 23:09:38 +01:00
Andrew Wood 1a70cc228a Correction to the description and removal of the TODO marker; and use the transfer interval as the time to wait after closure (#81). 2025-10-17 22:50:33 +01:00
Andrew Wood 17ca4fc9c9 Keep displaying --watchfd fds for a short time after they are closed, and don't clear the display at the end but just move the cursor past it (#81). 2025-10-17 20:40:14 +01:00
Andrew Wood 0aac6d6aac Add comments and "pid_last_seen", "fd_last_seen" structure members for proposed new logic that will hold fd info on-screen a short time after closure, to retain the progress display when a watched process exits (#81). 2025-10-17 19:09:46 +01:00
Andrew Wood 61021eab6b Remove the TODO markers for #81 as this work will be done in a separate branch. 2025-10-17 17:52:33 +01:00
Andrew Wood e59452d765 Add a note describing the apparent lack of output file growth during transfer of null bytes with --sparse (#45). 2025-10-16 21:13:43 +01:00
Andrew Wood d2647ac55c Line number updates, and remove incorrect fuzzy entries. 2025-10-15 23:46:04 +01:00
Andrew Wood c2c58762f0 Datestamp update. 2025-10-15 23:28:24 +01:00
Andrew Wood 0a55710cfc Acknowledge the suggestions for --sparse (#45). 2025-10-15 23:28:18 +01:00
Andrew Wood 660d3da704 Note the new --sparse option (#45). 2025-10-15 23:27:53 +01:00
Andrew Wood 972f8b7df8 Re-order no_splice and sparse_output relative to other flags to more closely match the order they appear in the manual. 2025-10-15 23:23:16 +01:00
Andrew Wood a40bdfb55f Merge branch 'issue45_sparse' (#45). 2025-10-15 23:17:05 +01:00
Andrew Wood 3c9ab822fe Call lseek() at the start if output is appending, so that future lseek()s are relative to the right position, fixing the issue with incorrect truncation size (#45). 2025-10-15 23:08:33 +01:00
Andrew Wood fb5ce33518 Add debugging messages about truncation and seeking (#45). 2025-10-15 22:43:56 +01:00
Andrew Wood 5c15337662 Only call ftruncate() once, when the output file descriptor is closed at the end, instead of after every lseek() - this corrects the file growth on XFS but has the side effect that writing to stdout in >> (append) mode truncates the file to the wrong size (#45). 2025-10-15 22:32:21 +01:00
Andrew Wood 71f929e29c Add a TODO indicating the problems so far and what to try next (#45). 2025-10-15 17:49:38 +01:00
Andrew Wood c21ad6fdf1 For sparse output, instead of fstat(), ftruncate(), then lseek(), do lseek() then ftruncate(), like dd does (#45). 2025-10-14 23:38:15 +01:00
Andrew Wood f0895177e7 Remove comment lines from the lab-hosts config when reading it. 2025-10-14 22:11:40 +01:00
Andrew Wood 72686655cf Move the pv__transfer_write_completed label, jumped to on a sparse write, outside of the compound statement; and so, move all of the variables within that compound statement to the start of the function. The GCC on RHEL derivatives like AlmaLinux 9, Rocky 8, CentOS 7/6/5 throws an error if the label is at the end of that block rather than just outside it (#45). 2025-10-14 22:03:41 +01:00
Andrew Wood 2efe598855 Add a test for --sparse (#45). 2025-10-14 21:46:16 +01:00
Andrew Wood 54913fddbe First working draft of --sparse transfers, tests still needed (#45). 2025-10-13 22:13:54 +01:00
Andrew Wood 023cf22a59 Add --sparse / -O to the manual, to --help, and to option processing (#45). 2025-10-13 21:26:24 +01:00
Andrew Wood 164d7f7738 Add the extra --watchfd syntax to the help for that option. 2025-10-13 17:58:37 +01:00
Andrew Wood 6b8acd9e01 Add sparse_output option and control flags, and an output_not_seekable transfer flag, to structures for "sparse output" mode in future (#45). 2025-10-12 18:12:43 +01:00
Andrew Wood 3f6dc99aa5 Change the release process to build packages with parmo. 2025-10-11 22:01:59 +01:00
Andrew Wood d939d45c27 Commit to the release date. 2025-10-11 21:31:26 +01:00
Andrew Wood fc8326a2b4 Message position updates. 2025-10-11 16:00:44 +01:00
Andrew Wood 8d939c9b99 Provisional version bump. 2025-10-11 16:00:13 +01:00
Andrew Wood 72d9efc993 More specific TODOs for one way of implementing #81. 2025-10-07 22:17:10 +01:00
Andrew Wood 64c4e8efb9 Add TODO markers for one way of implementing #81. 2025-10-06 18:03:46 +01:00
Andrew Wood 25dadb2bfd Add a comment describing what this structure is for. 2025-10-06 18:01:57 +01:00
Andrew Wood 80b68a73ee Include -C in the test, since splice can have an effect (#166). 2025-10-05 21:50:09 +01:00
Andrew Wood 3437b75256 Position updates and new strings. 2025-10-05 21:41:51 +01:00
Andrew Wood 462415a88a Note the Turkish translation updates. 2025-10-05 21:40:52 +01:00
Andrew Wood d23a7e929e Acknowledge Turkish translation updates (#168). 2025-10-05 21:40:25 +01:00
Andrew Wood f18fa637c6 Merge pull request 'Translations update from Codeberg Translate' (#168) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/168
2025-10-05 22:34:50 +02:00
Oğuz ErsenandCodeberg Translate 9bff7f0bb5 Translated using Weblate (Turkish)
Currently translated at 100.0% (134 of 134 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2025-10-05 20:33:46 +00:00
Andrew Wood 771b61db30 Add test for over-read when using stop-at-size (#166). 2025-10-05 21:33:32 +01:00
Andrew Wood 615c1d5321 Explicitly cast both sides of the comparison to "long long", otherwise there is an overflow on 32-bit systems and stop-at-size stops at the wrong point (#166). 2025-10-05 21:20:27 +01:00
Andrew Wood 3442d7651a Use a void *, not a char *, so the types are consistent throughout. 2025-10-05 21:16:34 +01:00
Andrew Wood 7982badb65 Write a debugging line when truncating transfers for stop-at-size. 2025-10-05 21:15:58 +01:00
Andrew Wood a83a549de5 Correct the value size in the debug statement, otherwise it overflows on 32-bits systems. 2025-10-05 21:02:27 +01:00
Andrew Wood b1797c51e6 Note the new "=NAME" and "@LISTFILE" syntax additions to --watchfd. 2025-10-05 18:10:41 +01:00
Andrew Wood 8504964f1a Remove old non-functional code relating to ETAs and --size in the --watchfd loop. 2025-10-05 18:07:02 +01:00
Andrew Wood f83aa2272b Fix incorrect usage of "optarg". 2025-10-04 21:51:26 +01:00
Andrew Wood fb7c05c262 Implement the "pgrep" call for --watchfd =NAME (#95). 2025-10-04 21:50:25 +01:00
Andrew Wood e6f611f4de Adjust formatting. 2025-10-04 20:27:24 +01:00
Andrew Wood bd4ca7301c Document the new "=NAME" (#95) and "@FILE" (#12) syntax for --watchfd options. 2025-10-04 20:17:46 +01:00
Andrew Wood 242297a3c6 Partial draft of "-d @filename" (#12) and "-d =processname" syntax (#95). 2025-10-04 17:46:43 +01:00
Andrew Wood 0a658f99bb In --watchfd, when deciding whether to insert %N into the format, check for %{name} in the current format as well as the existing check for %N. 2025-10-04 14:49:06 +01:00
Andrew Wood 8df1c29c37 Note the addition of an empty Finnish translation file. 2025-10-04 00:54:48 +01:00
Andrew Wood a8b7cd19bd Add an empty translation file for Finnish. 2025-10-03 23:03:38 +01:00
Andrew Wood b4f525fd79 Merge pull request 'Translations update from Codeberg Translate' (#167) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/167
Reviewed-by: Andrew Wood <a-j-wood@noreply.codeberg.org>
2025-10-02 22:31:05 +02:00
Coral PinkandCodeberg Translate 8caa977a35 Translated using Weblate (Polish)
Currently translated at 100.0% (134 of 134 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/pl/
2025-10-02 13:23:16 +00:00
Andrew Wood f6d398738e Note the behaviour change of --stop-at-size with a zero size. 2025-10-01 22:09:33 +01:00
Andrew Wood 11dc25966d If stop_at_size is true, do not read more than control.size even if that is 0 (#166). 2025-10-01 18:06:59 +01:00
Andrew Wood efc8b33e81 Position updates. 2025-09-30 22:30:36 +01:00
Andrew Wood be066f6c8c Restrict the amount to read when --stop-at-size is active so that reads, as well as writes, never go past --size bytes (#166). 2025-09-30 22:27:25 +01:00
Andrew Wood 6a1ad7d374 Note the improvement to the control of a --watchfd with a remote -R. 2025-09-29 22:05:47 +01:00
Andrew Wood 751263376b Adjust the format and reparse the display, if a remote update -R was received while in the --watchfd loop. 2025-09-29 21:42:48 +01:00
Andrew Wood d903a7d188 Add a return value to pv_remote_check() so its caller can know whether a message was received. 2025-09-29 21:31:05 +01:00
Andrew Wood a4e2243102 Position updates. 2025-09-29 17:55:39 +01:00
Andrew Wood 9fe604df1a Move the declaration of changes_made outside the conditional, so as to not break on macOS. 2025-09-29 17:53:56 +01:00
Andrew Wood 64cd9cd85c Move the watchfd %N format insertion into its own function, so it can be called separately elsewhere in future, and to make it easier to extend the %N detection to find %{name} later as well. 2025-09-28 17:22:56 +01:00
Andrew Wood 10ef5a8596 If watching more than one distinct PID with --watchfd, display the PID as well as the FD number (#12). 2025-09-28 16:36:06 +01:00
Andrew Wood 77ed2e5989 Another minor issue noted as a TODO. 2025-09-27 18:32:27 +01:00
Andrew Wood 8ae549c47f Mention the --watchfd multiple arguments feature (#12). 2025-09-27 18:31:24 +01:00
Andrew Wood 284ceba52b Add TODO marker after some testing showed an issue. 2025-09-27 18:24:59 +01:00
Andrew Wood 3ea19829d7 Merge pv_watchpid_loop into pv_watchfd_loop, and allow multiple PID / PID:FD sets to be watched at once (#12). 2025-09-27 17:55:18 +01:00
Andrew Wood c49fc4aa57 Eliminate the fd_to_idx array in --watchfd, so that file descriptors aren't constrained to FD_SETSIZE and so we don't have to track another array. 2025-09-26 23:40:39 +01:00
Andrew Wood 7fdb6716e1 In the pvwatchfd_s structure, use booleans "displayable" and "unused" instead of having values of watch_pid=0 for unused and watch_fd=-1 for not displayable, so that each item only means one thing. 2025-09-26 23:01:07 +01:00
Andrew Wood c61c589378 Typo correction in the comment. 2025-09-26 22:29:36 +01:00
Andrew Wood c688987087 Adjust the --watchfd documentation to say that multiple PID/PID:FD arguments are allowed (#12). 2025-09-25 06:21:55 +01:00
Andrew Wood 0b2f9ec397 Only call pv_watchfd_loop() from main, so that eventually pv_watchpid_loop() can be removed and multiple "-d" values supported (#12). 2025-09-24 22:11:44 +01:00
Andrew Wood 8a8e6d71a4 Reinstate the previously removed "cannot transfer files" message for "-d". 2025-09-23 05:46:53 +01:00
Andrew Wood a0a9d682ca Reject "-o" when using "-d". 2025-09-23 05:45:43 +01:00
Andrew Wood 05a72bf75e Position updates, two new strings, one old message removed. 2025-09-23 05:39:43 +01:00
Andrew Wood 22bf08f8e4 Accept additional arguments when -d is specified, expecting them to be more pid[:fd] values (#12). 2025-09-22 21:50:35 +01:00
Andrew Wood b5fbd1978e Replace watch_pid, watch_fd with arrays, though for now only use the first item in the arrays (#12). 2025-09-21 19:50:56 +01:00
Andrew Wood db80f838ff Explicitly set an action variable to say which action to perform, instead of inferring it from other settings like whether a watch PID was set (#12). 2025-09-18 06:18:18 +01:00
Andrew Wood 8c2e934768 Add a TODO marker for the next step to take. 2025-09-18 05:47:15 +01:00
Andrew Wood dbce5b355e Add --watchfd option values to an array in the main state, as well as to the currently used variables (#12). 2025-09-17 23:12:13 +01:00
Andrew Wood 12cc996d32 Add --watchfd option values to an array as well as to the currently used variables (#12). 2025-09-17 22:12:45 +01:00
Andrew Wood 4a0f9e713c Define struct pvwatchspec_s for future use in an array for --watchfd, and add a comment defining nullable_string_t. 2025-09-16 23:05:41 +01:00
Andrew Wood 8771b901d9 Add TODO markers as part of looking at supporting multiple "-d" options (#12). 2025-09-15 20:12:55 +01:00
Andrew Wood 48ac509af7 Line number updates. 2025-09-14 16:42:42 +01:00
Andrew Wood f70627c031 Pass through indent. 2025-09-14 16:42:08 +01:00
Andrew Wood 1e6c9704b1 Adjustments to remove the need for the unqualifiedtrans and nullstate splint workarounds. 2025-09-14 16:39:47 +01:00
Andrew Wood a629a488d7 Add TODO marker for the planned next step. 2025-07-28 20:39:05 +01:00
Andrew Wood ad1d0e1c9a In the watchfd info array, instead of using copies of the global state, each fd has its own flags, transfer, calc, and display sub-structures (#165). 2025-07-28 00:25:14 +01:00
Andrew Wood 4f9d746823 Split the state reset functions into smaller pieces, so sub-structures can be reset individually (#165). 2025-07-27 23:24:56 +01:00
Andrew Wood 9fc9b6a8ed Carry the fd info_array "size" into the global "control" structure just before calling pv_display() so it gets used without having to have a per-fd copy of "control" (#165). 2025-07-27 21:39:36 +01:00
Andrew Wood 9ab82cde1e Use the original info_aray size for comparison as the "control" structure may be made irrelevant here soon (#165). 2025-07-27 21:38:55 +01:00
Andrew Wood a7f392e3c3 Address splint warnings about setting and clearing state->control.name (#165). 2025-07-27 21:34:46 +01:00
Andrew Wood 574ea04502 Instead of adding an aliased display name and having to maintain it and treat it differently, go back to keeping the name only in the "control" sub-structure of the state, but share the global state "control" across all watched fds, and just change it before each pv_display() call so it points to the relevant fd display_name when needed (#165). 2025-07-27 21:23:41 +01:00
Andrew Wood 5282a521b5 Pass only the relevant sub-structure to pv_alloc_history (#165). 2025-07-27 20:59:21 +01:00
Andrew Wood 52634f01f9 Do not call pv_state_name_set when adjusting an fd display_name, but instead set the alias state->display.name ourselves. Since the fd display_name we are pointing to is within the info_array, if we extend info_array with realloc we then have to also reset those aliases since display_name may move if realloc rebases the array. (#165) 2025-07-27 20:51:00 +01:00
Andrew Wood a0f2d9c9c7 Use status, cursor from main state, and a null extra_display, to reduce the dependency on the per-watched-fd state (#165). 2025-07-27 20:46:51 +01:00
Andrew Wood 8386c05978 Explicitly check for non-NULL rather than treating NULL as boolean false. 2025-07-27 20:43:52 +01:00
Andrew Wood 6a2b9a2788 Add an alias for the name for %N to the display sub-structure, so that the name can be varied between displays without having to alter the control value (#165). 2025-07-27 19:53:28 +01:00
Andrew Wood e04f50f0dc Change all cursor positioning functions to use sub-structures rather than the whole state structure, and if turning off cursor positioning, do so via a new flag "cursor->disable" rather than changing the operator-supplied options in "control" (#165). 2025-07-27 17:05:04 +01:00
Andrew Wood 021dc6e054 Pass individual sub-structures to pv_display, but still keep state for now, until the functions cursor.c have been updated to take sub-structures rather than the whole state (#165). 2025-07-27 15:56:03 +01:00
Andrew Wood 7d7efac7c6 Move the terminal_supports_utf8, terminal_supports_colour, and checked_colour_support flags out of "control" and into "status", as they are not operator-supplied options, but are program-generated status flags; this will allow "control" to remain read-only for larger parts of the program (#165). 2025-07-27 15:37:16 +01:00
Andrew Wood f79bed3cb8 Rename "can_display_colour" and "can_display_utf8" to "terminal_supports_colour" and "terminal_supports_utf8" to make it clearer that these are not operator-supplied option settings, they are derived from terminal capabilities (colour) and the environment (UTF-8). 2025-07-27 15:20:05 +01:00
Andrew Wood 2171f40703 Address the splint warning. 2025-07-27 00:34:09 +01:00
Andrew Wood 960ff1572f Pass state->status, rather than state itself, to pv_format (#165). 2025-07-27 00:31:45 +01:00
Andrew Wood da2a2e6fd2 Remove the state from the pv_error arguments, by adding a new function pv_set_error_prefix to call on startup, eliminating the need for a state program_name string; and add a private boolean to track whether there has been any output which means errors need preceding by a newline, which is updated by pv_display directly (#165). 2025-07-27 00:22:57 +01:00
Andrew Wood 005bc2f841 Pass the sub-structures separately to pv_format and pv__format_init rather than the whole state; but still pass state for now, as pv_error needs it (#165). 2025-07-26 22:49:29 +01:00
Andrew Wood ecc0c0e414 Adjust the readonly structure pointer types so the pointer itself is not read-only but the thing it points to is; and change the display formatters to use pointers to control, transfer, and calc structures instead of the whole state, with read-only access enforced at compile time (#165). 2025-07-26 22:28:39 +01:00
Andrew Wood 18548d217b Rename struct pvipcstate_s to pvcursorstate_s since it is for cursor positioning, not for IPC (#165). 2025-07-26 21:30:16 +01:00
Andrew Wood 653326ca9b Rename struct pvcursorstate_s to pvipccursorstate_s for clarity since it is only for IPC (#165). 2025-07-26 21:29:20 +01:00
Andrew Wood 0cf8902d9b Rename display structure member "display_visible" to "output_produced" for clarity. 2025-07-26 21:25:54 +01:00
Andrew Wood 762676f4e1 Make pv_tty_write take only the transient flags part of the state rather than the whole state, and rename the "flag" part of the state to "flags" for better readability (#165). 2025-07-26 21:18:13 +01:00
Andrew Wood 3bd49a0c3f Ensure the current average rate calculation can't accidentally divide by zero. 2025-07-26 20:53:22 +01:00
Andrew Wood 870dfad9fd Introduce read-only structure pointer typedefs for each of the state sub-structures, so the compiler will catch anywhere that a function would alter a structure it isn't expected to (#165). 2025-07-26 20:51:28 +01:00
Andrew Wood 3b0891b128 Pass more specific structures to pv_calculate_transfer_rate rather than the whole state (#165). 2025-07-26 19:22:07 +01:00
Andrew Wood b3c854b27a Add typedefs for the pointers to the sub-structures within struct pvstate_s, so they can be used as types in function declarations (#165). 2025-07-26 18:33:24 +01:00
Andrew Wood a923bdaca4 Give struct names to each of the sub-structures within struct pvstate_s, so they can be used as types in function declarations (#165). 2025-07-26 18:24:47 +01:00
Andrew Wood 0070a74390 Correct a minor typo in a comment. 2025-07-26 17:57:46 +01:00
69 changed files with 6989 additions and 3886 deletions
+6 -2
View File
@@ -8,14 +8,13 @@ bin_PROGRAMS = pv
dist_doc_DATA = README.md docs/INSTALL docs/COPYING docs/NEWS.md docs/ACKNOWLEDGEMENTS.md docs/DEVELOPERS.md
dist_man1_MANS = docs/pv.1
EXTRA_DIST = docs/pv.1.md docs/benchmark.sh docs/test-on-vm-lab.sh docs/build-package.sh docs/release.sh
EXTRA_DIST = docs/pv.1.md docs/benchmark-rw-syscalls-vs-data.sh docs/release.cf
pv_SOURCES = \
src/main/debug.c \
src/main/help.c \
src/main/main.c \
src/main/options.c \
src/main/remote.c \
src/main/version.c \
src/pv/calc.c \
src/pv/cursor.c \
@@ -38,6 +37,7 @@ src/pv/format/timer.c \
src/pv/loop.c \
src/pv/number.c \
src/pv/proctitle.c \
src/pv/remote.c \
src/pv/signal.c \
src/pv/state.c \
src/pv/string.c \
@@ -93,12 +93,16 @@ tests/Modifiers_-_--force.test \
tests/Modifiers_-_--interval.test \
tests/Modifiers_-_--line-mode.test \
tests/Modifiers_-_--size_from_file_size.test \
tests/Modifiers_-_--size_from_dir_size.test \
tests/Modifiers_-_--size.test \
tests/Modifiers_-_--sync.test \
tests/Sparse_-_Basic.test \
tests/Terminal_-_Detect_width.test \
tests/Transfer_-_--rate-limit.test \
tests/Transfer_-_--remote.test \
tests/Transfer_-_--stop-at-size.test \
tests/Transfer_-_--stop-at-size_reads.test \
tests/Watchfd_-_Multiple_arguments.test \
tests/Watchfd_-_Multiple_descriptors.test \
tests/Watchfd_-_Single_descriptor.test
+12 -6
View File
@@ -1,10 +1,16 @@
# Introduction
This is the README for **pv** ("Pipe Viewer"), a terminal-based tool for
monitoring the progress of data through a pipeline. It can be inserted into
any normal pipeline between two processes to give a visual indication of how
quickly data is passing through, how long it has taken, how near to
completion it is, and an estimate of how long it will be until completion.
**pv** ("Pipe Viewer") is a terminal-based tool for monitoring the progress
of data through a pipeline and modifying its flow.
It can be inserted into any normal pipeline between two processes to give a
visual indication of how quickly data is passing through, how long it has
taken, how near to completion it is, and an estimate of how long it will be
until completion. Data flow rate, error handling strategy, buffer size, and
cache interaction can all be adjusted.
In "**\--watchfd**" mode, **pv** will inspect another process and show its
progress through the files it has open.
# Documentation
@@ -51,7 +57,7 @@ run it as described above.
See "[docs/ACKNOWLEDGEMENTS.md](./docs/ACKNOWLEDGEMENTS.md)" for a list of
contributors.
Copyright (C) 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood.
Copyright (C) 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood.
License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl-3.0.html>.
+5 -2
View File
@@ -1,10 +1,10 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
dnl Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
dnl
dnl License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
AC_INIT([pv], [1.9.34], [https://codeberg.org/ivarch/pv/issues], [pv], [https://ivarch.com/p/pv])
AC_INIT([pv], [1.10.4], [https://codeberg.org/ivarch/pv/issues], [pv], [https://ivarch.com/p/pv])
AC_CONFIG_SRCDIR([src/include/config.h.in])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([src/include/config.h])
@@ -17,6 +17,7 @@ AC_C_CONST
AC_HEADER_STDBOOL
AC_SYS_LARGEFILE
AM_GNU_GETTEXT_VERSION([0.21])
AM_GNU_GETTEXT_REQUIRE_VERSION([0.21])
AM_GNU_GETTEXT([external])
if test "$USE_NLS" = "yes"; then
CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
@@ -31,6 +32,7 @@ AC_CHECK_FUNCS([fpathconf sysconf posix_memalign posix_fadvise])
AC_CHECK_FUNCS([nanosleep])
AC_CHECK_FUNCS([setitimer])
AC_CHECK_FUNCS([setproctitle])
AC_CHECK_FUNCS([nftw])
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_HEADERS([limits.h])
AC_CHECK_HEADERS([langinfo.h])
@@ -40,6 +42,7 @@ AC_CHECK_HEADERS([libgen.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([libintl.h locale.h])
AC_CHECK_HEADERS([sys/sysmacros.h])
AC_CHECK_HEADERS([ftw.h])
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_DECLS([SA_SIGINFO], [], [], [[#include <signal.h>]])
+6
View File
@@ -108,11 +108,16 @@ is acknowledged and greatly appreciated:
* [Alexander Petrossian](https://github.com/neopaf) - suggested using Unicode output for a more granular progress bar, and provided the codepoints to use ([#15](https://codeberg.org/ivarch/pv/issues/15))
* [jmealo](https://codeberg.org/jmealo) - suggested JSON progress output ([#127](https://codeberg.org/ivarch/pv/issues/127))
* [ipaqmaster](https://codeberg.org/ipaqmaster) - investigated 100%-CPU utilisation bug when piping to a command that has exited ([#164](https://codeberg.org/ivarch/pv/issues/164))
* Andriy Galetski, and also [thinrope](https://codeberg.org/thinrope) - suggested the "**--sparse**" option ([#45](https://codeberg.org/ivarch/pv/issues/45))
* [KimHansen](https://codeberg.org/KimHansen) - suggested that "**--watchfd**" should keep its display when the process ends ([#81](https://codeberg.org/ivarch/pv/issues/81))
* [njt](https://codeberg.org/njt) - suggested that "**--size** @*PATH*" should accept directories ([#179](https://codeberg.org/ivarch/pv/issues/179))
Translations provided through [Codeberg Weblate](https://translate.codeberg.org/projects/pv/):
* **Czech**
* [mmatous](https://translate.codeberg.org/user/mmatous/) (135)
* **Finnish**
* [artnay](https://translate.codeberg.org/user/artnay/) (65)
* **French**
* anonymous suggestions (7)
* [milimarg](https://codeberg.org/milimarg) (13)
@@ -129,5 +134,6 @@ Translations provided through [Codeberg Weblate](https://translate.codeberg.org/
* [0ko](https://translate.codeberg.org/user/0ko/) (157)
* **Turkish**
* [omerdduran](https://translate.codeberg.org/user/omerdduran/) (129)
* [Oğuz Ersen](https://codeberg.org/ersen) (8)
---
+38
View File
@@ -1,3 +1,41 @@
### 1.10.4 - 8 March 2026
* *fix:* when using **--size @PATH**, *PATH* can be a directory, and the total size of all files within it will be used ([#179](https://codeberg.org/ivarch/pv/issues/179))
### 1.10.3 - 15 December 2025
* *fix:* stop truncating the process title set by **--extra-display**
### 1.10.2 - 22 November 2025
* *i18n:* Finnish translations updated
* *cleanup:* adjust valgrind suppressions so memory safety tests work on LTO builds ([#174](https://codeberg.org/ivarch/pv/issues/174)/[Debian bug 1121157](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121157))
### 1.10.1 - 12 November 2025
* *fix:* correct **--watchfd** memory allocation error when given multiple arguments ([#170](https://codeberg.org/ivarch/pv/issues/170))
### 1.10.0 - 7 November 2025
* *feature:* new **--query** option to show the transfer status of another running **pv** ([#101](https://codeberg.org/ivarch/pv/issues/101))
* *fix:* make the timers work consistently in **--watchfd** if paused and resumed ([#169](https://codeberg.org/ivarch/pv/issues/169))
### 1.9.44 - 18 October 2025
* *feature:* new **--sparse** option to write sparse output ([#45](https://codeberg.org/ivarch/pv/issues/45))
* *fix:* don't clear the **--watchfd** display when the watched process ends ([#81](https://codeberg.org/ivarch/pv/issues/81))
### 1.9.42 - 11 October 2025
* *feature:* permit multiple arguments to **--watchfd** ([#12](https://codeberg.org/ivarch/pv/issues/12))
* *feature:* new "**=NAME**" syntax for **--watchfd** to watch processes by name using **pgrep**(1) ([#95](https://codeberg.org/ivarch/pv/issues/95))
* *feature:* new "**@LISTFILE**" syntax for **--watchfd** to watch processes listed in a file
* *fix:* improve support for changing the format of a **--watchfd** process with **--remote**
* *fix:* don't read more than **--size** bytes when using **--stop-at-size** ([#166](https://codeberg.org/ivarch/pv/issues/166))
* *fix:* transfer nothing if **--stop-at-size** is given a **--size** of 0 ([#166](https://codeberg.org/ivarch/pv/issues/166))
* *i18n:* Finnish translation stub added
* *i18n:* Turkish translations updated
### 1.9.34 - 26 July 2025
* *fix:* prevent tight loop consuming CPU when waiting for a partially filled output pipe to be drained ([#164](https://codeberg.org/ivarch/pv/issues/164))
-149
View File
@@ -1,149 +0,0 @@
#!/bin/sh
#
# Usage: sh build-package.sh source-1.2.3.tar.gz
#
# Given a tar.gz, build a package for the current OS.
#
# Supports these packaging types:
#
# .deb (Debian, Ubuntu, etc) - requires dpkg-dev, debhelper
# .rpm (AlmaLinux, Rocky Linux, OpenSUSE etc) - requires rpmbuild
#
# If the MAINTAINER environment variable is set, this is used as a GPG key
# ID for package signing.
#
# The packages built with this script are not "official", in that they are
# not part of any Linux distribution and may not follow the distribution's
# policies. Use at your own risk.
#
# Copyright 2024-2025 Andrew Wood
# License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
sourceArchive="$1"
test -n "${sourceArchive}" && test -f "${sourceArchive}" \
|| { printf "%s: %s: %s\n" "${0##*/}" "${sourceArchive}" "source archive not found" 1>&2; exit 1; }
packageName="pv"
packageSummary="Shell pipeline element to meter data passing through"
packageDescription="\
pv (Pipe Viewer) can be inserted into any normal pipeline between two
processes to give a visual indication of how quickly data is passing
through, how long it has taken, how near to completion it is, and an
estimate of how long it will be until completion."
packageUrl="https://ivarch.com/p/pv"
sourceUrl="https://ivarch.com/programs/sources/${packageName}-%{version}.tar.gz"
packageEmail="Andrew Wood <pv@ivarch.com>"
workDir="$(mktemp -d)" || exit 1
trap 'rm -rf "${workDir}"' EXIT
# Infer the version from the most recent NEWS entry.
version="$(tar xzf "${sourceArchive}" --wildcards -O '*/docs/NEWS.md' 2>/dev/null | awk '/^### [0-9]/{print $2}' | sed -n 1p)"
if command -v rpmbuild >/dev/null 2>&1; then
# Build an RPM.
cat > "${workDir}"/spec <<EOF
Summary: ${packageSummary}
Name: ${packageName}
Version: ${version}
Release: 1%{?dist}
License: GPLv3+
Source: ${sourceUrl}
Url: ${packageUrl}
%description
${packageDescription}
%prep
%setup -q
%build
%configure
make %{?_smp_mflags}
%install
test -n "\${RPM_BUILD_ROOT}" && test "\${RPM_BUILD_ROOT}" != '/' && rm -rf "\${RPM_BUILD_ROOT}"
make install DESTDIR="\${RPM_BUILD_ROOT}"
rm -rf "\${RPM_BUILD_ROOT}/usr/share/doc"
%find_lang %{name}
%check
make check SKIP_VALGRIND_TESTS=1
%clean
test -n "\${RPM_BUILD_ROOT}" && test "\${RPM_BUILD_ROOT}" != '/' && rm -rf "\${RPM_BUILD_ROOT}"
%files -f %{name}.lang
%defattr(-, root, root)
%{_bindir}/*
%{_mandir}/man1/*
%doc README.md docs/NEWS.md docs/ACKNOWLEDGEMENTS.md docs/COPYING
%changelog
* $(date '+%a %b %d %Y') ${packageEmail} - ${version}-1
- Package built from main source.
EOF
mkdir "${workDir}/SOURCES"
cp "${sourceArchive}" "${workDir}/SOURCES/${packageName}-${version}.tar.gz"
rpmbuild -D "%_topdir ${workDir}" -bb "${workDir}/spec" || exit 1
if test -n "${MAINTAINER}"; then
# Sign the RPMs.
rpm -D "%_gpg_name ${MAINTAINER}" --addsign "${workDir}/RPMS"/*/*.rpm || exit 1
fi
cp -v "${workDir}/RPMS"/*/*.rpm .
fi
if command -v dpkg-buildpackage >/dev/null 2>&1; then
# Build a Debian package.
mkdir "${workDir}/build" "${workDir}/build/debian" "${workDir}/build/debian/source"
tar xzf "${sourceArchive}" -C "${workDir}/build" --strip-components=1
printf "%s\n" "10" > "${workDir}/build/debian/compat"
touch "${workDir}/build/debian/copyright"
printf "%s\n" "3.0 (quilt)" > "${workDir}/build/debian/source/format"
cat > "${workDir}/build/debian/rules" <<EOF
#!/usr/bin/make -f
export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh \$@
EOF
chmod 700 "${workDir}/build/debian/rules"
cat > "${workDir}/build/debian/control" <<EOF
Source: ${packageName}
Maintainer: ${packageEmail}
Section: misc
Priority: optional
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 9)
Package: ${packageName}
Architecture: any
Depends: \${misc:Depends}
Description: ${packageSummary}
$(printf "%s\n.\n" "${packageDescription}" | sed 's,^, ,')
EOF
cat > "${workDir}/build/debian/changelog" <<EOF
${packageName} (${version}-1) UNRELEASED; urgency=low
* Package built from main source.
-- ${packageEmail} $(date -R)
EOF
if test -n "${MAINTAINER}"; then
(cd "${workDir}/build" && dpkg-buildpackage --build=binary --force-sign --sign-key="${MAINTAINER}") || exit 1
else
(cd "${workDir}/build" && dpkg-buildpackage --build=binary) || exit 1
fi
cp -v "${workDir}"/*.deb . || exit 1
fi
+83 -27
View File
@@ -1,25 +1,32 @@
.TH PV 1 2025-07-26 pv-1.9.34 "User Commands"
.TH PV 1 2026-03-08 pv-1.10.4 "User Commands"
.\"
.SH NAME
pv \- monitor the progress of data through a pipe
pv \- monitor and manage the progress of data through a pipe
.\"
.SH SYNOPSIS
.B pv
[\fIOPTION\fR]... [\fIFILE\fR]...
.PP
\fBpv\fR \fB\-d\fR|\fB\-\-watchfd\fR \fIPID\fR[:\fIFD\fR] [\fIOPTION\fR]...
\fBpv\fR [\fIOPTION\fR]... \fB\-d\fR|\fB\-\-watchfd\fR
\fIPID\fR[:\fIFD\fR]|=\fINAME\fR|@\fILISTFILE\fR...
.PP
\fBpv\fR \fB\-R\fR|\fB\-\-remote\fR \fIPID\fR [\fIOPTION\fR]...
.PP
\fBpv\fR \fB\-Q\fR|\fB\-\-query\fR \fIPID\fR [\fIOPTION\fR]...
.\"
.SH DESCRIPTION
Show the progress of data through a pipeline by giving information such as
time elapsed, percentage completed (with progress bar), current throughput
rate, total data transferred, and ETA.
The data flow rate, error handling strategy, buffer size, and cache
interaction can all be adjusted.
.PP
Each \fIFILE\fR is copied to standard output.
With no \fIFILE\fR, or when \fIFILE\fR is \*(lq-\*(rq, standard input is
read.
This is the same behaviour as \fBcat\fR(1).
.PP
In \*(lq\fB\-\-watchfd\fR\*(rq mode, inspect another process and show its
progress through the files it has open.
.\"
.SH OPTIONS
.\"
@@ -155,7 +162,8 @@ If \*(lq\fB\-\-si\fR\*(rq appears before this option, suffixes will denote
kilobytes (*1000), megabytes, and so on instead.
.IP
If \fISIZE\fR starts with \*(lq\fB@\fR\*(rq, the size of file whose name
follows the @ will be used.
follows the @ will be used; if that is a directory, the size of all files
under it will be used, like \*(lq\fBdu\~\-\-apparent\-size\~\-b\fR\*(rq.
.TP
.B \-g, \-\-gauge
If the progress bar is shown but the size is not known, then instead of
@@ -272,9 +280,9 @@ from or to a pipe than regular \fBread\fR(2) and \fBwrite\fR(2), but means
that the transfer buffer may not be used.
This prevents \*(lq\fB\-\-buffer\-percent\fR\*(rq and
\*(lq\fB\-\-last\-written\fR\*(rq from working, cannot work with
\*(lq\fB\-\-discard\fR\*(rq, and makes \*(lq\fB\-\-buffer\-size\fR\*(rq
redundant, so using any of those options automatically switches on
\*(lq\fB\-\-no\-splice\fR\*(rq.
\*(lq\fB\-\-sparse\fR\*(rq or \*(lq\fB\-\-discard\fR\*(rq, and makes
\*(lq\fB\-\-buffer\-size\fR\*(rq redundant, so using any of those options
automatically switches on \*(lq\fB\-\-no\-splice\fR\*(rq.
Switching on this option results in a small loss of transfer efficiency.
It has no effect on systems where \fBsplice\fR(2) is unavailable.
.TP
@@ -324,6 +332,13 @@ failures with an error of \*(lqInvalid argument\*(rq, especially if reading
and writing files across a variety of filesystems in a single \fBpv\fR call.
Use this option with caution.
.TP
.B \-O, \-\-sparse
When writing null bytes, try to seek, producing a sparse output file.
Implies \*(lq\fB\-\-no\-splice\fR\*(rq.
On filesystems without sparse file support, or when the output is not
seekable, this option will have no effect other than to turn on
\*(lq\fB\-\-no\-splice\fR\*(rq.
.TP
.B \-X, \-\-discard
Instead of transferring input data to standard output, discard it.
This is equivalent to redirecting standard output to \fI/dev/null\fR,
@@ -349,16 +364,28 @@ doesn't affect the progress display.
.\"
.SS "Alternative operating modes"
.TP
.BI \-d\ PID\fR[\fB:\fR\fIFD\fR],\ \fB\-\-watchfd\ PID\fR[\fB:\fR\fIFD\fR]
\fB\-d\fR, \fB\-\-watchfd\fR \fIPID\fR[:\fIFD\fR]|=\fINAME\fR|@\fILISTFILE\fR...
Instead of transferring data, watch file descriptor \fIFD\fR of process
\fIPID\fR, and show its progress.
The \fBpv\fR process will exit when \fIFD\fR either changes to a different
file, changes read/write mode, or is closed; other data transfer modifiers -
and remote control - may not be used with this option.
Other data transfer modifiers - and remote control - may not be used with
this option.
.IP
If only a \fIPID\fR is specified, then that process will be watched, and all
regular files and block devices it opens will be shown with a progress bar.
The \fBpv\fR process will exit when process \fIPID\fR exits.
If a \fIPID\fR is specified without an \fIFD\fR, then that process will be
watched, and all regular files and block devices it opens will be shown with
a progress bar.
.IP
If a \fINAME\fR is specified, prefixed with "=", then processes with that
name will be found with \fBpgrep\fR(1), and as watched described above.
.IP
If a \fILISTFILE\fR is specified, prefixed with "@", the lines in that file
will be used as additional arguments.
.IP
All remaining non-option arguments will also be treated as additional
arguments.
.IP
The \fBpv\fR process will exit when all \fIFD\fRs have either changed to a
different file, changed read/write mode, or have closed, and all \fIPID\fRs
(without a specific \fIFD\fR) have exited.
.TP
.BI \-R\ PID \fR,\ \fB\-\-remote\ PID
Remotely control another instance of \fBpv\fR with process ID \fIPID\fR,
@@ -371,6 +398,17 @@ Note that some options cannot be changed while running, such as
\*(lq\fB\-\-cursor\fR\*(rq, \*(lq\fB\-\-line\-mode\fR\*(rq,
\*(lq\fB\-\-force\fR\*(rq, \*(lq\fB\-\-delay\-start\fR\*(rq,
\*(lq\fB\-\-skip\-errors\fR\*(rq, and \*(lq\fB\-\-stop\-at\-size\fR\*(rq.
.TP
.BI \-Q\ PID \fR,\ \fB\-\-query\ PID
Display the transfer progress of another instance of \fBpv\fR with process
ID \fIPID\fR, owned by the same user.
.IP
Some output modifiers can only be used while querying another process if
they match those of that process - such as
\*(lq\fB\-\-line\-mode\fR\*(rq,
\*(lq\fB\-\-null\fR\*(rq, and
\*(lq\fB\-\-average\-rate\-window\fR\*(rq.
Data transfer modifiers will have no effect.
.\"
.SS "Other options"
.TP
@@ -599,6 +637,17 @@ tar cf \- directory/ \e
.EE
.in
.PP
An alternative way of doing the same thing:
.PP
.in +4
.EX
tar cf \- directory/ \e
| pv \-\-size @directory/ \e
| gzip \-9 \e
> out.tar.gz
.EE
.in
.PP
Taking an image of a disk, skipping errors:
.PP
.in +4
@@ -671,8 +720,8 @@ pv \-\-numeric \-\-format '{"elapsed":%t,"bytes":%b,"rate":%r,"percentage":%{pro
.in
.\"
.SH EXIT STATUS
An exit status of 1 indicates a problem with the \*(lq\fB\-\-remote\fR\*(rq
or \*(lq\fB\-\-pidfile\fR\*(rq options.
An exit status of 1 indicates a problem with the \*(lq\fB\-\-remote\fR\*(rq,
\*(lq\fB\-\-query\fR\*(rq, or \*(lq\fB\-\-pidfile\fR\*(rq options.
.PP
Any other exit status is a bitmask of the following:
.TP 5
@@ -701,10 +750,10 @@ The following environment variables may affect \fBpv\fR:
.TP
.B HOME
The current user's home directory.
This may be used by \*(lq\fB\-\-remote\fR\*(rq to exchange messages between
\fBpv\fR instances: if the \fI/run/user/UID/\fR directory does not exist
(where \fIUID\fR is the current user ID), then \fI$HOME/.pv/\fR will be used
instead.
This may be used by \*(lq\fB\-\-remote\fR\*(rq and \*(lq\fB\-\-query\fR\*(rq
to exchange messages between \fBpv\fR instances: if the \fI/run/user/UID/\fR
directory does not exist (where \fIUID\fR is the current user ID), then
\fI$HOME/.pv/\fR will be used instead.
.TP
.BR TMPDIR ", " TMP
The directory to create per-tty lock files for the terminal when using
@@ -748,9 +797,9 @@ issue #105
.UE
for full details.
.PP
The \*(lq\fB\-\-remote\fR\*(rq option requires that either
\fI/run/user/<uid>/\fR or \fI$HOME/\fR can be written to, for inter-process
communication.
The \*(lq\fB\-\-remote\fR\*(rq and \*(lq\fB\-\-query\fR\*(rq options require
that either \fI/run/user/<uid>/\fR or \fI$HOME/\fR can be written to, for
inter-process communication.
.PP
The \*(lq\fB\-\-size\fR\*(rq option has no effect if used with
\*(lq\fB\-\-watchfd\fR\~\fIPID\fR\*(rq to watch all file descriptors of a
@@ -778,8 +827,15 @@ have a suffix.
.PP
Numbers passed to \*(lq\fB\-\-last\-written\fR\*(rq,
\*(lq\fB\-\-width\fR\*(rq, \*(lq\fB\-\-height\fR\*(rq,
\*(lq\fB\-\-average\-rate\-window\fR\*(rq, and \*(lq\fB\-\-remote\fR\*(rq
must be integers with no suffix.
\*(lq\fB\-\-average\-rate\-window\fR\*(rq, \*(lq\fB\-\-remote\fR\*(rq, and
\*(lq\fB\-\-query\fR\*(rq must be integers with no suffix.
.PP
When \*(lq\fB\-\-sparse\fR\*(rq is in effect and output is being written to
a file, that file may look like it has stopped growing if inspected with
\fBls\fR(1) while null bytes are being written, even though \fBpv\fR still
reports progress.
This is because of the way sparse output is achieved, and the file will be
the correct size when the transfer ends.
.\"
.SH REPORTING BUGS
Please report bugs or feature requests via the issue tracker linked from the
@@ -796,7 +852,7 @@ Please report bugs or feature requests via the issue tracker linked from the
.BR console_codes (4)
.\"
.SH COPYRIGHT
Copyright \(co 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood.
Copyright \(co 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood.
.PP
License GPLv3+:
.UR https://www.gnu.org/licenses/gpl-3.0.html
+81 -29
View File
@@ -1,24 +1,31 @@
# NAME
pv - monitor the progress of data through a pipe
pv - monitor and manage the progress of data through a pipe
# SYNOPSIS
**pv** \[*OPTION*\]\... \[*FILE*\]\...
**pv** **-d**\|**\--watchfd** *PID*\[:*FD*\] \[*OPTION*\]\...
**pv** \[*OPTION*\]\... **-d**\|**\--watchfd**
*PID*\[:*FD*\]\|=*NAME*\|@*LISTFILE*\...
**pv** **-R**\|**\--remote** *PID* \[*OPTION*\]\...
**pv** **-Q**\|**\--query** *PID* \[*OPTION*\]\...
# DESCRIPTION
Show the progress of data through a pipeline by giving information such
as time elapsed, percentage completed (with progress bar), current
throughput rate, total data transferred, and ETA.
throughput rate, total data transferred, and ETA. The data flow rate,
error handling strategy, buffer size, and cache interaction can all be
adjusted.
Each *FILE* is copied to standard output. With no *FILE*, or when *FILE*
is "-", standard input is read. This is the same behaviour as
**cat**(1).
is "-", standard input is read.
In "**\--watchfd**" mode, inspect another process and show its progress
through the files it has open.
# OPTIONS
@@ -157,7 +164,8 @@ are explicitly switched on will be shown.
denote kilobytes (\*1000), megabytes, and so on instead.
If *SIZE* starts with "**@**", the size of file whose name follows
the @ will be used.
the @ will be used; if that is a directory, the size of all files
under it will be used, like "**du \--apparent-size -b**".
**-g, \--gauge**
@@ -280,11 +288,11 @@ are explicitly switched on will be shown.
data from or to a pipe than regular **read**(2) and **write**(2),
but means that the transfer buffer may not be used. This prevents
"**\--buffer-percent**" and "**\--last-written**" from working,
cannot work with "**\--discard**", and makes "**\--buffer-size**"
redundant, so using any of those options automatically switches on
"**\--no-splice**". Switching on this option results in a small loss
of transfer efficiency. It has no effect on systems where
**splice**(2) is unavailable.
cannot work with "**\--sparse**" or "**\--discard**", and makes
"**\--buffer-size**" redundant, so using any of those options
automatically switches on "**\--no-splice**". Switching on this
option results in a small loss of transfer efficiency. It has no
effect on systems where **splice**(2) is unavailable.
**-E, \--skip-errors**
@@ -335,6 +343,13 @@ are explicitly switched on will be shown.
especially if reading and writing files across a variety of
filesystems in a single **pv** call. Use this option with caution.
**-O, \--sparse**
: When writing null bytes, try to seek, producing a sparse output
file. Implies "**\--no-splice**". On filesystems without sparse file
support, or when the output is not seekable, this option will have
no effect other than to turn on "**\--no-splice**".
**-X, \--discard**
: Instead of transferring input data to standard output, discard it.
@@ -361,17 +376,29 @@ are explicitly switched on will be shown.
## Alternative operating modes
**-d PID\[:FD\], \--watchfd PID\[:FD\]**
**-d**, **\--watchfd** *PID*\[:*FD*\]\|=*NAME*\|@*LISTFILE*\...
: Instead of transferring data, watch file descriptor *FD* of process
*PID*, and show its progress. The **pv** process will exit when *FD*
either changes to a different file, changes read/write mode, or is
closed; other data transfer modifiers - and remote control - may not
be used with this option.
*PID*, and show its progress. Other data transfer modifiers - and
remote control - may not be used with this option.
If only a *PID* is specified, then that process will be watched, and
all regular files and block devices it opens will be shown with a
progress bar. The **pv** process will exit when process *PID* exits.
If a *PID* is specified without an *FD*, then that process will be
watched, and all regular files and block devices it opens will be
shown with a progress bar.
If a *NAME* is specified, prefixed with \"=\", then processes with
that name will be found with **pgrep**(1), and as watched described
above.
If a *LISTFILE* is specified, prefixed with \"@\", the lines in that
file will be used as additional arguments.
All remaining non-option arguments will also be treated as
additional arguments.
The **pv** process will exit when all *FD*s have either changed to a
different file, changed read/write mode, or have closed, and all
*PID*s (without a specific *FD*) have exited.
**-R PID, \--remote PID**
@@ -386,6 +413,16 @@ are explicitly switched on will be shown.
"**\--delay-start**", "**\--skip-errors**", and
"**\--stop-at-size**".
**-Q PID, \--query PID**
: Display the transfer progress of another instance of **pv** with
process ID *PID*, owned by the same user.
Some output modifiers can only be used while querying another
process if they match those of that process - such as
"**\--line-mode**", "**\--null**", and "**\--average-rate-window**".
Data transfer modifiers will have no effect.
## Other options
**-P FILE, \--pidfile FILE**
@@ -596,6 +633,13 @@ To watch the progress of creating a tar.gz archive:
| gzip -9 \
> out.tar.gz
An alternative way of doing the same thing:
tar cf - directory/ \
| pv --size @directory/ \
| gzip -9 \
> out.tar.gz
Taking an image of a disk, skipping errors:
pv -EE /dev/your/disk/device > disk-image.img
@@ -639,8 +683,8 @@ Showing progress as lines of JSON data:
# EXIT STATUS
An exit status of 1 indicates a problem with the "**\--remote**" or
"**\--pidfile**" options.
An exit status of 1 indicates a problem with the "**\--remote**",
"**\--query**", or "**\--pidfile**" options.
Any other exit status is a bitmask of the following:
@@ -678,9 +722,10 @@ The following environment variables may affect **pv**:
**HOME**
: The current user\'s home directory. This may be used by
"**\--remote**" to exchange messages between **pv** instances: if
the */run/user/UID/* directory does not exist (where *UID* is the
current user ID), then *\$HOME/.pv/* will be used instead.
"**\--remote**" and "**\--query**" to exchange messages between
**pv** instances: if the */run/user/UID/* directory does not exist
(where *UID* is the current user ID), then *\$HOME/.pv/* will be
used instead.
**TMPDIR**, **TMP**
@@ -712,8 +757,9 @@ brackets to force the use of a subshell:
Refer to [issue #105](https://codeberg.org/ivarch/pv/issues/105) for
full details.
The "**\--remote**" option requires that either */run/user/\<uid\>/* or
*\$HOME/* can be written to, for inter-process communication.
The "**\--remote**" and "**\--query**" options require that either
*/run/user/\<uid\>/* or *\$HOME/* can be written to, for inter-process
communication.
The "**\--size**" option has no effect if used with
"**\--watchfd** *PID*" to watch all file descriptors of a process, but
@@ -737,8 +783,14 @@ Numbers passed to "**\--interval**" and "**\--delay-start**" may be
integers or decimals, but may not have a suffix.
Numbers passed to "**\--last-written**", "**\--width**",
"**\--height**", "**\--average-rate-window**", and "**\--remote**" must
be integers with no suffix.
"**\--height**", "**\--average-rate-window**", "**\--remote**", and
"**\--query**" must be integers with no suffix.
When "**\--sparse**" is in effect and output is being written to a file,
that file may look like it has stopped growing if inspected with
**ls**(1) while null bytes are being written, even though **pv** still
reports progress. This is because of the way sparse output is achieved,
and the file will be the correct size when the transfer ends.
# REPORTING BUGS
@@ -752,7 +804,7 @@ the [**pv** home page](https://ivarch.com/p/pv).
# COPYRIGHT
Copyright © 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew
Copyright © 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew
Wood.
License GPLv3+: [GNU GPL version 3 or
+51
View File
@@ -0,0 +1,51 @@
# Configuration for the foss-release.sh script.
# The script is here: https://codeberg.org/ivarch/scripts
set maintainer andrew.wood@ivarch.com
set mainprogram auto
set version auto
set mandir docs
set newsdir docs
export SKIP_VALGRIND_TESTS=1
section Initial checks
action check_po
action check_version_news
action check_version_autoconf
action check_version_man
section Initial build
action configure
action make
action check_analyse
action check_version_program
action check_version_year
section Documentation and source reformatting
action man_md
action man_html
action news_html
action make_indent
section Update po files
action make_update_po
section Run autoreconf
action autoreconf
section Commit check
action check_git_status
section Release archive
action check_make_distcheck
action make_dist
section Lab tests
action labtest
section Sign release
action sign_tarball
section Build OS packages
action parmo_build
-208
View File
@@ -1,208 +0,0 @@
#!/bin/sh
#
# Automate a portion of the release checklist. Expects to be run from a
# build directory, such as one in which "configure" has been run, i.e.
# there should be a Makefile present.
#
# If ~/.config/packaging-hosts exists, then build-package.sh is run on each
# one and the resultant packages (RPMs, DEBs, etc) are copied back.
#
# All of the release artefacts are placed in a "RELEASE-x" directory, where
# "x" is the version.
#
# Copyright 2024-2025 Andrew Wood
# License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
#
# Version: 0.0.2 / 16 Dec 2024
srcdir="$(awk '/^VPATH/{print $NF}' < Makefile | sed -n 1p)"
manuals="$(find "${srcdir}/docs" -mindepth 1 -maxdepth 1 -type f -name "*.[0-9]" -printf "%f\n")"
mainProgram="$(awk '/^[a-z]+_PROGRAMS/{print $3}' Makefile |cut -d '$' -f 1 | sed -n 1p)"
labTestScript="${srcdir}/docs/test-on-vm-lab.sh"
packageBuildScript="${srcdir}/docs/build-package.sh"
status () {
test -n "$*" && printf "\n"
printf '\e]0;%s\007\r' "$*" >&2
if test -n "$*"; then
tput rev >&2
printf " -- %s -- " "$*" >&2
tput sgr0 >&2
printf "\n\n"
fi
}
possiblyDie () {
printf "\n" >&2
tput bold >&2
printf "%s: %s\n" "release" "$*" >&2
tput sgr0 >&2
printf "\n%s\n" "Type 'y' and hit Enter to continue anyway."
read -r line
test "${line}" = "y" || { status ""; exit 1; }
}
test -e "${labTestScript}" || labTestScript=""
test -e "${packageBuildScript}" || packageBuildScript=""
# The checklist is re-ordered a little so that we defer making changes (like
# "make indent") until as late as possible, in case any checks fail.
status "Initial checks"
# Check MAINTAINER is provided.
test -n "${MAINTAINER}" || possiblyDie "environment variable MAINTAINER is empty"
# * Check that _po/POTFILES.in_ is up to date
if test -d "${srcdir}/po"; then
inFile="$(sort < "${srcdir}/po/POTFILES.in")"
realList="$(find "${srcdir}" -name "*.c" -printf "%P\n" | sort)"
test "${inFile}" = "${realList}" || possiblyDie "po/POTFILES.in is incorrect"
fi
status "Initial build"
make || possiblyDie "failed 'make'"
# * Run "_make analyse_" and see whether remaining warnings can be addressed
status "Source analysis"
make analyse || possiblyDie "failed 'make analyse'"
# * Version bump and documentation checks:
status "Version checks"
# * Check that _docs/NEWS.md_ is up to date
versionInNews="$(awk 'FNR==1{print $2}' "${srcdir}/docs/NEWS.md")"
printf "%s\n" "${versionInNews}" | grep -Eq '^[0-9]' || possiblyDie "version in NEWS.md (${versionInNews}) is not numeric"
# * Check the version in both _configure.ac_ and _docs/NEWS.md_ was updated
versionInConfig="$(grep ^AC_INIT "${srcdir}/configure.ac" | cut -d '[' -f 3 | cut -d ']' -f 1)"
test "${versionInConfig}" = "${versionInNews}" || possiblyDie "version in configure.ac (${versionInConfig}) mismatches NEWS.md (${versionInNews})"
# * Check that the manuals are up to date
for manPage in ${manuals}; do
versionInManual="$(awk 'FNR==1 {print $5}' "${srcdir}/docs/${manPage}" | cut -d - -f 2)"
test "${versionInManual}" = "${versionInNews}" || possiblyDie "version in ${manPage} (${versionInManual}) mismatches NEWS.md (${versionInNews})"
done
# * Check that the program version is correct
versionInVersionOutput="$(./"${mainProgram}" --version | awk 'FNR==1{print $NF}')"
test "${versionInVersionOutput}" = "${versionInNews}" || possiblyDie "version in '${mainProgram} --version' (${versionInVersionOutput}) mismatches NEWS.md (${versionInNews})"
# * Check that the year displayed by --version is correct
yearInVersion="$(./"${mainProgram}" --version | awk '/^Copyright/{print $2}')"
yearNow="$(date '+%Y')"
test "${yearInVersion}" = "${yearNow}" || possiblyDie "the year in '--version' (${yearInVersion}) is not this year (${yearNow})"
# * Make the Markdown version of the manuals and, if using VPATH, copy the result to the source directory
# We also wipe everything in "docs" so we don't accidentally package
# leftover working files.
status "Markdown manual"
rm -f docs/*
for manPage in ${manuals}; do
make "docs/${manPage}.md"
cp "docs/${manPage}.md" "${srcdir}/docs/${manPage}.md"
done
# * Run "_make indent; make indent indentclean check_"
status "Reformat source"
make indent
make indent indentclean
# The check will run later as part of "make distcheck".
# * Run "_make -C po update-po_"
status "Update po files"
if test -d "${srcdir}/po"; then
make -C po update-po || possiblyDie "update-po failed"
fi
# * Run "_autoreconf_" in the source directory
status "Run autoreconf"
(cd "${srcdir}" && autoreconf -is) || possiblyDie "autoreconf failed"
# * Ensure everything has been committed to the repository
status "Commit check"
gitStatus="$(cd "${srcdir}" && git status --porcelain=v1)" || possiblyDie "failed to run 'git status'"
test -z "${gitStatus}" || possiblyDie "not everything is committed - 'git status' is not empty"
# * Consistency and build checks:
# * Wipe the build directory, and run "_configure_" there
# * Run "_make distcheck_"
# * Run "_make release MAINTAINER=<signing-user>_"
# NB "make release" implies "make distcheck".
# We set SKIP_VALGRIND_TESTS=1 because the full tests will run in the lab
# check.
status "Release archive"
workDir="$(mktemp -d)" || possiblyDie "mktemp failed"
trap 'chmod -R u+w "${workDir}"; rm -rf "${workDir}"' EXIT
(
cd "${workDir}" || exit 1
sh "${srcdir}/configure" || exit 1
make -j8 release SKIP_VALGRIND_TESTS=1 || exit 1
exit 0
) || possiblyDie "failed on 'make release'"
sourceArchive="$(find "${workDir}" -mindepth 1 -maxdepth 1 -type f -name "*.tar.gz")"
test -e "${sourceArchive}.asc" || possiblyDie "release was not signed"
# * Run "_./configure && make check_" on all test systems, using the _tar.gz_ that was just created
# * Run a cross-compilation check
if test -n "${labTestScript}"; then
status "Lab test"
sh "${labTestScript}" "${sourceArchive}" || possiblyDie "lab test failed"
fi
# * Update the project web site:
# * Copy the release _.tar.gz_, _.txt_, and _.asc_ files to the web site
# * Use "_pandoc --from markdown --to html_" to convert the news and manual to HTML
status "Release dir"
rm -rf "RELEASE-${versionInNews}"
mkdir "RELEASE-${versionInNews}"
cp "${sourceArchive}" "${sourceArchive}.asc" "${sourceArchive}.txt" "RELEASE-${versionInNews}/" || possiblyDie "failed to copy release files"
status "HTML docs"
for manPage in ${manuals}; do
pandoc --from markdown --to html --shift-heading-level-by=1 < "${srcdir}/docs/${manPage}.md" > "RELEASE-${versionInNews}/${manPage}.html"
done
pandoc --from markdown --to html < "${srcdir}/docs/NEWS.md" > "RELEASE-${versionInNews}/news.html"
# Build OS packages.
packagingHosts="$(cat ~/.config/packaging-hosts 2>/dev/null)"
test -n "${packageBuildScript}" || packagingHosts=""
for buildHost in ${packagingHosts}; do
remoteWorkDir="$(ssh "${buildHost}" "mktemp -d")" || continue
test -n "${remoteWorkDir}" || continue
status "Package: ${buildHost}"
buildOK=true
scp "${packageBuildScript}" "${buildHost}:${remoteWorkDir}/build-package.sh" || buildOK=false
${buildOK} && scp "${sourceArchive}" "${buildHost}:${remoteWorkDir}/" || buildOK=false
# shellcheck disable=SC2029
${buildOK} && ssh -t "${buildHost}" "cd \"${remoteWorkDir}\" && SKIP_VALGRIND_TESTS=\"${SKIP_VALGRIND_TESTS}\" MAINTAINER=\"${MAINTAINER}\" sh ./build-package.sh ./*gz" || buildOK=false
# shellcheck disable=SC2029
${buildOK} && ssh "${buildHost}" "rm \"${remoteWorkDir}\"/${sourceArchive##*/} \"${remoteWorkDir}/build-package.sh\""
${buildOK} && mkdir -p "RELEASE-${versionInNews}/${buildHost}"
${buildOK} && scp "${buildHost}:${remoteWorkDir}/*" "RELEASE-${versionInNews}/${buildHost}/"
# shellcheck disable=SC2029
ssh "${buildHost}" "rm -rf \"${remoteWorkDir}\""
done
find "RELEASE-${versionInNews}/" -type f -exec chmod 644 '{}' ';'
find "RELEASE-${versionInNews}/" -type d -exec chmod 755 '{}' ';'
status "Done"
cat <<EOF
Files are under: RELEASE-${versionInNews}/
Still to do:
* Update the news and manual on the web site
* Update the version numbers on the web site
* Update the package index on the web site
* Create a new release in the repository, and apply the associated tag
EOF
exit 0
-343
View File
@@ -1,343 +0,0 @@
#!/bin/sh
#
# Run "make check" from a source tarball, on a whole lab of VMs.
#
# The source tarball should contain a directory; this directory must contain
# a "configure" script. After running "configure", this script calls "make"
# and then "make check", from a build subdirectory.
#
# Hostnames need to be listed on the command line after the tarball, or in
# ~/.config/lab-hosts. They need to be reachable over SSH with no password.
#
# Cross-compilation is performed if the hostname is of the form "x:y", where
# "x" is a target like "arm-linux-gnueabi", and "y" is the name of a host of
# that architecture. The package is built locally with "--host=x" and the
# result is copied to "y" and "make check" is run.
#
# Displays progress to the terminal and produces a tarball of results. In
# the results, the file "latest-status.txt" contains the last status
# display, and there is a directory for each host. The directories contain
# SCW metrics files plus "output.log" (timestamped), "raw-output.log"
# (without timestamps), "framework-output.log" (messages from this script),
# and the "config.log", "test-suite.log", and "tests/" from the build area.
#
# Requires "scw" (https://ivarch.com/p/scw).
#
# Copyright 2024-2025 Andrew Wood
# License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
#
# Version: 0.0.1 / 16 Dec 2024
# Number of tests to run in parallel on each host.
concurrency="1"
# Run a build and check, according to these environment variables:
#
# sourceArchive local source tarball path
# buildHost where to build, or "" for local
# checkHost where to test, or "" for local
# remoteBuildDir temp directory for remote build or check
# localBuildDir temp directory for local build
# configureArguments extra "configure" script arguments
#
# Does not return - always exits.
#
# Expects to be run under SCW, so writes status to fd 3.
#
testRunner () {
printf '%s %s\n' 'notice' 'creating build area' >&3
if test -n "${buildHost}"; then
ssh "${buildHost}" mkdir "${remoteBuildDir}" || exit 1
else
mkdir "${localBuildDir}" || exit 1
fi
printf '%s %s\n' 'ok' 'created build area' >&3
if test -n "${checkHost}"; then
printf '%s %s\n' 'notice' 'creating check area' >&3
ssh "${checkHost}" mkdir "${remoteBuildDir}" || exit 1
printf '%s %s\n' 'ok' 'created check area' >&3
fi
printf '%s %s\n' 'notice' 'copying source archive' >&3
if test -n "${buildHost}"; then
scp "${sourceArchive}" "${buildHost}:${remoteBuildDir}/" || exit 1
elif test -n "${checkHost}"; then
scp "${sourceArchive}" "${checkHost}:${remoteBuildDir}/" || exit 1
fi
printf '%s %s\n' 'ok' 'source archive copied' >&3
printf '%s %s\n' 'notice' 'extracting source archive' >&3
if test -n "${buildHost}"; then
ssh "${buildHost}" tar xzf "${remoteBuildDir}/${sourceArchive##*/}" -C "${remoteBuildDir}" || exit $?
else
tar xzf "${sourceArchive}" -C "${localBuildDir}" || exit $?
ssh "${checkHost}" tar xzf "${remoteBuildDir}/${sourceArchive##*/}" -C "${remoteBuildDir}" || exit $?
fi
printf '%s %s\n' 'ok' 'source archive extracted' >&3
stepResult="ok"
if test -n "${buildHost}"; then
printf '%s %s\n' 'notice' 'configuring' >&3
ssh "${buildHost}" "cd \"${remoteBuildDir}\" && mkdir BUILD && cd BUILD && ../*/configure ${configureArguments}" || exit $?
else
printf '%s %s\n' 'notice' 'configuring locally' >&3
( cd "${localBuildDir}" && mkdir BUILD && cd BUILD && ../*/configure ${configureArguments} ) || exit $?
printf '%s %s\n' 'notice' "configuring on ${checkHost}" >&3
ssh "${checkHost}" "cd \"${remoteBuildDir}\" && mkdir BUILD && cd BUILD && ../*/configure" \
|| { stepResult="warning"; printf '%s %s\n' 'warning' "configuration failed on ${checkHost}" >&3; }
fi
printf '%s %s\n' "${stepResult}" 'configuration completed' >&3
printf '%s %s\n' 'notice' 'building' >&3
if test -n "${buildHost}"; then
ssh "${buildHost}" "cd \"${remoteBuildDir}/BUILD\" && make -j${concurrency}" || exit $?
else
make -j${concurrency} -C "${localBuildDir}/BUILD" || exit $?
fi
printf '%s %s\n' 'ok' 'build completed' >&3
if test -n "${buildHost}"; then
printf '%s %s\n' 'notice' 'testing' >&3
ssh "${buildHost}" "cd \"${remoteBuildDir}/BUILD\" && make -j${concurrency} check" || exit $?
printf '%s %s\n' 'ok' 'testing completed' >&3
elif test -n "${checkHost}"; then
printf '%s %s\n' 'notice' "transferring build to ${checkHost}" >&3
tar cvf "${localBuildDir}/build.tar" -C "${localBuildDir}" BUILD || exit $?
scp "${localBuildDir}/build.tar" "${checkHost}:${remoteBuildDir}/build.tar" || exit $?
ssh "${checkHost}" "tar xf \"${remoteBuildDir}/build.tar\" -C \"${remoteBuildDir}\"" || exit $?
printf '%s %s\n' 'ok' "transferred build to ${checkHost}" >&3
printf '%s %s\n' 'notice' "testing on ${checkHost}" >&3
ssh "${checkHost}" "cd \"${remoteBuildDir}/BUILD\" && make -j${concurrency} check-TESTS XCTEST=1" || exit $?
printf '%s %s\n' 'ok' 'testing completed' >&3
fi
exit 0
}
# Using directory $1 for metrics and output, run the remaining arguments as
# a command using "scw" to capture metrics and record logs.
#
recordCommand () {
targetDir="$1"
shift
mkdir -p "${targetDir}"
scw -c /dev/null \
-s UserConfigFile=/dev/null \
-s ItemsDir=/dev/null \
-s MetricsDir="${targetDir}" \
-s CheckLockFile="${targetDir}/.widelock" \
-s OutputMap= \
-s OutputMap="OES stamped ${targetDir}/output.log" \
-s OutputMap="OES raw ${targetDir}/raw-output.log" \
-s Command="$*" \
run item
}
if test "$1" = "--testRunner"; then
testRunner
exit 1
fi
labHosts="$(cat ~/.config/lab-hosts 2>/dev/null)"
workDir=$(mktemp -d) || exit 1
trap 'rm -rf "${workDir}"' EXIT
sourceArchive="$1"
shift
hostList="$*"
test -n "${hostList}" || hostList="${labHosts}"
test -n "${sourceArchive}" || { echo "Usage: ${0##*/} TARBALL [HOST...]"; exit 1; }
test -s "${sourceArchive}" || { echo "${sourceArchive}: not found"; exit 1; }
attrBold="$(tput bold 2>/dev/null)"
attrUnderline="$(tput smul 2>/dev/null)"
attrRed="$(tput setaf 1 2>/dev/null)"
attrGreen="$(tput setaf 2 2>/dev/null)"
attrYellow="$(tput setaf 3 2>/dev/null)"
attrBlue="$(tput setaf 4 2>/dev/null)"
attrMagenta="$(tput setaf 5 2>/dev/null)"
attrCyan="$(tput setaf 6 2>/dev/null)"
attrWhite="$(tput setaf 7 2>/dev/null)"
attrNone="$(tput sgr0 2>/dev/null)"
dateStamp="$(date +%Y%m%d-%H%M)"
resultsArchive="result-${dateStamp}.tar.gz"
startEpoch="$(date +%s)"
for hostSpec in ${hostList}; do
localTestDir="${workDir}/${hostSpec}"
remoteBuildDir="test-${dateStamp}.$(date +%s).$$"
buildHost="${hostSpec}"
checkHost=""
configureArguments=""
xcFor="${hostSpec%:*}"
xcRunOn="${hostSpec#*:}"
if ! test "${xcFor}" = "${xcRunOn}"; then
localTestDir="${workDir}/${xcFor}-${xcRunOn}"
buildHost=""
checkHost="${xcRunOn}"
configureArguments="--host ${xcFor}"
fi
mkdir "${localTestDir}"
printf "%s\n" "${hostSpec}" > "${localTestDir}/hostSpec"
localBuildDir="${localTestDir}/XC"
(
flock -x 3
export sourceArchive buildHost checkHost remoteBuildDir localBuildDir configureArguments
recordCommand "${localTestDir}" "sh \"$0\" --testRunner" 3<&-
exec >>"${localTestDir}/output.log" 2>&1
printf '*** %s\n' 'retrieving build and test artefacts'
mkdir "${localTestDir}/tests"
if test -n "${buildHost}"; then
scp "${buildHost}:${remoteBuildDir}/BUILD/config.log" "${localTestDir}/"
scp "${buildHost}:${remoteBuildDir}/BUILD/test-suite.log" "${localTestDir}/"
scp "${buildHost}:${remoteBuildDir}/BUILD/tests/*" "${localTestDir}/tests/"
elif test -n "${checkHost}"; then
scp "${checkHost}:${remoteBuildDir}/BUILD/config.log" "${localTestDir}/"
scp "${checkHost}:${remoteBuildDir}/BUILD/test-suite.log" "${localTestDir}/"
scp "${checkHost}:${remoteBuildDir}/BUILD/tests/*" "${localTestDir}/tests/"
fi
printf '*** %s\n' 'removing build area'
rm -rf "${localBuildDir}"
if test -n "${buildHost}"; then
ssh "${buildHost}" rm -rf "${remoteBuildDir}"
elif test -n "${checkHost}"; then
ssh "${checkHost}" rm -rf "${remoteBuildDir}"
fi
printf '\n'
flock -u 3
) > "${localTestDir}/framework-output.log" 2>&1 3>>"${localTestDir}/active" &
done
sleep 0.1
allTestHostDirs="$(find "${workDir}" -mindepth 1 -maxdepth 1 -name "[0-9A-Za-z_]*" -type d -printf "%f\n" | sort)"
hostCount=0
for testHostDir in ${allTestHostDirs}; do hostCount=$((1+hostCount)); done
exitedCount=0
overallStatus=""
while test "${exitedCount}" -lt "${hostCount}"; do
width="$(tput cols 2>/dev/null)"
test -n "${width}" || width=80
currentEpoch="$(date +%s)"
elapsedSeconds=$((currentEpoch-startEpoch))
{
nameWidth=0
runningCount=0
failedCount=0
passedCount=0
exitedCount=0
overallStatus=""
for testHostDir in ${allTestHostDirs}; do
hostSpec="${testHostDir}"
{ read -r hostSpec < "${workDir}/${testHostDir}/hostSpec"; } 2>/dev/null
test "${#hostSpec}" -gt "${nameWidth}" && nameWidth="${#hostSpec}"
exec 3>>"${workDir}/${testHostDir}/active"
flock -x -n 3 && exitedCount=$((1+exitedCount))
exec 3<&-
test -e "${workDir}/${testHostDir}/ended" || runningCount=$((1+runningCount))
if test -e "${workDir}/${testHostDir}/failed"; then
overallStatus="FAIL"
failedCount=$((1+failedCount))
elif test -e "${workDir}/${testHostDir}/succeeded"; then
test -z "${overallStatus}" && overallStatus="PASS"
passedCount=$((1+passedCount))
fi
done
test -n "${overallStatus}" || overallStatus="----"
printf "%sT+%04d - %s%s\n\n" "${attrUnderline}" "${elapsedSeconds}" "$(date '+%Y-%m-%d %H:%M:%S')" "${attrNone}"
for testHostDir in ${allTestHostDirs}; do
hostSpec="${testHostDir}"
{ read -r hostSpec < "${workDir}/${testHostDir}/hostSpec"; } 2>/dev/null
lastStatusWord="-"
lastStatusMessage="-"
{ read -r lastStatusWord lastStatusMessage < "${workDir}/${testHostDir}/last-status"; } 2>/dev/null
lastLine="-"
test -s "${workDir}/${testHostDir}/output.log" && lastLine="$(tail -n 1 "${workDir}/${testHostDir}/output.log" 2>/dev/null | expand)"
testResult="----"
test -e "${workDir}/${testHostDir}/failed" && testResult="FAIL"
test -e "${workDir}/${testHostDir}/succeeded" && testResult="PASS"
remainingWidth=$((width-nameWidth-20))
statusWidth=$((remainingWidth*2/3))
test "${statusWidth}" -gt 40 && statusWidth=40
lastLineWidth=$((remainingWidth-statusWidth))
printf " %s%${nameWidth}s%s " "${attrBold}${attrYellow}" "${hostSpec}" "${attrNone}"
case "${testResult}" in
"PASS") printf "%s%s%s" "${attrBold}${attrGreen}" "PASS" "${attrNone}" ;;
"FAIL") printf "%s%s%s" "${attrBold}${attrRed}" "FAIL" "${attrNone}" ;;
*) printf "%s" "----"
esac
case "${lastStatusWord}" in
"(begin)"|"begin") printf " (%s%s%s) " "${attrBold}${attrMagenta}" "begin" "${attrNone}" ;;
"(end)"|"end") printf " (%s%s%s) " "${attrBold}${attrMagenta}" "end" "${attrNone}" ;;
"(notice)"|"notice") printf " (%s%s%s) " "${attrBold}${attrCyan}" "notice" "${attrNone}" ;;
"(ok)"|"ok") printf " (%s%s%s) " "${attrBold}${attrGreen}" "ok" "${attrNone}" ;;
"(warning)"|"warning") printf " (%s%s%s)" "${attrBold}${attrYellow}" "warning" "${attrNone}" ;;
"(error)"|"error") printf " (%s%s%s) " "${attrBold}${attrRed}" "error" "${attrNone}" ;;
*) printf " %7s " ""; lastStatusMessage="${lastStatusWord} ${lastStatusMessage}" ;;
esac
printf " %s%-${statusWidth}.${statusWidth}s%s" "${attrWhite}" "${lastStatusMessage}" "${attrNone}"
printf " %s%-${lastLineWidth}.${lastLineWidth}s%s" "${attrBlue}" "${lastLine}" "${attrNone}"
printf "\n"
done
printf "\n%s%s%s " "${attrBold}" "Overall status:" "${attrNone}"
case "${overallStatus}" in
"PASS") printf "%s%s%s" "${attrBold}${attrGreen}" "PASS" "${attrNone}" ;;
"FAIL") printf "%s%s%s" "${attrBold}${attrRed}" "FAIL" "${attrNone}" ;;
*) printf "%s" "----"
esac
printf " %s%s%s " "${attrBold}" "Running,Passed,Failed:" "${attrNone}"
printf "%sR%d%s" "${attrBold}${attrMagenta}" "${runningCount}" "${attrNone}"
printf ",%sP%d%s" "${attrBold}${attrGreen}" "${passedCount}" "${attrNone}"
printf ",%sF%d%s" "${attrBold}${attrRed}" "${failedCount}" "${attrNone}"
printf " = %d" "${hostCount}"
printf "\n\n"
} > "${workDir}/latest-status.txt"
cat "${workDir}/latest-status.txt"
sleep 1
done
endEpoch="$(date +%s)"
elapsedSeconds=$((endEpoch-startEpoch))
printf '%s\n' 'Generating results archive'
tar czf "${resultsArchive}" -C "${workDir}" .
printf '%s: %d%s\n' 'Total time taken' "${elapsedSeconds}" "s"
printf '%s: %s\n' 'Results archive' "${resultsArchive}"
test "${overallStatus}" = "PASS" || exit 1
+2
View File
@@ -1,7 +1,9 @@
cs
de
es
fi
fr
ka
pl
pt
ru
+28 -21
View File
@@ -1,14 +1,14 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-2000 Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 2000-2020 Free Software Foundation, Inc.
# Copyright (C) 2000-2024 Free Software Foundation, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
#
# Origin: gettext-0.21
GETTEXT_MACRO_VERSION = 0.20
# Origin: gettext-0.23
GETTEXT_MACRO_VERSION = 0.22
PACKAGE = @PACKAGE@
VERSION = @VERSION@
@@ -68,7 +68,7 @@ POFILES = @POFILES@
GMOFILES = @GMOFILES@
UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@
DISTFILES.common = Makefile.in.in remove-potcdate.sin \
DISTFILES.common = Makefile.in.in remove-potcdate.sed \
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
$(POFILES) $(GMOFILES) \
@@ -94,7 +94,7 @@ all: all-@USE_NLS@
.SUFFIXES:
.SUFFIXES: .po .gmo .sed .sin .nop .po-create .po-update
.SUFFIXES: .po .gmo .sed .nop .po-create .po-update
# The .pot file, stamp-po, .po files, and .gmo files appear in release tarballs.
# The GNU Coding Standards say in
@@ -113,6 +113,7 @@ all: all-@USE_NLS@
$(GMOFILES): $(srcdir)/$(DOMAIN).pot
.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.1po && rm -f $${lang}.1po"; \
cd $(srcdir) && \
@@ -122,10 +123,6 @@ $(GMOFILES): $(srcdir)/$(DOMAIN).pot
mv t-$${lang}.gmo $${lang}.gmo && \
rm -f $${lang}.1po
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
all-yes: $(srcdir)/stamp-po
all-no:
@@ -170,7 +167,7 @@ $(srcdir)/stamp-po: $(srcdir)/$(DOMAIN).pot
# The determination of whether the package xyz is a GNU one is based on the
# heuristic whether some file in the top level directory mentions "GNU xyz".
# If GNU 'find' is available, we avoid grepping through monster files.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in
package_gnu="$(PACKAGE_GNU)"; \
test -n "$$package_gnu" || { \
if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
@@ -222,8 +219,8 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
|| exit 1; \
fi; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
sed -f $(srcdir)/remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f $(srcdir)/remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
else \
@@ -247,16 +244,19 @@ $(POFILES): $(POFILESDEPS)
@test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot"; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) \
&& { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
'' | 0.[0-9] | 0.[0-9].* | 0.10 | 0.10.*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
0.1[1-5] | 0.1[1-5].*) \
$(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
0.1[6-7] | 0.1[6-7].*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --previous $${lang}.po $(DOMAIN).pot;; \
$(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) --previous $${lang}.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot;; \
$(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot;; \
esac; \
}; \
else \
@@ -394,7 +394,6 @@ info dvi ps pdf html tags TAGS ctags CTAGS ID:
install-dvi install-ps install-pdf install-html:
mostlyclean:
rm -f remove-potcdate.sed
rm -f $(srcdir)/stamp-poT
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
rm -fr *.o
@@ -464,15 +463,17 @@ update-po: Makefile
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
echo "$${cdcmd}$(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) --lang=$$lang --previous $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
'' | 0.[0-9] | 0.[0-9].* | 0.10 | 0.10.*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
0.1[1-5] | 0.1[1-5].*) \
$(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
0.1[6-7] | 0.1[6-7].*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
$(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
$(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) --lang=$$lang --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
esac; \
}; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
@@ -508,3 +509,9 @@ force:
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# This Makefile contains rules which don't work with parallel make,
# namely dist2.
# See <https://lists.gnu.org/archive/html/bug-gettext/2022-06/msg00022.html>.
# So, turn off parallel execution in this Makefile.
.NOTPARALLEL:
+1 -1
View File
@@ -2,7 +2,6 @@ src/main/debug.c
src/main/help.c
src/main/main.c
src/main/options.c
src/main/remote.c
src/main/version.c
src/pv/calc.c
src/pv/cursor.c
@@ -25,6 +24,7 @@ src/pv/format/timer.c
src/pv/loop.c
src/pv/number.c
src/pv/proctitle.c
src/pv/remote.c
src/pv/signal.c
src/pv/state.c
src/pv/string.c
+195 -159
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: 2024-10-13 20:43+0000\n"
"Last-Translator: mmatous <mmatous@users.noreply.translate.codeberg.org>\n"
"Language-Team: Czech <https://translate.codeberg.org/projects/pv/pv/cs/>\n"
@@ -168,8 +168,8 @@ msgstr "vypisuj výstup i pokud standardní chybový výstup není terminál"
msgid "use cursor positioning escape sequences"
msgstr "pozicuj kurzor pomocí řídících znaků"
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr "SOUBOR"
@@ -218,136 +218,156 @@ msgid "use direct I/O to bypass cache"
msgstr "použij přímý V/V k obejítí cache"
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr "zahoď vstup namísto zápisu na výstup"
#: src/main/help.c:358
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr "zapiš veškerý vstup do SOUBORu před výpisem na výstup"
#: src/main/help.c:360
msgid "PID[:FD]"
msgstr "PID[:DS]"
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:361
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr "sleduj soubor DS otevřený procesem PID"
#: src/main/help.c:364
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr "PID"
#: src/main/help.c:365
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr "aktualizuj nastavení procesu PID"
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr "ulož id procesu do SOUBORu"
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "ukaž pomoc a skonči"
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "ukaž informace o verzi a skonči"
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr "zapiš ladící záznamy do SOUBORu"
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Použití: %s [VOLBY] [SOUBOR]..."
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Spoj SOUBOR(y) nebo standardní vstup na standardního výstup, s monitoringem."
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Prosím, hlašte veškeré chyby na: %s"
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr "(vstup)"
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr "selhala alokace stavu"
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
msgstr "nebylo možné zjistit informace o souboru"
#: src/main/options.c:160
msgid "is a directory"
msgstr "je adresář"
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr "selhalo vytváření jména pro soubor v sysfs"
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr "selhalo čtení velikosti souboru v sysfs"
#: src/main/options.c:231
msgid "failed to open block device"
msgstr "selhalo otevření blokového zařízení"
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr "selhalo zjištění velikosti blokového zařízení"
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr "selhala alokace struktury pro volby"
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr "selhala alokace struktury pro argv"
#: src/main/options.c:419
msgid "numeric value not understood"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:437
msgid "integer argument expected"
msgstr "očekáván celočíselný argument"
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr "očekáván číselný argument"
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr "očekáváno ID procesu nebo dvojice PID:DS"
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "neplatné ID procesu"
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr "nebylo možné zjistit informace o souboru"
#: src/main/options.c:519
msgid "is a directory"
msgstr "je adresář"
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr "selhalo vytváření jména pro soubor v sysfs"
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr "selhalo čtení velikosti souboru v sysfs"
#: src/main/options.c:591
msgid "failed to open block device"
msgstr "selhalo otevření blokového zařízení"
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr "selhalo zjištění velikosti blokového zařízení"
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr "selhala alokace struktury pro volby"
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr "selhala alokace struktury pro argv"
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:801
msgid "integer argument expected"
msgstr "očekáván celočíselný argument"
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr "očekáván číselný argument"
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Zkuste `%s --help' pro více informací."
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Zkuste `%s --h' pro více informací."
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -355,29 +375,33 @@ msgstr ""
"při sledování deskriptorů souborů nelze použít řádkový mód nebo volby pro "
"modifikaci přenosu"
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr "při sledování deskriptorů souborů nelze pozicování kurzoru použít"
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr "při sledování deskriptorů souborů nelze použít vzdálené ovládání"
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr "při sledování deskriptorů souborů nelze použít přenos souborů"
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr "není dostupné na systémech bez /proc/self/fdinfo"
#: src/main/remote.c:309
msgid "message not received"
msgstr "zpráva nepřijata"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO není na tomto systému podporováno"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -411,150 +435,162 @@ msgstr "selhal pokus o uzamčení"
msgid "failed to open terminal"
msgstr "selhalo otevření terminálu"
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnum KMGTPEZY"
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr "selhala alokace vyrovnávací paměti"
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr "selhalo posunutí za začátek výstupu"
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "selhalo zavření souboru"
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "selhalo čtení ze souboru"
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr "selhalo zjištění informací o výstupním souboru"
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "vstupní soubor je výstupní soubor"
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr "(žádný)"
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr "B"
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr "rychlost min/avg/max/std"
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr "rychlost neměřena"
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr "pid"
#: src/pv/state.c:40
msgid "history structure allocation failed"
msgstr "selhala alokace struktury historie"
#: src/pv/state.c:617 src/pv/state.c:628
msgid "file list allocation failed"
msgstr "selhala alokace seznamu souborů"
#: src/pv/transfer.c:463
msgid "read failed"
msgstr "čtení selhalo"
#: src/pv/transfer.c:479
msgid "warning: read errors detected"
msgstr "varování: detekovány chyby při čtení"
#: src/pv/transfer.c:495
msgid "file is not seekable"
msgstr "souborem nelze procházet"
#: src/pv/transfer.c:573
msgid "failed to seek past error"
msgstr "selhal skok za chybu"
#: src/pv/transfer.c:593
msgid "skipped past read error"
msgstr "chyba přeskočena"
#: src/pv/transfer.c:634
msgid "no transfer buffer allocated"
msgstr "vyrovnávací paměť není alokována"
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr "selhalo nastavení intervalového časovače"
#: src/pv/transfer.c:702
msgid "failed to clear interval timer"
msgstr "selhalo vynulování intervalového časovače"
#: src/pv/transfer.c:744
msgid "line position buffer allocation failed"
msgstr "selhala alokace vyrovnávací paměti pro pozici v řádcích"
#: src/pv/transfer.c:918
msgid "write failed"
msgstr "zápis selhal"
#: src/pv/transfer.c:1159
msgid "select call failed"
msgstr "selhalo volání select"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr "ds"
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr "zpráva nepřijata"
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO není na tomto systému podporováno"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr "selhala alokace struktury historie"
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr "selhala alokace seznamu souborů"
#: src/pv/transfer.c:490
msgid "read failed"
msgstr "čtení selhalo"
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "varování: detekovány chyby při čtení"
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr "souborem nelze procházet"
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr "selhal skok za chybu"
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr "chyba přeskočena"
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr "vyrovnávací paměť není alokována"
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr "selhalo nastavení intervalového časovače"
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr "selhalo vynulování intervalového časovače"
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr "selhala alokace vyrovnávací paměti pro pozici v řádcích"
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "zápis selhal"
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr "selhalo volání select"
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "není obyčejný soubor nebo blokové zařízení"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:DS]"
+199 -163
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: 2025-01-14 20:39+0000\n"
"Last-Translator: Benny <benny@users.noreply.translate.codeberg.org>\n"
"Language-Team: German <https://translate.codeberg.org/projects/pv/pv/de/>\n"
@@ -14,9 +14,9 @@ msgstr ""
"From: Andrew Wood <ivarch@ubik>\n"
"Xgettext-Options: --default-domain=pkgbuild --directory=./.pkgdir --add-"
"comments --keyword=_ --keyword=N_\n"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/init."
"c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/guts/"
"configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/"
"init.c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/"
"guts/configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"generate.c src/ui/main.c src/ui/xpm.c src/ui/status.c src/ui/activate.c src/"
"ui/handlers/main.c src/ui/handlers/package.c src/ui/handlers/prefs.c src/ui/"
"handlers/dirsel.c src/ui/handlers/popup.c src/ui/handlers/help.c src/ui/"
@@ -185,8 +185,8 @@ msgstr ""
msgid "use cursor positioning escape sequences"
msgstr "benutze Escape-Sequenzen zur Cursor-Positionierung"
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr "DATEI"
@@ -235,137 +235,157 @@ msgid "use direct I/O to bypass cache"
msgstr "verwende direkte E/A, um den Cache zu umgehen"
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr "verwirf die Eingabe anstatt in die Ausgabe zu schreiben"
#: src/main/help.c:358
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr "Ausgabe nach FILE schrieben bevor sie ausgegeben wird"
#: src/main/help.c:360
msgid "PID[:FD]"
msgstr "PID[:FD]"
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:361
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr "die vom Prozess PID geöffnete Datei FD beobachten"
#: src/main/help.c:364
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr "PID"
#: src/main/help.c:365
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr "Einstellungen der Prozess-PID updaten"
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr "Prozess-ID in DATEI speichern"
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "zeige diese Hilfe und beende"
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "zeige Versionsinformationen und beende"
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr "schreibe Debug-Protokolle in DATEI"
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Aufruf: %s [OPTION] [DATEI]..."
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Verbindet DATEI(en) oder den Standard-Eingabe-Kanal mit dem Standard-Ausgabe-"
"Kanal und misst den Datenstrom."
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr "unterstützte Formate:"
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Bitte senden Sie Fehlerberichte an %s"
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr "(eingabe)"
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr "Speicherzuweisung für `state' fehlgeschlagen"
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
msgstr "konnte Dateiinformationen nicht lesen"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:160
msgid "is a directory"
msgstr "ist ein Verzeichnis"
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr "konnte Sysfs-Dateinamen nicht erzeugen"
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr "konnte Größe der Sysfs-Datei nicht lesen"
#: src/main/options.c:231
msgid "failed to open block device"
msgstr "konnte Blockgerät nicht öffnen"
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr "konnte Größe des Blockgeräts nicht ermitteln"
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr "Speicherzuweisung für `option' fehlgeschlagen"
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr "Speicherzuweisung für `argv' der Option fehlgeschlagen"
#: src/main/options.c:419
msgid "numeric value not understood"
msgstr "numerischen Wert nicht verstanden"
#: src/main/options.c:437
msgid "integer argument expected"
msgstr "Ganzzahliges Argument erwartet"
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr "numerisches Argument erwartet"
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr "Prozess-ID oder PID:FD-Paar erwartet"
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "ungültige Prozess-ID"
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr "konnte Dateiinformationen nicht lesen"
#: src/main/options.c:519
msgid "is a directory"
msgstr "ist ein Verzeichnis"
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr "konnte Sysfs-Dateinamen nicht erzeugen"
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr "konnte Größe der Sysfs-Datei nicht lesen"
#: src/main/options.c:591
msgid "failed to open block device"
msgstr "konnte Blockgerät nicht öffnen"
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr "konnte Größe des Blockgeräts nicht ermitteln"
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr "Speicherzuweisung für `option' fehlgeschlagen"
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr "Speicherzuweisung für `argv' der Option fehlgeschlagen"
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr "numerischen Wert nicht verstanden"
#: src/main/options.c:801
msgid "integer argument expected"
msgstr "Ganzzahliges Argument erwartet"
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr "numerisches Argument erwartet"
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "`%s --help' zeigt weitere Informationen an."
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "`%s -h' zeigt weitere Informationen an."
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -373,34 +393,38 @@ msgstr ""
"Beim Beobachten von Dateideskriptoren können keine Optionen für den "
"Zeilenmodus oder den Übertragungsmodifikator verwendet werden"
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"Beim Beobachten von Dateideskriptoren kann Cursor-Positionierung nicht "
"verwendet werden"
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr ""
"Beim Beobachten von Dateideskriptoren kann die Fernbedienung nicht verwenden "
"werden"
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr ""
"Beim Beobachten von Dateideskriptoren können Dateien nicht übertragen werden"
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr "Nicht verfügbar auf Systemen ohne /proc/self/fdinfo"
#: src/main/remote.c:309
msgid "message not received"
msgstr "Nachricht nicht empfangen"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO wird auf diesem System nicht unterstützt"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -434,150 +458,162 @@ msgstr "Sperrversuch fehlgeschlagen"
msgid "failed to open terminal"
msgstr "konnte Terminal nicht öffnen"
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnµm kMGTPEZY"
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnµm KMGTPEZY"
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr "Speicherzuweisung für den Puffer fehlgeschlagen"
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr "Konnte nicht zum Anfang der Ausgabe springen"
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "konnte Datei nicht schließen"
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "konnte Datei nicht lesen"
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr "konnte Dateiinformationen für Ausgabe-Datei nicht lesen"
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "Eingabe-Datei ist Ausgabe-Datei"
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr "(keine)"
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr "B"
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr "Endzeit"
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr "Rate min/mittel/max/abweichung"
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr "Übertragungsrate nicht gemessen"
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr "pid"
#: src/pv/state.c:40
msgid "history structure allocation failed"
msgstr "Speicherzuweisung für `history' fehlgeschlagen"
#: src/pv/state.c:617 src/pv/state.c:628
msgid "file list allocation failed"
msgstr "Speicherzuweisung für die Dateiliste fehlgeschlagen"
#: src/pv/transfer.c:463
msgid "read failed"
msgstr "read-Aufruf fehlgeschlagen"
#: src/pv/transfer.c:479
msgid "warning: read errors detected"
msgstr "warnung: lesefehler erkannt"
#: src/pv/transfer.c:495
msgid "file is not seekable"
msgstr "Datei ist nicht durchsuchbar"
#: src/pv/transfer.c:573
msgid "failed to seek past error"
msgstr "konnte den Fehler nicht überwinden"
#: src/pv/transfer.c:593
msgid "skipped past read error"
msgstr "über den Lesefehler hinaus verschoben"
#: src/pv/transfer.c:634
msgid "no transfer buffer allocated"
msgstr "Speicherzuweisung für den Transferpuffer fehlgeschlagen"
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr "konnte Intervall-Timer nicht setzen"
#: src/pv/transfer.c:702
msgid "failed to clear interval timer"
msgstr "konnte Intervall-Timer nicht löschen"
#: src/pv/transfer.c:744
msgid "line position buffer allocation failed"
msgstr "Zuweisung des Zeilenpuffers fehlgeschlagen"
#: src/pv/transfer.c:918
msgid "write failed"
msgstr "write-Aufruf fehlgeschlagen"
#: src/pv/transfer.c:1159
msgid "select call failed"
msgstr "select-Aufruf fehlgeschlagen"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr "fd"
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr "Nachricht nicht empfangen"
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO wird auf diesem System nicht unterstützt"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr "Speicherzuweisung für `history' fehlgeschlagen"
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr "Speicherzuweisung für die Dateiliste fehlgeschlagen"
#: src/pv/transfer.c:490
msgid "read failed"
msgstr "read-Aufruf fehlgeschlagen"
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "warnung: lesefehler erkannt"
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr "Datei ist nicht durchsuchbar"
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr "konnte den Fehler nicht überwinden"
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr "über den Lesefehler hinaus verschoben"
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr "Speicherzuweisung für den Transferpuffer fehlgeschlagen"
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr "konnte Intervall-Timer nicht setzen"
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr "konnte Intervall-Timer nicht löschen"
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr "Zuweisung des Zeilenpuffers fehlgeschlagen"
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "write-Aufruf fehlgeschlagen"
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr "select-Aufruf fehlgeschlagen"
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "ist weder eine normale Datei noch ein Blockgerät"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
+191 -158
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -163,8 +163,8 @@ msgstr ""
msgid "use cursor positioning escape sequences"
msgstr ""
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr ""
@@ -213,162 +213,186 @@ msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:355
msgid "discard input instead of writing to output"
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "write all input to FILE before writing to output"
msgstr ""
#: src/main/help.c:360
msgid "PID[:FD]"
msgid "discard input instead of writing to output"
msgstr ""
#: src/main/help.c:361
msgid "watch file FD opened by process PID"
msgid "write all input to FILE before writing to output"
msgstr ""
#: src/main/help.c:364
msgid "PID"
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr ""
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr ""
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr ""
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr ""
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr ""
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr ""
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr ""
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr ""
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr ""
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr ""
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr ""
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:160
msgid "is a directory"
msgstr ""
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr ""
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr ""
#: src/main/options.c:231
msgid "failed to open block device"
msgstr ""
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr ""
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr ""
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr ""
#: src/main/options.c:419
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:437
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr ""
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr ""
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr ""
#: src/main/options.c:519
msgid "is a directory"
msgstr ""
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr ""
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr ""
#: src/main/options.c:591
msgid "failed to open block device"
msgstr ""
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr ""
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr ""
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr ""
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:801
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr ""
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr ""
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr ""
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr ""
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
#: src/main/remote.c:309
msgid "message not received"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
@@ -403,150 +427,159 @@ msgstr ""
msgid "failed to open terminal"
msgstr ""
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr ""
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr ""
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr ""
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr ""
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr ""
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr ""
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr ""
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr ""
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr ""
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr ""
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr ""
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr ""
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr ""
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr ""
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr ""
#: src/pv/state.c:40
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:617 src/pv/state.c:628
msgid "file list allocation failed"
msgstr ""
#: src/pv/transfer.c:463
msgid "read failed"
msgstr ""
#: src/pv/transfer.c:479
msgid "warning: read errors detected"
msgstr ""
#: src/pv/transfer.c:495
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:573
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:593
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:634
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:702
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:744
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:918
msgid "write failed"
msgstr ""
#: src/pv/transfer.c:1159
msgid "select call failed"
msgstr ""
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr ""
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr ""
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr ""
#: src/pv/transfer.c:490
msgid "read failed"
msgstr ""
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr ""
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:996
msgid "write failed"
msgstr ""
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr ""
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr ""
+593
View File
@@ -0,0 +1,593 @@
msgid ""
msgstr ""
"Project-Id-Version: pv 1.9.34\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: 2025-11-22 15:06+0000\n"
"Last-Translator: artnay <artnay@noreply.codeberg.org>\n"
"Language-Team: Finnish <https://translate.codeberg.org/projects/pv/pv/fi/>\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.14\n"
#: src/main/help.c:236
msgid "show progress bar"
msgstr "näytä edistymispalkki"
#: src/main/help.c:239
msgid "show elapsed time"
msgstr "näytä kulunut aika"
#: src/main/help.c:242
msgid "show estimated time of arrival (completion)"
msgstr "näytä arvioitu valmistumisaika"
#: src/main/help.c:245
msgid "show absolute estimated time of arrival (completion)"
msgstr "näytä absoluuttinen arvioitu valmistumisaika"
#: src/main/help.c:248
msgid "show data transfer rate counter"
msgstr "näytä datan siirtonopeuden laskuri"
#: src/main/help.c:251
msgid "show data transfer average rate counter"
msgstr "näytä datan keskimääräisen siirtonopeuden laskuri"
#: src/main/help.c:254
msgid "show number of bytes transferred"
msgstr "näytä siirrettyjen tavujen määrä"
#: src/main/help.c:257
msgid "show percentage of transfer buffer in use"
msgstr ""
#: src/main/help.c:259
msgid "NUM"
msgstr "NUM"
#: src/main/help.c:260
msgid "show NUM bytes last written"
msgstr "näytä NUM viimeksi kirjoitettua tavua"
#: src/main/help.c:262
msgid "FORMAT"
msgstr "MUOTO"
#: src/main/help.c:263
msgid "set output format to FORMAT"
msgstr "aseta tulostemuodoksi MUOTO"
#: src/main/help.c:266
msgid "output percentages, not visual information"
msgstr "tulosta prosentit, ei visuaalista tietoa"
#: src/main/help.c:269
msgid "do not output any transfer information at all"
msgstr "älä tulosta minkäänlaista siirtotietoa"
#: src/main/help.c:273
msgid "show number of bits transferred"
msgstr "näytä siirrettyjen bittien määrä"
#: src/main/help.c:276
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "käsittele päätteitä 1000:n kertoimina 1024:n sijaan"
#: src/main/help.c:279
msgid "display nothing until first byte transferred"
msgstr "älä näytä mitään, ennen kuin ensimmäinen tavu on siirretty"
#: src/main/help.c:281 src/main/help.c:296 src/main/help.c:299
msgid "SEC"
msgstr ""
#: src/main/help.c:282
msgid "display nothing until SEC seconds have passed"
msgstr "älä näytä mitään, ennen kuin SEC sekuntia on kulunut"
#: src/main/help.c:284
msgid "SIZE"
msgstr "KOKO"
#: src/main/help.c:285
msgid "set estimated data size to SIZE bytes"
msgstr "aseta arvioiduksi datan kooksi KOKO tavua"
#: src/main/help.c:288
msgid "if size unknown, show rate vs max rate"
msgstr ""
#: src/main/help.c:291
msgid "count lines instead of bytes"
msgstr "laske rivit tavujen sijaan"
#: src/main/help.c:294
msgid "lines are null-terminated"
msgstr ""
#: src/main/help.c:297
msgid "update every SEC seconds"
msgstr "päivitä SEC sekunnin välein"
#: src/main/help.c:300
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr "laske keskimääräinen siirtonopeus SEC sekunnin ajalta (oletus 30 s)"
#: src/main/help.c:302
msgid "WIDTH"
msgstr "LEVEYS"
#: src/main/help.c:303
msgid "assume terminal is WIDTH characters wide"
msgstr "oleta, että päätteen LEVEYS on merkkiä leveä"
#: src/main/help.c:305
msgid "HEIGHT"
msgstr "KORKEUS"
#: src/main/help.c:306
msgid "assume terminal is HEIGHT rows high"
msgstr "oleta, että päätteen KORKEUS on merkkiä korkea"
#: src/main/help.c:308
msgid "NAME"
msgstr "NIMI"
#: src/main/help.c:309
msgid "prefix visual information with NAME"
msgstr ""
#: src/main/help.c:311
msgid "STYLE"
msgstr "TYYLI"
#: src/main/help.c:312
msgid "set default bar style to NAME"
msgstr ""
#: src/main/help.c:314
msgid "SPEC"
msgstr ""
#: src/main/help.c:315
msgid "also send progress to SPEC"
msgstr ""
#: src/main/help.c:318
msgid "output transfer statistics at the end"
msgstr "tulosta siirtotilastot lopussa"
#: src/main/help.c:321
msgid "output even if standard error is not a terminal"
msgstr ""
#: src/main/help.c:324
msgid "use cursor positioning escape sequences"
msgstr ""
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr "TIEDOSTO"
#: src/main/help.c:328
msgid "write output to FILE instead of stdout"
msgstr "kirjoita tuloste tiedostoon TIEDOSTO oletustulosteen (stdout) sijaan"
#: src/main/help.c:330
msgid "RATE"
msgstr "NOPEUS"
#: src/main/help.c:331
msgid "limit transfer to RATE bytes per second"
msgstr "rajoita siirron nopeudeksi NOPEUS tavua per sekunti"
#: src/main/help.c:333 src/main/help.c:342
msgid "BYTES"
msgstr ""
#: src/main/help.c:334
msgid "use a buffer size of BYTES"
msgstr ""
#: src/main/help.c:337
msgid "never use splice(), always use read/write"
msgstr ""
#: src/main/help.c:340
msgid "skip read errors in input"
msgstr "ohita lukuvirheet syötteessä"
#: src/main/help.c:343
msgid "skip errors in BYTES blocks at a time"
msgstr ""
#: src/main/help.c:346
msgid "stop after --size bytes have been transferred"
msgstr "lopeta kun --size tavua on siirretty"
#: src/main/help.c:349
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:352
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr ""
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr ""
"kirjoita kaikki syöte tiedostoon TIEDOSTO ennen tulosteeseen kirjoittamista"
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr ""
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr ""
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr ""
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr ""
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "näytä tämä ohje ja lopeta"
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "näytä versiotiedot ja lopeta"
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr "kirjoita vianjäljityslokit tiedostoon TIEDOSTO"
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Käyttö: %s [VALINTA] [TIEDOSTO]..."
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Putkita TIEDOSTO(t), tai vakiosyöte, vakiotulosteeseen, monitoroinnin kanssa."
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr "Tuetut muotosekvenssit:"
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Ilmoita ongelmista: %s"
#: src/main/main.c:228
msgid "(input)"
msgstr ""
#: src/main/main.c:330
msgid "state allocation failed"
msgstr ""
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr ""
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "virheellinen prosessin ID"
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr ""
#: src/main/options.c:519
msgid "is a directory"
msgstr "on hakemisto"
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr ""
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr ""
#: src/main/options.c:591
msgid "failed to open block device"
msgstr "lohkolaitteen avaaminen epäonnistui"
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr "lohkolaitteen koon päättely epäonnistui"
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr ""
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr ""
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr "numeerista arvoa ei ymmärretty"
#: src/main/options.c:801
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:825
msgid "missing filename"
msgstr "puuttuva tiedostonimi"
#: src/main/options.c:853
msgid "missing process name"
msgstr "puuttuva prosessinimi"
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Suorita `%s --help' saadaksesi lisätietoja."
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Suorita `%s -h' saadaksesi lisätietoja."
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr ""
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr ""
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "Lisenssi: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
#: src/main/version.c:32
msgid "Project web site"
msgstr "Projektin verkkosivu"
#: src/pv/cursor.c:61
msgid "failed to get terminal name"
msgstr ""
#: src/pv/cursor.c:106
msgid "failed to open lock file"
msgstr ""
#: src/pv/cursor.c:139
msgid "lock attempt failed"
msgstr ""
#: src/pv/cursor.c:400
msgid "failed to open terminal"
msgstr ""
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr ""
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr ""
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "tiedoston sulkeminen epäonnistui"
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "tiedoston lukeminen epäonnistui"
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr ""
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "syötetiedosto on tulostetiedosto"
#: src/pv/file.c:429
msgid "(none)"
msgstr ""
#: src/pv/file.c:431
msgid "(stdin)"
msgstr ""
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr ""
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr ""
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr ""
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr ""
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr ""
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr ""
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr ""
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr ""
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr ""
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO ei ole tuettu tässä järjestelmässä"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr ""
#: src/pv/transfer.c:490
msgid "read failed"
msgstr ""
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "varoitus: lukuvirheitä havaittu"
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "kirjoittaminen epäonnistui"
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr ""
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "ei tavallinen tiedosto tai lohkolaite"
+199 -163
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: 2025-05-31 08:58+0000\n"
"Last-Translator: milimarg <milimarg@noreply.codeberg.org>\n"
"Language-Team: French <https://translate.codeberg.org/projects/pv/pv/fr/>\n"
@@ -14,9 +14,9 @@ msgstr ""
"From: Andrew Wood <ivarch@ubik>\n"
"Xgettext-Options: --default-domain=pkgbuild --directory=./.pkgdir --add-"
"comments --keyword=_ --keyword=N_\n"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/init."
"c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/guts/"
"configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/"
"init.c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/"
"guts/configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"generate.c src/ui/main.c src/ui/xpm.c src/ui/status.c src/ui/activate.c src/"
"ui/handlers/main.c src/ui/handlers/package.c src/ui/handlers/prefs.c src/ui/"
"handlers/dirsel.c src/ui/handlers/popup.c src/ui/handlers/help.c src/ui/"
@@ -186,8 +186,8 @@ msgstr ""
msgid "use cursor positioning escape sequences"
msgstr "utiliser les séquences d'échappements de positionnement de curseur"
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr "FICHIER"
@@ -236,137 +236,157 @@ msgid "use direct I/O to bypass cache"
msgstr "utiliser les E/S directes pour contourner le cache"
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr "rejeter l'entrée au lieu de l'écrire vers la sortie"
#: src/main/help.c:358
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr "écrire toute l'entrée vers FICHIER avant de l'écrire vers la sortie"
#: src/main/help.c:360
msgid "PID[:FD]"
msgstr "PID[:FD]"
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:361
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr "surveiller le fichier FD ouvert par le processus PID"
#: src/main/help.c:364
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr "PID"
#: src/main/help.c:365
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr "mettre à jour la configuration du processus PID"
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr "enregistrer l'ID de processus dans FICHIER"
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "afficher cette aide puis quitter"
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "afficher la version puis quitter"
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr "écrire les journaux de déboggage vers FICHIER"
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Utilisation : %s [OPTIONS] [FICHIER]..."
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concaténer FICHIER(s), ou l'entrée standard, sur la sortie standard avec "
"monitorage."
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr "Séquences de formatage supportées :"
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "SVP rapporter tous bogues à %s"
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr "(entrée)"
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr "échec de l'allocation de mémoire de condition"
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
msgstr "échec à statuer sur le fichier"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:160
msgid "is a directory"
msgstr "est un répertoire"
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr "échec de génération du nom de fichier sysfs"
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr "échec de la lecture de la taille du fichier sysfs"
#: src/main/options.c:231
msgid "failed to open block device"
msgstr "échec de l'ouverture du périphérique de bloc"
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr "échec de l'évaluation de la taille du périphérique de bloc"
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr "l'allocation pour la structure d'une option a échoué"
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr "l'allocation pour la structure de l'option argv a échoué"
#: src/main/options.c:419
msgid "numeric value not understood"
msgstr "valeur numérique non comprise"
#: src/main/options.c:437
msgid "integer argument expected"
msgstr "Valeur entière attendue"
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr "Valeur numérique attendue"
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr "ID de processus ou paire pid:fd attendue"
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "ID de processus non valide"
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr "échec à statuer sur le fichier"
#: src/main/options.c:519
msgid "is a directory"
msgstr "est un répertoire"
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr "échec de génération du nom de fichier sysfs"
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr "échec de la lecture de la taille du fichier sysfs"
#: src/main/options.c:591
msgid "failed to open block device"
msgstr "échec de l'ouverture du périphérique de bloc"
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr "échec de l'évaluation de la taille du périphérique de bloc"
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr "l'allocation pour la structure d'une option a échoué"
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr "l'allocation pour la structure de l'option argv a échoué"
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr "valeur numérique non comprise"
#: src/main/options.c:801
msgid "integer argument expected"
msgstr "Valeur entière attendue"
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr "Valeur numérique attendue"
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Essayez `%s --help' pour plus d'informations."
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Essayez `%s -h' pour plus d'informations."
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -374,35 +394,39 @@ msgstr ""
"impossible d'utiliser le mode ligne ou les options de modificateur de "
"transfert lors de la visualisation des descripteurs de fichiers"
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"impossible d'utiliser le positionnement du curseur lors de la visualisation "
"des descripteurs de fichier"
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr ""
"impossible d'utiliser la télécommande lors de la visualisation des "
"descripteurs de fichiers"
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr ""
"impossible de transférer des fichiers lorsque vous regardez des descripteurs "
"de fichiers"
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr "non disponible sur les systèmes sans /proc/self/fdinfo"
#: src/main/remote.c:309
msgid "message not received"
msgstr "message non reçu"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO non pris en charge sur ce système"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -438,153 +462,165 @@ msgstr "échec de la tentative de verrouillage"
msgid "failed to open terminal"
msgstr "échec de l'ouverture du terminal"
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnum KMGTPEZY"
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr "échec de l'allocation de mémoire tampon"
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr "ne peut pas passer au début de la sortie"
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "la fermeture du fichier a échoué"
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "la lecture du fichier a échoué"
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr "échec à statuer sur le fichier de sortie"
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "fichiers d'entré et de sortie sont les mêmes"
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr "(aucun)"
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr "O/s"
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr "O"
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr "taux min/moy/max/écart-type"
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr "taux non mesuré"
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr "pid"
#: src/pv/state.c:40
msgid "history structure allocation failed"
msgstr "l'allocation de la structure de l'historique a échoué"
#: src/pv/state.c:617 src/pv/state.c:628
msgid "file list allocation failed"
msgstr "échec de l'allocation de la liste de fichiers"
#: src/pv/transfer.c:463
msgid "read failed"
msgstr "la lecture a échoué"
#: src/pv/transfer.c:479
msgid "warning: read errors detected"
msgstr "avertissement : erreurs de lecture détectées"
#: src/pv/transfer.c:495
msgid "file is not seekable"
msgstr "ne peut pas se déplacer dans le fichier"
#: src/pv/transfer.c:573
msgid "failed to seek past error"
msgstr "n'a pas réussi à dépasser l'erreur"
#: src/pv/transfer.c:593
msgid "skipped past read error"
msgstr "erreur de lecture dépassée"
#: src/pv/transfer.c:634
msgid "no transfer buffer allocated"
msgstr "aucun tampon de transfert alloué"
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr "La définition de l'intervalle du minuteur a échoué"
#: src/pv/transfer.c:702
msgid "failed to clear interval timer"
msgstr "La réinitialisation des intervalles du minuteur a échoué"
#: src/pv/transfer.c:744
msgid "line position buffer allocation failed"
msgstr "L'allocation de la position de la ligne de la mémoire tampon a échoué"
#: src/pv/transfer.c:918
msgid "write failed"
msgstr "l'écriture a échoué"
#: src/pv/transfer.c:1159
msgid "select call failed"
msgstr "l'appel de sélection a échoué"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr "fd"
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr "message non reçu"
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO non pris en charge sur ce système"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr "l'allocation de la structure de l'historique a échoué"
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr "échec de l'allocation de la liste de fichiers"
#: src/pv/transfer.c:490
msgid "read failed"
msgstr "la lecture a échoué"
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "avertissement : erreurs de lecture détectées"
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr "ne peut pas se déplacer dans le fichier"
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr "n'a pas réussi à dépasser l'erreur"
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr "erreur de lecture dépassée"
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr "aucun tampon de transfert alloué"
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr "La définition de l'intervalle du minuteur a échoué"
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr "La réinitialisation des intervalles du minuteur a échoué"
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr "L'allocation de la position de la ligne de la mémoire tampon a échoué"
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "l'écriture a échoué"
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr "l'appel de sélection a échoué"
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "pas un fichier ordinaire ou un périphérique de bloc"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
#~ msgid "failed to set alarm signal handler"
#~ msgstr "échec de la définition du gestionnaire de signal d'alarme"
+589
View File
@@ -0,0 +1,589 @@
msgid ""
msgstr ""
"Project-Id-Version: pv 1.9.34\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: ka\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/main/help.c:236
msgid "show progress bar"
msgstr ""
#: src/main/help.c:239
msgid "show elapsed time"
msgstr ""
#: src/main/help.c:242
msgid "show estimated time of arrival (completion)"
msgstr ""
#: src/main/help.c:245
msgid "show absolute estimated time of arrival (completion)"
msgstr ""
#: src/main/help.c:248
msgid "show data transfer rate counter"
msgstr ""
#: src/main/help.c:251
msgid "show data transfer average rate counter"
msgstr ""
#: src/main/help.c:254
msgid "show number of bytes transferred"
msgstr ""
#: src/main/help.c:257
msgid "show percentage of transfer buffer in use"
msgstr ""
#: src/main/help.c:259
msgid "NUM"
msgstr ""
#: src/main/help.c:260
msgid "show NUM bytes last written"
msgstr ""
#: src/main/help.c:262
msgid "FORMAT"
msgstr ""
#: src/main/help.c:263
msgid "set output format to FORMAT"
msgstr ""
#: src/main/help.c:266
msgid "output percentages, not visual information"
msgstr ""
#: src/main/help.c:269
msgid "do not output any transfer information at all"
msgstr ""
#: src/main/help.c:273
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:276
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr ""
#: src/main/help.c:279
msgid "display nothing until first byte transferred"
msgstr ""
#: src/main/help.c:281 src/main/help.c:296 src/main/help.c:299
msgid "SEC"
msgstr ""
#: src/main/help.c:282
msgid "display nothing until SEC seconds have passed"
msgstr ""
#: src/main/help.c:284
msgid "SIZE"
msgstr ""
#: src/main/help.c:285
msgid "set estimated data size to SIZE bytes"
msgstr ""
#: src/main/help.c:288
msgid "if size unknown, show rate vs max rate"
msgstr ""
#: src/main/help.c:291
msgid "count lines instead of bytes"
msgstr ""
#: src/main/help.c:294
msgid "lines are null-terminated"
msgstr ""
#: src/main/help.c:297
msgid "update every SEC seconds"
msgstr ""
#: src/main/help.c:300
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:302
msgid "WIDTH"
msgstr ""
#: src/main/help.c:303
msgid "assume terminal is WIDTH characters wide"
msgstr ""
#: src/main/help.c:305
msgid "HEIGHT"
msgstr ""
#: src/main/help.c:306
msgid "assume terminal is HEIGHT rows high"
msgstr ""
#: src/main/help.c:308
msgid "NAME"
msgstr ""
#: src/main/help.c:309
msgid "prefix visual information with NAME"
msgstr ""
#: src/main/help.c:311
msgid "STYLE"
msgstr ""
#: src/main/help.c:312
msgid "set default bar style to NAME"
msgstr ""
#: src/main/help.c:314
msgid "SPEC"
msgstr ""
#: src/main/help.c:315
msgid "also send progress to SPEC"
msgstr ""
#: src/main/help.c:318
msgid "output transfer statistics at the end"
msgstr ""
#: src/main/help.c:321
msgid "output even if standard error is not a terminal"
msgstr ""
#: src/main/help.c:324
msgid "use cursor positioning escape sequences"
msgstr ""
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr ""
#: src/main/help.c:328
msgid "write output to FILE instead of stdout"
msgstr ""
#: src/main/help.c:330
msgid "RATE"
msgstr ""
#: src/main/help.c:331
msgid "limit transfer to RATE bytes per second"
msgstr ""
#: src/main/help.c:333 src/main/help.c:342
msgid "BYTES"
msgstr ""
#: src/main/help.c:334
msgid "use a buffer size of BYTES"
msgstr ""
#: src/main/help.c:337
msgid "never use splice(), always use read/write"
msgstr ""
#: src/main/help.c:340
msgid "skip read errors in input"
msgstr ""
#: src/main/help.c:343
msgid "skip errors in BYTES blocks at a time"
msgstr ""
#: src/main/help.c:346
msgid "stop after --size bytes have been transferred"
msgstr ""
#: src/main/help.c:349
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:352
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr ""
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr ""
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr ""
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr ""
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr ""
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr ""
#: src/main/help.c:380
msgid "show this help and exit"
msgstr ""
#: src/main/help.c:383
msgid "show version information and exit"
msgstr ""
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr ""
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr ""
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr ""
#: src/main/main.c:228
msgid "(input)"
msgstr ""
#: src/main/main.c:330
msgid "state allocation failed"
msgstr ""
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr ""
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr ""
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr ""
#: src/main/options.c:519
msgid "is a directory"
msgstr ""
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr ""
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr ""
#: src/main/options.c:591
msgid "failed to open block device"
msgstr ""
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr ""
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr ""
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr ""
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:801
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr ""
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr ""
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr ""
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr ""
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr ""
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
#: src/pv/cursor.c:61
msgid "failed to get terminal name"
msgstr ""
#: src/pv/cursor.c:106
msgid "failed to open lock file"
msgstr ""
#: src/pv/cursor.c:139
msgid "lock attempt failed"
msgstr ""
#: src/pv/cursor.c:400
msgid "failed to open terminal"
msgstr ""
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr ""
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr ""
#: src/pv/file.c:303
msgid "failed to close file"
msgstr ""
#: src/pv/file.c:335
msgid "failed to read file"
msgstr ""
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr ""
#: src/pv/file.c:372
msgid "input file is output file"
msgstr ""
#: src/pv/file.c:429
msgid "(none)"
msgstr ""
#: src/pv/file.c:431
msgid "(stdin)"
msgstr ""
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr ""
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr ""
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr ""
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr ""
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr ""
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr ""
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr ""
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr ""
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr ""
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr ""
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr ""
#: src/pv/transfer.c:490
msgid "read failed"
msgstr ""
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr ""
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:996
msgid "write failed"
msgstr ""
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr ""
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr ""
+169 -127
View File
@@ -6,9 +6,9 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"PO-Revision-Date: 2025-01-15 19:08+0000\n"
"Last-Translator: coralpink <coralpink@users.noreply.translate.codeberg.org>\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: 2025-10-02 13:23+0000\n"
"Last-Translator: Coral Pink <coralpink@noreply.codeberg.org>\n"
"Language-Team: Polish <https://translate.codeberg.org/projects/pv/pv/pl/>\n"
"Language: pl\n"
"MIME-Version: 1.0\n"
@@ -16,7 +16,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 5.9.2\n"
"X-Generator: Weblate 5.13.2\n"
#: src/main/help.c:236
msgid "show progress bar"
@@ -178,8 +178,8 @@ msgstr "pokaż wyjście nawet standardowe wyjście błędu nie jest terminalem"
msgid "use cursor positioning escape sequences"
msgstr "używaj znaków ucieczki do pozycjonowania kursora"
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr "PLIK"
@@ -229,138 +229,158 @@ msgstr ""
"użyj bezpośredniego wejścia/wyjścia celem pominięcia pamięci podręcznej"
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr "zignoruj dane wejściowe zamiast wyświetlić je na wyjściu standardowym"
#: src/main/help.c:358
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr ""
"zapisz wszystkie dane wejściowe do PLIK przed wyświetleniem ich na wyjściu"
#: src/main/help.c:360
msgid "PID[:FD]"
msgstr "PID[:FD]"
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:361
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr "obserwuj plik FD otworzony przez proces PID"
#: src/main/help.c:364
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr "PID"
#: src/main/help.c:365
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr "zaktualizuj ustawienia procesu PID"
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr "zapisz ID procesu do PLIK"
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "wyświetl te informacje z pomocą i wyjdź"
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "wyświetl informacje o wersji i wyjdź"
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr "zapisz logi debugujące do PLIK"
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Sposób użycia: %s [OPCJA] [PLIK]..."
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Łączenie PLIK(ów) lub wejścia standardowego, do wyjścia standardowego z "
"monitoringiem."
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr "Wspierane sekwencje formatowania:"
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Proszę przesyłać zgłoszenia błędów do %s"
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr "(wejście)"
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr "alokacja stanu programu nie powiodła się"
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
msgstr "nie udało się wykonać operacji stat na pliku"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:160
msgid "is a directory"
msgstr "jest katalogiem"
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr "nie udało się wygenerować nazwy pliku dla sysfs"
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr "nie udało się odczytać rozmiaru pliku sysfs"
#: src/main/options.c:231
msgid "failed to open block device"
msgstr "nie udało się otworzyć urządzenia blokowego"
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr "nie udało się ustalić rozmiaru urządzenia blokowego"
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr "nie udało się zaalokować struktur opcji"
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr "nie udało się zaalokować struktur opcji argv"
#: src/main/options.c:419
msgid "numeric value not understood"
msgstr "wartość liczbowa niezrozumiana"
#: src/main/options.c:437
msgid "integer argument expected"
msgstr "oczekiwany argument typu liczby całkowitej"
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr "oczekiwany argument liczbowy"
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr "oczekiwany proces ID lub para PID:FD"
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "niepoprawne ID procesu"
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr "nie udało się wykonać operacji stat na pliku"
#: src/main/options.c:519
msgid "is a directory"
msgstr "jest katalogiem"
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr "nie udało się wygenerować nazwy pliku dla sysfs"
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr "nie udało się odczytać rozmiaru pliku sysfs"
#: src/main/options.c:591
msgid "failed to open block device"
msgstr "nie udało się otworzyć urządzenia blokowego"
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr "nie udało się ustalić rozmiaru urządzenia blokowego"
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr "nie udało się zaalokować struktur opcji"
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr "nie udało się zaalokować struktur opcji argv"
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr "wartość liczbowa niezrozumiana"
#: src/main/options.c:801
msgid "integer argument expected"
msgstr "oczekiwany argument typu liczby całkowitej"
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr "oczekiwany argument liczbowy"
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Spróbuj `%s --help' by uzyskać więcej informacji."
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Spróbuj `%s -h' by uzyskać więcej informacji."
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -368,33 +388,37 @@ msgstr ""
"nie można użyć trybu zliczania linii lub opcji modyfikujących przesył "
"łącznie z opcją obserwowania deskryptorów plików"
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"nie można użyć pozycjonowania kursora łącznie z opcją obserwowania "
"deskryptorów plików"
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr ""
"nie można użyć opcji zaktualizowania ustawień procesu łącznie z opcją "
"obserwowania deskryptorów plików"
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr "nie można przesyłać plików z opcją obserwowania deskryptorów plików"
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr "niedostępne na systemach bez /proc/self/fdinfo"
#: src/main/remote.c:309
msgid "message not received"
msgstr "wiadomość nieodebrana"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO nie jest wspierane na tym systemie"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -429,152 +453,170 @@ msgstr "blokada zasobów nie powiodła się"
msgid "failed to open terminal"
msgstr "nie udało się otworzyć terminala"
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnum KMGTPEZY"
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr "nie udało się zaalokować bufora"
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr "nie udało się przewinąć wyjścia do początku"
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "nie udało się zamknąć pliku"
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "nie udało się odczytać pliku"
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr "nie udało się wykonać operacji stat na pliku wyjściowym"
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "plik wejściowy jest zarazem plikiem wyjściowym"
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr "(brak)"
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr "B"
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr "prędkość min/śr/max/odch"
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr "prędkość niezmierzona"
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr "pid"
#: src/pv/state.c:40
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr "fd"
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr "wiadomość nieodebrana"
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO nie jest wspierane na tym systemie"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr "nie udało się zaalokować struktury historii"
#: src/pv/state.c:617 src/pv/state.c:628
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr "nie udało się zaalokować listy plików"
#: src/pv/transfer.c:463
#: src/pv/transfer.c:490
msgid "read failed"
msgstr "błąd odczytu"
#: src/pv/transfer.c:479
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "ostrzeżenie: błędy odczytu wykryte"
#: src/pv/transfer.c:495
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr "pliku nie da się przewijać"
#: src/pv/transfer.c:573
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr "nie udało się przewinąć za błąd"
#: src/pv/transfer.c:593
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr "pominięto błąd odczytu"
#: src/pv/transfer.c:634
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr "brak zaalokowanego bufora transferu"
#: src/pv/transfer.c:676
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr "nie udało się ustawić interwału czasowego"
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/transfer.c:702
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr "nie udało się wyczyścić interwału czasowego"
#: src/pv/transfer.c:744
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr "alokacja buforu pozycji linii nie powiodła się"
#: src/pv/transfer.c:918
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "błąd zapisu"
#: src/pv/transfer.c:1159
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr "nie udało się wywołać funkcji select"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
msgid "fd"
msgstr "fd"
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "plik nie jest plikiem regularnym lub urządzeniem blokowym"
#~ msgid "process list allocation failed"
#~ msgstr "nie udało się zaalokować listy procesów"
#~ msgid "file descriptor list allocation failed"
#~ msgstr "nie udało się zaalokować listy deskryptorów plików"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
+194 -161
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -171,8 +171,8 @@ msgstr "gera dados mesmo que a saída de erro seja redirecionada"
msgid "use cursor positioning escape sequences"
msgstr "utiliza caracteres de escape para posicionar o cursor"
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr ""
@@ -221,137 +221,157 @@ msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:355
msgid "discard input instead of writing to output"
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "write all input to FILE before writing to output"
msgstr ""
#: src/main/help.c:360
msgid "PID[:FD]"
msgid "discard input instead of writing to output"
msgstr ""
#: src/main/help.c:361
msgid "watch file FD opened by process PID"
msgstr "assistir arquivo FD aberto pelo processo PID"
msgid "write all input to FILE before writing to output"
msgstr ""
#: src/main/help.c:364
msgid "PID"
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr "assistir arquivo FD aberto pelo processo PID"
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr ""
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr "atualizar as configurações do processo PID"
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr "salvar ID do processo em FILE"
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "exibe esta tela de ajuda e termina"
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "exibe a versão e termina"
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr ""
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Uso: %s [OPÇÕES] [ARQUIVOS]..."
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concatena ARQUIVO(s) ou a entrada padrão e grava na saída padrão, com "
"monitoramento."
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Por favor, reporte quaisquer defeitos para %s"
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr ""
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr "alocação de memória de status falhou"
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
msgstr "erro obtendo informações do arquivo"
#: src/main/options.c:160
msgid "is a directory"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr ""
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr ""
#: src/main/options.c:231
msgid "failed to open block device"
msgstr ""
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr ""
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr "erro na alocação da estrutura de opções"
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr "erro na alocação da estrutura de opções argv"
#: src/main/options.c:419
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:437
msgid "integer argument expected"
msgstr "argumento inteiro esperado"
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr "argumento numérico esperado"
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr "ID do processo ou par pid:fd esperado"
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "ID de processo inválido"
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr "erro obtendo informações do arquivo"
#: src/main/options.c:519
msgid "is a directory"
msgstr ""
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr ""
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr ""
#: src/main/options.c:591
msgid "failed to open block device"
msgstr ""
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr ""
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr "erro na alocação da estrutura de opções"
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr "erro na alocação da estrutura de opções argv"
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:801
msgid "integer argument expected"
msgstr "argumento inteiro esperado"
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr "argumento numérico esperado"
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Tente `%s --help' para maiores informações."
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Tente `%s -h' para maiores informações."
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -359,31 +379,35 @@ msgstr ""
"não pode usar o modo de linha ou opções de modificador de transferência ao "
"assistir os descritores de arquivo"
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"não pode usar o posicionamento do cursor ao observar os descritores de "
"arquivo"
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr "não pode usar o controle remoto ao assistir os descritores de arquivo"
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr "não pode transferir arquivos ao assistir descritores de arquivo"
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr "não disponível em sistemas sem /proc/self/fdinfo"
#: src/main/remote.c:309
msgid "message not received"
msgstr "mensagem não recebida"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO não suportado neste sistema"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -417,150 +441,159 @@ msgstr "tentativa de bloqueio falhou"
msgid "failed to open terminal"
msgstr "erro abrindo o terminal"
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr "erro alocando o buffer"
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr "não pode mover para o início da produção"
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "erro fechando o arquivo"
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "erro lendo o arquivo"
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr "erro obtendo informações do arquivo de saída"
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "os arquivos de entrada e saída são o mesmo"
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr ""
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr ""
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr ""
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr ""
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr ""
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr ""
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr ""
#: src/pv/state.c:40
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:617 src/pv/state.c:628
msgid "file list allocation failed"
msgstr ""
#: src/pv/transfer.c:463
msgid "read failed"
msgstr "erro de leitura"
#: src/pv/transfer.c:479
msgid "warning: read errors detected"
msgstr "aviso: erros de leitura detectados"
#: src/pv/transfer.c:495
msgid "file is not seekable"
msgstr "não pode mover dentro do arquivo"
#: src/pv/transfer.c:573
msgid "failed to seek past error"
msgstr "não pode ir além do erro"
#: src/pv/transfer.c:593
msgid "skipped past read error"
msgstr "ignorado erro de leitura"
#: src/pv/transfer.c:634
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:702
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:744
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:918
msgid "write failed"
msgstr "erro de gravação"
#: src/pv/transfer.c:1159
msgid "select call failed"
msgstr "erro na chamada da função select"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr "mensagem não recebida"
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO não suportado neste sistema"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr ""
#: src/pv/transfer.c:490
msgid "read failed"
msgstr "erro de leitura"
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "aviso: erros de leitura detectados"
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr "não pode mover dentro do arquivo"
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr "não pode ir além do erro"
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr "ignorado erro de leitura"
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "erro de gravação"
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr "erro na chamada da função select"
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "não é um arquivo regular ou dispositivo de bloqueio"
+196 -160
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: 2025-01-15 19:08+0000\n"
"Last-Translator: 0ko <0ko@users.noreply.translate.codeberg.org>\n"
"Language-Team: Russian <https://translate.codeberg.org/projects/pv/pv/ru/>\n"
@@ -170,8 +170,8 @@ msgid "use cursor positioning escape sequences"
msgstr ""
"использовать символьные последовательности для позиционирования курсора"
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr "ФАЙЛ"
@@ -220,163 +220,187 @@ msgid "use direct I/O to bypass cache"
msgstr "использовать прямой ввод/вывод для обхода кеша"
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr "отбрасывать ввод вместо записи в вывод"
#: src/main/help.c:358
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr "записывать весь ввод в ФАЙЛ прежде, чем отправлять на вывод"
#: src/main/help.c:360
msgid "PID[:FD]"
msgstr "ИДпр[:FD]"
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:361
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr "следить за FD файла, открытого процессом ИДпр"
#: src/main/help.c:364
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr "ИДпр"
#: src/main/help.c:365
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr "обновить настройки ИДпр процесса"
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr "сохранить ИД процесса в ФАЙЛ"
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "показать справку и завершить работу"
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "показать версию программы и завершить работу"
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr "вести запись отладочного журнала в ФАЙЛ"
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Использование: %s [ОПЦИИ] [ФАЙЛ]..."
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr "Поддерживаемые последовательности:"
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Сообщайте о проблемах на: %s"
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr "(ввод)"
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr ""
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
msgstr "не удалось получить информацию о файле"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:160
msgid "is a directory"
msgstr "является каталогом"
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr "не удалось создать имя файла sysfs"
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr "не удалось узнать размер файла sysfs"
#: src/main/options.c:231
msgid "failed to open block device"
msgstr "не удалось открыть блочное устройство"
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr "не удалось определить размер блочного устройства"
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr "не удалось выделить память для структуры опций"
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr "не удалось выделить память для структуры опций argv"
#: src/main/options.c:419
msgid "numeric value not understood"
msgstr "число не распознано"
#: src/main/options.c:437
msgid "integer argument expected"
msgstr "ожидалось целое число"
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr "ожидалось число"
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr "ожидался ИД процесса или пара ИДпр:ДФ"
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "неправильный ИД процесса"
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr "не удалось получить информацию о файле"
#: src/main/options.c:519
msgid "is a directory"
msgstr "является каталогом"
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr "не удалось создать имя файла sysfs"
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr "не удалось узнать размер файла sysfs"
#: src/main/options.c:591
msgid "failed to open block device"
msgstr "не удалось открыть блочное устройство"
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr "не удалось определить размер блочного устройства"
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr "не удалось выделить память для структуры опций"
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr "не удалось выделить память для структуры опций argv"
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr "число не распознано"
#: src/main/options.c:801
msgid "integer argument expected"
msgstr "ожидалось целое число"
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr "ожидалось число"
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Выполните `%s --help' для получения подробностей."
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Выполните `%s -h' для получения подробностей."
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr "удалённое управление невозможно при отслеживании дескрипторов файлов"
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr "передача файлов невозможна при отслеживании дескрипторов файлов"
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr "невозможно на системах без /proc/self/fdinfo"
#: src/main/remote.c:309
msgid "message not received"
msgstr "сообщение не получено"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
msgstr "Этой системой не поддерживается SA_SIGINFO"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -412,150 +436,162 @@ msgstr "попытка блокировки не удалась"
msgid "failed to open terminal"
msgstr "не удалось открыть терминал"
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr "не удалось выделить память для буфера"
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr ""
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "не удалось закрыть файл"
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "не удалось прочесть файл"
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr "не удалось получить информацию о выходном файле"
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "пути исходного и выходного файлов одинаковы"
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr "(нет)"
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr "(стд. ввод)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr "бит/с"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/с"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr "байт/с"
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "бит"
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr "байт"
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr "ОЖИД"
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr "ЗАВЕРШ"
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr "скор. мин/сред/макс/дев"
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr "скорость не изменяется"
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr "ИДпр"
#: src/pv/state.c:40
msgid "history structure allocation failed"
msgstr "не удалось выделить память для структуры истории"
#: src/pv/state.c:617 src/pv/state.c:628
msgid "file list allocation failed"
msgstr "не удалось выделить память для списка файлов"
#: src/pv/transfer.c:463
msgid "read failed"
msgstr "чтение не удалось"
#: src/pv/transfer.c:479
msgid "warning: read errors detected"
msgstr "внимание: замечены ошибки чтения"
#: src/pv/transfer.c:495
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:573
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:593
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:634
msgid "no transfer buffer allocated"
msgstr "не выделена память для буфера передачи"
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr "не удалось задать измеритель временного промежутка"
#: src/pv/transfer.c:702
msgid "failed to clear interval timer"
msgstr "не удалось очистить измеритель временного промежутка"
#: src/pv/transfer.c:744
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:918
msgid "write failed"
msgstr "запись не удалась"
#: src/pv/transfer.c:1159
msgid "select call failed"
msgstr "запрос выборки не удался"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr "дф"
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr "сообщение не получено"
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "Этой системой не поддерживается SA_SIGINFO"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr "не удалось выделить память для структуры истории"
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr "не удалось выделить память для списка файлов"
#: src/pv/transfer.c:490
msgid "read failed"
msgstr "чтение не удалось"
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "внимание: замечены ошибки чтения"
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr "не выделена память для буфера передачи"
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr "не удалось задать измеритель временного промежутка"
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr "не удалось очистить измеритель временного промежутка"
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "запись не удалась"
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr "запрос выборки не удался"
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "не является обычным файлом или блочным устройством"
#~ msgid "PID[:FD]"
#~ msgstr "ИДпр[:FD]"
+209 -167
View File
@@ -2,16 +2,16 @@ msgid ""
msgstr ""
"Project-Id-Version: pv 1.8.14\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-07-26 14:50+0100\n"
"PO-Revision-Date: 2024-10-12 23:51+0000\n"
"Last-Translator: a-j-wood <a-j-wood@users.noreply.translate.codeberg.org>\n"
"POT-Creation-Date: 2026-03-08 11:20+0000\n"
"PO-Revision-Date: 2025-10-05 20:09+0000\n"
"Last-Translator: Oğuz Ersen <ersen@noreply.codeberg.org>\n"
"Language-Team: Turkish <https://translate.codeberg.org/projects/pv/pv/tr/>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.7.2\n"
"X-Generator: Weblate 5.13.2\n"
#: src/main/help.c:236
msgid "show progress bar"
@@ -143,19 +143,19 @@ msgstr "görsel bilgiyi İSİM ile öne ekle"
#: src/main/help.c:311
msgid "STYLE"
msgstr ""
msgstr "BİÇİM"
#: src/main/help.c:312
msgid "set default bar style to NAME"
msgstr ""
msgstr "öntanımlı çubuk biçimini İSİM olarak ayarla"
#: src/main/help.c:314
msgid "SPEC"
msgstr ""
msgstr "BELİRT"
#: src/main/help.c:315
msgid "also send progress to SPEC"
msgstr ""
msgstr "ilerlemeyi BELİRT ögesine de gönder"
#: src/main/help.c:318
msgid "output transfer statistics at the end"
@@ -169,8 +169,8 @@ msgstr "standart hata bir terminal olmasa bile çıktı yazdır"
msgid "use cursor positioning escape sequences"
msgstr "imleç konumlandırma kaçış dizilerini kullan"
#: src/main/help.c:327 src/main/help.c:357 src/main/help.c:369
#: src/main/help.c:379
#: src/main/help.c:327 src/main/help.c:360 src/main/help.c:376
#: src/main/help.c:386
msgid "FILE"
msgstr "DOSYA"
@@ -219,136 +219,156 @@ msgid "use direct I/O to bypass cache"
msgstr "Önbelleği atlamak için doğrudan I/O kullan"
#: src/main/help.c:355
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:358
msgid "discard input instead of writing to output"
msgstr "Girdiyi çıktıya yazmak yerine yok say"
#: src/main/help.c:358
#: src/main/help.c:361
msgid "write all input to FILE before writing to output"
msgstr "çıktıya yazmadan önce tüm girdiyi DOSYA'ya yaz"
#: src/main/help.c:360
msgid "PID[:FD]"
msgstr "PID[:FD]"
#: src/main/help.c:364
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:361
#: src/main/help.c:365
msgid "watch file FD opened by process PID"
msgstr "FD izleme dosyası PID işlemi tarafından açıldı"
#: src/main/help.c:364
#: src/main/help.c:368 src/main/help.c:371
msgid "PID"
msgstr "PID"
#: src/main/help.c:365
#: src/main/help.c:369
msgid "update settings of process PID"
msgstr "süreç PID ayarlarını güncelle"
#: src/main/help.c:370
#: src/main/help.c:372
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:377
msgid "save process ID in FILE"
msgstr "FILE'da işlem kimliğini (ID) kaydet"
#: src/main/help.c:373
#: src/main/help.c:380
msgid "show this help and exit"
msgstr "bu yardımı göster ve çık"
#: src/main/help.c:376
#: src/main/help.c:383
msgid "show version information and exit"
msgstr "sürüm bilgilerini göster ve çık"
#: src/main/help.c:380
#: src/main/help.c:387
msgid "write debug logs to FILE"
msgstr "Hata ayıklama kayıtlarını DOSYA'ya yaz"
#: src/main/help.c:406
#: src/main/help.c:413
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Kullanım şekli: %s [AYAR] [DOSYA]..."
#: src/main/help.c:417
#: src/main/help.c:424
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"İzleme ile DOSYA(lar)ı veya standart girdiyi standart çıktı ile birleştirin."
#: src/main/help.c:555
#: src/main/help.c:562
msgid "Supported format sequences:"
msgstr ""
msgstr "Desteklenen biçim dizileri:"
#: src/main/help.c:569
#: src/main/help.c:576
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Lütfen hataları şu adrese bildirin: %s"
#: src/main/main.c:232
#: src/main/main.c:228
msgid "(input)"
msgstr "(giriş)"
#: src/main/main.c:328
#: src/main/main.c:330
msgid "state allocation failed"
msgstr "durum tahsisi başarısız oldu"
#: src/main/options.c:146 src/pv/file.c:324
msgid "failed to stat file"
msgstr "dosya statüsünde başarısız oldu"
#: src/main/options.c:160
msgid "is a directory"
msgstr "bir dizindir"
#: src/main/options.c:189
msgid "failed to generate sysfs filename"
msgstr "sysfs dosya adı oluşturulamadı"
#: src/main/options.c:211
msgid "failed to read sysfs size file"
msgstr "sysfs boyut dosyası okunamadı"
#: src/main/options.c:231
msgid "failed to open block device"
msgstr "blok aygıtı açılamadı"
#: src/main/options.c:241
msgid "failed to determine size of block device"
msgstr "blok aygıtının boyutu belirlenemedi"
#: src/main/options.c:347
msgid "option structure allocation failed"
msgstr "seçenek yapısı tahsisi başarısız oldu"
#: src/main/options.c:366
msgid "option structure argv allocation failed"
msgstr "seçenek yapısı argv tahsisi başarısız oldu"
#: src/main/options.c:419
msgid "numeric value not understood"
#: src/main/options.c:374
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:437
msgid "integer argument expected"
msgstr "tamsayı bağımsız değişkeni bekleniyor"
#: src/main/options.c:449
msgid "numeric argument expected"
msgstr "sayısal bağımsız değişken bekleniyor"
#: src/main/options.c:460
#: src/main/options.c:395 src/main/options.c:397 src/main/options.c:865
msgid "process ID or pid:fd pair expected"
msgstr "süreç kimliği (ID) veya pid:fd çifti bekleniyor"
#: src/main/options.c:467
#: src/main/options.c:407 src/main/options.c:409 src/main/options.c:872
msgid "invalid process ID"
msgstr "geçersiz süreç kimliği (ID)"
#: src/main/options.c:700
#: src/main/options.c:476 src/pv/file.c:342
msgid "failed to stat file"
msgstr "dosya statüsünde başarısız oldu"
#: src/main/options.c:519
msgid "is a directory"
msgstr "bir dizindir"
#: src/main/options.c:549
msgid "failed to generate sysfs filename"
msgstr "sysfs dosya adı oluşturulamadı"
#: src/main/options.c:571
msgid "failed to read sysfs size file"
msgstr "sysfs boyut dosyası okunamadı"
#: src/main/options.c:591
msgid "failed to open block device"
msgstr "blok aygıtı açılamadı"
#: src/main/options.c:601
msgid "failed to determine size of block device"
msgstr "blok aygıtının boyutu belirlenemedi"
#: src/main/options.c:710
msgid "option structure allocation failed"
msgstr "seçenek yapısı tahsisi başarısız oldu"
#: src/main/options.c:729
msgid "option structure argv allocation failed"
msgstr "seçenek yapısı argv tahsisi başarısız oldu"
#: src/main/options.c:781
msgid "numeric value not understood"
msgstr "sayısal değer anlaşılmadı"
#: src/main/options.c:801
msgid "integer argument expected"
msgstr "tamsayı bağımsız değişkeni bekleniyor"
#: src/main/options.c:813
msgid "numeric argument expected"
msgstr "sayısal bağımsız değişken bekleniyor"
#: src/main/options.c:825
msgid "missing filename"
msgstr ""
#: src/main/options.c:853
msgid "missing process name"
msgstr ""
#: src/main/options.c:1114
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Daha fazla bilgi için `%s --help' seçeneğini deneyin."
#: src/main/options.c:702
#: src/main/options.c:1116
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Daha fazla bilgi için `%s -h' seçeneğini deneyin."
#: src/main/options.c:733
#: src/main/options.c:1147
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -356,29 +376,33 @@ msgstr ""
"dosya tanımlayıcılarını izlerken satır modu veya aktarım değiştirici "
"seçeneklerini kullanamaz"
#: src/main/options.c:742
#: src/main/options.c:1156
msgid "cannot use cursor positioning when watching file descriptors"
msgstr "dosya tanımlayıcılarını izlerken imleç konumlandırmayı kullanamaz"
#: src/main/options.c:751
#: src/main/options.c:1165
msgid "cannot use remote control when watching file descriptors"
msgstr "dosya tanımlayıcılarını izlerken uzaktan kumandayı kullanamaz"
#: src/main/options.c:760
#: src/main/options.c:1174
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1183
msgid "cannot transfer files when watching file descriptors"
msgstr "dosya tanımlayıcıları izlenirken dosya aktarılamıyor"
#: src/main/options.c:775
#: src/main/options.c:1208
msgid "not available on systems without /proc/self/fdinfo"
msgstr "/proc/self/fdinfo olmayan sistemlerde kullanılamaz"
#: src/main/remote.c:309
msgid "message not received"
msgstr "mesaj alınamadı"
#: src/main/options.c:1220
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:440
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO bu sistemde desteklenmiyor"
#: src/main/options.c:1247
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -413,150 +437,168 @@ msgstr "kilit denemesi başarısız oldu"
msgid "failed to open terminal"
msgstr "terminal açılamadı"
#: src/pv/display.c:249
#: src/pv/display.c:285
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:267
#: src/pv/display.c:303
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnum KMGTPEZY"
#: src/pv/display.c:989 src/pv/transfer.c:1057
#: src/pv/display.c:1053 src/pv/state.c:842 src/pv/transfer.c:1135
msgid "buffer allocation failed"
msgstr "arabellek tahsisi başarısız oldu"
#: src/pv/file.c:149
#: src/pv/file.c:153
msgid "failed to seek to start of output"
msgstr "çıktının başlangıcına ulaşılamadı"
#: src/pv/file.c:294
#: src/pv/file.c:303
msgid "failed to close file"
msgstr "dosya kapatılamadı"
#: src/pv/file.c:317
#: src/pv/file.c:335
msgid "failed to read file"
msgstr "dosya okunamadı"
#: src/pv/file.c:332
#: src/pv/file.c:350
msgid "failed to stat output file"
msgstr "çıktı dosyası stat edilemedi"
#: src/pv/file.c:354
#: src/pv/file.c:372
msgid "input file is output file"
msgstr "girdi dosyası çıktı dosyasıdır"
#: src/pv/file.c:412
#: src/pv/file.c:429
msgid "(none)"
msgstr "(yok)"
#: src/pv/file.c:414
#: src/pv/file.c:431
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:93
#: src/pv/format/rate.c:37 src/pv/loop.c:562
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:121
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:97
#: src/pv/format/rate.c:41 src/pv/loop.c:562
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:121
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:37
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:41 src/pv/transfer.c:594
#: src/pv/format/bytes.c:39 src/pv/transfer.c:620
msgid "B"
msgstr "B"
#: src/pv/format/eta.c:53 src/pv/format/eta.c:57
#: src/pv/format/eta.c:52 src/pv/format/eta.c:56
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:81
#: src/pv/format/fineta.c:80
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:561
#: src/pv/loop.c:120
msgid "rate min/avg/max/mdev"
msgstr "oran min/ortalama/maks/standart sapma"
#: src/pv/loop.c:573
#: src/pv/loop.c:132
msgid "rate not measured"
msgstr "oran ölçülmedi"
#: src/pv/loop.c:783 src/pv/loop.c:834 src/pv/loop.c:887 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:300 src/pv/watchpid.c:308
#: src/pv/watchpid.c:385 src/pv/watchpid.c:406
#: src/pv/loop.c:802 src/pv/loop.c:818 src/pv/loop.c:836 src/pv/watchpid.c:101
#: src/pv/watchpid.c:110 src/pv/watchpid.c:121 src/pv/watchpid.c:129
#: src/pv/watchpid.c:166 src/pv/watchpid.c:185 src/pv/watchpid.c:193
#: src/pv/watchpid.c:203 src/pv/watchpid.c:307 src/pv/watchpid.c:315
#: src/pv/watchpid.c:447 src/pv/watchpid.c:470
msgid "pid"
msgstr "pid"
#: src/pv/state.c:40
msgid "history structure allocation failed"
msgstr "geçmiş yapısı tahsisi başarısız oldu"
#: src/pv/state.c:617 src/pv/state.c:628
msgid "file list allocation failed"
msgstr "dosya listesi tahsisi başarısız oldu"
#: src/pv/transfer.c:463
msgid "read failed"
msgstr "okuma başarısız"
#: src/pv/transfer.c:479
msgid "warning: read errors detected"
msgstr "uyarı: okuma hataları tespit edildi"
#: src/pv/transfer.c:495
msgid "file is not seekable"
msgstr "dosya aranabilir değil"
#: src/pv/transfer.c:573
msgid "failed to seek past error"
msgstr "geçmiş hatayı aramakta başarısız oldu"
#: src/pv/transfer.c:593
msgid "skipped past read error"
msgstr "geçmiş okuma hatası atlandı"
#: src/pv/transfer.c:634
msgid "no transfer buffer allocated"
msgstr "aktarım arabelleği ayrılmamış"
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr "aralık zamanlayıcısı ayarlanamadı"
#: src/pv/transfer.c:702
msgid "failed to clear interval timer"
msgstr "aralık zamanlayıcısı temizlenemedi"
#: src/pv/transfer.c:744
msgid "line position buffer allocation failed"
msgstr "satır konumu arabellek tahsisi başarısız oldu"
#: src/pv/transfer.c:918
msgid "write failed"
msgstr "yazma başarısız"
#: src/pv/transfer.c:1159
msgid "select call failed"
msgstr "seçme çağrısı başarısız oldu"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:836 src/pv/watchpid.c:110 src/pv/watchpid.c:122
#: src/pv/watchpid.c:131 src/pv/watchpid.c:185 src/pv/watchpid.c:194
#: src/pv/watchpid.c:205
msgid "fd"
msgstr "fd"
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:237 src/pv/remote.c:622
msgid "message not received"
msgstr "mesaj alınamadı"
#: src/pv/remote.c:644 src/pv/remote.c:662
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO bu sistemde desteklenmiyor"
#: src/pv/state.c:42
msgid "history structure allocation failed"
msgstr "geçmiş yapısı tahsisi başarısız oldu"
#: src/pv/state.c:794 src/pv/state.c:806
msgid "file list allocation failed"
msgstr "dosya listesi tahsisi başarısız oldu"
#: src/pv/transfer.c:490
msgid "read failed"
msgstr "okuma başarısız"
#: src/pv/transfer.c:506
msgid "warning: read errors detected"
msgstr "uyarı: okuma hataları tespit edildi"
#: src/pv/transfer.c:522
msgid "file is not seekable"
msgstr "dosya aranabilir değil"
#: src/pv/transfer.c:599
msgid "failed to seek past error"
msgstr "geçmiş hatayı aramakta başarısız oldu"
#: src/pv/transfer.c:619
msgid "skipped past read error"
msgstr "geçmiş okuma hatası atlandı"
#: src/pv/transfer.c:663
msgid "no transfer buffer allocated"
msgstr "aktarım arabelleği ayrılmamış"
#: src/pv/transfer.c:751
msgid "failed to set interval timer"
msgstr "aralık zamanlayıcısı ayarlanamadı"
#: src/pv/transfer.c:777
msgid "failed to clear interval timer"
msgstr "aralık zamanlayıcısı temizlenemedi"
#: src/pv/transfer.c:822
msgid "line position buffer allocation failed"
msgstr "satır konumu arabellek tahsisi başarısız oldu"
#: src/pv/transfer.c:996
msgid "write failed"
msgstr "yazma başarısız"
#: src/pv/transfer.c:1237
msgid "select call failed"
msgstr "seçme çağrısı başarısız oldu"
#: src/pv/watchpid.c:131 src/pv/watchpid.c:205
msgid "not a regular file or block device"
msgstr "normal bir dosya veya blok aygıtı değil"
#~ msgid "process list allocation failed"
#~ msgstr "işlem listesi tahsisi başarısız oldu"
#~ msgid "file descriptor list allocation failed"
#~ msgstr "dosya tanımlayıcı listesi tahsisi başarısız oldu"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
+2 -2
View File
@@ -3,7 +3,7 @@
* `configure' script. Include this after config.h and before anything
* else.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -44,7 +44,7 @@ typedef bool _Bool;
# define __bool_true_false_are_defined 1
#endif
/* Whether "--remote" should be available. */
/* Whether "--remote" and "--query" should be available. */
#undef PV_REMOTE_CONTROL
#if HAVE_DECL_SA_SIGINFO
# if SIGINFO_PROVIDES_PID
+63 -47
View File
@@ -10,10 +10,10 @@
language is requested. */
#undef ENABLE_NLS
/* Define to 1 if you have the `alarm' function. */
/* Define to 1 if you have the 'alarm' function. */
#undef HAVE_ALARM
/* Define to 1 if you have the `basename' function. */
/* Define to 1 if you have the 'basename' function. */
#undef HAVE_BASENAME
/* Define to 1 if you have the Mac OS X function
@@ -24,39 +24,42 @@
the CoreFoundation framework. */
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
/* Define to 1 if you have the `clock_gettime' function. */
/* Define to 1 if you have the 'clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the declaration of `SA_SIGINFO', and to 0 if you
/* Define to 1 if you have the declaration of 'SA_SIGINFO', and to 0 if you
don't. */
#undef HAVE_DECL_SA_SIGINFO
/* Define to 1 if you have the `dup2' function. */
/* Define to 1 if you have the 'dup2' function. */
#undef HAVE_DUP2
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fdatasync' function. */
/* Define to 1 if you have the 'fdatasync' function. */
#undef HAVE_FDATASYNC
/* Define to 1 if you have the `fmod' function. */
/* Define to 1 if you have the 'fmod' function. */
#undef HAVE_FMOD
/* Define to 1 if you have the `fpathconf' function. */
/* Define to 1 if you have the 'fpathconf' function. */
#undef HAVE_FPATHCONF
/* Define to 1 if you have the `getcwd' function. */
/* Define to 1 if you have the <ftw.h> header file. */
#undef HAVE_FTW_H
/* Define to 1 if you have the 'getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getopt_long' function. */
/* Define to 1 if you have the 'getopt_long' function. */
#undef HAVE_GETOPT_LONG
/* Define if the GNU gettext() function is already present or preinstalled. */
@@ -89,52 +92,55 @@
/* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H
/* Define to 1 if you have the `memcpy' function. */
/* Define to 1 if you have the 'memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the `memmove' function. */
/* Define to 1 if you have the 'memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the `memrchr' function. */
/* Define to 1 if you have the 'memrchr' function. */
#undef HAVE_MEMRCHR
/* Define to 1 if you have the `memset' function. */
/* Define to 1 if you have the 'memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the <minix/config.h> header file. */
#undef HAVE_MINIX_CONFIG_H
/* Define to 1 if you have the `mkdir' function. */
/* Define to 1 if you have the 'mkdir' function. */
#undef HAVE_MKDIR
/* Define to 1 if you have the `nanosleep' function. */
/* Define to 1 if you have the 'nanosleep' function. */
#undef HAVE_NANOSLEEP
/* Define to 1 if you have the `posix_fadvise' function. */
/* Define to 1 if you have the 'nftw' function. */
#undef HAVE_NFTW
/* Define to 1 if you have the 'posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE
/* Define to 1 if you have the `posix_memalign' function. */
/* Define to 1 if you have the 'posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN
/* Define to 1 if you have the `select' function. */
/* Define to 1 if you have the 'select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `setitimer' function. */
/* Define to 1 if you have the 'setitimer' function. */
#undef HAVE_SETITIMER
/* Define to 1 if you have the `setlocale' function. */
/* Define to 1 if you have the 'setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the `setproctitle' function. */
/* Define to 1 if you have the 'setproctitle' function. */
#undef HAVE_SETPROCTITLE
/* Define to 1 if you have the `shmget' function. */
/* Define to 1 if you have the 'shmget' function. */
#undef HAVE_SHMGET
/* Define to 1 if you have the `splice' function. */
/* Define to 1 if you have the 'splice' function. */
#undef HAVE_SPLICE
/* Define to 1 if you have the `sqrtl' function. */
/* Define to 1 if you have the 'sqrtl' function. */
#undef HAVE_SQRTL
/* Define to 1 if stdbool.h conforms to C99. */
@@ -149,10 +155,10 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strchr' function. */
/* Define to 1 if you have the 'strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the `strerror' function. */
/* Define to 1 if you have the 'strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
@@ -161,25 +167,25 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
/* Define to 1 if you have the 'strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strrchr' function. */
/* Define to 1 if you have the 'strrchr' function. */
#undef HAVE_STRRCHR
/* Define to 1 if you have the `strstr' function. */
/* Define to 1 if you have the 'strstr' function. */
#undef HAVE_STRSTR
/* Define to 1 if you have the `strtoul' function. */
/* Define to 1 if you have the 'strtoul' function. */
#undef HAVE_STRTOUL
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
/* Define to 1 if 'st_blksize' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
/* Define to 1 if `st_rdev' is a member of `struct stat'. */
/* Define to 1 if 'st_rdev' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
/* Define to 1 if you have the `sysconf' function. */
/* Define to 1 if you have the 'sysconf' function. */
#undef HAVE_SYSCONF
/* Define to 1 if you have the <sys/file.h> header file. */
@@ -218,7 +224,7 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vsnprintf' function. */
/* Define to 1 if you have the 'vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the <wchar.h> header file. */
@@ -227,7 +233,7 @@
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define to 1 if the system has the type `_Bool'. */
/* Define to 1 if the system has the type '_Bool'. */
#undef HAVE__BOOL
/* Name of package */
@@ -254,12 +260,12 @@
/* Signal handlers can determine the sending PID */
#undef SIGINFO_PROVIDES_PID
/* Define to 1 if all of the C90 standard headers exist (not just the ones
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
/* Enable extensions on AIX, Interix, z/OS. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
@@ -320,11 +326,15 @@
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by C23 Annex F. */
#ifndef __STDC_WANT_IEC_60559_EXT__
# undef __STDC_WANT_IEC_60559_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
@@ -353,35 +363,41 @@
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
/* Define to 1 on platforms where this makes off_t a 64-bit type. */
#undef _LARGE_FILES
/* Define to empty if `const' does not conform to ANSI C. */
/* Number of bits in time_t, on hosts where this is settable. */
#undef _TIME_BITS
/* Define to 1 on platforms where this makes time_t a 64-bit type. */
#undef __MINGW_USE_VC2005_COMPAT
/* Define to empty if 'const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
/* Define as 'int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef int32_t
/* Define to `int' if <sys/types.h> does not define. */
/* Define to 'int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `long int' if <sys/types.h> does not define. */
/* Define to 'long int' if <sys/types.h> does not define. */
#undef off_t
/* Define as a signed integer type capable of holding a process identifier. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* Define as 'unsigned int' if <stddef.h> doesn't define. */
#undef size_t
/* Define to `int' if <sys/types.h> does not define. */
/* Define as 'int' if <sys/types.h> doesn't define. */
#undef ssize_t
/* Define to `int' if <sys/types.h> doesn't define. */
/* Define as 'int' if <sys/types.h> doesn't define. */
#undef uid_t
#include "config-aux.h"
+20 -4
View File
@@ -1,7 +1,7 @@
/*
* Global program option structure and the parsing function prototype.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -23,6 +23,18 @@ extern "C" {
struct opts_s;
typedef struct opts_s *opts_t;
/*
* Overall program actions to select.
*/
typedef enum {
PV_ACTION_NOTHING, /* do nothing, and exit */
PV_ACTION_TRANSFER, /* transfer data */
PV_ACTION_STORE_AND_FORWARD, /* store to file, then output from it */
PV_ACTION_WATCHFD, /* watch process file descriptors */
PV_ACTION_REMOTE_CONTROL, /* remotely control another pv */
PV_ACTION_QUERY /* watch the state of another pv */
} pvaction_t;
/*
* Structure describing run-time options.
*
@@ -39,6 +51,8 @@ struct opts_s {
/*@keep@*/ /*@null@*/ char *pidfile; /* PID file, if any */
/*@keep@*/ /*@null@*/ char *store_and_forward_file; /* store and forward file, if any */
/*@keep@*/ /*@null@*/ char *extra_display; /* extra display specifier, if any */
/*@keep@*/ /*@null@*/ pid_t *watchfd_pid; /* array of processes to watch fds of */
/*@keep@*/ /*@null@*/ int *watchfd_fd; /* array of fds to watch in each one (0=all) */
/*@keep@*/ /*@null@*/ const char **argv; /* array of non-option arguments */
size_t lastwritten; /* show N bytes last written */
off_t rate_limit; /* rate limit, in bytes per second */
@@ -46,15 +60,16 @@ struct opts_s {
off_t size; /* total size of data */
off_t error_skip_block; /* skip block size, 0 for adaptive */
pid_t remote; /* PID of pv to update settings of */
pid_t query; /* PID of pv to query progress of */
unsigned int skip_errors; /* skip read errors counter */
pid_t watch_pid; /* process to watch fds of */
int watch_fd; /* fd to watch */
unsigned int average_rate_window; /* time window in seconds for average rate calculations */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
unsigned int argc; /* number of non-option arguments */
unsigned int argv_length; /* allocated array size */
bool do_nothing; /* exit-without-doing-anything flag */
unsigned int watchfd_count; /* number of watchfd items */
unsigned int watchfd_length; /* allocated array size */
pvaction_t action; /* the program action to perform */
bool progress; /* progress bar flag */
bool timer; /* timer flag */
bool eta; /* ETA flag */
@@ -77,6 +92,7 @@ struct opts_s {
bool stop_at_size; /* set if we stop at "size" bytes */
bool sync_after_write; /* set if we sync after every write */
bool direct_io; /* set if O_DIRECT is to be used */
bool sparse_output; /* set if we leave holes in the output */
bool discard_input; /* set to write nothing to output */
bool show_stats; /* set to write statistics at the end */
bool width_set_manually; /* width was set manually, not detected */
+156 -64
View File
@@ -1,7 +1,7 @@
/*
* Functions internal to the PV library. Include "config.h" first.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -25,7 +25,7 @@ extern "C" {
#define RATE_GRANULARITY 100000000 /* nsec between -L rate chunks */
#define RATE_BURST_WINDOW 5 /* rate burst window (multiples of rate) */
#define REMOTE_INTERVAL 100000000 /* nsec between checks for -R */
#define REMOTE_INTERVAL 100000000 /* nsec between checks for -R and -Q */
#define BUFFER_SIZE (size_t) 409600 /* default transfer buffer size */
#define BUFFER_SIZE_MAX (size_t) 524288 /* max auto transfer buffer size */
#define MAX_READ_AT_ONCE (size_t) 524288 /* max to read() in one go */
@@ -60,7 +60,7 @@ extern "C" {
/*
* Structure for data shared between multiple "pv -c" instances.
*/
struct pvcursorstate_s {
struct pvipccursorstate_s {
int y_topmost; /* terminal row of topmost "pv" instance */
bool tty_tostop_added; /* whether any instance had to set TOSTOP on the terminal */
};
@@ -131,6 +131,14 @@ typedef uint16_t pvdisplay_bytecount_t;
typedef uint16_t pvdisplay_width_t;
#define PVDISPLAY_WIDTH_MAX (65535) /* UINT16_MAX */
/*
* Structure defining the current state of a single watched file descriptor.
*/
struct pvwatchfd_s;
typedef /*@null@*/ struct pvwatchfd_s *pvwatchfd_t;
/* String pointer, that is the only pointer to this resource, that can be null. */
typedef /*@only@*/ /*@null@*/ char * nullable_string_t;
/*
* Structure for holding PV internal state. Opaque outside the PV library.
@@ -141,46 +149,74 @@ struct pvstate_s {
/******************
* Program status *
******************/
struct {
/*@only@*/ char *program_name; /* program name for error reporting */
struct pvprogramstatus_s {
char cwd[PV_SIZEOF_CWD]; /* current working directory for relative path */
int current_input_file; /* index of current file being read */
int exit_status; /* exit status to give (0=OK) */
bool terminal_supports_utf8; /* whether the terminal supports UTF-8 */
bool terminal_supports_colour; /* whether the terminal supports colour */
bool checked_colour_support; /* whether we have checked colour support yet */
} status;
/***************
* Input files *
***************/
struct {
/*@only@*/ /*@null@*/ char **filename; /* input filenames */
struct pvinputfiles_s {
/*@only@*/ /*@null@*/ nullable_string_t *filename; /* input filenames */
unsigned int file_count; /* number of input files */
} files;
/*********************************
* Items to watch with --watchfd *
*********************************/
struct {
/*@only@*/ /*@null@*/
struct pvwatcheditem_s { /* array of PID or PID:FD items */
pid_t pid; /* watched PID */
int fd; /* watched fd, or -1 for all */
pvwatchfd_t info_array; /* watch information for each fd */
int array_length; /* length of watch info array */
bool finished; /* "PID:FD": fd closed; or PID gone */
} *watching;
unsigned int count; /* number of items in these arrays */
bool multiple_pids; /* true if more than one distinct PID */
} watchfd;
/*******************
* Program control *
*******************/
struct {
struct pvcontrol_s {
char default_format[PV_SIZEOF_DEFAULT_FORMAT]; /* default format string */
double interval; /* interval between updates */
double delay_start; /* delay before first display */
/*@only@*/ /*@null@*/ char *name; /* display name */
/*@only@*/ /*@null@*/ char *format_string; /* output format string */
/*@only@*/ /*@null@*/ char *extra_format_string; /* extra format string */
/*@only@*/ /*@null@*/ char *extra_display_spec; /* full spec for extra displays */
/*@only@*/ /*@null@*/ char *extra_format_string; /* extra format string alone */
/*@null@*/ char *output_name; /* name of the output, for diagnostics */
/*@null@*/ char *default_bar_style; /* which bar style to use by default */
off_t error_skip_block; /* skip block size, 0 for adaptive */
off_t rate_limit; /* rate limit, in bytes per second */
size_t target_buffer_size; /* buffer size (0=default) */
off_t size; /* total size of data */
pid_t watch_pid; /* process to watch fds of */
unsigned int skip_errors; /* skip read errors counter */
int watch_fd; /* fd to watch */
int output_fd; /* fd to write output to */
unsigned int average_rate_window; /* time window in seconds for average rate calculations */
unsigned int history_interval; /* seconds between each average rate calc history entry */
pvdisplay_width_t width; /* screen width */
unsigned int height; /* screen height */
unsigned int extra_displays; /* bitmask of extra display destinations */
struct { /* old-style format options (used by -R) */
size_t lastwritten; /* --last-written (amount) */
bool progress; /* --progress */
bool timer; /* --timer */
bool eta; /* --eta */
bool fineta; /* --fineta */
bool rate; /* --rate */
bool average_rate; /* --average-rate */
bool bytes; /* --bytes */
bool bufpercent; /* --buffer-percent */
} format_option;
bool force; /* display even if not on terminal */
bool cursor; /* use cursor positioning */
bool numeric; /* numeric output only */
@@ -191,16 +227,14 @@ struct pvstate_s {
bool decimal_units; /* use decimal prefixes */
bool null_terminated_lines; /* lines are null-terminated */
bool no_display; /* do nothing other than pipe data */
bool no_splice; /* never use splice() */
bool stop_at_size; /* set if we stop at "size" bytes */
bool sync_after_write; /* set if we sync after every write */
bool direct_io; /* set if O_DIRECT is to be used */
bool direct_io_changed; /* set when direct_io is changed */
bool no_splice; /* never use splice() */
bool sparse_output; /* set if we leave holes in the output */
bool discard_input; /* write nothing to stdout */
bool show_stats; /* show statistics on exit */
bool can_display_utf8; /* whether UTF-8 output is permitted */
bool can_display_colour; /* whether the terminal supports colour */
bool checked_colour_support; /* whether we have checked colour support yet */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
} control;
@@ -208,7 +242,7 @@ struct pvstate_s {
/*******************
* Signal handling *
*******************/
struct {
struct pvsignal_s {
/* old signal handlers to restore in pv_sig_fini(). */
struct sigaction old_sigpipe;
struct sigaction old_sigttou;
@@ -220,20 +254,23 @@ struct pvstate_s {
struct sigaction old_sigterm;
#ifdef PV_REMOTE_CONTROL
struct sigaction old_sigusr2;
struct sigaction old_sigusr1;
#endif
struct sigaction old_sigalrm;
struct timespec tstp_time; /* see pv_sig_tstp() / __cont() */
struct timespec toffset; /* total time spent stopped */
struct timespec when_tstp_arrived; /* see pv_sig_tstp() / __cont() */
struct timespec total_stoppage_time; /* total time spent stopped */
#ifdef PV_REMOTE_CONTROL
volatile sig_atomic_t rxusr2; /* whether SIGUSR2 was received */
volatile pid_t sender; /* PID of sending process for SIGUSR2 */
volatile pid_t sender_usr2; /* PID of sending process for SIGUSR2 */
volatile sig_atomic_t rxusr1; /* whether SIGUSR1 was received */
volatile pid_t sender_usr1; /* PID of sending process for SIGUSR1 */
#endif
} signal;
/*******************
* Transient flags *
*******************/
struct {
struct pvtransientflags_s {
volatile sig_atomic_t reparse_display; /* whether to re-check format string */
volatile sig_atomic_t terminal_resized; /* whether we need to get term size again */
volatile sig_atomic_t trigger_exit; /* whether we need to abort right now */
@@ -241,7 +278,7 @@ struct pvstate_s {
volatile sig_atomic_t suspend_stderr; /* whether writing to stderr is suspended */
volatile sig_atomic_t skip_next_sigcont; /* whether to ignore the next SIGCONT */
volatile sig_atomic_t pipe_closed; /* whether the output pipe was closed */
} flag;
} flags;
/*****************
* Display state *
@@ -295,7 +332,7 @@ struct pvstate_s {
bool colour_permitted; /* whether colour is permitted for this display */
bool sgr_code_active; /* set while SGR code is active in a display line */
bool final_update; /* set internally on the final update */
bool display_visible; /* set once anything written to terminal */
bool output_produced; /* set once anything written to terminal */
} display;
@@ -305,7 +342,7 @@ struct pvstate_s {
/************************************
* Calculated state of the transfer *
************************************/
struct {
struct pvtransfercalc_s {
long double transfer_rate; /* calculated transfer rate */
long double average_rate; /* calculated average transfer rate */
@@ -337,10 +374,10 @@ struct pvstate_s {
/********************
* Cursor/IPC state *
********************/
struct {
struct pvcursorstate_s {
char lock_file[PV_SIZEOF_CRS_LOCK_FILE];
#ifdef HAVE_IPC
/*@keep@*/ /*@null@*/ struct pvcursorstate_s *shared; /* data shared between instances */
/*@keep@*/ /*@null@*/ struct pvipccursorstate_s *shared; /* data shared between instances */
int shmid; /* ID of our shared memory segment */
int pvcount; /* number of `pv' processes in total */
int pvmax; /* highest number of `pv's seen */
@@ -353,6 +390,7 @@ struct pvstate_s {
#ifdef HAVE_IPC
bool noipc; /* set if we can't use IPC */
#endif /* HAVE_IPC */
bool disable; /* set if cursor positioning can't be used */
} cursor;
/*******************
@@ -362,9 +400,9 @@ struct pvstate_s {
* The transfer buffer is used for moving data from the input files
* to the output when splice() is not available.
*
* If buffer_size is smaller than pv__target_bufsize, then
* If buffer_size is smaller than control.target_buffer_size, then
* pv_transfer() will try to reallocate transfer_buffer to make
* buffer_size equal to pv__target_bufsize.
* buffer_size equal to control.target_buffer_size.
*
* Data from the input files is read into the buffer; read_position
* is the offset in the buffer that we've read data up to.
@@ -373,7 +411,7 @@ struct pvstate_s {
* is the offset in the buffer that we've written data up to. It
* will always be less than or equal to read_position.
*/
struct {
struct pvtransferstate_s {
long double elapsed_seconds; /* how long we have been transferring data for */
/*@only@*/ /*@null@*/ char *transfer_buffer; /* data transfer buffer */
size_t buffer_size; /* size of buffer */
@@ -385,6 +423,7 @@ struct pvstate_s {
size_t written_but_not_consumed; /* bytes in the output pipe, unread */
off_t total_bytes_read; /* total bytes read */
off_t total_written; /* total bytes or lines written */
off_t transferred; /* amount transferred (written - unconsumed) */
@@ -426,19 +465,78 @@ struct pvstate_s {
bool splice_used;
#endif
bool read_error_warning_shown;
bool output_not_seekable; /* set if lseek() fails on output */
} transfer;
};
typedef struct pvprogramstatus_s *pvprogramstatus_t;
typedef struct pvinputfiles_s *pvinputfiles_t;
typedef struct pvcontrol_s *pvcontrol_t;
typedef struct pvsignal_s *pvsignal_t;
typedef struct pvtransientflags_s *pvtransientflags_t;
typedef struct pvdisplay_s *pvdisplay_t;
typedef struct pvdisplay_segment_s *pvdisplay_segment_t;
typedef struct pvtransfercalc_s *pvtransfercalc_t;
typedef struct pvcursorstate_s *pvcursorstate_t;
typedef struct pvtransferstate_s *pvtransferstate_t;
/*
* Structure defining the current state of a single watched file descriptor.
* The full definition needs to go here as it refers to sub-structures of
* the main state, defined above.
*/
struct pvwatchfd_s {
struct pvtransientflags_s flags; /* transient flags */
struct pvtransferstate_s transfer; /* transfer state */
struct pvtransfercalc_s calc; /* calculated transfer state */
struct pvdisplay_s display; /* display data */
#ifdef __APPLE__
#else
char file_fdinfo[PV_SIZEOF_FILE_FDINFO]; /* path to /proc fdinfo file */
char file_fd[PV_SIZEOF_FILE_FD]; /* path to /proc fd symlink */
#endif
char file_fdpath[PV_SIZEOF_FILE_FDPATH]; /* path to file that was opened */
/*@keep@ */ char display_name[PV_SIZEOF_DISPLAY_NAME]; /* name to show on progress bar */
struct stat sb_fd; /* stat of fd symlink */
struct stat sb_fd_link; /* lstat of fd symlink */
off_t size; /* size of whole file, 0 if unknown */
off_t position; /* position last seen at */
struct timespec start_time; /* time we started watching the fd */
struct timespec end_time; /* time the fd was marked as closed */
struct timespec total_stoppage_time; /* total time spent stopped */
pid_t watch_pid; /* PID the fd belongs to */
int watch_fd; /* fd to watch */
bool closed; /* true once the fd is closed */
bool displayable; /* false if not displayable */
bool unused; /* true if free for re-use */
};
/*
* Read-only counterparts to the above structure pointers, to be used in
* function declarations where the function definitely shouldn't be altering
* the contents of the structure.
*/
typedef const struct pvprogramstatus_s * readonly_pvprogramstatus_t;
typedef const struct pvinputfiles_s * readonly_pvinputfiles_t;
typedef const struct pvcontrol_s * readonly_pvcontrol_t;
typedef const struct pvsignal_s * readonly_pvsignal_t;
typedef const struct pvtransientflags_s * readonly_pvtransientflags_t;
typedef const struct pvdisplay_s * readonly_pvdisplay_t;
typedef const struct pvdisplay_segment_s * readonly_pvdisplay_segment_t;
typedef const struct pvtransfercalc_s * readonly_pvtransfercalc_t;
typedef const struct pvcursorstate_s * readonly_pvcursorstate_t;
typedef const struct pvtransferstate_s * readonly_pvtransferstate_t;
/*
* Structure containing the parameters used by formatters.
*/
struct pvformatter_args_s {
/*@dependent@*/ pvstate_t state; /* overall state */
/*@dependent@*/ pvdisplay_t display; /* the display being updated */
/*@dependent@*/ pvdisplay_segment_t segment; /* the segment of the display */
/*@dependent@*/ readonly_pvprogramstatus_t status; /* program status */
/*@dependent@*/ readonly_pvcontrol_t control; /* control settings */
/*@dependent@*/ readonly_pvtransferstate_t transfer; /* transfer state */
/*@dependent@*/ readonly_pvtransfercalc_t calc; /* calculated transfer state */
/*@dependent@*/ char *buffer; /* buffer to write formatted segments into */
pvdisplay_bytecount_t buffer_size; /* size of the buffer */
pvdisplay_bytecount_t offset; /* current write position in the buffer */
@@ -459,30 +557,10 @@ struct pvdisplay_component_s {
bool dynamic; /* whether it can scale with screen size */
};
struct pvwatchfd_s {
#ifdef __APPLE__
#else
char file_fdinfo[PV_SIZEOF_FILE_FDINFO]; /* path to /proc fdinfo file */
char file_fd[PV_SIZEOF_FILE_FD]; /* path to /proc fd symlink */
#endif
char file_fdpath[PV_SIZEOF_FILE_FDPATH]; /* path to file that was opened */
char display_name[PV_SIZEOF_DISPLAY_NAME]; /* name to show on progress bar */
struct stat sb_fd; /* stat of fd symlink */
struct stat sb_fd_link; /* lstat of fd symlink */
off_t size; /* size of whole file, 0 if unknown */
off_t position; /* position last seen at */
struct timespec start_time; /* time we started watching the fd */
/*@null@*/ pvstate_t state; /* state object for flags and display */
pid_t watch_pid; /* PID to watch */
int watch_fd; /* fd to watch, -1 = not displayed */
};
typedef struct pvwatchfd_s *pvwatchfd_t;
void pv_error(pvstate_t, char *, ...);
void pv_error(char *, ...);
int pv_main_loop(pvstate_t);
void pv_calculate_transfer_rate(pvstate_t, bool);
void pv_calculate_transfer_rate(pvtransfercalc_t, readonly_pvtransferstate_t, readonly_pvcontrol_t, readonly_pvdisplay_t, bool);
long pv_bound_long(long, long, long);
long pv_seconds_remaining(const off_t, const off_t, const long double);
@@ -534,35 +612,49 @@ pvdisplay_bytecount_t pv_formatter_previous_line(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_name(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_sgr(pvformatter_args_t);
bool pv_format(pvstate_t, /*@null@*/ const char *, pvdisplay_t, bool, bool);
void pv_display(pvstate_t, bool);
bool pv_format (pvprogramstatus_t, readonly_pvcontrol_t,
readonly_pvtransferstate_t, readonly_pvtransfercalc_t,
/*@null@ */ const char *, pvdisplay_t, bool, bool);
void pv_display (pvprogramstatus_t, readonly_pvcontrol_t, pvtransientflags_t,
readonly_pvtransferstate_t, pvtransfercalc_t,
pvcursorstate_t, pvdisplay_t, /*@null@ */ pvdisplay_t, bool);
ssize_t pv_transfer(pvstate_t, int, bool *, bool *, off_t, long *);
int pv_next_file(pvstate_t, unsigned int, int);
/*@keep@*/ const char *pv_current_file_name(pvstate_t);
void pv_write_retry(int, const char *, size_t);
void pv_tty_write(pvstate_t, const char *, size_t);
unsigned int pv_update_calc_average_rate_window(pvtransfercalc_t, unsigned int);
void pv_reset_calc(pvtransfercalc_t);
void pv_reset_transfer(pvtransferstate_t);
void pv_reset_flags(pvtransientflags_t);
void pv_reset_display(pvdisplay_t);
void pv_reset_watchfd(pvwatchfd_t);
void pv_freecontents_display(pvdisplay_t);
void pv_freecontents_transfer(pvtransferstate_t);
void pv_freecontents_calc(pvtransfercalc_t);
void pv_freecontents_watchfd(pvwatchfd_t);
void pv_freecontents_watchfd_items(struct pvwatcheditem_s *, unsigned int);
void pv_crs_fini(pvstate_t);
void pv_crs_init(pvstate_t);
void pv_crs_update(pvstate_t, const char *);
void pv_write_retry(int, const char *, size_t);
void pv_tty_write(readonly_pvtransientflags_t, const char *, size_t);
void pv_crs_fini(pvcursorstate_t, readonly_pvcontrol_t, pvtransientflags_t);
void pv_crs_init(pvcursorstate_t, readonly_pvcontrol_t, pvtransientflags_t);
void pv_crs_update(pvcursorstate_t, readonly_pvcontrol_t, pvtransientflags_t, const char *);
#ifdef HAVE_IPC
void pv_crs_needreinit(pvstate_t);
void pv_crs_needreinit(pvcursorstate_t);
#endif
void pv_sig_allowpause(void);
void pv_sig_checkbg(void);
void pv_sig_nopause(void);
void pv_remote_init(pvstate_t);
void pv_remote_check(pvstate_t);
void pv_remote_fini(pvstate_t);
int pv_remote_set(pvstate_t);
bool pv_remote_check(pvstate_t);
int pv_watchfd_info(pvstate_t, pvwatchfd_t, bool);
bool pv_watchfd_changed(pvwatchfd_t);
off_t pv_watchfd_position(pvwatchfd_t);
int pv_watchpid_scanfds(pvstate_t, pid_t, int *, pvwatchfd_t *, int *);
int pv_watchpid_scanfds(pvstate_t, pid_t, int, int *, pvwatchfd_t *);
void pv_watchpid_setname(pvstate_t, pvwatchfd_t);
#ifdef __cplusplus
+40 -8
View File
@@ -1,7 +1,7 @@
/*
* Functions used across the program.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -13,6 +13,7 @@
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <signal.h>
@@ -175,10 +176,15 @@ void pv_nanosleep(long long);
* Main PV functions.
*/
/*
* Set the prefix (program name) for any PV error messages.
*/
extern void pv_set_error_prefix(/*@unique@ */ const char *);
/*
* Create a new state structure, and return it, or 0 (NULL) on error.
*/
extern /*@null@*/ /*@only@*/ pvstate_t pv_state_alloc(const char *);
extern /*@null@*/ /*@only@*/ pvstate_t pv_state_alloc(void);
/*
* Clear the calculated parts of a state structure.
@@ -216,6 +222,7 @@ extern void pv_state_error_skip_block_set(pvstate_t, off_t);
extern void pv_state_stop_at_size_set(pvstate_t, bool);
extern void pv_state_sync_after_write_set(pvstate_t, bool);
extern void pv_state_direct_io_set(pvstate_t, bool);
extern void pv_state_sparse_output_set(pvstate_t, bool);
extern void pv_state_rate_limit_set(pvstate_t, off_t);
extern void pv_state_target_buffer_size_set(pvstate_t, size_t);
extern void pv_state_no_splice_set(pvstate_t, bool);
@@ -228,13 +235,12 @@ extern void pv_state_name_set(pvstate_t, /*@null@*/ const char *);
extern void pv_state_default_bar_style_set(pvstate_t, /*@null@ */ const char *);
extern void pv_state_format_string_set(pvstate_t, /*@null@*/ const char *);
extern void pv_state_extra_display_set(pvstate_t, /*@null@*/ const char *);
extern void pv_state_watch_pid_set(pvstate_t, pid_t);
extern void pv_state_watch_fd_set(pvstate_t, int);
extern void pv_state_output_set(pvstate_t, int, const char *);
extern void pv_state_average_rate_window_set(pvstate_t, unsigned int);
extern void pv_state_set_can_display_utf8(pvstate_t, bool);
extern void pv_state_set_terminal_supports_utf8(pvstate_t, bool);
extern void pv_state_inputfiles(pvstate_t, unsigned int, const char **);
extern void pv_state_watchfds(pvstate_t, unsigned int, const pid_t *, const int *);
/*
* Work out whether we are in the foreground.
@@ -261,22 +267,48 @@ extern void pv_sig_init(pvstate_t);
* Return true if SIGUSR2 has been received, and indicate the sender.
*/
extern bool pv_sigusr2_received(pvstate_t, pid_t *);
/*
* Return true if SIGUSR1 has been received, and indicate the sender.
*/
extern bool pv_sigusr1_received(pvstate_t, pid_t *);
#endif
/*
* Return a stream pointer for a control file associated with a particular
* process ID and signal.
*/
/*@null@ */
/*@dependent@ */
extern FILE *pv_open_controlfile(char *, size_t, pid_t, int, bool);
/*
* Enter the main transfer loop, transferring all input files to the output.
*/
extern int pv_main_loop(pvstate_t);
/*
* Watch the selected file descriptor of the selected process.
* Watch the selected file descriptors of the selected processes.
*/
extern int pv_watchfd_loop(pvstate_t);
/*
* Watch the selected process.
* Watch the progress of another pv process.
*/
extern int pv_watchpid_loop(pvstate_t);
extern int pv_query_loop(pvstate_t, pid_t);
/*
* Set the options of another pv process.
*/
int pv_remote_set(pvstate_t, pid_t);
/*
* Query another pv process for its elapsed transfer time, amount
* transferred, and total size, and update the local state with those
* values. Optionally also return the total size separately. Reports
* errors unless "silent" is true.
*/
int pv_remote_transferstate_fetch(pvstate_t state, pid_t query, /*@null@ */ off_t *sizeptr, bool silent);
/*
* Shut down signal handlers after running the main loop.
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* Output debugging information.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
+9 -2
View File
@@ -1,7 +1,7 @@
/*
* Output command-line help to stdout.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -351,19 +351,26 @@ void display_help(void)
{ "-K", "--direct-io", NULL,
N_("use direct I/O to bypass cache"),
{ 0, 0, 0, 0} },
{ "-O", "--sparse", NULL,
N_("try to seek instead of writing null bytes"),
{ 0, 0, 0, 0} },
{ "-X", "--discard", NULL,
N_("discard input instead of writing to output"),
{ 0, 0, 0, 0} },
{ "-U", "--store-and-forward", N_("FILE"),
N_("write all input to FILE before writing to output"),
{ 0, 0, 0, 0} },
{ "-d", "--watchfd", N_("PID[:FD]"),
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-d", "--watchfd", N_("PID[:FD]|=NAME|@LISTFILE"),
N_("watch file FD opened by process PID"),
{ 0, 0, 0, 0} },
#ifdef PV_REMOTE_CONTROL
{ "-R", "--remote", N_("PID"),
N_("update settings of process PID"),
{ 0, 0, 0, 0} },
{ "-Q", "--query", N_("PID"),
N_("show progress of process PID"),
{ 0, 0, 0, 0} },
#endif /* PV_REMOTE_CONTROL */
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-P", "--pidfile", N_("FILE"),
+69 -45
View File
@@ -2,7 +2,7 @@
* Main program entry point - read the command line options, then perform
* the appropriate actions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -23,10 +23,6 @@
#include <langinfo.h>
#endif
int pv_remote_set(opts_t, pvstate_t);
void pv_remote_init(void);
void pv_remote_fini(void);
/*
* Write a PID file, returning nonzero on error. Write it atomically, such
* that the file either exists and contains the PID, or is not updated at
@@ -281,7 +277,7 @@ int main(int argc, char **argv)
/*@only@ */ pvstate_t state = NULL;
int retcode = 0;
bool can_have_eta = true;
bool can_display_utf8 = false;
bool terminal_supports_utf8 = false;
#if ! HAVE_SETPROCTITLE
initproctitle(argc, argv);
@@ -295,7 +291,7 @@ int main(int argc, char **argv)
#ifdef HAVE_LANGINFO_H
/*@-mustfreefresh@ *//* splint thinks nl_langinfo() leaks memory */
if (0 == strcmp(nl_langinfo(CODESET), "UTF-8"))
can_display_utf8 = true;
terminal_supports_utf8 = true;
/*@+mustfreefresh@ */
#endif
#endif
@@ -308,16 +304,22 @@ int main(int argc, char **argv)
}
/* Early exit if necessary, such as with "-h". */
if (opts->do_nothing) {
if (PV_ACTION_NOTHING == opts->action) {
debug("%s", "nothing to do - exiting with status 0");
opts_free(opts);
return 0;
}
/* Set the error message prefix. */
/*@-keeptrans@ */
pv_set_error_prefix(opts->program_name);
/* splint - this function doesn't add an alias or release it. */
/*@+keeptrans@ */
/*
* Allocate our internal state buffer.
*/
state = pv_state_alloc(opts->program_name);
state = pv_state_alloc();
if (NULL == state) {
/*@-mustfreefresh@ */
/*
@@ -332,23 +334,6 @@ int main(int argc, char **argv)
/*@+mustfreefresh@ */
}
/*
* -R specified - send the message, then exit.
*/
if (opts->remote > 0) {
/* Initialise signal handling. */
pv_sig_init(state);
/* Send the message. */
retcode = pv_remote_set(opts, state);
/* Close down the signal handling. */
pv_sig_fini(state);
/* Free resources. */
pv_state_free(state);
opts_free(opts);
/* Early exit. */
return retcode;
}
/*
* Write a PID file if -P was specified.
*/
@@ -381,6 +366,13 @@ int main(int argc, char **argv)
pv_state_inputfiles(state, opts->argc, (const char **) (opts->argv));
}
/*
* Put the list of watchfd items into the PV internal state.
*/
if ((opts->watchfd_count > 0) && (NULL != opts->watchfd_pid) && (NULL != opts->watchfd_fd)) {
pv_state_watchfds(state, opts->watchfd_count, opts->watchfd_pid, opts->watchfd_fd);
}
/*
* If stderr is not a terminal and we're neither forcing output nor
* outputting numerically, we will have nothing to display at all.
@@ -435,7 +427,12 @@ int main(int argc, char **argv)
* do this before looking at setting the size, as the size
* calculation looks at the output file if the input size can't be
* calculated (issue #91).
*
* We have to set the sparse output flag before doing this, so that
* in sparse mode the lseek() on O_APPEND can be done (issue #45);
* see the comments in pv_state_output_set() in src/pv/state.c.
*/
pv_state_sparse_output_set(state, opts->sparse_output);
retcode = pv__set_output(state, opts, opts->output);
if (0 != retcode) {
pv_state_free(state);
@@ -452,7 +449,7 @@ int main(int argc, char **argv)
pv_state_stop_at_size_set(state, opts->stop_at_size);
/* Total size calculation, in normal transfer mode. */
if (0 == opts->watch_pid) {
if (PV_ACTION_TRANSFER == opts->action) {
/*
* If no size was given, try to calculate the total size.
*/
@@ -472,6 +469,31 @@ int main(int argc, char **argv)
}
}
/* Initialise the signal handling. */
pv_sig_init(state);
/*
* Get the total size, in query mode.
*
* Note that this uses signals, so signal handling has to have been
* set up first.
*/
if (PV_ACTION_QUERY == opts->action) {
opts->size = 0;
retcode = pv_remote_transferstate_fetch(state, opts->query, &(opts->size), false);
if (0 != retcode) {
pv_sig_fini(state);
pv_state_free(state);
opts_free(opts);
return retcode;
}
/* As above - no ETA if the size is unknown. */
if (opts->size < 1) {
can_have_eta = false;
debug("%s", "size unknown - ETA disabled");
}
}
/*
* Copy the remaining parameters from the options into the main
* state.
@@ -505,37 +527,39 @@ int main(int argc, char **argv)
pv_state_default_bar_style_set(state, opts->default_bar_style);
pv_state_format_string_set(state, opts->format);
pv_state_extra_display_set(state, opts->extra_display);
pv_state_watch_pid_set(state, opts->watch_pid);
pv_state_watch_fd_set(state, opts->watch_fd);
pv_state_average_rate_window_set(state, opts->average_rate_window);
pv_state_set_format(state, opts->progress, opts->timer, can_have_eta ? opts->eta : false,
can_have_eta ? opts->fineta : false, opts->rate, opts->average_rate,
opts->bytes, opts->bufpercent, opts->lastwritten, opts->name);
debug("%s: %s", "can_display_utf8", can_display_utf8 ? "true" : "false");
pv_state_set_can_display_utf8(state, can_display_utf8);
/* Initialise the signal handling. */
pv_sig_init(state);
debug("%s: %s", "terminal_supports_utf8", terminal_supports_utf8 ? "true" : "false");
pv_state_set_terminal_supports_utf8(state, terminal_supports_utf8);
/* Run the appropriate main loop. */
if (0 == opts->watch_pid && NULL == opts->store_and_forward_file) {
switch (opts->action) {
case PV_ACTION_NOTHING:
break;
case PV_ACTION_TRANSFER:
/* Normal "transfer data" mode. */
pv_remote_init();
retcode = pv_main_loop(state);
pv_remote_fini();
} else if (0 == opts->watch_pid && NULL != opts->store_and_forward_file) {
break;
case PV_ACTION_STORE_AND_FORWARD:
/* Store-and-forward transfer mode. */
pv_remote_init();
retcode = pv__store_and_forward(state, opts, can_have_eta);
pv_remote_fini();
} else if (0 != opts->watch_pid && -1 == opts->watch_fd) {
/* "Watch all file descriptors of another process" mode. */
retcode = pv_watchpid_loop(state);
} else if (0 != opts->watch_pid && -1 != opts->watch_fd) {
/* "Watch a specific file descriptor of another process" mode. */
break;
case PV_ACTION_WATCHFD:
/* "Watch file descriptor(s) of another process" mode. */
retcode = pv_watchfd_loop(state);
break;
case PV_ACTION_REMOTE_CONTROL:
/* Change the options of another running pv. */
retcode = pv_remote_set(state, opts->remote);
break;
case PV_ACTION_QUERY:
/* Query the progress of another running pv. */
retcode = pv_query_loop(state, opts->query);
break;
}
/* Clear up the PID file, if one was written. */
+477 -22
View File
@@ -1,7 +1,7 @@
/*
* Parse command-line options.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -26,14 +26,27 @@
#endif
#endif
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
#include <sys/wait.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#ifdef HAVE_FTW_H
#include <ftw.h>
#endif
void display_help(void);
void display_version(void);
static bool opts_watchfd_parse(opts_t, const char *, /*@null@ */ const char *, unsigned int);
/*
* splint note about mustfreefresh: the gettext calls made by _() cause
* memory leak warnings, but in these cases it's unavoidable, and mitigated
* by the fact we only translate each string once.
*/
/*
@@ -63,6 +76,10 @@ void opts_free( /*@only@ */ opts_t opts)
free(opts->store_and_forward_file);
if (NULL != opts->extra_display)
free(opts->extra_display);
if (NULL != opts->watchfd_pid)
free(opts->watchfd_pid);
if (NULL != opts->watchfd_fd)
free(opts->watchfd_fd);
if (NULL != opts->argv)
free(opts->argv);
/*@+keeptrans@ */
@@ -104,6 +121,321 @@ bool opts_add_file(opts_t opts, const char *filename)
return true;
}
/*
* Add a process ID and file descriptor to the list of items to watch with
* --watchfd, returning false on error.
*/
static bool opts_watchfd_add_item(opts_t opts, pid_t pid, int fd)
{
/*@-branchstate@ */
if ((opts->watchfd_count >= opts->watchfd_length) || (NULL == opts->watchfd_pid)) {
opts->watchfd_length = opts->watchfd_count + 10;
/*@-keeptrans@ */
opts->watchfd_pid = realloc(opts->watchfd_pid, opts->watchfd_length * sizeof(pid_t));
opts->watchfd_fd = realloc(opts->watchfd_fd, opts->watchfd_length * sizeof(int));
/*@+keeptrans@ */
if ((NULL == opts->watchfd_pid) || (NULL == opts->watchfd_fd)) {
fprintf(stderr, "%s: %s\n", opts->program_name, strerror(errno));
opts->watchfd_length = 0;
opts->watchfd_count = 0;
return false;
}
}
/*@+branchstate@ */
/*
* splint notes: we turned off "branchstate" and "keeptrans" above
* because of the same reason as in opts_add_file().
*/
opts->watchfd_pid[opts->watchfd_count] = pid;
opts->watchfd_fd[opts->watchfd_count] = fd;
opts->watchfd_count++;
return true;
}
/*
* Look for processes with the given name, and add all of them to the list
* of watched PIDs. Returns false on error.
*/
static bool opts_watchfd_processname(opts_t opts, const char *process_name)
{
int fds[2];
pid_t pid;
FILE *fptr;
char buffer[1024]; /* flawfinder: ignore */
pid_t waited_pid;
int pid_status;
bool ok;
/*
* flawfinder: buffer is zeroed before each use, and fgets() is
* passed one less than its size so the string functions in the loop
* always find a null byte at the end.
*/
/* Pipe for communicating with pgrep. */
if (pipe(fds) < 0) {
fprintf(stderr, "%s: %s\n", opts->program_name, strerror(errno));
return false;
}
/* Subprocess in which to run pgrep. */
pid = (pid_t) fork();
if (pid < 0) {
fprintf(stderr, "%s: %s\n", opts->program_name, strerror(errno));
(void) close(fds[0]);
(void) close(fds[1]);
return false;
} else if (0 == pid) {
int nullfd;
/* Child process - close stdin, set up stdout, run pgrep. */
/* Replace stdin with /dev/null. */
nullfd = open("/dev/null", O_RDONLY); /* flawfinder: ignore */
/* flawfinder: /dev/null is trusted. */
if (nullfd < 0) {
fprintf(stderr, "%s: %s: %s\n", opts->program_name, "/dev/null", strerror(errno));
exit(EXIT_FAILURE);
}
if (dup2(nullfd, STDIN_FILENO) < 0) {
perror("dup2");
exit(EXIT_FAILURE);
}
(void) close(nullfd);
/* Replace stdout with the write end of the pipe. */
if (dup2(fds[1], STDOUT_FILENO) < 0) {
perror("dup2");
exit(EXIT_FAILURE);
}
(void) close(fds[1]);
/* Close the read end of the pipe. */
(void) close(fds[0]);
/* Run pgrep. */
if (execlp("pgrep", "pgrep", process_name, NULL) < 0) { /* flawfinder: ignore */
perror("pgrep");
}
/*
* flawfinder: deliberately calling pgrep as there isn't a
* portable library to use instead.
*/
exit(EXIT_FAILURE);
}
/* Close the write end of the pipe. */
(void) close(fds[1]);
/* Open a file stream on the read end of the pipe. */
fptr = fdopen(fds[0], "r");
if (NULL == fptr) {
perror("fdopen");
(void) close(fds[0]);
return false;
}
/* Read the lines of output from the child process. */
ok = true;
memset(buffer, 0, sizeof(buffer));
while ((0 == feof(fptr)) && (NULL != fgets(buffer, (int) (sizeof(buffer) - 1), fptr))) {
unsigned int watch_pid;
/* Skip all lines if we've hit any errors. */
if (!ok) {
memset(buffer, 0, sizeof(buffer));
continue;
}
/* Skip lines without valid PID. */
watch_pid = 0;
if (sscanf(buffer, "%u", &watch_pid) < 1)
continue;
if (watch_pid < 1)
continue;
if (!opts_watchfd_parse(opts, buffer, NULL, 0))
ok = false;
memset(buffer, 0, sizeof(buffer));
}
/* Close the stream from the read end of the pipe. */
(void) fclose(fptr);
/* Wait for the child process to exit. */
do {
/*@-type@ */
/* splint disagreement about __pid_t vs pid_t. */
pid_status = 0;
waited_pid = waitpid(pid, &pid_status, 0);
/*@+type@ */
} while (-1 == waited_pid && errno == EINTR);
return ok;
}
/*
* Read additional "-d" values from the given file, returning false on
* failure.
*/
static bool opts_watchfd_listfile(opts_t opts, const char *filename)
{
FILE *fptr;
char buffer[1024]; /* flawfinder: ignore */
unsigned int linenumber;
/*
* flawfinder: buffer is zeroed before each use, and fgets() is
* passed one less than its size so the string functions in the loop
* always find a null byte at the end.
*/
fptr = fopen(filename, "r"); /* flawfinder: ignore */
/*
* flawfinder note: caller directly controls filename, and we're
* opening the file read-only.
*/
if (NULL == fptr) {
fprintf(stderr, "%s: -d @: %s: %s\n", opts->program_name, filename, strerror(errno));
return false;
}
linenumber = 0;
memset(buffer, 0, sizeof(buffer));
while ((0 == feof(fptr)) && (NULL != fgets(buffer, (int) (sizeof(buffer) - 1), fptr))) {
char *argument;
char *nlptr;
linenumber++;
/* Remove trailing carriage returns or newlines. */
nlptr = strchr(buffer, '\r');
if (NULL != nlptr)
nlptr[0] = '\0';
nlptr = strchr(buffer, '\n');
if (NULL != nlptr)
nlptr[0] = '\0';
/* Ignore leading spaces. */
argument = buffer;
while (argument[0] != '\0' && (argument[0] == ' ' || argument[0] == '\t'))
argument++;
/* Ignore blank lines or comment lines. */
if ((argument[0] == '\0') || (argument[0] == '#')) {
memset(buffer, 0, sizeof(buffer));
continue;
}
/* Reject "@" lines. */
if (argument[0] == '@') {
(void) fclose(fptr);
return false;
}
if (!opts_watchfd_parse(opts, argument, filename, linenumber)) {
(void) fclose(fptr);
return false;
}
memset(buffer, 0, sizeof(buffer));
}
(void) fclose(fptr);
return true;
}
/*
* Parse a "-d" option value and make the appropriate additions to the list
* of watchfd items, returning false on failure.
*/
static bool opts_watchfd_parse(opts_t opts, const char *argument, /*@null@ */ const char *filename, unsigned int line)
{
unsigned int parse_pid;
int parse_fd;
if ('@' == argument[0]) {
/* "-d @FILE" syntax - read more values from FILE. */
/* Don't allow this syntax in a list file. */
if (NULL != filename) {
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: -d @: %s:%u: %s\n",
opts->program_name, filename, line, _("list files may not contain @ lines"));
return false;
/*@+mustfreefresh@ */
}
return opts_watchfd_listfile(opts, argument + 1);
} else if ('=' == argument[0]) {
/* "-d =NAME" syntax - find processes named NAME. */
return opts_watchfd_processname(opts, argument + 1);
}
/* "-d PID[:FD]" syntax. */
parse_pid = 0;
parse_fd = -1;
if (sscanf(argument, "%u:%d", &parse_pid, &parse_fd) < 1) {
/*@-mustfreefresh@ *//* see above */
if (NULL != filename) {
fprintf(stderr, "%s: -d: %s:%u: %s\n",
opts->program_name, filename, line, _("process ID or pid:fd pair expected"));
} else {
fprintf(stderr, "%s: -d: %s\n", opts->program_name, _("process ID or pid:fd pair expected"));
}
return false;
/*@+mustfreefresh@ */
}
if (parse_pid < 1) {
/*@-mustfreefresh@ *//* see above */
if (NULL != filename) {
fprintf(stderr, "%s: -d: %s:%u: %u: %s\n",
opts->program_name, filename, line, parse_pid, _("invalid process ID"));
} else {
fprintf(stderr, "%s: -d: %u: %s\n", opts->program_name, parse_pid, _("invalid process ID"));
}
return false;
/*@+mustfreefresh@ */
}
return opts_watchfd_add_item(opts, (pid_t) parse_pid, parse_fd);
}
#ifdef HAVE_NFTW
/*
* Callback function for nftw() to add the size of the given file to the
* total size so far.
*/
static off_t dir_tree_file_size_so_far = 0;
static int dir_tree_total_file_size( /*@unused@ */ __attribute__((unused))
const char *fpath, const struct stat *sb, int typeflag, /*@unused@ */
__attribute__((unused))
struct FTW *ftwbuf)
{
if (typeflag != FTW_F)
return 0;
if (NULL == sb)
return 0;
dir_tree_file_size_so_far += (off_t) (sb->st_size);
return 0;
}
#endif /* HAVE_NFTW */
/*
* Set opts->size from the size of the file whose name is size_file,
@@ -111,6 +443,9 @@ bool opts_add_file(opts_t opts, const char *filename)
*
* If size_file points to a block device, the size of the block device is
* used.
*
* If size_file points to a directory, opts->size is set to the sum of the
* sizes of all regular files under that directory, if nftw() is available.
*/
static bool opts_use_size_of_file(opts_t opts, const char *size_file)
{
@@ -136,12 +471,7 @@ static bool opts_use_size_of_file(opts_t opts, const char *size_file)
stat_rc = stat(size_file, &sb);
if (0 != stat_rc) {
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory
* leak warnings, but in this case it's unavoidable, and
* mitigated by the fact we only translate each string once.
*/
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: %s: %s: %s\n",
opts->program_name, size_file, _("failed to stat file"), strerror(errno));
return false;
@@ -154,6 +484,35 @@ static bool opts_use_size_of_file(opts_t opts, const char *size_file)
return true;
}
#ifdef HAVE_NFTW
/* This was a directory - use the size of all files under it. */
if (S_ISDIR((mode_t) (sb.st_mode))) {
int maxfds, rc_nftw;
maxfds = -1;
#ifdef _POSIX_OPEN_MAX
maxfds = _POSIX_OPEN_MAX;
#endif
if (maxfds < 1) {
maxfds = (int) sysconf(_SC_OPEN_MAX);
}
dir_tree_file_size_so_far = 0;
rc_nftw = nftw(size_file, dir_tree_total_file_size, maxfds, 0
#ifdef FTW_PHYS
| FTW_PHYS
#endif
);
if (rc_nftw < 0) {
fprintf(stderr, "%s: %s: %s\n", opts->program_name, size_file, strerror(errno));
return false;
}
opts->size = dir_tree_file_size_so_far;
return true;
}
#else /* HAVE_NFTW */
/* This was a directory - report an error. */
if (S_ISDIR((mode_t) (sb.st_mode))) {
/*@-mustfreefresh@ *//* see above */
@@ -161,6 +520,7 @@ static bool opts_use_size_of_file(opts_t opts, const char *size_file)
return false;
/*@+mustfreefresh@ */
}
#endif /* !HAVE_NFTW */
/* This was not a block device - just use the size and return. */
if (!S_ISBLK((mode_t) (sb.st_mode))) {
@@ -310,9 +670,12 @@ opts_t opts_parse(unsigned int argc, char **argv)
{ "stop-at-size", 0, NULL, (int) 'S' },
{ "sync", 0, NULL, (int) 'Y' },
{ "direct-io", 0, NULL, (int) 'K' },
{ "sparse", 0, NULL, (int) 'O' },
{ "sparse-output", 0, NULL, (int) 'O' },
{ "discard", 0, NULL, (int) 'X' },
{ "store-and-forward", 1, NULL, (int) 'U' },
{ "remote", 1, NULL, (int) 'R' },
{ "query", 1, NULL, (int) 'Q' },
{ "pidfile", 1, NULL, (int) 'P' },
{ "watchfd", 1, NULL, (int) 'd' },
{ "output", 1, NULL, (int) 'o' },
@@ -325,14 +688,14 @@ opts_t opts_parse(unsigned int argc, char **argv)
/*@+nullassign@ */
int option_index = 0;
#endif /* HAVE_GETOPT_LONG */
char *short_options = "hVpteIrab8kTA:fvnqcWD:s:gl0i:w:H:N:u:F:x:L:B:CEZ:SYKXU:R:P:d:m:o:"
char *short_options = "hVpteIrab8kTA:fvnqcWD:s:gl0i:w:H:N:u:F:x:L:B:CEZ:SYKOXU:R:Q:P:d:m:o:"
#ifdef ENABLE_DEBUGGING
"!:"
#endif
;
int c, numopts;
unsigned int check_pid, parse_pid;
int check_fd, parse_fd;
unsigned int check_pid;
int check_fd;
opts_t opts;
char *leafptr;
@@ -372,10 +735,9 @@ opts_t opts_parse(unsigned int argc, char **argv)
numopts = 0;
opts->action = PV_ACTION_TRANSFER;
opts->interval = 1;
opts->delay_start = 0;
opts->watch_pid = 0;
opts->watch_fd = -1;
opts->average_rate_window = 30;
opts->width_set_manually = false;
@@ -430,6 +792,8 @@ opts_t opts_parse(unsigned int argc, char **argv)
/*@fallthrough@ */
case 'R':
/*@fallthrough@ */
case 'Q':
/*@fallthrough@ */
case 'm':
if (!pv_getnum_check(optarg, PV_NUMTYPE_BARE_INTEGER)) {
/*@-mustfreefresh@ *//* see above */
@@ -453,8 +817,49 @@ opts_t opts_parse(unsigned int argc, char **argv)
}
break;
case 'd':
if ('@' == optarg[0]) {
/* "-d @FILE" syntax - check FILE exists. */
if (optarg[1] == '\0') {
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: -%c @: %s\n",
opts->program_name, c, _("missing filename"));
opts_free(opts);
return NULL;
/*@+mustfreefresh@ */
} else if (0 != access(optarg + 1, R_OK)) { /* flawfinder: ignore */
/*
* flawfinder rationale: we're not
* using access() to check
* permissions, only to help give a
* usable error message, so there's
* no TOCTOU issue.
*/
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: -%c @: %s: %s\n",
opts->program_name, c, optarg + 1, strerror(errno));
opts_free(opts);
return NULL;
/*@+mustfreefresh@ */
}
break;
} else if ('=' == optarg[0]) {
/*
* "-d =NAME" syntax - check NAME is not
* blank.
*/
if (optarg[1] == '\0') {
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: -%c %c: %s\n",
opts->program_name, c, optarg[0], _("missing process name"));
opts_free(opts);
return NULL;
/*@+mustfreefresh@ */
}
break;
}
if (sscanf(optarg, "%u:%d", &check_pid, &check_fd)
< 1) {
/* "-d PID[:FD]" syntax - check numbers. */
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: -%c: %s\n",
opts->program_name, c, _("process ID or pid:fd pair expected"));
@@ -480,11 +885,11 @@ opts_t opts_parse(unsigned int argc, char **argv)
switch (c) {
case 'h':
display_help();
opts->do_nothing = true;
opts->action = PV_ACTION_NOTHING;
return opts; /* early return */
case 'V':
display_version();
opts->do_nothing = true;
opts->action = PV_ACTION_NOTHING;
return opts; /* early return */
case 'p':
opts->progress = true;
@@ -630,6 +1035,10 @@ opts_t opts_parse(unsigned int argc, char **argv)
case 'K':
opts->direct_io = true;
break;
case 'O':
opts->sparse_output = true;
opts->no_splice = true;
break;
case 'X':
opts->discard_input = true;
opts->no_splice = true;
@@ -641,9 +1050,15 @@ opts_t opts_parse(unsigned int argc, char **argv)
opts_free(opts);
return NULL;
}
opts->action = PV_ACTION_STORE_AND_FORWARD;
break;
case 'R':
opts->remote = (pid_t) pv_getnum_count(optarg, false);
opts->action = PV_ACTION_REMOTE_CONTROL;
break;
case 'Q':
opts->query = (pid_t) pv_getnum_count(optarg, false);
opts->action = PV_ACTION_QUERY;
break;
case 'P':
opts->pidfile = pv_strdup(optarg);
@@ -670,12 +1085,11 @@ opts_t opts_parse(unsigned int argc, char **argv)
}
break;
case 'd':
parse_pid = 0;
parse_fd = -1;
/* No syntax check here, already done earlier */
(void) sscanf(optarg, "%u:%d", &parse_pid, &parse_fd);
opts->watch_pid = (pid_t) parse_pid;
opts->watch_fd = parse_fd;
if (!opts_watchfd_parse(opts, optarg, NULL, 0)) {
opts_free(opts);
return NULL;
}
opts->action = PV_ACTION_WATCHFD;
break;
case 'o':
opts->output = pv_strdup(optarg);
@@ -724,7 +1138,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
if (NULL == opts)
return NULL;
if (0 != opts->watch_pid) {
if (PV_ACTION_WATCHFD == opts->action) {
if (opts->linemode || opts->null_terminated_lines || opts->stop_at_size
|| (opts->skip_errors > 0) || (opts->buffer_size > 0)
|| (opts->rate_limit > 0)) {
@@ -754,14 +1168,33 @@ opts_t opts_parse(unsigned int argc, char **argv)
/*@+mustfreefresh@ */
}
if (optind < (int) argc) {
if (0 != opts->query) {
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: %s\n", opts->program_name,
_("cannot use remote query when watching file descriptors"));
opts_free(opts);
return NULL;
/*@+mustfreefresh@ */
}
if (NULL != opts->output) {
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: -o: %s\n", opts->program_name,
_("cannot transfer files when watching file descriptors"));
opts_free(opts);
return NULL;
/*@+mustfreefresh@ */
}
/* Accept additional watchfd arguments. */
while (optind < (int) argc) {
if (!opts_watchfd_parse(opts, argv[optind], NULL, 0)) {
opts_free(opts);
return NULL;
}
optind++;
}
#ifndef __APPLE__
if (0 != access("/proc/self/fdinfo", X_OK)) { /* flawfinder: ignore */
/*
@@ -780,6 +1213,16 @@ opts_t opts_parse(unsigned int argc, char **argv)
#endif
}
/* Don't allow -R and -Q together. */
if ((0 != opts->remote) && (0 != opts->query)) {
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: %s\n", opts->program_name,
_("cannot use remote control and remote query together"));
opts_free(opts);
return NULL;
/*@+mustfreefresh@ */
}
/*
* Default options: -pterb
*/
@@ -795,6 +1238,18 @@ opts_t opts_parse(unsigned int argc, char **argv)
if (opts->error_skip_block > 0 && 0 == opts->skip_errors)
opts->skip_errors = 1;
/*
* Don't allow any non-option arguments with -R or -Q.
*/
if ((optind < (int) argc) && ((0 != opts->remote) || (0 != opts->query))) {
/*@-mustfreefresh@ *//* see above */
fprintf(stderr, "%s: %s: %s\n", opts->program_name, 0 != opts->remote ? "-R" : "-Q",
_("files cannot be specified with this option"));
opts_free(opts);
return NULL;
/*@+mustfreefresh@ */
}
/*
* Store remaining command-line arguments.
*/
-445
View File
@@ -1,445 +0,0 @@
/*
* Remote-control functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "options.h"
#include "pv.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#ifdef PV_REMOTE_CONTROL
void pv_error(pvstate_t, char *, ...);
struct remote_msg {
bool progress; /* progress bar flag */
bool timer; /* timer flag */
bool eta; /* ETA flag */
bool fineta; /* absolute ETA flag */
bool rate; /* rate counter flag */
bool average_rate; /* average rate counter flag */
bool bytes; /* bytes transferred flag */
bool bufpercent; /* transfer buffer percentage flag */
size_t lastwritten; /* last-written bytes count */
off_t rate_limit; /* rate limit, in bytes per second */
size_t buffer_size; /* buffer size, in bytes (0=default) */
off_t size; /* total size of data */
double interval; /* interval between updates */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
char name[256]; /* flawfinder: ignore */
char format[256]; /* flawfinder: ignore */
char extra_display[256]; /* flawfinder: ignore */
};
/*
* flawfinder rationale: name, format, and extra_display are always
* explicitly zeroed and bounded to one less than their size so they are
* always \0 terminated.
*/
/*
* Return a stream pointer, and populate the filename buffer, for a control
* file associated with a particular process ID; it will be opened for
* writing if "sender" is true. Returns NULL on error.
*/
/*@null@ */
/*@dependent@ */
static FILE *pv__control_file(char *filename, size_t bufsize, pid_t control_pid, bool sender)
{
int open_flags, open_mode, control_fd;
/*@dependent@ */ FILE *control_fptr = NULL;
open_flags = O_RDONLY;
#ifdef O_NOFOLLOW
open_flags += O_NOFOLLOW;
#endif
if (sender)
open_flags = O_WRONLY | O_CREAT | O_EXCL;
open_mode = 0644;
(void) pv_snprintf(filename, bufsize, "/run/user/%lu/pv.remote.%lu", (unsigned long) geteuid(),
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If /run/user/<uid> wasn't usable, try $HOME/.pv instead.
*/
if (control_fd < 0) {
char *home_dir;
home_dir = getenv("HOME"); /* flawfinder: ignore */
if (NULL == home_dir)
return NULL;
if ('\0' == home_dir[0])
return NULL;
/*
* flawfinder rationale: null and zero-size values are
* rejected, and the destination buffer is bounded.
*/
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%lu", home_dir, (unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If the open failed, try creating the $HOME/.pv directory
* first.
*/
if (control_fd < 0) {
(void) pv_snprintf(filename, bufsize, "%s/.pv", home_dir);
(void) mkdir(filename, 0700);
/* In case of weird umask, explicitly chmod the dir. */
(void) chmod(filename, 0700); /* flawfinder: ignore */
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%lu", home_dir,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
}
}
/*
* flawfinder rationale: the files are in a directory whose parents
* cannot be manipulated, and we are not allowing the final
* component to be a symbolic link. We are checking that $HOME is
* not NULL, and it's bounded by pv_snprintf() so it can't overshoot
* the filename buffer. When we chmod $HOME/.pv, we assume that an
* attacker is unlikely to be able to manipulate $HOME's contents to
* make use of us setting $HOME/.pv to mode 700.
*/
if (control_fd < 0)
return NULL;
debug("%s: %s", "control filename", filename);
control_fptr = fdopen(control_fd, sender ? "wb" : "rb");
return control_fptr;
}
/*
* Set the options of a remote process by writing them to a file, sending a
* signal to the receiving process, and waiting for the message to be
* consumed by the remote process.
*
* Returns nonzero on error.
*/
int pv_remote_set(opts_t opts, pvstate_t state)
{
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
pid_t signal_sender;
long timeout;
bool received;
/*
* flawfinder rationale: buffer is large enough, explicitly zeroed,
* and always bounded properly as we are only writing to it with
* pv_snprintf().
*/
/*
* Check that the remote process exists.
*/
if (kill((pid_t) (opts->remote), 0) != 0) {
pv_error(state, "%u: %s", opts->remote, strerror(errno));
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Make sure parameters are within sensible bounds.
*/
if (opts->width < 1)
opts->width = 80;
if (opts->height < 1)
opts->height = 25;
if (opts->width > 999999)
opts->width = 999999;
if (opts->height > 999999)
opts->height = 999999;
if ((opts->interval > 0) && (opts->interval < 0.1))
opts->interval = 0.1;
if (opts->interval > 600)
opts->interval = 600;
/*
* Copy parameters into message buffer.
*/
memset(&msgbuf, 0, sizeof(msgbuf));
msgbuf.progress = opts->progress;
msgbuf.timer = opts->timer;
msgbuf.eta = opts->eta;
msgbuf.fineta = opts->fineta;
msgbuf.rate = opts->rate;
msgbuf.average_rate = opts->average_rate;
msgbuf.bytes = opts->bytes;
msgbuf.bufpercent = opts->bufpercent;
msgbuf.lastwritten = opts->lastwritten;
msgbuf.rate_limit = opts->rate_limit;
msgbuf.buffer_size = opts->buffer_size;
msgbuf.size = opts->size;
msgbuf.interval = opts->interval;
msgbuf.width = opts->width;
msgbuf.height = opts->height;
msgbuf.width_set_manually = opts->width_set_manually;
msgbuf.height_set_manually = opts->height_set_manually;
if (opts->name != NULL) {
strncpy(msgbuf.name, opts->name, sizeof(msgbuf.name) - 1); /* flawfinder: ignore */
}
if (opts->format != NULL) {
strncpy(msgbuf.format, opts->format, sizeof(msgbuf.format) - 1); /* flawfinder: ignore */
}
if (opts->extra_display != NULL) {
strncpy(msgbuf.extra_display, opts->extra_display, sizeof(msgbuf.extra_display) - 1); /* flawfinder: ignore */
}
/*
* flawfinder rationale: name, format, and extra_display are
* explicitly bounded to 1 less than the size of their buffer and
* the buffer is \0 terminated by memset() earlier.
*/
/*
* Get the filename and file stream to use for remote control.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv__control_file(control_filename, sizeof(control_filename), (pid_t) getpid(), true);
if (NULL == control_fptr) {
pv_error(state, "%s", strerror(errno));
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Write the message buffer to the remote control file, and close
* it.
*/
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_error(state, "%s", strerror(errno));
(void) fclose(control_fptr);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
if (0 != fclose(control_fptr)) {
pv_error(state, "%s", strerror(errno));
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Send a SIGUSR2 signal to the remote process, to tell it a message
* is ready to read, after clearing our own "SIGUSR2 received" flag.
*/
signal_sender = 0;
(void) pv_sigusr2_received(state, &signal_sender);
if (kill((pid_t) (opts->remote), SIGUSR2) != 0) {
pv_error(state, "%u: %s", opts->remote, strerror(errno));
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
debug("%s", "message sent");
/*
* Wait for a signal from the remote process to say it has received
* the message.
*/
timeout = 1100000;
received = false;
while (timeout > 10000 && !received) {
struct timeval tv;
memset(&tv, 0, sizeof(tv));
tv.tv_sec = 0;
tv.tv_usec = 10000;
/*@-nullpass@ *//* splint: NULL is OK with select() */
(void) select(0, NULL, NULL, NULL, &tv);
/*@+nullpass@ */
timeout -= 10000;
if (pv_sigusr2_received(state, &signal_sender)) {
if (signal_sender == opts->remote) {
debug("%s", "message received");
received = true;
}
}
}
/*
* Remove the remote control file.
*/
if (0 != remove(control_filename)) {
pv_error(state, "%s", strerror(errno));
}
/*
* Return 0 if the message was received.
*/
if (received)
return 0;
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory leak
* warnings, but in this case it's unavoidable, and mitigated by the
* fact we only translate each string once.
*/
pv_error(state, "%u: %s", opts->remote, _("message not received"));
return PV_ERROREXIT_REMOTE_OR_PID;
/*@+mustfreefresh @ */
}
/*
* Check for a remote control message and, if there is one, replace the
* current process's options with those being passed in.
*
* NB relies on pv_state_set_format() causing the output format to be
* reparsed.
*/
void pv_remote_check(pvstate_t state)
{
pid_t signal_sender;
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
/* flawfinder rationale: as above. */
/*
* Return early if a SIGUSR2 signal has not been received.
*/
signal_sender = 0;
if (!pv_sigusr2_received(state, &signal_sender))
return;
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv__control_file(control_filename, sizeof(control_filename), signal_sender, false);
if (NULL == control_fptr) {
pv_error(state, "%s: %s", control_filename, strerror(errno));
return;
}
/*
* Read the message buffer from the remote control file, and close
* it.
*/
if (1 != fread(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_error(state, "%s", strerror(errno));
(void) fclose(control_fptr);
return;
}
if (0 != fclose(control_fptr)) {
pv_error(state, "%s", strerror(errno));
return;
}
/*
* Send a SIGUSR2 signal to the sending process, to tell it the
* message has been received.
*/
if (kill(signal_sender, SIGUSR2) != 0) {
debug("%u: %s", signal_sender, strerror(errno));
}
debug("%s", "received remote message");
pv_state_format_string_set(state, NULL);
pv_state_name_set(state, NULL);
pv_state_extra_display_set(state, NULL);
msgbuf.name[sizeof(msgbuf.name) - 1] = '\0';
msgbuf.format[sizeof(msgbuf.format) - 1] = '\0';
msgbuf.extra_display[sizeof(msgbuf.extra_display) - 1] = '\0';
pv_state_set_format(state, msgbuf.progress, msgbuf.timer,
msgbuf.eta, msgbuf.fineta, msgbuf.rate,
msgbuf.average_rate,
msgbuf.bytes, msgbuf.bufpercent,
msgbuf.lastwritten, '\0' == msgbuf.name[0] ? NULL : msgbuf.name);
if (msgbuf.rate_limit > 0)
pv_state_rate_limit_set(state, msgbuf.rate_limit);
if (msgbuf.buffer_size > 0) {
pv_state_target_buffer_size_set(state, msgbuf.buffer_size);
}
if (msgbuf.size > 0)
pv_state_size_set(state, msgbuf.size);
if (msgbuf.interval > 0)
pv_state_interval_set(state, msgbuf.interval);
if (msgbuf.width > 0 && msgbuf.width_set_manually)
pv_state_width_set(state, msgbuf.width, msgbuf.width_set_manually);
if (msgbuf.height > 0 && msgbuf.height_set_manually)
pv_state_height_set(state, msgbuf.height, msgbuf.height_set_manually);
if (msgbuf.format[0] != '\0')
pv_state_format_string_set(state, msgbuf.format);
if (msgbuf.extra_display[0] != '\0')
pv_state_extra_display_set(state, msgbuf.extra_display);
}
/*
* Initialise remote message reception handling.
*/
void pv_remote_init(void)
{
}
/*
* Clean up after remote message reception handling.
*/
void pv_remote_fini(void)
{
}
#else /* !PV_REMOTE_CONTROL */
/*
* Dummy stubs for remote control when we don't have PV_REMOTE_CONTROL.
*/
void pv_remote_init(void)
{
}
void pv_remote_check( /*@unused@ */ __attribute__((unused)) pvstate_t state)
{
}
void pv_remote_fini(void)
{
}
int pv_remote_set( /*@unused@ */
__attribute__((unused)) opts_t opts, /*@unused@ */ __attribute__((unused)) pvstate_t state)
{
/*@-mustfreefresh@ *//* splint - see above */
fprintf(stderr, "%s\n", _("SA_SIGINFO not supported on this system"));
/*@+mustfreefresh@ */
return PV_ERROREXIT_REMOTE_OR_PID;
}
#endif /* SA_SIGINFO */
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* Output version information to stdout.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -23,7 +23,7 @@ void display_version(void)
/* GNU standard first line format: program and version only */
printf("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
/* GNU standard second line format - "Copyright" always in English */
printf("Copyright %s %s\n", "2025", "Andrew Wood");
printf("Copyright %s %s\n", "2026", "Andrew Wood");
/* GNU standard license line and free software notice */
printf("%s\n", _("License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"));
printf("%s\n", _("This is free software: you are free to change and redistribute it."));
+73 -62
View File
@@ -1,7 +1,7 @@
/*
* Functions for updating the calculated state of the transfer.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -17,23 +17,24 @@
* rate, otherwise calulate the average rate from the difference between the
* current position + elapsed time pair, and the oldest pair in the buffer.
*/
static void pv__update_average_rate_history(pvstate_t state, long double rate)
static void pv__update_average_rate_history(pvtransfercalc_t calc, readonly_pvtransferstate_t transfer,
unsigned int history_interval, long double rate)
{
size_t first = state->calc.history_first;
size_t last = state->calc.history_last;
size_t first = calc->history_first;
size_t last = calc->history_last;
long double last_elapsed;
if (NULL == state->calc.history)
if (NULL == calc->history)
return;
last_elapsed = state->calc.history[last].elapsed_sec;
last_elapsed = calc->history[last].elapsed_sec;
/*
* Do nothing if this is not the first call but not enough time has
* elapsed since the previous call yet.
*/
if ((last_elapsed > 0.0)
&& (state->transfer.elapsed_seconds < (last_elapsed + state->control.history_interval)))
&& (transfer->elapsed_seconds < (last_elapsed + history_interval)))
return;
/*
@@ -41,53 +42,62 @@ static void pv__update_average_rate_history(pvstate_t state, long double rate)
* buffer.
*/
if (last_elapsed > 0.0) {
size_t len = state->calc.history_len;
size_t len = calc->history_len;
last = (last + 1) % len;
state->calc.history_last = last;
calc->history_last = last;
if (last == first) {
first = (first + 1) % len;
state->calc.history_first = first;
calc->history_first = first;
}
}
state->calc.history[last].elapsed_sec = state->transfer.elapsed_seconds;
state->calc.history[last].transferred = state->transfer.transferred;
calc->history[last].elapsed_sec = transfer->elapsed_seconds;
calc->history[last].transferred = transfer->transferred;
if (first == last) {
state->calc.current_avg_rate = rate;
calc->current_avg_rate = rate;
} else {
off_t bytes = (state->calc.history[last].transferred - state->calc.history[first].transferred);
long double sec = (state->calc.history[last].elapsed_sec - state->calc.history[first].elapsed_sec);
state->calc.current_avg_rate = (long double) bytes / sec;
off_t bytes = (calc->history[last].transferred - calc->history[first].transferred);
long double sec = (calc->history[last].elapsed_sec - calc->history[first].elapsed_sec);
/* Safety check to avoid division by zero. */
if (sec < 0.000001 && sec > -0.000001)
sec = 0.000001;
calc->current_avg_rate = (long double) bytes / sec;
}
}
/*
* Update all calculated transfer state (state->calc).
* Update all calculated transfer state in calc (usually from state->calc).
*
* If "final" is true, this is the final update, so
* state->calc.transfer_rate and state->calc.average_rate are given as an
* average over the whole transfer; otherwise they are the current transfer
* rate and current average rate.
* If "final" is true, this is the final update, so calc->transfer_rate and
* calc->average_rate are given as an average over the whole transfer;
* otherwise they are the current transfer rate and current average rate.
*
* The value of state->calc.percentage will reflect the percentage
* completion if state->control.size is greater than zero, otherwise it will
* increase by 2 each call and wrap at 200.
* The value of calc->percentage will reflect the percentage completion if
* control->size is greater than zero, otherwise it will increase by 2 each
* call and wrap at 200.
*/
void pv_calculate_transfer_rate(pvstate_t state, bool final)
void pv_calculate_transfer_rate(pvtransfercalc_t calc, readonly_pvtransferstate_t transfer,
readonly_pvcontrol_t control, readonly_pvdisplay_t display, bool final)
{
off_t bytes_since_last;
long double time_since_last, transfer_rate, average_rate;
/* Quick safety check - state must exist. */
if (NULL == state)
/* Quick safety checks for null pointers. */
if (NULL == calc)
return;
if (NULL == transfer)
return;
if (NULL == control)
return;
if (NULL == display)
return;
bytes_since_last = 0;
if (state->transfer.transferred >= 0) {
bytes_since_last = state->transfer.transferred - state->calc.prev_transferred;
state->calc.prev_transferred = state->transfer.transferred;
if (transfer->transferred >= 0) {
bytes_since_last = transfer->transferred - calc->prev_transferred;
calc->prev_transferred = transfer->transferred;
}
/*
@@ -96,37 +106,37 @@ void pv_calculate_transfer_rate(pvstate_t state, bool final)
* adding to that until a reasonable amount of time has passed to
* avoid rate spikes or division by zero.
*/
time_since_last = state->transfer.elapsed_seconds - state->calc.prev_elapsed_sec;
time_since_last = transfer->elapsed_seconds - calc->prev_elapsed_sec;
if (time_since_last <= 0.01) {
transfer_rate = state->calc.prev_rate;
state->calc.prev_trans += bytes_since_last;
transfer_rate = calc->prev_rate;
calc->prev_trans += bytes_since_last;
} else {
long double measured_rate;
transfer_rate = ((long double) bytes_since_last + state->calc.prev_trans) / time_since_last;
transfer_rate = ((long double) bytes_since_last + calc->prev_trans) / time_since_last;
measured_rate = transfer_rate;
state->calc.prev_elapsed_sec = state->transfer.elapsed_seconds;
state->calc.prev_trans = 0;
calc->prev_elapsed_sec = transfer->elapsed_seconds;
calc->prev_trans = 0;
if (state->control.bits)
if (control->bits)
measured_rate = 8.0 * measured_rate;
if ((state->calc.measurements_taken < 1) || (measured_rate < state->calc.rate_min)) {
state->calc.rate_min = measured_rate;
if ((calc->measurements_taken < 1) || (measured_rate < calc->rate_min)) {
calc->rate_min = measured_rate;
}
if (measured_rate > state->calc.rate_max) {
state->calc.rate_max = measured_rate;
if (measured_rate > calc->rate_max) {
calc->rate_max = measured_rate;
}
state->calc.rate_sum += measured_rate;
state->calc.ratesquared_sum += (measured_rate * measured_rate);
state->calc.measurements_taken++;
calc->rate_sum += measured_rate;
calc->ratesquared_sum += (measured_rate * measured_rate);
calc->measurements_taken++;
}
state->calc.prev_rate = transfer_rate;
calc->prev_rate = transfer_rate;
/* Update history and current average rate for ETA. */
pv__update_average_rate_history(state, transfer_rate);
average_rate = state->calc.current_avg_rate;
pv__update_average_rate_history(calc, transfer, control->history_interval, transfer_rate);
average_rate = calc->current_avg_rate;
/*
* If this is the final update at the end of the transfer, we
@@ -134,19 +144,20 @@ void pv_calculate_transfer_rate(pvstate_t state, bool final)
* period of the transfer.
*/
if (final) {
long double total_elapsed_seconds = (long double) (transfer->elapsed_seconds);
/* Safety check to avoid division by zero. */
if (state->transfer.elapsed_seconds < 0.000001)
state->transfer.elapsed_seconds = 0.000001;
if (total_elapsed_seconds < 0.000001)
total_elapsed_seconds = 0.000001;
average_rate =
(((long double) (state->transfer.transferred)) -
((long double) state->display.initial_offset)) / (long double) (state->transfer.elapsed_seconds);
(((long double) (transfer->transferred)) -
((long double) display->initial_offset)) / total_elapsed_seconds;
transfer_rate = average_rate;
}
state->calc.transfer_rate = transfer_rate;
state->calc.average_rate = average_rate;
calc->transfer_rate = transfer_rate;
calc->average_rate = average_rate;
if (state->control.size <= 0) {
if (control->size <= 0) {
/*
* If we don't know the total size of the incoming data,
* then for a percentage, we gradually increase the
@@ -156,16 +167,16 @@ void pv_calculate_transfer_rate(pvstate_t state, bool final)
* 0%-100%, 100%-0%, 0%-100%, and so on.
*/
if (transfer_rate > 0)
state->calc.percentage += 2;
if (state->calc.percentage > 199)
state->calc.percentage = 0;
calc->percentage += 2;
if (calc->percentage > 199)
calc->percentage = 0;
} else {
state->calc.percentage = pv_percentage(state->transfer.transferred, state->control.size);
calc->percentage = pv_percentage(transfer->transferred, control->size);
}
/* Ensure the percentage is never negative or huge. */
if (state->calc.percentage < 0.0)
state->calc.percentage = 0.0;
if (state->calc.percentage > 100000.0)
state->calc.percentage = 100000.0;
if (calc->percentage < 0.0)
calc->percentage = 0.0;
if (calc->percentage > 100000.0)
calc->percentage = 100000.0;
}
+147 -140
View File
@@ -10,7 +10,7 @@
* terminal, so we try to use a lockfile if terminal locking doesn't work,
* and finally abort if even that is unavailable.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -47,24 +47,24 @@
* Create a per-euid, per-tty, lockfile in ${TMPDIR:-${TMP:-/tmp}} for the
* tty on the given file descriptor.
*/
static void pv_crs_open_lockfile(pvstate_t state, int fd)
static void pv_crs_open_lockfile(pvcursorstate_t cursor, readonly_pvcontrol_t control, int fd)
{
char *ttydev;
char *tmpdir;
int openflags;
state->cursor.lock_fd = -1;
cursor->lock_fd = -1;
ttydev = ttyname(fd);
if (!ttydev) {
if (!state->control.force) {
pv_error(state, "%s: %s", _("failed to get terminal name"), strerror(errno));
if (!control->force) {
pv_error("%s: %s", _("failed to get terminal name"), strerror(errno));
}
/*
* If we don't know our terminal name, we can neither do IPC
* nor make a lock file, so turn off cursor positioning.
*/
state->control.cursor = 0;
cursor->disable = true;
debug("%s", "ttyname failed - cursor positioning disabled");
return;
}
@@ -80,8 +80,8 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
* $TMP are rejected, and the destination buffer is bounded.
*/
memset(state->cursor.lock_file, 0, PV_SIZEOF_CRS_LOCK_FILE);
(void) pv_snprintf(state->cursor.lock_file,
memset(cursor->lock_file, 0, PV_SIZEOF_CRS_LOCK_FILE);
(void) pv_snprintf(cursor->lock_file,
PV_SIZEOF_CRS_LOCK_FILE, "%s/pv-%s-%i.lock", tmpdir, basename(ttydev), (int) geteuid());
/*
@@ -93,7 +93,7 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
openflags = O_RDWR | O_CREAT;
#endif
state->cursor.lock_fd = open(state->cursor.lock_file, openflags, 0600); /* flawfinder: ignore */
cursor->lock_fd = open(cursor->lock_file, openflags, 0600); /* flawfinder: ignore */
/*
* flawfinder rationale: we aren't truncating the lock file, we
@@ -102,9 +102,9 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
* open() is as safe as we can make it.
*/
if (state->cursor.lock_fd < 0) {
pv_error(state, "%s: %s: %s", state->cursor.lock_file, _("failed to open lock file"), strerror(errno));
state->control.cursor = 0;
if (cursor->lock_fd < 0) {
pv_error("%s: %s: %s", cursor->lock_file, _("failed to open lock file"), strerror(errno));
cursor->disable = true;
return;
}
}
@@ -114,14 +114,14 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
* Lock the terminal on the given file descriptor, falling back to using a
* lockfile if the terminal itself cannot be locked.
*/
static void pv_crs_lock(pvstate_t state, int fd)
static void pv_crs_lock(pvcursorstate_t cursor, readonly_pvcontrol_t control, int fd)
{
struct flock lock;
int lock_fd;
lock_fd = fd;
if (state->cursor.lock_fd >= 0)
lock_fd = state->cursor.lock_fd;
if (cursor->lock_fd >= 0)
lock_fd = cursor->lock_fd;
memset(&lock, 0, sizeof(lock));
lock.l_type = (short) F_WRLCK;
@@ -130,20 +130,20 @@ static void pv_crs_lock(pvstate_t state, int fd)
lock.l_len = 1;
while (fcntl(lock_fd, F_SETLKW, &lock) < 0) {
if (errno != EINTR) {
if (state->cursor.lock_fd == -2) {
pv_crs_open_lockfile(state, fd);
if (state->cursor.lock_fd >= 0) {
lock_fd = state->cursor.lock_fd;
if (cursor->lock_fd == -2) {
pv_crs_open_lockfile(cursor, control, fd);
if (cursor->lock_fd >= 0) {
lock_fd = cursor->lock_fd;
}
} else {
pv_error(state, "%s: %s", _("lock attempt failed"), strerror(errno));
pv_error("%s: %s", _("lock attempt failed"), strerror(errno));
return;
}
}
}
if (state->cursor.lock_fd >= 0) {
debug("%s: %s", state->cursor.lock_file, "terminal lockfile acquired");
if (cursor->lock_fd >= 0) {
debug("%s: %s", cursor->lock_file, "terminal lockfile acquired");
} else {
debug("%s", "terminal lock acquired");
}
@@ -154,14 +154,14 @@ static void pv_crs_lock(pvstate_t state, int fd)
* Unlock the terminal on the given file descriptor. If pv_crs_lock used
* lockfile locking, unlock the lockfile.
*/
static void pv_crs_unlock(pvstate_t state, int fd)
static void pv_crs_unlock(pvcursorstate_t cursor, int fd)
{
struct flock lock;
int lock_fd;
lock_fd = fd;
if (state->cursor.lock_fd >= 0)
lock_fd = state->cursor.lock_fd;
if (cursor->lock_fd >= 0)
lock_fd = cursor->lock_fd;
memset(&lock, 0, sizeof(lock));
lock.l_type = (short) F_UNLCK;
@@ -170,8 +170,8 @@ static void pv_crs_unlock(pvstate_t state, int fd)
lock.l_len = 1;
(void) fcntl(lock_fd, F_SETLK, &lock);
if (state->cursor.lock_fd >= 0) {
debug("%s: %s", state->cursor.lock_file, "terminal lockfile released");
if (cursor->lock_fd >= 0) {
debug("%s: %s", cursor->lock_file, "terminal lockfile released");
} else {
debug("%s", "terminal lock released");
}
@@ -185,20 +185,20 @@ static void pv_crs_unlock(pvstate_t state, int fd)
* cursor mode (including us), and store it in pv_crs_pvcount. If this is
* larger than pv_crs_pvmax, update pv_crs_pvmax.
*/
static void pv_crs_ipccount(pvstate_t state)
static void pv_crs_ipccount(pvcursorstate_t cursor)
{
struct shmid_ds buf;
memset(&buf, 0, sizeof(buf));
buf.shm_nattch = 0;
(void) shmctl(state->cursor.shmid, IPC_STAT, &buf);
state->cursor.pvcount = (int) (buf.shm_nattch);
(void) shmctl(cursor->shmid, IPC_STAT, &buf);
cursor->pvcount = (int) (buf.shm_nattch);
if (state->cursor.pvcount > state->cursor.pvmax)
state->cursor.pvmax = state->cursor.pvcount;
if (cursor->pvcount > cursor->pvmax)
cursor->pvmax = cursor->pvcount;
debug("%s: %d", "pvcount", state->cursor.pvcount);
debug("%s: %d", "pvcount", cursor->pvcount);
}
#endif /* HAVE_IPC */
@@ -294,7 +294,7 @@ static int pv_crs_get_ypos(int terminalfd)
* count" of one, and so no initialisation occurs. So, we lock the terminal
* with pv_crs_lock() while we are attaching and checking.
*/
static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
static int pv_crs_ipcinit(pvcursorstate_t cursor, readonly_pvcontrol_t control, char *ttyfile, int terminalfd)
{
key_t key;
@@ -309,25 +309,25 @@ static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
return 1;
}
pv_crs_lock(state, terminalfd);
if (!state->control.cursor) {
pv_crs_lock(cursor, control, terminalfd);
if ((!control->cursor) || (cursor->disable)) {
debug("%s", "early return - cursor has been disabled");
return 1;
}
state->cursor.shmid = shmget(key, sizeof(struct pvcursorstate_s), 0600 | IPC_CREAT);
if (state->cursor.shmid < 0) {
cursor->shmid = shmget(key, sizeof(struct pvipccursorstate_s), 0600 | IPC_CREAT);
if (cursor->shmid < 0) {
debug("%s: %s", "shmget failed", strerror(errno));
pv_crs_unlock(state, terminalfd);
pv_crs_unlock(cursor, terminalfd);
return 1;
}
/*@-nullpass@ */
/* splint doesn't know shmaddr can be NULL */
state->cursor.shared = shmat(state->cursor.shmid, NULL, 0);
cursor->shared = shmat(cursor->shmid, NULL, 0);
/*@+nullpass@ */
pv_crs_ipccount(state);
pv_crs_ipccount(cursor);
/*
* If nobody else is attached to the shared memory segment, we're
@@ -335,29 +335,29 @@ static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
* current Y cursor co-ordinate and with an initial false value for
* the TOSTOP-added flag.
*/
if (state->cursor.pvcount < 2) {
state->cursor.y_start = pv_crs_get_ypos(terminalfd);
state->cursor.shared->y_topmost = state->cursor.y_start;
state->cursor.shared->tty_tostop_added = false;
state->cursor.y_lastread = state->cursor.y_start;
if (cursor->pvcount < 2) {
cursor->y_start = pv_crs_get_ypos(terminalfd);
cursor->shared->y_topmost = cursor->y_start;
cursor->shared->tty_tostop_added = false;
cursor->y_lastread = cursor->y_start;
debug("%s", "we are the first to attach");
}
state->cursor.y_offset = state->cursor.pvcount - 1;
if (state->cursor.y_offset < 0)
state->cursor.y_offset = 0;
cursor->y_offset = cursor->pvcount - 1;
if (cursor->y_offset < 0)
cursor->y_offset = 0;
/*
* If anyone else had attached to the shared memory segment, we need
* to read the top Y co-ordinate from it.
*/
if (state->cursor.pvcount > 1) {
state->cursor.y_start = state->cursor.shared->y_topmost;
state->cursor.y_lastread = state->cursor.y_start;
debug("%s: %d", "not the first to attach - got top y", state->cursor.y_start);
if (cursor->pvcount > 1) {
cursor->y_start = cursor->shared->y_topmost;
cursor->y_lastread = cursor->y_start;
debug("%s: %d", "not the first to attach - got top y", cursor->y_start);
}
pv_crs_unlock(state, terminalfd);
pv_crs_unlock(cursor, terminalfd);
return 0;
}
@@ -367,15 +367,15 @@ static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
/*
* Initialise the terminal for cursor positioning.
*/
void pv_crs_init(pvstate_t state)
void pv_crs_init(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags)
{
char *ttyfile;
int terminalfd;
state->cursor.lock_fd = -2;
state->cursor.lock_file[0] = '\0';
cursor->lock_fd = -2;
cursor->lock_file[0] = '\0';
if (!state->control.cursor)
if ((!control->cursor) || (cursor->disable))
return;
debug("%s", "init");
@@ -383,7 +383,7 @@ void pv_crs_init(pvstate_t state)
ttyfile = ttyname(STDERR_FILENO);
if (NULL == ttyfile) {
debug("%s: %s", "disabling cursor positioning because ttyname failed", strerror(errno));
state->control.cursor = false;
cursor->disable = true;
return;
}
@@ -397,23 +397,23 @@ void pv_crs_init(pvstate_t state)
*/
if (terminalfd < 0) {
pv_error(state, "%s: %s: %s", _("failed to open terminal"), ttyfile, strerror(errno));
state->control.cursor = false;
pv_error("%s: %s: %s", _("failed to open terminal"), ttyfile, strerror(errno));
cursor->disable = true;
return;
}
#ifdef HAVE_IPC
if (pv_crs_ipcinit(state, ttyfile, terminalfd) != 0) {
if (pv_crs_ipcinit(cursor, control, ttyfile, terminalfd) != 0) {
debug("%s", "ipcinit failed, setting noipc flag");
state->cursor.noipc = true;
cursor->noipc = true;
}
/*
* If we have already set the terminal TOSTOP attribute, set the
* flag in shared memory to let the other instances know.
*/
if ((!state->cursor.noipc) && (1 == state->flag.clear_tty_tostop_on_exit) && (NULL != state->cursor.shared)) {
if ((!cursor->noipc) && (1 == flags->clear_tty_tostop_on_exit) && (NULL != cursor->shared)) {
debug("%s", "propagating local clear_tty_tostop_on_exit true value to shared tty_tostop_added flag");
state->cursor.shared->tty_tostop_added = true;
cursor->shared->tty_tostop_added = true;
}
/*
@@ -421,26 +421,26 @@ void pv_crs_init(pvstate_t state)
* co-ordinate. If we are using IPC, then the pv_crs_ipcinit()
* function takes care of this in a more multi-process-friendly way.
*/
if (state->cursor.noipc) {
if (cursor->noipc) {
#else /* ! HAVE_IPC */
if (1) {
#endif /* HAVE_IPC */
/*
* Get current cursor position + 1.
*/
pv_crs_lock(state, terminalfd);
state->cursor.y_start = pv_crs_get_ypos(terminalfd);
pv_crs_lock(cursor, control, terminalfd);
cursor->y_start = pv_crs_get_ypos(terminalfd);
/*
* Move down a line while the terminal is locked, so that
* other processes in the pipeline will get a different
* initial ypos.
*/
if (state->cursor.y_start > 0)
pv_tty_write(state, "\n", 1);
pv_crs_unlock(state, terminalfd);
if (cursor->y_start > 0)
pv_tty_write(flags, "\n", 1);
pv_crs_unlock(cursor, terminalfd);
if (state->cursor.y_start < 1)
state->control.cursor = 0;
if (cursor->y_start < 1)
cursor->disable = true;
}
(void) close(terminalfd);
@@ -451,11 +451,11 @@ void pv_crs_init(pvstate_t state)
/*
* Set the "we need to reinitialise cursor positioning" flag.
*/
void pv_crs_needreinit(pvstate_t state)
void pv_crs_needreinit(pvcursorstate_t cursor)
{
state->cursor.needreinit += 2;
if (state->cursor.needreinit > 3)
state->cursor.needreinit = 3;
cursor->needreinit += 2;
if (cursor->needreinit > 3)
cursor->needreinit = 3;
}
#endif
@@ -465,36 +465,36 @@ void pv_crs_needreinit(pvstate_t state)
* Reinitialise the cursor positioning code (called if we are backgrounded
* then foregrounded again).
*/
static void pv_crs_reinit(pvstate_t state)
static void pv_crs_reinit(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags)
{
debug("%s", "reinit");
if (1 == state->flag.suspend_stderr) {
if (1 == flags->suspend_stderr) {
debug("%s", "reinit abandoned - stderr is suspended");
return;
}
pv_crs_lock(state, STDERR_FILENO);
pv_crs_lock(cursor, control, STDERR_FILENO);
state->cursor.needreinit--;
if (state->cursor.y_offset < 1)
state->cursor.needreinit = 0;
cursor->needreinit--;
if (cursor->y_offset < 1)
cursor->needreinit = 0;
if (state->cursor.needreinit > 0) {
pv_crs_unlock(state, STDERR_FILENO);
if (cursor->needreinit > 0) {
pv_crs_unlock(cursor, STDERR_FILENO);
return;
}
debug("%s", "reinit full");
state->cursor.y_start = pv_crs_get_ypos(STDERR_FILENO);
cursor->y_start = pv_crs_get_ypos(STDERR_FILENO);
if ((state->cursor.y_offset < 1) && (NULL != state->cursor.shared)) {
state->cursor.shared->y_topmost = state->cursor.y_start;
if ((cursor->y_offset < 1) && (NULL != cursor->shared)) {
cursor->shared->y_topmost = cursor->y_start;
}
state->cursor.y_lastread = state->cursor.y_start;
cursor->y_lastread = cursor->y_start;
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
}
#endif
@@ -503,12 +503,17 @@ static void pv_crs_reinit(pvstate_t state)
* Output a single-line update (\0-terminated), using the ECMA-48 CSI "CUP"
* sequence to move the cursor to the correct position to do so.
*/
void pv_crs_update(pvstate_t state, const char *output_line)
void pv_crs_update(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags,
const char *output_line)
{
char cup_cmd[32]; /* flawfinder: ignore */
size_t cup_cmd_length, output_line_length;
int y;
/* Early return if cursor positioning was disabled. */
if (cursor->disable)
return;
/*
* flawfinder rationale: the "cup_cmd" buffer is always zeroed
* before each use, and is only written to by pv_snprintf() bounded
@@ -520,24 +525,24 @@ void pv_crs_update(pvstate_t state, const char *output_line)
/* flawfinder - output_line is explictly expected to be \0-terminated. */
#ifdef HAVE_IPC
if (!state->cursor.noipc) {
if (state->cursor.needreinit > 0)
pv_crs_reinit(state);
if (!cursor->noipc) {
if (cursor->needreinit > 0)
pv_crs_reinit(cursor, control, flags);
pv_crs_ipccount(state);
if (NULL != state->cursor.shared) {
if (state->cursor.y_lastread != state->cursor.shared->y_topmost) {
state->cursor.y_start = state->cursor.shared->y_topmost;
state->cursor.y_lastread = state->cursor.y_start;
pv_crs_ipccount(cursor);
if (NULL != cursor->shared) {
if (cursor->y_lastread != cursor->shared->y_topmost) {
cursor->y_start = cursor->shared->y_topmost;
cursor->y_lastread = cursor->y_start;
}
}
if (state->cursor.needreinit > 0)
if (cursor->needreinit > 0)
return;
}
#endif /* HAVE_IPC */
y = state->cursor.y_start;
y = cursor->y_start;
#ifdef HAVE_IPC
/*
@@ -546,41 +551,41 @@ void pv_crs_update(pvstate_t state, const char *output_line)
* scroll the screen (only if we're the first `pv'), and then move
* our initial Y co-ordinate up.
*/
if (((state->cursor.y_start + state->cursor.pvmax) > (int) (state->control.height))
&& (!state->cursor.noipc)
if (((cursor->y_start + cursor->pvmax) > (int) (control->height))
&& (!cursor->noipc)
) {
int offs;
offs = ((state->cursor.y_start + state->cursor.pvmax) - state->control.height);
offs = ((cursor->y_start + cursor->pvmax) - control->height);
state->cursor.y_start -= offs;
if (state->cursor.y_start < 1)
state->cursor.y_start = 1;
cursor->y_start -= offs;
if (cursor->y_start < 1)
cursor->y_start = 1;
debug("%s: %d", "scroll offset", offs);
/*
* Scroll the screen if we're the first `pv'.
*/
if (0 == state->cursor.y_offset) {
pv_crs_lock(state, STDERR_FILENO);
if (0 == cursor->y_offset) {
pv_crs_lock(cursor, control, STDERR_FILENO);
memset(cup_cmd, 0, sizeof(cup_cmd));
(void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%u;1H", state->control.height);
(void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%u;1H", control->height);
cup_cmd_length = strlen(cup_cmd); /* flawfinder: ignore */
pv_tty_write(state, cup_cmd, cup_cmd_length);
pv_tty_write(flags, cup_cmd, cup_cmd_length);
for (; offs > 0; offs--) {
pv_tty_write(state, "\n", 1);
pv_tty_write(flags, "\n", 1);
}
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
debug("%s", "we are the first - scrolled screen");
}
}
if (!state->cursor.noipc)
y = state->cursor.y_start + state->cursor.y_offset;
if (!cursor->noipc)
y = cursor->y_start + cursor->y_offset;
#endif /* HAVE_IPC */
/*
@@ -601,19 +606,19 @@ void pv_crs_update(pvstate_t state, const char *output_line)
* pv_snprintf() fails to run the string will be of zero length.
*/
pv_crs_lock(state, STDERR_FILENO);
pv_crs_lock(cursor, control, STDERR_FILENO);
pv_tty_write(state, cup_cmd, cup_cmd_length);
pv_tty_write(state, output_line, output_line_length);
pv_tty_write(flags, cup_cmd, cup_cmd_length);
pv_tty_write(flags, output_line, output_line_length);
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
}
/*
* Reposition the cursor to a final position.
*/
void pv_crs_fini(pvstate_t state)
void pv_crs_fini(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags)
{
char cup_cmd[32]; /* flawfinder: ignore */
unsigned int y;
@@ -622,15 +627,15 @@ void pv_crs_fini(pvstate_t state)
debug("%s", "fini");
y = (unsigned int) (state->cursor.y_start);
y = (unsigned int) (cursor->y_start);
#ifdef HAVE_IPC
if ((state->cursor.pvmax > 0) && (!state->cursor.noipc))
y += state->cursor.pvmax - 1;
if ((cursor->pvmax > 0) && (!cursor->noipc))
y += cursor->pvmax - 1;
#endif /* HAVE_IPC */
if (y > state->control.height)
y = state->control.height;
if (y > control->height)
y = control->height;
/*
* Absolute bounds check.
@@ -641,9 +646,11 @@ void pv_crs_fini(pvstate_t state)
memset(cup_cmd, 0, sizeof(cup_cmd));
(void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%u;1H\n", y);
pv_crs_lock(state, STDERR_FILENO);
pv_crs_lock(cursor, control, STDERR_FILENO);
pv_tty_write(state, cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */
if (!cursor->disable) {
pv_tty_write(flags, cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */
}
/* flawfinder - pv_snprintf() always \0-terminates (see above). */
#ifdef HAVE_IPC
@@ -652,40 +659,40 @@ void pv_crs_fini(pvstate_t state)
* attribute, set our local flag so pv_sig_fini() will know about
* it.
*/
if ((!state->cursor.noipc) && (NULL != state->cursor.shared) && state->cursor.shared->tty_tostop_added) {
if (0 == state->flag.clear_tty_tostop_on_exit) {
if ((!cursor->noipc) && (NULL != cursor->shared) && cursor->shared->tty_tostop_added) {
if (0 == flags->clear_tty_tostop_on_exit) {
debug("%s",
"propagating shared tty_tostop_added true value to local clear_tty_tostop_on_exit flag");
state->flag.clear_tty_tostop_on_exit = 1;
flags->clear_tty_tostop_on_exit = 1;
}
}
pv_crs_ipccount(state);
if (NULL != state->cursor.shared) {
(void) shmdt(state->cursor.shared);
pv_crs_ipccount(cursor);
if (NULL != cursor->shared) {
(void) shmdt(cursor->shared);
}
state->cursor.shared = NULL;
cursor->shared = NULL;
/*
* If we are the last instance detaching from the shared memory,
* delete it so it's not left lying around.
*/
if (state->cursor.pvcount < 2) {
if (cursor->pvcount < 2) {
struct shmid_ds shm_buf;
memset(&shm_buf, 0, sizeof(shm_buf));
(void) shmctl(state->cursor.shmid, IPC_RMID, &shm_buf);
(void) shmctl(cursor->shmid, IPC_RMID, &shm_buf);
}
#endif /* HAVE_IPC */
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
if (state->cursor.lock_fd >= 0) {
(void) close(state->cursor.lock_fd);
if (cursor->lock_fd >= 0) {
(void) close(cursor->lock_fd);
/*
* We can get away with removing this on exit because all
* the other PVs will be finishing at the same sort of time.
*/
(void) remove(state->cursor.lock_file);
(void) remove(cursor->lock_file);
}
}
+167 -83
View File
@@ -1,7 +1,7 @@
/*
* Display functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -49,17 +49,53 @@
#include <sys/ioctl.h>
#endif
/*
* The error prefix for messages (the program name); whether it has been
* set; and whether any output has been displayed yet, indicating whether
* any errors must be preceded by a newline.
*/
static char pv__error_prefix[64]; /* flawfinder: ignore */
static bool pv__error_prefix_set = false;
static bool pv__output_produced = false;
/*
* flawfinder rationale: zeroed before use, string copy is bounded to 1 less
* than size so it always has \0 termination. Not used unless initialised,
* by checking pv__error_prefix_set.
*/
/*
* Set the error message prefix.
*/
void pv_set_error_prefix( /*@unique@ */ const char *prefix)
{
if (NULL == prefix)
return;
memset(pv__error_prefix, 0, sizeof(pv__error_prefix));
strncpy(pv__error_prefix, prefix, sizeof(pv__error_prefix) - 1); /* flawfinder: ignore */
pv__error_prefix_set = true;
/*
* flawfinder rationale: strncpy's pointers are as valid as we can
* make them since the first is a static buffer and the second is
* caller-supplied. The caller must \0-terminate the string but in
* any case it is bounded to 1 less than the size of the
* destination. The destination is zeroed before use so the result
* is guaranteed to be \0-terminated.
*/
}
/*
* Output an error message. If we've displayed anything to the terminal
* already, then put a newline before our error so we don't write over what
* we've written.
*/
void pv_error(pvstate_t state, char *format, ...)
void pv_error(char *format, ...)
{
va_list ap;
if (state->display.display_visible)
if (pv__output_produced)
fprintf(stderr, "\n");
fprintf(stderr, "%s: ", state->status.program_name);
if (pv__error_prefix_set)
fprintf(stderr, "%s: ", pv__error_prefix);
va_start(ap, format);
(void) vfprintf(stderr, format, ap); /* flawfinder: ignore */
va_end(ap);
@@ -140,9 +176,9 @@ void pv_write_retry(int fd, const char *buf, size_t count)
* Write the given buffer to the terminal, like pv_write_retry(), unless
* stderr is suspended.
*/
void pv_tty_write(pvstate_t state, const char *buf, size_t count)
void pv_tty_write(readonly_pvtransientflags_t flags, const char *buf, size_t count)
{
while (0 == state->flag.suspend_stderr && count > 0) {
while (0 == flags->suspend_stderr && count > 0) {
ssize_t nwritten;
nwritten = write(STDERR_FILENO, buf, count);
@@ -553,15 +589,26 @@ char *pv_format_sequences(void)
/*
* Initialise the output format structure, based on the current options.
*
* May update status->checked_colour_support and
* status->terminal_supports_colour.
*/
static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supplied, pvdisplay_t display)
static void pv__format_init(pvprogramstatus_t status, readonly_pvcontrol_t control, readonly_pvtransferstate_t transfer,
readonly_pvtransfercalc_t calc,
/*@null@ */ const char *format_supplied, pvdisplay_t display)
{
struct pvdisplay_component_s *format_component_array;
const char *display_format;
size_t strpos;
size_t segment;
if (NULL == state)
if (NULL == status)
return;
if (NULL == control)
return;
if (NULL == transfer)
return;
if (NULL == calc)
return;
if (NULL == display)
return;
@@ -578,7 +625,7 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
display->showing_previous_line = false;
display->format_uses_colour = false;
display_format = NULL == format_supplied ? state->control.default_format : format_supplied;
display_format = NULL == format_supplied ? control->default_format : format_supplied;
if (NULL == display_format)
return;
@@ -779,9 +826,12 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
memset(&formatter_info, 0, sizeof(formatter_info));
dummy_buffer[0] = '\0';
formatter_info.state = state;
formatter_info.display = display;
formatter_info.segment = &(display->format[segment]);
formatter_info.status = status;
formatter_info.control = control;
formatter_info.transfer = transfer;
formatter_info.calc = calc;
formatter_info.buffer = dummy_buffer;
formatter_info.buffer_size = 0;
formatter_info.offset = 0;
@@ -801,16 +851,16 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
display->format_segment_count++;
}
if (display->format_uses_colour && !state->control.checked_colour_support) {
state->control.checked_colour_support = true;
if (display->format_uses_colour && !status->checked_colour_support) {
status->checked_colour_support = true;
#ifdef ENABLE_NCURSES
/*
* If we have terminal info support, check whether the
* current terminal supports colour - or just assume it's
* supported if we're forcing output.
*/
if (true == state->control.force) {
state->control.can_display_colour = true;
if (true == control->force) {
status->terminal_supports_colour = true;
debug("%s", "force mode - assuming terminal supports colour");
} else {
char *term_env = NULL;
@@ -820,22 +870,22 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
* flawfinder - here we pass responsibility to the
* ncurses library to behave OK with $TERM.
*/
state->control.can_display_colour = false;
status->terminal_supports_colour = false;
if (NULL != term_env) {
int setup_err = 0;
if ((0 == setupterm(term_env, STDERR_FILENO, &setup_err))
&& (tigetnum("colors") > 1)
) {
state->control.can_display_colour = true;
status->terminal_supports_colour = true;
debug("%s: %s", term_env, "terminal supports colour");
} else {
state->control.can_display_colour = false;
status->terminal_supports_colour = false;
debug("%s: %s", term_env, "terminal does not support colour");
}
} else {
/* If TERM is unset, disable colour. */
state->control.can_display_colour = false;
status->terminal_supports_colour = false;
debug("%s", "no TERM variable - disabling colour support");
}
}
@@ -846,8 +896,8 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
* to determine whether colour is available, unless --force
* was supplied, in which case colour support is assumed.
*/
if (true == state->control.force) {
state->control.can_display_colour = true;
if (true == control->force) {
status->terminal_supports_colour = true;
debug("%s", "force mode - assuming terminal supports colour");
} else {
FILE *command_fptr;
@@ -863,21 +913,21 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
*/
if (NULL == command_fptr) {
state->control.can_display_colour = false;
status->terminal_supports_colour = false;
debug("%s (%s)", "popen failed - disabling colour support", strerror(errno));
} else {
int colour_count;
if (1 == fscanf(command_fptr, "%d", &colour_count)) {
if (colour_count > 1) {
state->control.can_display_colour = true;
status->terminal_supports_colour = true;
debug("%s (%d)", "terminal supports colour", colour_count);
} else {
state->control.can_display_colour = false;
status->terminal_supports_colour = false;
debug("%s (%d)",
"fewer than 2 colours available - disabling colour support");
}
} else {
state->control.can_display_colour = false;
status->terminal_supports_colour = false;
debug("%s", "tput did not produce a number - disabling colour support");
}
/*@-unrecog@ *//* splint doesn't know pclose(). */
@@ -890,7 +940,7 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
* Without terminal info support, just assume colour is
* available.
*/
state->control.can_display_colour = true;
status->terminal_supports_colour = true;
debug("%s", "terminal info support not compiled in - assuming colour support");
#endif /* (! ENABLE_NCURSES) && (! USE_POPEN_TPUTS) */
#endif /* ! ENABLE_NCURSES */
@@ -900,7 +950,7 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
/*
* Update display->display_buffer with status information formatted
* according to the state held within the given structure.
* according to the state held within the given structures.
*
* If "reinitialise" is true, the format string is reparsed first. This
* should be true for the first call, and true whenever the format is
@@ -914,9 +964,14 @@ static void pv__format_init(pvstate_t state, /*@null@ */ const char *format_supp
* When returning true, this function will have also set
* display->display_string_len to the length of the string in
* display->display_buffer, in bytes.
*
* Updates status->exit_status if buffer allocation fails.
*
* See pv__format_init for the adjustments that may be made to "status".
*/
bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdisplay_t display, bool reinitialise,
bool final)
bool pv_format(pvprogramstatus_t status, readonly_pvcontrol_t control, readonly_pvtransferstate_t transfer,
readonly_pvtransfercalc_t calc, /*@null@ */ const char *format_supplied, pvdisplay_t display,
bool reinitialise, bool final)
{
struct pvdisplay_component_s *format_component_array;
char display_segments[PV_SIZEOF_FORMAT_SEGMENTS_BUF]; /* flawfinder: ignore - always bounded */
@@ -930,17 +985,26 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
memset(&formatter_info, 0, sizeof(formatter_info));
display_segments[0] = '\0';
/* Quick safety check - state and display must exist. */
if (NULL == state)
/* Quick safety check for null pointers. */
if (NULL == status)
return false;
if (NULL == control)
return false;
if (NULL == transfer)
return false;
if (NULL == calc)
return false;
if (NULL == display)
return false;
formatter_info.state = state;
formatter_info.display = display;
formatter_info.buffer = display_segments;
formatter_info.buffer_size = sizeof(display_segments);
formatter_info.offset = 0;
formatter_info.status = status;
formatter_info.control = control;
formatter_info.transfer = transfer;
formatter_info.calc = calc;
format_component_array = pv__format_components();
@@ -949,24 +1013,24 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
/* Reinitialise if we were asked to. */
if (reinitialise)
pv__format_init(state, format_supplied, display);
pv__format_init(status, control, transfer, calc, format_supplied, display);
/* The format string is needed for the static segments. */
display_format = NULL == format_supplied ? state->control.default_format : format_supplied;
display_format = NULL == format_supplied ? control->default_format : format_supplied;
if (NULL == display_format)
return false;
/* Determine the type of thing being counted for transfer, rate, etc. */
display->count_type = PV_TRANSFERCOUNT_BYTES;
if (state->control.linemode)
if (control->linemode)
display->count_type = PV_TRANSFERCOUNT_LINES;
else if (state->control.decimal_units)
else if (control->decimal_units)
display->count_type = PV_TRANSFERCOUNT_DECBYTES;
/*
* Reallocate the output buffer if the display width changes.
*/
if (display->display_buffer != NULL && display->display_buffer_size < (size_t) ((state->control.width * 4))) {
if (display->display_buffer != NULL && display->display_buffer_size < (size_t) ((control->width * 4))) {
free(display->display_buffer);
display->display_buffer = NULL;
display->display_buffer_size = 0;
@@ -979,15 +1043,15 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
char *new_buffer;
size_t new_size;
new_size = (size_t) ((4 * state->control.width) + 80);
if (NULL != state->control.name)
new_size += strlen(state->control.name); /* flawfinder: ignore */
new_size = (size_t) ((4 * control->width) + 80);
if (NULL != control->name)
new_size += strlen(control->name); /* flawfinder: ignore */
/* flawfinder: name is always set by pv_strdup(), which bounds with a \0. */
new_buffer = malloc(new_size + 16);
if (NULL == new_buffer) {
pv_error(state, "%s: %s", _("buffer allocation failed"), strerror(errno));
state->status.exit_status |= PV_ERROREXIT_MEMORY;
pv_error("%s: %s", _("buffer allocation failed"), strerror(errno));
status->exit_status |= PV_ERROREXIT_MEMORY;
display->display_buffer = NULL;
return false;
}
@@ -1054,8 +1118,8 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
*/
dynamic_segment_width = 0;
if (state->control.width > static_portion_width)
dynamic_segment_width = state->control.width - static_portion_width;
if (control->width > static_portion_width)
dynamic_segment_width = control->width - static_portion_width;
/*
* Divide the total remaining screen space by the number of dynamic
@@ -1064,8 +1128,8 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
if (dynamic_segment_count > 1)
dynamic_segment_width /= dynamic_segment_count;
debug("control.width=%d static_portion_width=%d dynamic_segment_width=%d dynamic_segment_count=%d",
state->control.width, static_portion_width, dynamic_segment_width, dynamic_segment_count);
debug("control->width=%d static_portion_width=%d dynamic_segment_width=%d dynamic_segment_count=%d",
control->width, static_portion_width, dynamic_segment_width, dynamic_segment_count);
for (segment_idx = 0; segment_idx < display->format_segment_count; segment_idx++) {
pvdisplay_segment_t segment;
@@ -1153,7 +1217,7 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
* spaces at the end, so that we don't leave dangling bits behind.
*/
if ((new_display_string_width < display->display_string_width)
&& (state->control.width >= display->prev_screen_width)) {
&& (control->width >= display->prev_screen_width)) {
char spaces[32]; /* flawfinder: ignore - terminated, bounded */
int spaces_to_add;
@@ -1173,7 +1237,7 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
display->display_string_bytes = new_display_string_bytes;
display->display_string_width = new_display_string_width;
display->prev_screen_width = state->control.width;
display->prev_screen_width = control->width;
return true;
}
@@ -1185,78 +1249,98 @@ bool pv_format(pvstate_t state, /*@null@ */ const char *format_supplied, pvdispl
* If "final" is true, this is the final update, so the rate is given as an
* an average over the whole transfer; otherwise the current rate is shown.
*/
void pv_display(pvstate_t state, bool final)
void pv_display(pvprogramstatus_t status, readonly_pvcontrol_t control, pvtransientflags_t flags,
readonly_pvtransferstate_t transfer, pvtransfercalc_t calc, pvcursorstate_t cursor, pvdisplay_t display,
/*@null@ */ pvdisplay_t extra_display, bool final)
{
bool reinitialise = false;
if (NULL == state)
if (NULL == status)
return;
if (NULL == control)
return;
if (NULL == flags)
return;
if (NULL == transfer)
return;
if (NULL == calc)
return;
if (NULL == cursor)
return;
if (NULL == display)
return;
pv_sig_checkbg();
pv_calculate_transfer_rate(state, final);
pv_calculate_transfer_rate(calc, transfer, control, display, final);
/*
* Enable colour on the main display, and disable it on the extra
* display (process title, window title).
*/
state->display.colour_permitted = true;
state->extra_display.colour_permitted = false;
display->colour_permitted = true;
if (NULL != extra_display)
extra_display->colour_permitted = false;
/*
* If the display options need reparsing, do so to generate new
* formatting parameters.
*/
if (0 != state->flag.reparse_display) {
if (0 != flags->reparse_display) {
reinitialise = true;
state->flag.reparse_display = 0;
flags->reparse_display = 0;
}
if (!pv_format(state, state->control.format_string, &(state->display), reinitialise, final))
if (!pv_format(status, control, transfer, calc, control->format_string, display, reinitialise, final))
return;
if (0 != state->control.extra_displays) {
if (!pv_format(state, state->control.extra_format_string, &(state->extra_display), reinitialise, final))
if ((NULL != extra_display) && (0 != control->extra_displays)) {
if (!pv_format
(status, control, transfer, calc, control->extra_format_string, extra_display, reinitialise, final))
return;
}
if (NULL == state->display.display_buffer)
if (NULL == display->display_buffer)
return;
if (state->control.numeric) {
pv_tty_write(state, state->display.display_buffer, state->display.display_string_bytes);
pv_tty_write(state, "\n", 1);
} else if (state->control.cursor) {
if (state->control.force || pv_in_foreground()) {
pv_crs_update(state, state->display.display_buffer);
state->display.display_visible = true;
if (control->numeric) {
pv_tty_write(flags, display->display_buffer, display->display_string_bytes);
pv_tty_write(flags, "\n", 1);
} else if (control->cursor) {
if (control->force || pv_in_foreground()) {
pv_crs_update(cursor, control, flags, display->display_buffer);
display->output_produced = true;
pv__output_produced = true;
}
} else {
if (state->control.force || pv_in_foreground()) {
pv_tty_write(state, state->display.display_buffer, state->display.display_string_bytes);
pv_tty_write(state, "\r", 1);
state->display.display_visible = true;
if (control->force || pv_in_foreground()) {
pv_tty_write(flags, display->display_buffer, display->display_string_bytes);
pv_tty_write(flags, "\r", 1);
display->output_produced = true;
pv__output_produced = true;
}
}
debug("%s: [%s]", "display", state->display.display_buffer);
debug("%s: [%s]", "display", display->display_buffer);
if ((0 != (PV_DISPLAY_WINDOWTITLE & state->control.extra_displays))
&& (state->control.force || pv_in_foreground())
&& (NULL != state->extra_display.display_buffer)
if ((0 != (PV_DISPLAY_WINDOWTITLE & control->extra_displays))
&& (control->force || pv_in_foreground())
&& (NULL != extra_display)
&& (NULL != extra_display->display_buffer)
) {
pv_tty_write(state, "\033]2;", 4);
pv_tty_write(state, state->extra_display.display_buffer, state->extra_display.display_string_bytes);
pv_tty_write(state, "\033\\", 2);
state->extra_display.display_visible = true;
debug("%s: [%s]", "windowtitle display", state->extra_display.display_buffer);
pv_tty_write(flags, "\033]2;", 4);
pv_tty_write(flags, extra_display->display_buffer, extra_display->display_string_bytes);
pv_tty_write(flags, "\033\\", 2);
extra_display->output_produced = true;
debug("%s: [%s]", "windowtitle display", extra_display->display_buffer);
}
if ((0 != (PV_DISPLAY_PROCESSTITLE & state->control.extra_displays))
&& (NULL != state->extra_display.display_buffer)
if ((0 != (PV_DISPLAY_PROCESSTITLE & control->extra_displays))
&& (NULL != extra_display)
&& (NULL != extra_display->display_buffer)
) {
setproctitle("%s", state->extra_display.display_buffer);
state->extra_display.display_visible = true;
debug("%s: [%s]", "processtitle display", state->extra_display.display_buffer);
setproctitle("%s -- %s", PACKAGE_NAME, extra_display->display_buffer);
extra_display->output_produced = true;
debug("%s: [%s]", "processtitle display", extra_display->display_buffer);
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* Functions relating to elapsed time.
*
* Copyright 2023-2025 Andrew Wood
* Copyright 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
+114 -14
View File
@@ -1,7 +1,7 @@
/*
* Functions for opening and closing files, and calculating their size.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -54,6 +54,10 @@ static off_t pv_calc_total_bytes(pvstate_t state)
for (file_idx = 0; file_idx < state->files.file_count; file_idx++) {
int rc;
/* Skip any NULL entries, though they should be impossible. */
if (NULL == state->files.filename[file_idx])
continue;
if (0 == strcmp(state->files.filename[file_idx], "-")) {
rc = fstat(STDIN_FILENO, &sb);
if (rc != 0) {
@@ -144,7 +148,7 @@ static off_t pv_calc_total_bytes(pvstate_t state)
total = end_position;
}
if (lseek(state->control.output_fd, 0, SEEK_SET) != 0) {
pv_error(state, "%s: %s: %s",
pv_error("%s: %s: %s",
NULL == state->control.output_name ? "(null)" : state->control.output_name,
_("failed to seek to start of output"), strerror(errno));
state->status.exit_status |= PV_ERROREXIT_ACCESS;
@@ -187,6 +191,10 @@ static off_t pv_calc_total_lines(pvstate_t state)
int fd = -1;
int rc = 0;
/* Skip any NULL entries, though they should be impossible. */
if (NULL == state->files.filename[file_idx])
continue;
if (0 == strcmp(state->files.filename[file_idx], "-")) {
rc = fstat(STDIN_FILENO, &sb);
if ((rc != 0) || (!S_ISREG(sb.st_mode))) {
@@ -228,7 +236,7 @@ static off_t pv_calc_total_lines(pvstate_t state)
* OK.
*/
if (numread < 0) {
pv_error(state, "%s: %s", state->files.filename[file_idx], strerror(errno));
pv_error("%s: %s", state->files.filename[file_idx], strerror(errno));
state->status.exit_status |= PV_ERROREXIT_ACCESS;
break;
} else if (0 == numread) {
@@ -246,7 +254,7 @@ static off_t pv_calc_total_lines(pvstate_t state)
}
if (0 != lseek(fd, 0, SEEK_SET)) {
pv_error(state, "%s: %s", state->files.filename[file_idx], strerror(errno));
pv_error("%s: %s", state->files.filename[file_idx], strerror(errno));
state->status.exit_status |= PV_ERROREXIT_ACCESS;
}
@@ -288,10 +296,11 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
struct stat osb;
int fd;
bool input_file_is_output;
char *next_filename;
if (oldfd >= 0) {
if (0 != close(oldfd)) {
pv_error(state, "%s: %s", _("failed to close file"), strerror(errno));
pv_error("%s: %s", _("failed to close file"), strerror(errno));
state->status.exit_status |= PV_ERROREXIT_TRANSITION;
return -1;
}
@@ -303,33 +312,42 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
return -1;
}
if ((NULL == state->files.filename) || (0 == strcmp(state->files.filename[filenum], "-"))) {
next_filename = NULL;
if (NULL != state->files.filename) {
next_filename = state->files.filename[filenum];
if (NULL == next_filename) {
debug("%s: @%d, max %d", "unexpected null filename", filenum, state->files.file_count);
state->status.exit_status |= PV_ERROREXIT_TRANSITION;
return -1;
}
}
if ((NULL == next_filename) || (0 == strcmp(next_filename, "-"))) {
fd = STDIN_FILENO;
} else {
fd = open(state->files.filename[filenum], O_RDONLY); /* flawfinder: ignore */
fd = open(next_filename, O_RDONLY); /* flawfinder: ignore */
/*
* flawfinder rationale: the input file list is under the
* control of the operator by its nature, so we can't refuse
* to open symlinks etc as that would be counterintuitive.
*/
if (fd < 0) {
pv_error(state, "%s: %s: %s",
_("failed to read file"), state->files.filename[filenum], strerror(errno));
pv_error("%s: %s: %s", _("failed to read file"), next_filename, strerror(errno));
state->status.exit_status |= PV_ERROREXIT_ACCESS;
return -1;
}
}
if (0 != fstat(fd, &isb)) {
pv_error(state, "%s: %s: %s", _("failed to stat file"),
NULL == state->files.filename ? "-" : state->files.filename[filenum], strerror(errno));
pv_error("%s: %s: %s", _("failed to stat file"),
NULL == next_filename ? "-" : next_filename, strerror(errno));
(void) close(fd);
state->status.exit_status |= PV_ERROREXIT_ACCESS;
return -1;
}
if (0 != fstat(state->control.output_fd, &osb)) {
pv_error(state, "%s: %s", _("failed to stat output file"), strerror(errno));
pv_error("%s: %s", _("failed to stat output file"), strerror(errno));
(void) close(fd);
state->status.exit_status |= PV_ERROREXIT_ACCESS;
return -1;
@@ -351,8 +369,7 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
input_file_is_output = false;
if (input_file_is_output) {
pv_error(state, "%s: %s", _("input file is output file"),
NULL == state->files.filename ? "-" : state->files.filename[filenum]);
pv_error("%s: %s", _("input file is output file"), NULL == next_filename ? "-" : next_filename);
(void) close(fd);
state->status.exit_status |= PV_ERROREXIT_OUROBOROS;
return -1;
@@ -447,3 +464,86 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
/*@+onlytrans@ */
/*@+observertrans@ */
}
/*
* Return a stream pointer, and populate the filename buffer, for a control
* file associated with a particular process ID, for the given signal
* number; it will be opened for writing if "sender" is true. Returns NULL
* on error.
*/
/*@null@ */
/*@dependent@ */
FILE *pv_open_controlfile(char *filename, size_t bufsize, pid_t control_pid, int signum, bool sender)
{
int open_flags, open_mode, control_fd;
/*@dependent@ */ FILE *control_fptr = NULL;
open_flags = O_RDONLY;
#ifdef O_NOFOLLOW
open_flags += O_NOFOLLOW;
#endif
if (sender)
open_flags = O_WRONLY | O_CREAT | O_EXCL;
open_mode = 0644;
(void) pv_snprintf(filename, bufsize, "/run/user/%lu/pv.remote.%d.%lu", (unsigned long) geteuid(), signum,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If /run/user/<uid> wasn't usable, try $HOME/.pv instead.
*/
if (control_fd < 0) {
char *home_dir;
home_dir = getenv("HOME"); /* flawfinder: ignore */
if (NULL == home_dir)
return NULL;
if ('\0' == home_dir[0])
return NULL;
/*
* flawfinder rationale: null and zero-size values are
* rejected, and the destination buffer is bounded.
*/
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%d.%lu", home_dir, signum,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If the open failed, try creating the $HOME/.pv directory
* first.
*/
if (control_fd < 0) {
(void) pv_snprintf(filename, bufsize, "%s/.pv", home_dir);
(void) mkdir(filename, 0700);
/* In case of weird umask, explicitly chmod the dir. */
(void) chmod(filename, 0700); /* flawfinder: ignore */
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%d.%lu", home_dir, signum,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
}
}
/*
* flawfinder rationale: the files are in a directory whose parents
* cannot be manipulated, and we are not allowing the final
* component to be a symbolic link. We are checking that $HOME is
* not NULL, and it's bounded by pv_snprintf() so it can't overshoot
* the filename buffer. When we chmod $HOME/.pv, we assume that an
* attacker is unlikely to be able to manipulate $HOME's contents to
* make use of us setting $HOME/.pv to mode 700.
*/
if (control_fd < 0)
return NULL;
debug("%s: %s", "control filename", filename);
control_fptr = fdopen(control_fd, sender ? "wb" : "rb");
return control_fptr;
}
+6 -6
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for average rate.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -24,18 +24,18 @@ pvdisplay_bytecount_t pv_formatter_average_rate(pvformatter_args_t args)
return 0;
/*@-mustfreefresh@ */
if (args->state->control.numeric) {
if (args->control->numeric) {
/* numeric - raw value without suffix. */
(void) pv_snprintf(content, sizeof(content),
"%.4Lf", ((args->state->control.bits ? 8.0 : 1.0) * args->state->calc.average_rate));
} else if (args->state->control.bits && !args->state->control.linemode) {
"%.4Lf", ((args->control->bits ? 8.0 : 1.0) * args->calc->average_rate));
} else if (args->control->bits && !args->control->linemode) {
/* bits per second */
pv_describe_amount(content, sizeof(content),
"(%s)", 8 * args->state->calc.average_rate, "", _("b/s"), args->display->count_type);
"(%s)", 8 * args->calc->average_rate, "", _("b/s"), args->display->count_type);
} else {
/* bytes or lines per second */
pv_describe_amount(content,
sizeof(content), "(%s)", args->state->calc.average_rate, _("/s"), _("B/s"),
sizeof(content), "(%s)", args->calc->average_rate, _("/s"), _("B/s"),
args->display->count_type);
}
/*@+mustfreefresh@ *//* splint: see above. */
+5 -5
View File
@@ -1,7 +1,7 @@
/*
* Formatter functions for styled progress bars.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -44,7 +44,7 @@ static bool pv_barstyle(pvformatter_args_t args, pvbarstyle_t style, const char
memset(style, 0, sizeof(*style));
if (args->state->control.can_display_utf8 && 0 == strcmp(name, "block")) {
if (args->status->terminal_supports_utf8 && 0 == strcmp(name, "block")) {
style->style_id = 2;
@@ -58,7 +58,7 @@ static bool pv_barstyle(pvformatter_args_t args, pvbarstyle_t style, const char
return true;
} else if (args->state->control.can_display_utf8 && 0 == strcmp(name, "granular")) {
} else if (args->status->terminal_supports_utf8 && 0 == strcmp(name, "granular")) {
style->style_id = 3;
@@ -79,7 +79,7 @@ static bool pv_barstyle(pvformatter_args_t args, pvbarstyle_t style, const char
return true;
} else if (args->state->control.can_display_utf8 && 0 == strcmp(name, "shaded")) {
} else if (args->status->terminal_supports_utf8 && 0 == strcmp(name, "shaded")) {
style->style_id = 4;
@@ -164,7 +164,7 @@ pvdisplay_bytecount_t pv_formatter_bar_default(pvformatter_args_t args)
{
if (0 == args->segment->parameter) {
const char *default_name;
default_name = args->state->control.default_bar_style;
default_name = args->control->default_bar_style;
/*@-branchstate@ */
if (NULL == default_name)
default_name = "plain";
+5 -6
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for transfer buffer percentage utilisation.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -23,16 +23,15 @@ pvdisplay_bytecount_t pv_formatter_buffer_percent(pvformatter_args_t args)
if (0 == args->buffer_size)
return 0;
if (args->state->transfer.buffer_size > 0) {
if (args->transfer->buffer_size > 0) {
double pct_used = pv_percentage((off_t)
(args->state->transfer.read_position -
args->state->transfer.write_position),
(args->transfer->read_position - args->transfer->write_position),
(off_t)
(args->state->transfer.buffer_size));
(args->transfer->buffer_size));
(void) pv_snprintf(content, sizeof(content), "{%3.0f%%}", pct_used);
}
#ifdef HAVE_SPLICE
if (args->state->transfer.splice_used)
if (args->transfer->splice_used)
(void) pv_snprintf(content, sizeof(content), "{%s}", "----");
#endif
+6 -9
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for bytes or lines transferred.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -26,20 +26,17 @@ pvdisplay_bytecount_t pv_formatter_bytes(pvformatter_args_t args)
content[0] = '\0';
/*@-mustfreefresh@ */
if (args->state->control.numeric) {
if (args->control->numeric) {
/* Numeric mode - raw values only, no suffix. */
(void) pv_snprintf(content, sizeof(content),
"%lld",
(long long) ((args->state->control.bits ? 8 : 1) *
args->state->transfer.transferred));
} else if (args->state->control.bits && !args->state->control.linemode) {
"%lld", (long long) ((args->control->bits ? 8 : 1) * args->transfer->transferred));
} else if (args->control->bits && !args->control->linemode) {
pv_describe_amount(content, sizeof(content), "%s",
(long double) (args->state->transfer.transferred * 8), "", _("b"),
(long double) (args->transfer->transferred * 8), "", _("b"),
args->display->count_type);
} else {
pv_describe_amount(content, sizeof(content), "%s",
(long double) (args->state->transfer.transferred), "", _("B"),
args->display->count_type);
(long double) (args->transfer->transferred), "", _("B"), args->display->count_type);
}
/*@+mustfreefresh@ *//* splint - false positive from gettext(). */
+4 -5
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for ETA display.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -24,16 +24,15 @@ pvdisplay_bytecount_t pv_formatter_eta(pvformatter_args_t args)
/*
* Don't try to calculate this if the size is not known.
*/
if (args->state->control.size < 1)
if (args->control->size < 1)
return 0;
if (0 == args->buffer_size)
return 0;
eta =
pv_seconds_remaining((args->state->transfer.transferred - args->display->initial_offset),
args->state->control.size - args->display->initial_offset,
args->state->calc.current_avg_rate);
pv_seconds_remaining((args->transfer->transferred - args->display->initial_offset),
args->control->size - args->display->initial_offset, args->calc->current_avg_rate);
/*
* Bounds check, so we don't overrun the suffix buffer. This means
+4 -5
View File
@@ -2,7 +2,7 @@
* Formatter function for the local time at which the transfer is expected
* to complete.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -32,7 +32,7 @@ pvdisplay_bytecount_t pv_formatter_fineta(pvformatter_args_t args)
/*
* Don't try to calculate this if the size is not known.
*/
if (args->state->control.size < 1)
if (args->control->size < 1)
return 0;
if (0 == args->buffer_size)
@@ -47,9 +47,8 @@ pvdisplay_bytecount_t pv_formatter_fineta(pvformatter_args_t args)
* lookup.
*/
eta = pv_seconds_remaining(args->state->transfer.transferred - args->display->initial_offset,
args->state->control.size - args->display->initial_offset,
args->state->calc.current_avg_rate);
eta = pv_seconds_remaining(args->transfer->transferred - args->display->initial_offset,
args->control->size - args->display->initial_offset, args->calc->current_avg_rate);
/* Bounds check - see pv_formatter_eta(). */
eta = pv_bound_long(eta, 0, (long) 360000000L);
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for showing the last bytes written.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
+3 -3
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for showing the name of the transfer.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -35,8 +35,8 @@ pvdisplay_bytecount_t pv_formatter_name(pvformatter_args_t args)
(void) pv_snprintf(string_format, sizeof(string_format), "%%%d.500s:", field_width);
content[0] = '\0';
if (args->state->control.name) {
(void) pv_snprintf(content, sizeof(content), string_format, args->state->control.name);
if (NULL != args->control->name) {
(void) pv_snprintf(content, sizeof(content), string_format, args->control->name);
}
return pv_formatter_segmentcontent(content, args);
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for the most recently written line.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
+16 -18
View File
@@ -1,7 +1,7 @@
/*
* Formatter functions for progress bars.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -74,28 +74,26 @@ static pvdisplay_bytecount_t pv_formatter_progress_knownsize(pvformatter_args_t
memset(after_bar, 0, sizeof(after_bar));
if (args->state->control.size > 0) {
if (args->control->size > 0) {
/* Percentage of data transferred. */
bar_percentage = (double) (args->state->calc.percentage);
bar_percentage = (double) (args->calc->percentage);
(void) pv_snprintf(after_bar, sizeof(after_bar), " %3ld%%", (int) bar_percentage);
} else {
/* Current rate vs max rate. */
bar_percentage = 0.0;
if (args->state->calc.rate_max > 0) {
bar_percentage =
(double) (100.0 * args->state->calc.transfer_rate / args->state->calc.rate_max);
if (args->calc->rate_max > 0) {
bar_percentage = (double) (100.0 * args->calc->transfer_rate / args->calc->rate_max);
}
/*@-mustfreefresh@ */
if (args->state->control.bits && !args->state->control.linemode) {
if (args->control->bits && !args->control->linemode) {
/* bits per second */
pv_describe_amount(after_bar, sizeof(after_bar), "/%s",
8.0 * args->state->calc.rate_max, "", _("b/s"), args->display->count_type);
8.0 * args->calc->rate_max, "", _("b/s"), args->display->count_type);
} else {
/* bytes or lines per second */
pv_describe_amount(after_bar, sizeof(after_bar),
"/%s", args->state->calc.rate_max, _("/s"), _("B/s"),
args->display->count_type);
"/%s", args->calc->rate_max, _("/s"), _("B/s"), args->display->count_type);
}
/*@+mustfreefresh@ *//* splint: see above about gettext(). */
}
@@ -247,7 +245,7 @@ static pvdisplay_bytecount_t pv_formatter_progress_unknownsize(pvformatter_args_
* here we make values above 100 send the indicator back down again,
* so it moves back and forth.
*/
indicator_position = args->state->calc.percentage;
indicator_position = args->calc->percentage;
if (indicator_position > 200.0)
#if HAVE_FMOD
indicator_position = fmod(indicator_position, 200.0);
@@ -316,7 +314,7 @@ pvdisplay_bytecount_t pv_formatter_progress(pvformatter_args_t args)
if (0 == args->segment->parameter) {
const char *default_name;
default_name = args->state->control.default_bar_style;
default_name = args->control->default_bar_style;
/*@-branchstate@ */
if (NULL == default_name)
default_name = "plain";
@@ -328,7 +326,7 @@ pvdisplay_bytecount_t pv_formatter_progress(pvformatter_args_t args)
if (0 == args->buffer_size)
return 0;
if (args->state->control.size > 0 || args->state->control.rate_gauge) {
if (args->control->size > 0 || args->control->rate_gauge) {
/* Known size or rate gauge - bar with percentage. */
bytes = pv_formatter_progress_knownsize(args, content, sizeof(content), true, true, true);
} else {
@@ -354,7 +352,7 @@ pvdisplay_bytecount_t pv_formatter_progress_bar_only(pvformatter_args_t args)
if (0 == args->segment->parameter) {
const char *default_name;
default_name = args->state->control.default_bar_style;
default_name = args->control->default_bar_style;
/*@-branchstate@ */
if (NULL == default_name)
default_name = "plain";
@@ -366,7 +364,7 @@ pvdisplay_bytecount_t pv_formatter_progress_bar_only(pvformatter_args_t args)
if (0 == args->buffer_size)
return 0;
if (args->state->control.size > 0 || args->state->control.rate_gauge) {
if (args->control->size > 0 || args->control->rate_gauge) {
/* Known size or rate gauge - bar with percentage. */
bytes = pv_formatter_progress_knownsize(args, content, sizeof(content), false, true, false);
} else {
@@ -393,12 +391,12 @@ pvdisplay_bytecount_t pv_formatter_progress_amount_only(pvformatter_args_t args)
if (0 == args->buffer_size)
return 0;
if (args->state->control.numeric) {
if (args->control->numeric) {
/* Numeric mode - percentage as a rounded integer with no suffix. */
(void) pv_snprintf(content, sizeof(content), "%.0f", args->state->calc.percentage);
(void) pv_snprintf(content, sizeof(content), "%.0f", args->calc->percentage);
bytes = strlen(content); /* flawfinder: ignore */
/* flawfinder: always \0-terminated by pv_snprintf() and the earlier memset(). */
} else if (args->state->control.size > 0 || args->state->control.rate_gauge) {
} else if (args->control->size > 0 || args->control->rate_gauge) {
/* Known size or rate gauge - percentage or rate. */
bytes = pv_formatter_progress_knownsize(args, content, sizeof(content), false, false, true);
} else {
+6 -8
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for the current rate of transfer.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -26,20 +26,18 @@ pvdisplay_bytecount_t pv_formatter_rate(pvformatter_args_t args)
return 0;
/*@-mustfreefresh@ */
if (args->state->control.numeric) {
if (args->control->numeric) {
/* numeric - raw value without suffix. */
(void) pv_snprintf(content, sizeof(content),
"%.4Lf",
((args->state->control.bits ? 8.0 : 1.0) * args->state->calc.transfer_rate));
} else if (args->state->control.bits && !args->state->control.linemode) {
"%.4Lf", ((args->control->bits ? 8.0 : 1.0) * args->calc->transfer_rate));
} else if (args->control->bits && !args->control->linemode) {
/* bits per second */
pv_describe_amount(content, sizeof(content), "[%s]",
8 * args->state->calc.transfer_rate, "", _("b/s"), args->display->count_type);
8 * args->calc->transfer_rate, "", _("b/s"), args->display->count_type);
} else {
/* bytes or lines per second */
pv_describe_amount(content, sizeof(content),
"[%s]", args->state->calc.transfer_rate, _("/s"), _("B/s"),
args->display->count_type);
"[%s]", args->calc->transfer_rate, _("/s"), _("B/s"), args->display->count_type);
}
/*@+mustfreefresh@ *//* splint: see above. */
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for ECMA-48 SGR codes.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -109,7 +109,7 @@ pvdisplay_bytecount_t pv_formatter_sgr(pvformatter_args_t args)
args->display->format_uses_colour = true;
if (!args->state->control.can_display_colour)
if (!args->status->terminal_supports_colour)
return 0;
if (NULL == args->segment->string_parameter)
return 0;
+16 -15
View File
@@ -1,7 +1,7 @@
/*
* Formatter function for the elapsed transfer time.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -17,6 +17,7 @@
pvdisplay_bytecount_t pv_formatter_timer(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - always bounded */
long double elapsed_seconds;
args->display->showing_timer = true;
@@ -25,22 +26,24 @@ pvdisplay_bytecount_t pv_formatter_timer(pvformatter_args_t args)
if (0 == args->buffer_size)
return 0;
elapsed_seconds = args->transfer->elapsed_seconds;
/*
* Bounds check, so we don't overrun the prefix buffer. This does
* mean that the timer will stop at a 100,000 hours, but since
* that's 11 years, it shouldn't be a problem.
*/
if (args->state->transfer.elapsed_seconds > (long double) 360000000.0L)
args->state->transfer.elapsed_seconds = (long double) 360000000.0L;
if (elapsed_seconds > (long double) 360000000.0L)
elapsed_seconds = (long double) 360000000.0L;
/* Also check it's not negative. */
if (args->state->transfer.elapsed_seconds < 0.0)
args->state->transfer.elapsed_seconds = 0.0;
if (elapsed_seconds < 0.0)
elapsed_seconds = 0.0;
if (args->state->control.numeric) {
if (args->control->numeric) {
/* Numeric mode - show the number of seconds, unformatted. */
(void) pv_snprintf(content, sizeof(content), "%.4Lf", args->state->transfer.elapsed_seconds);
} else if (args->state->transfer.elapsed_seconds > (long double) 86400.0L) {
(void) pv_snprintf(content, sizeof(content), "%.4Lf", elapsed_seconds);
} else if (elapsed_seconds > (long double) 86400.0L) {
/*
* If the elapsed time is more than a day, include a day count as
* well as hours, minutes, and seconds.
@@ -48,17 +51,15 @@ pvdisplay_bytecount_t pv_formatter_timer(pvformatter_args_t args)
(void) pv_snprintf(content,
sizeof(content),
"%ld:%02ld:%02ld:%02ld",
((long) (args->state->transfer.elapsed_seconds)) / 86400,
(((long) (args->state->transfer.elapsed_seconds)) / 3600) %
24, (((long) (args->state->transfer.elapsed_seconds)) / 60) % 60,
((long) (args->state->transfer.elapsed_seconds)) % 60);
((long) (elapsed_seconds)) / 86400,
(((long) (elapsed_seconds)) / 3600) %
24, (((long) (elapsed_seconds)) / 60) % 60, ((long) (elapsed_seconds)) % 60);
} else {
(void) pv_snprintf(content,
sizeof(content),
"%ld:%02ld:%02ld",
((long) (args->state->transfer.elapsed_seconds)) / 3600,
(((long) (args->state->transfer.elapsed_seconds)) / 60) % 60,
((long) (args->state->transfer.elapsed_seconds)) % 60);
((long) (elapsed_seconds)) / 3600,
(((long) (elapsed_seconds)) / 60) % 60, ((long) (elapsed_seconds)) % 60);
}
return pv_formatter_segmentcontent(content, args);
+710 -456
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* Functions for converting strings to numbers.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -160,7 +160,7 @@ off_t pv_getnum_size(const char *str, bool decimal_units)
fractional_part = fractional_part / fractional_divisor;
integral_part += fractional_part;
debug("%s [%s] = %ld", str, decimal_units ? "decimal" : "binary", integral_part);
debug("%s [%s] = %lld", str, decimal_units ? "decimal" : "binary", (long long) integral_part);
return integral_part;
}
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* Functions for setting the process title.
*
* Copyright 2024-2025 Andrew Wood
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -110,7 +110,7 @@ void setproctitle(const char *format, ...)
if (length > space_available - 2)
length = space_available - 2;
(void) pv_snprintf(base_argv[0], space_available, "%s -- %s", PACKAGE_NAME, title);
(void) pv_snprintf(base_argv[0], space_available, "%s", title);
if (space_available > length)
memset(base_argv[0] + length, 0, space_available - length);
}
+667
View File
@@ -0,0 +1,667 @@
/*
* Remote-control and remote-query functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#ifdef PV_REMOTE_CONTROL
/* Structure for transferring settings with --remote. */
struct remote_msg {
bool progress; /* progress bar flag */
bool timer; /* timer flag */
bool eta; /* ETA flag */
bool fineta; /* absolute ETA flag */
bool rate; /* rate counter flag */
bool average_rate; /* average rate counter flag */
bool bytes; /* bytes transferred flag */
bool bufpercent; /* transfer buffer percentage flag */
size_t lastwritten; /* last-written bytes count */
off_t rate_limit; /* rate limit, in bytes per second */
size_t buffer_size; /* buffer size, in bytes (0=default) */
off_t size; /* total size of data */
double interval; /* interval between updates */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
char name[256]; /* flawfinder: ignore */
char format[256]; /* flawfinder: ignore */
char extra_display[256]; /* flawfinder: ignore */
};
/* Structure for transferring transfer state with --query. */
struct query_msg {
long double elapsed_seconds; /* from state.transfer */
off_t transferred; /* from state.transfer */
off_t size; /* from state.control */
bool response; /* true if this is the response signal. */
};
/*
* flawfinder rationale: name, format, and extra_display are always
* explicitly zeroed and bounded to one less than their size so they are
* always \0 terminated.
*/
/*
* Set the options of a remote process by writing them to a file, sending a
* signal to the receiving process, and waiting for the message to be
* consumed by the remote process.
*
* Returns nonzero on error.
*/
int pv_remote_set(pvstate_t state, pid_t remote)
{
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
pid_t signal_sender;
long timeout;
bool received;
/*
* flawfinder rationale: buffer is large enough, explicitly zeroed,
* and always bounded properly as we are only writing to it with
* pv_snprintf().
*/
/*
* Check that the remote process exists.
*/
if (kill((pid_t) (remote), 0) != 0) {
pv_error("%u: %s", remote, strerror(errno));
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Copy parameters into message buffer.
*/
memset(&msgbuf, 0, sizeof(msgbuf));
msgbuf.progress = state->control.format_option.progress;
msgbuf.timer = state->control.format_option.timer;
msgbuf.eta = state->control.format_option.eta;
msgbuf.fineta = state->control.format_option.fineta;
msgbuf.rate = state->control.format_option.rate;
msgbuf.average_rate = state->control.format_option.average_rate;
msgbuf.bytes = state->control.format_option.bytes;
msgbuf.bufpercent = state->control.format_option.bufpercent;
msgbuf.lastwritten = state->control.format_option.lastwritten;
msgbuf.rate_limit = state->control.rate_limit;
msgbuf.buffer_size = state->control.target_buffer_size;
msgbuf.size = state->control.size;
msgbuf.interval = state->control.interval;
msgbuf.width = (unsigned int) (state->control.width);
msgbuf.height = (unsigned int) (state->control.height);
msgbuf.width_set_manually = state->control.width_set_manually;
msgbuf.height_set_manually = state->control.height_set_manually;
if (state->control.name != NULL) {
strncpy(msgbuf.name, state->control.name, sizeof(msgbuf.name) - 1); /* flawfinder: ignore */
}
if (state->control.format_string != NULL) {
strncpy(msgbuf.format, state->control.format_string, sizeof(msgbuf.format) - 1); /* flawfinder: ignore */
}
if (state->control.extra_display_spec != NULL) {
strncpy(msgbuf.extra_display, state->control.extra_display_spec, sizeof(msgbuf.extra_display) - 1); /* flawfinder: ignore */
}
/*
* Make sure parameters are within sensible bounds.
*/
if (msgbuf.width < 1)
msgbuf.width = 80;
if (msgbuf.height < 1)
msgbuf.height = 25;
if (msgbuf.width > 999999)
msgbuf.width = 999999;
if (msgbuf.height > 999999)
msgbuf.height = 999999;
if ((msgbuf.interval > 0) && (msgbuf.interval < 0.1))
msgbuf.interval = 0.1;
if (msgbuf.interval > 600)
msgbuf.interval = 600;
/*
* flawfinder rationale: name, format, and extra_display are
* explicitly bounded to 1 less than the size of their buffer and
* the buffer is \0 terminated by memset() earlier.
*/
/*
* Get the filename and file stream to use for remote control.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), (pid_t) getpid(), SIGUSR2, true);
if (NULL == control_fptr) {
pv_error("%s", strerror(errno));
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Write the message buffer to the remote control file, and close
* it.
*/
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_error("%s", strerror(errno));
(void) fclose(control_fptr);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
if (0 != fclose(control_fptr)) {
pv_error("%s", strerror(errno));
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Send a SIGUSR2 signal to the remote process, to tell it a message
* is ready to read, after clearing our own "SIGUSR2 received" flag.
*/
signal_sender = 0;
(void) pv_sigusr2_received(state, &signal_sender);
if (kill((pid_t) (remote), SIGUSR2) != 0) {
pv_error("%u: %s", remote, strerror(errno));
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
debug("%s", "message sent");
/*
* Wait for a signal from the remote process to say it has received
* the message.
*/
timeout = 1100000;
received = false;
while (timeout > 10000 && !received) {
struct timeval tv;
memset(&tv, 0, sizeof(tv));
tv.tv_sec = 0;
tv.tv_usec = 10000;
/*@-nullpass@ *//* splint: NULL is OK with select() */
(void) select(0, NULL, NULL, NULL, &tv);
/*@+nullpass@ */
timeout -= 10000;
if (pv_sigusr2_received(state, &signal_sender)) {
if (signal_sender == remote) {
debug("%s", "message received");
received = true;
}
}
}
/*
* Remove the remote control file.
*/
debug("%s: %s", "removing", control_filename);
if (0 != remove(control_filename)) {
pv_error("%s", strerror(errno));
}
/*
* Return 0 if the message was received.
*/
if (received)
return 0;
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory leak
* warnings, but in this case it's unavoidable, and mitigated by the
* fact we only translate each string once.
*/
pv_error("%u: %s", remote, _("message not received"));
return PV_ERROREXIT_REMOTE_OR_PID;
/*@+mustfreefresh @ */
}
/*
* Check for a --remote message (SIGUSR2), returning false if none was
* found.
*
* If a message was received, update the current process's options with the
* ones in the message.
*
* Note that this relies on pv_state_set_format() causing the output format
* to be reparsed.
*/
static bool pv__rxsignal_usr2(pvstate_t state)
{
pid_t signal_sender;
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
/* flawfinder rationale: as above. */
/*
* Return early if a SIGUSR2 signal has not been received.
*/
signal_sender = 0;
if (!pv_sigusr2_received(state, &signal_sender))
return false;
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), signal_sender, SIGUSR2, false);
if (NULL == control_fptr) {
pv_error("%s: %s", control_filename, strerror(errno));
return false;
}
/*
* Read the message buffer from the remote control file, and close
* it.
*/
if (1 != fread(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_error("%s", strerror(errno));
(void) fclose(control_fptr);
return false;
}
if (0 != fclose(control_fptr)) {
pv_error("%s", strerror(errno));
return false;
}
/*
* Send a SIGUSR2 signal to the sending process, to tell it the
* message has been received.
*/
if (kill(signal_sender, SIGUSR2) != 0) {
debug("%u: %s", signal_sender, strerror(errno));
}
debug("%s", "received remote control message");
pv_state_format_string_set(state, NULL);
pv_state_name_set(state, NULL);
pv_state_extra_display_set(state, NULL);
msgbuf.name[sizeof(msgbuf.name) - 1] = '\0';
msgbuf.format[sizeof(msgbuf.format) - 1] = '\0';
msgbuf.extra_display[sizeof(msgbuf.extra_display) - 1] = '\0';
pv_state_set_format(state, msgbuf.progress, msgbuf.timer,
msgbuf.eta, msgbuf.fineta, msgbuf.rate,
msgbuf.average_rate,
msgbuf.bytes, msgbuf.bufpercent,
msgbuf.lastwritten, '\0' == msgbuf.name[0] ? NULL : msgbuf.name);
if (msgbuf.rate_limit > 0)
pv_state_rate_limit_set(state, msgbuf.rate_limit);
if (msgbuf.buffer_size > 0) {
pv_state_target_buffer_size_set(state, msgbuf.buffer_size);
}
if (msgbuf.size > 0)
pv_state_size_set(state, msgbuf.size);
if (msgbuf.interval > 0)
pv_state_interval_set(state, msgbuf.interval);
if (msgbuf.width > 0 && msgbuf.width_set_manually)
pv_state_width_set(state, msgbuf.width, msgbuf.width_set_manually);
if (msgbuf.height > 0 && msgbuf.height_set_manually)
pv_state_height_set(state, msgbuf.height, msgbuf.height_set_manually);
if (msgbuf.format[0] != '\0')
pv_state_format_string_set(state, msgbuf.format);
if (msgbuf.extra_display[0] != '\0')
pv_state_extra_display_set(state, msgbuf.extra_display);
return true;
}
/*
* Check for a --query message (SIGUSR1).
*
* If a type 0 message was received (query), then write a type 1 (response)
* message to the control file and send a SIGUSR1 to the sending process.
*
* If a type 1 message was received (response), update the state from the
* message in the control file.
*
* In both cases, the receiver of the message deletes its control file.
*
* The state transferred by message is transfer.elapsed_seconds,
* transfer.transferred, and control.size.
*
* Returns true if a signal was received and dealt with, false otherwise.
*
* If match_sender is not zero, then ignores the signal and returns false if
* the sending PID is not match_sender.
*/
static bool pv__rxsignal_usr1(pvstate_t state, pid_t match_sender)
{
pid_t signal_sender;
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct query_msg msgbuf;
/* flawfinder rationale: as above. */
/*
* Return early if a SIGUSR1 signal has not been received.
*/
signal_sender = 0;
if (!pv_sigusr1_received(state, &signal_sender))
return false;
/*
* If match_sender was specified, ignore the signal if the sender
* doesn't match.
*/
if ((0 != match_sender) && (signal_sender != match_sender)) {
debug("%s=%d, %s=%d - %s", "match_sender", match_sender, "signal_sender", signal_sender,
"ignoring USR1");
return false;
}
/*
* Note that we use debug() rather than pv_error() here so that the
* display of a running pv doesn't get interrupted by, for example,
* a querying pv being terminated.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), signal_sender, SIGUSR1, false);
if (NULL == control_fptr) {
debug("%s: %s", control_filename, strerror(errno));
return false;
}
/*
* Read the message buffer from the remote control file, close it,
* and delete it.
*/
if (1 != fread(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
debug("fread: %s", strerror(errno));
(void) fclose(control_fptr);
return false;
}
if (0 != fclose(control_fptr)) {
debug("fclose: %s", strerror(errno));
return false;
}
debug("%s: %s", "removing", control_filename);
if (0 != remove(control_filename)) {
debug("remove: %s", strerror(errno));
return false;
}
if (msgbuf.response) {
/* Response message - update local state. */
debug("%s: %d [%Lg, %ld, %ld]", "query response received", signal_sender, msgbuf.elapsed_seconds,
msgbuf.transferred, msgbuf.size);
state->transfer.elapsed_seconds = msgbuf.elapsed_seconds;
state->transfer.transferred = msgbuf.transferred;
state->control.size = msgbuf.size;
return true;
}
/* Query message - transmit state to sender. */
debug("%s: %d", "query received", signal_sender);
msgbuf.elapsed_seconds = state->transfer.elapsed_seconds;
msgbuf.transferred = state->transfer.transferred;
msgbuf.size = state->control.size;
msgbuf.response = true;
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), (pid_t) getpid(), SIGUSR1, true);
if (NULL == control_fptr) {
debug("%s", strerror(errno));
return true; /* true since the signal was received. */
}
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
debug("fwrite: %s", strerror(errno));
(void) fclose(control_fptr);
(void) remove(control_filename);
return true; /* as above. */
}
if (0 != fclose(control_fptr)) {
debug("fclose: %s", strerror(errno));
(void) remove(control_filename);
return true;
}
/*
* Send a SIGUSR1 signal to the remote process, to tell it this
* query response message is ready to read.
*/
if (kill((pid_t) (signal_sender), SIGUSR1) != 0) {
debug("%u: %s", signal_sender, strerror(errno));
(void) remove(control_filename);
return true;
}
debug("%s: %d", "query response sent", signal_sender);
return true;
}
/*
* Check for remote control messages. For a SIGUSR2 (--remote), replace the
* current process's options with those being passed in. For a SIGUSR1
* (--query), either receive transfer state from the sending process, or
* send our transfer state to the sending process, depending on the content
* of the message.
*
* NB --remote relies on pv_state_set_format() causing the output format to
* be reparsed.
*
* Returns true if a --remote message was received, false otherwise.
*/
bool pv_remote_check(pvstate_t state)
{
bool received_remote;
received_remote = pv__rxsignal_usr2(state);
(void) pv__rxsignal_usr1(state, 0);
return received_remote;
}
/*
* Replace the transfer state with that of the given process, including the
* total transfer size. If sizeptr is not NULL, the size is also copied to
* *sizeptr (this is so a caller can get the size without knowing the
* structure of pvstate_t).
*
* Returns nonzero on error. If "silent" is false, reports the error.
*/
int pv_remote_transferstate_fetch(pvstate_t state, pid_t query, /*@null@ */ off_t *sizeptr, bool silent)
{
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct query_msg msgbuf;
pid_t signal_sender;
long timeout;
bool received;
/*
* flawfinder rationale: buffer is large enough, explicitly zeroed,
* and always bounded properly as we are only writing to it with
* pv_snprintf().
*/
/*
* Check that the remote process exists.
*/
if (kill((pid_t) (query), 0) != 0) {
if (!silent)
pv_error("%u: %s", query, strerror(errno));
return PV_ERROREXIT_REMOTE_OR_PID;
}
/* Set up the query message. */
memset(&msgbuf, 0, sizeof(msgbuf));
msgbuf.response = false;
/*
* Get the filename and file stream to use.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), (pid_t) getpid(), SIGUSR1, true);
if (NULL == control_fptr) {
if (!silent)
pv_error("%s", strerror(errno));
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Write the message to the control file, and close it.
*/
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
if (!silent)
pv_error("%s", strerror(errno));
(void) fclose(control_fptr);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
if (0 != fclose(control_fptr)) {
if (!silent)
pv_error("%s", strerror(errno));
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Send a SIGUSR1 signal to the remote process, to tell it a query
* message is ready, after first clearing our own SIGUSR1 received
* flag.
*/
signal_sender = 0;
(void) pv_sigusr1_received(state, &signal_sender);
if (kill((pid_t) (query), SIGUSR1) != 0) {
if (!silent)
pv_error("%u: %s", query, strerror(errno));
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
debug("%s: %d", "query sent", query);
/*
* Wait for a SIGUSR1 signal to be sent back with a query response
* message.
*/
timeout = 1100000;
received = false;
while (timeout > 10000 && !received && 0 == state->flags.trigger_exit) {
struct timeval tv;
memset(&tv, 0, sizeof(tv));
tv.tv_sec = 0;
tv.tv_usec = 10000;
/*@-nullpass@ *//* splint: NULL is OK with select() */
(void) select(0, NULL, NULL, NULL, &tv);
/*@+nullpass@ */
timeout -= 10000;
if (pv__rxsignal_usr1(state, query)) {
debug("%s", "response received");
received = true;
if (NULL != sizeptr)
*sizeptr = state->control.size;
}
}
/*
* Remove the control file in case it still exists - the other
* process should have removed it.
*/
debug("%s: %s", "cleaning up", control_filename);
(void) remove(control_filename);
/*
* Return 0 if the message was received.
*/
if (received)
return 0;
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory leak
* warnings, but in this case it's unavoidable, and mitigated by the
* fact we only translate each string once.
*/
if (!silent)
pv_error("%u: %s", query, _("message not received"));
return PV_ERROREXIT_REMOTE_OR_PID;
/*@+mustfreefresh @ */
}
#else /* !PV_REMOTE_CONTROL */
/*
* Dummy stubs for remote control when we don't have PV_REMOTE_CONTROL.
*/
bool pv_remote_check( /*@unused@ */ __attribute__((unused)) pvstate_t state)
{
}
int pv_remote_set( /*@unused@ */
__attribute__((unused)) pvstate_t state, /*@unused@ */ __attribute__((unused)) pid_t remote)
{
/*@-mustfreefresh@ *//* splint - see above */
pv_error("%s", _("SA_SIGINFO not supported on this system"));
/*@+mustfreefresh@ */
return PV_ERROREXIT_REMOTE_OR_PID;
}
int pv_remote_transferstate_fetch( /*@unused@ */
__attribute__((unused)) pvstate_t state,
/*@unused@ */
__attribute__((unused)) pid_t query,
/*@null@ */
/*@unused@ */
__attribute__((unused)) off_t *sizeptr,
/*@unused@ */
__attribute__((unused))
bool silent)
{
/*@-mustfreefresh@ *//* splint - see above */
fprintf(stderr, "%s\n", _("SA_SIGINFO not supported on this system"));
/*@+mustfreefresh@ */
return PV_ERROREXIT_REMOTE_OR_PID;
}
#endif /* PV_REMOTE_CONTROL */
+120 -42
View File
@@ -1,7 +1,7 @@
/*
* Signal handling functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -19,7 +19,7 @@
#include <fcntl.h>
#ifdef HAVE_IPC
void pv_crs_needreinit(pvstate_t);
void pv_crs_needreinit(pvcursorstate_t);
#endif
/*@null@*/ static pvstate_t pv_sig_state = NULL;
@@ -43,7 +43,7 @@ static void pv_sig_ensure_tty_tostop()
return;
/* Can't look at terminal flags if backgrounded. */
if (1 == pv_sig_state->flag.suspend_stderr)
if (1 == pv_sig_state->flags.suspend_stderr)
return;
if (0 != tcgetattr(STDERR_FILENO, &terminal_attributes)) {
@@ -52,13 +52,13 @@ static void pv_sig_ensure_tty_tostop()
}
/* Can't set terminal flags if backgrounded. */
if (1 == pv_sig_state->flag.suspend_stderr)
if (1 == pv_sig_state->flags.suspend_stderr)
return;
if (0 == (terminal_attributes.c_lflag & TOSTOP)) {
terminal_attributes.c_lflag |= TOSTOP;
if (0 == tcsetattr(STDERR_FILENO, TCSANOW, &terminal_attributes)) {
pv_sig_state->flag.clear_tty_tostop_on_exit = 1;
pv_sig_state->flags.clear_tty_tostop_on_exit = 1;
debug("%s", "set terminal TOSTOP attribute");
#if HAVE_IPC
/*
@@ -95,11 +95,11 @@ static void pv_sig_ttou( /*@unused@ */ __attribute__((unused))
if (NULL == pv_sig_state)
return;
if (1 != pv_sig_state->flag.suspend_stderr) {
if (1 != pv_sig_state->flags.suspend_stderr) {
debug("%s", "SIGTTOU - suspending stderr");
pv_sig_state->flag.suspend_stderr = 1;
pv_sig_state->flags.suspend_stderr = 1;
/* Also tell the SIGCONT handler to do nothing next time. */
pv_sig_state->flag.skip_next_sigcont++;
pv_sig_state->flags.skip_next_sigcont++;
/* Raise an immediate SIGCONT to bring the rest of the pipeline back up. */
/*@-unrecog@ *//* splint doesn't know about killpg() */
if (0 != killpg(getpgrp(), SIGCONT)) {
@@ -121,7 +121,7 @@ static void pv_sig_tstp( /*@unused@ */ __attribute__((unused))
{
if (NULL == pv_sig_state)
return;
pv_elapsedtime_read(&(pv_sig_state->signal.tstp_time));
pv_elapsedtime_read(&(pv_sig_state->signal.when_tstp_arrived));
if (0 != raise(SIGSTOP)) {
debug("%s: %s", "raise", strerror(errno));
}
@@ -142,25 +142,25 @@ static void pv_sig_cont( /*@unused@ */ __attribute__((unused))
if (NULL == pv_sig_state)
return;
if (pv_sig_state->flag.skip_next_sigcont > 0) {
if (pv_sig_state->flags.skip_next_sigcont > 0) {
debug("%s: %d", "SIGCONT received but ignored - current value of skip_next_sigcont",
pv_sig_state->flag.skip_next_sigcont);
pv_sig_state->flag.skip_next_sigcont--;
pv_sig_state->flags.skip_next_sigcont);
pv_sig_state->flags.skip_next_sigcont--;
return;
} else if (pv_sig_state->flag.skip_next_sigcont < 0) {
pv_sig_state->flag.skip_next_sigcont = 0;
} else if (pv_sig_state->flags.skip_next_sigcont < 0) {
pv_sig_state->flags.skip_next_sigcont = 0;
debug("%s", "skip_next_sigcont underrun cleared");
}
debug("%s: %d", "SIGCONT received - current value of suspend_stderr", pv_sig_state->flag.suspend_stderr);
debug("%s: %d", "SIGCONT received - current value of suspend_stderr", pv_sig_state->flags.suspend_stderr);
pv_sig_state->flag.terminal_resized = 1;
pv_sig_state->flags.terminal_resized = 1;
/*
* We can only make the time adjustments if this SIGCONT followed a
* SIGTSTP such that we have a stop time.
*/
if (0 != pv_sig_state->signal.tstp_time.tv_sec) {
if (0 != pv_sig_state->signal.when_tstp_arrived.tv_sec) {
memset(&current_time, 0, sizeof(current_time));
memset(&time_spent_stopped, 0, sizeof(time_spent_stopped));
@@ -168,33 +168,63 @@ static void pv_sig_cont( /*@unused@ */ __attribute__((unused))
pv_elapsedtime_read(&current_time);
/* time spent stopped = current time - time SIGTSTP received */
pv_elapsedtime_subtract(&time_spent_stopped, &current_time, &(pv_sig_state->signal.tstp_time));
pv_elapsedtime_subtract(&time_spent_stopped, &current_time, &(pv_sig_state->signal.when_tstp_arrived));
/* add time spent stopped the total stopped-time count */
pv_elapsedtime_add(&(pv_sig_state->signal.toffset), &(pv_sig_state->signal.toffset),
&time_spent_stopped);
pv_elapsedtime_add(&(pv_sig_state->signal.total_stoppage_time),
&(pv_sig_state->signal.total_stoppage_time), &time_spent_stopped);
/* In watchfd mode, update the stoppage time of all watched fds. */
if (pv_sig_state->watchfd.count > 0 && NULL != pv_sig_state->watchfd.watching) {
unsigned int watch_idx;
for (watch_idx = 0; watch_idx < pv_sig_state->watchfd.count; watch_idx++) {
int info_idx;
if (pv_sig_state->watchfd.watching[watch_idx].finished)
continue;
if (NULL == pv_sig_state->watchfd.watching[watch_idx].info_array)
continue;
for (info_idx = 0; info_idx < pv_sig_state->watchfd.watching[watch_idx].array_length;
info_idx++) {
pvwatchfd_t info_item =
&(pv_sig_state->watchfd.watching[watch_idx].info_array[info_idx]);
if (info_item->unused)
continue;
if (!info_item->displayable)
continue;
pv_elapsedtime_add(&(info_item->total_stoppage_time),
&(info_item->total_stoppage_time), &time_spent_stopped);
}
}
}
/* reset the SIGTSTP receipt time */
pv_elapsedtime_zero(&(pv_sig_state->signal.tstp_time));
pv_elapsedtime_zero(&(pv_sig_state->signal.when_tstp_arrived));
}
/*
* Try resuming our use of stderr, if we had suspended it, but only
* if we're now in the foreground.
*/
if (1 == pv_sig_state->flag.suspend_stderr) {
if (1 == pv_sig_state->flags.suspend_stderr) {
if (pv_in_foreground()) {
debug("%s", "SIGCONT - resuming stderr");
pv_sig_state->flag.suspend_stderr = 0;
pv_sig_state->flags.suspend_stderr = 0;
} else {
debug("%s", "SIGCONT but still in background - not resuming stderr");
}
}
if (0 == pv_sig_state->flag.suspend_stderr) {
if (0 == pv_sig_state->flags.suspend_stderr) {
pv_sig_ensure_tty_tostop();
#ifdef HAVE_IPC
pv_crs_needreinit(pv_sig_state);
pv_crs_needreinit(&(pv_sig_state->cursor));
#endif
}
}
@@ -209,7 +239,7 @@ static void pv_sig_winch( /*@unused@ */ __attribute__((unused))
{
if (NULL == pv_sig_state)
return;
pv_sig_state->flag.terminal_resized = 1;
pv_sig_state->flags.terminal_resized = 1;
}
#endif
@@ -222,7 +252,7 @@ static void pv_sig_term( /*@unused@ */ __attribute__((unused))
{
if (NULL == pv_sig_state)
return;
pv_sig_state->flag.trigger_exit = 1;
pv_sig_state->flags.trigger_exit = 1;
}
@@ -232,14 +262,14 @@ static void pv_sig_term( /*@unused@ */ __attribute__((unused))
* the sending PID.
*/
static void pv_sig_usr2( /*@unused@ */ __attribute__((unused))
int sig, siginfo_t * info, /*@unused@ */ __attribute__((unused))
int sig, siginfo_t *info, /*@unused@ */ __attribute__((unused))
void *ucontext)
{
if (NULL == pv_sig_state)
return;
if (NULL == info)
return;
pv_sig_state->signal.sender = info->si_pid;
pv_sig_state->signal.sender_usr2 = info->si_pid;
pv_sig_state->signal.rxusr2 = 1;
}
@@ -248,19 +278,53 @@ static void pv_sig_usr2( /*@unused@ */ __attribute__((unused))
* Return true if a SIGUSR2 signal has been received since the last time
* this function was called, populating *pid with the sending PID if so.
*/
bool pv_sigusr2_received(pvstate_t state, pid_t * pid)
bool pv_sigusr2_received(pvstate_t state, pid_t *pid)
{
if (NULL == state)
return false;
if (0 == state->signal.rxusr2)
return false;
if (NULL != pid)
*pid = state->signal.sender;
*pid = state->signal.sender_usr2;
state->signal.rxusr2 = 0;
return true;
}
#endif
/*
* Handle a SIGUSR1 by setting a flag to say we received it, after recording
* the sending PID.
*/
static void pv_sig_usr1( /*@unused@ */ __attribute__((unused))
int sig, siginfo_t *info, /*@unused@ */ __attribute__((unused))
void *ucontext)
{
if (NULL == pv_sig_state)
return;
if (NULL == info)
return;
pv_sig_state->signal.sender_usr1 = info->si_pid;
pv_sig_state->signal.rxusr1 = 1;
}
/*
* Return true if a SIGUSR1 signal has been received since the last time
* this function was called, populating *pid with the sending PID if so.
*/
bool pv_sigusr1_received(pvstate_t state, pid_t *pid)
{
if (NULL == state)
return false;
if (0 == state->signal.rxusr1)
return false;
if (NULL != pid)
*pid = state->signal.sender_usr1;
state->signal.rxusr1 = 0;
return true;
}
#endif /* PV_REMOTE_CONTROL */
/*
@@ -297,9 +361,9 @@ void pv_sig_init(pvstate_t state)
pv_sig_state = state;
pv_sig_state->flag.suspend_stderr = 0;
pv_elapsedtime_zero(&(pv_sig_state->signal.tstp_time));
pv_elapsedtime_zero(&(pv_sig_state->signal.toffset));
pv_sig_state->flags.suspend_stderr = 0;
pv_elapsedtime_zero(&(pv_sig_state->signal.when_tstp_arrived));
pv_elapsedtime_zero(&(pv_sig_state->signal.total_stoppage_time));
/*
* Note that we cast all sigemptyset() and sigaction() return values
@@ -320,7 +384,7 @@ void pv_sig_init(pvstate_t state)
* Handle SIGTTOU by continuing with output switched off, so that we
* can be stopped and backgrounded without messing up the terminal.
*/
pv_sig_state->flag.skip_next_sigcont = 0;
pv_sig_state->flags.skip_next_sigcont = 0;
sa.sa_handler = pv_sig_ttou;
(void) sigemptyset(&(sa.sa_mask));
sa.sa_flags = 0;
@@ -388,7 +452,20 @@ void pv_sig_init(pvstate_t state)
/*@+unrecog@ */
(void) sigaction(SIGUSR2, &sa, &(pv_sig_state->signal.old_sigusr2));
memset(&sa, 0, sizeof(sa));
#endif
/*
* Handle SIGUSR1 by setting a flag to say the signal has been
* received, and storing the sending process's PID.
*/
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = pv_sig_usr1;
(void) sigemptyset(&(sa.sa_mask));
/*@-unrecog@ *//* splint doesn't know about SA_SIGINFO */
sa.sa_flags = SA_SIGINFO;
/*@+unrecog@ */
(void) sigaction(SIGUSR1, &sa, &(pv_sig_state->signal.old_sigusr1));
memset(&sa, 0, sizeof(sa));
#endif /* PV_REMOTE_CONTROL */
/*
* Ensure that the TOSTOP terminal attribute is set, so that a
@@ -433,10 +510,11 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
(void) sigaction(SIGTERM, &(pv_sig_state->signal.old_sigterm), NULL);
#ifdef PV_REMOTE_CONTROL
(void) sigaction(SIGUSR2, &(pv_sig_state->signal.old_sigusr2), NULL);
(void) sigaction(SIGUSR1, &(pv_sig_state->signal.old_sigusr1), NULL);
#endif
(void) sigaction(SIGALRM, &(pv_sig_state->signal.old_sigalrm), NULL);
need_to_clear_tostop = (1 == pv_sig_state->flag.clear_tty_tostop_on_exit) ? true : false;
need_to_clear_tostop = (1 == pv_sig_state->flags.clear_tty_tostop_on_exit) ? true : false;
if (pv_sig_state->control.cursor) {
#ifdef HAVE_IPC
@@ -477,7 +555,7 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
}
}
pv_sig_state->flag.clear_tty_tostop_on_exit = 0;
pv_sig_state->flags.clear_tty_tostop_on_exit = 0;
}
}
@@ -537,17 +615,17 @@ void pv_sig_checkbg(void)
next_check = time(NULL) + 1;
if (0 == pv_sig_state->flag.suspend_stderr)
if (0 == pv_sig_state->flags.suspend_stderr)
return;
if (!pv_in_foreground())
return;
debug("%s: %s", "pv_sig_checkbg", "attempting to resume stderr");
pv_sig_state->flag.suspend_stderr = 0;
pv_sig_state->flags.suspend_stderr = 0;
pv_sig_ensure_tty_tostop();
#ifdef HAVE_IPC
pv_crs_needreinit(pv_sig_state);
pv_crs_needreinit(&(pv_sig_state->cursor));
#endif
}
+362 -139
View File
@@ -1,7 +1,7 @@
/*
* State management functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -21,29 +21,140 @@
#include <fcntl.h>
/* alloc / realloc history buffer */
static void pv_alloc_history(pvstate_t state)
/*
* Allocate or reallocate the history buffer for calculating average
* transfer rate.
*/
static void pv_alloc_calc_history(pvtransfercalc_t calc)
{
if (NULL != state->calc.history)
free(state->calc.history);
state->calc.history = NULL;
if (NULL != calc->history)
free(calc->history);
calc->history = NULL;
state->calc.history = calloc((size_t) (state->calc.history_len), sizeof(state->calc.history[0]));
if (NULL == state->calc.history) {
calc->history = calloc((size_t) (calc->history_len), sizeof(calc->history[0]));
if (NULL == calc->history) {
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory
* leak warnings, but in this case it's unavoidable, and
* mitigated by the fact we only translate each string once.
*/
fprintf(stderr, "%s: %s: %s\n", state->status.program_name,
_("history structure allocation failed"), strerror(errno));
pv_error("%s: %s", _("history structure allocation failed"), strerror(errno));
/*@+mustfreefresh@ */
return;
}
state->calc.history_first = state->calc.history_last = 0;
state->calc.history[0].elapsed_sec = 0.0; /* to be safe, memset() not recommended for doubles */
calc->history_first = calc->history_last = 0;
calc->history[0].elapsed_sec = 0.0; /* to be safe, memset() not recommended for doubles */
}
/*
* Set the "calc" state sub-structure's history length appropriately for the
* given average rate window setting, allocate an appropriate history, and
* return the appropriate history interval to use.
*/
unsigned int pv_update_calc_average_rate_window(pvtransfercalc_t calc, unsigned int val)
{
unsigned int history_interval;
if (val < 1)
val = 1;
if (val >= 20) {
calc->history_len = (size_t) (val / 5 + 1);
history_interval = 5;
} else {
calc->history_len = (size_t) (val + 1);
history_interval = 1;
}
pv_alloc_calc_history(calc);
return history_interval;
}
/*
* Clear the "calc" part of a state structure.
*/
void pv_reset_calc(pvtransfercalc_t calc)
{
if (NULL == calc)
return;
/*
* Explicitly set important floating point values to 0, as memset()
* is not recommended for this.
*/
calc->transfer_rate = 0.0;
calc->average_rate = 0.0;
calc->prev_elapsed_sec = 0.0;
calc->prev_rate = 0.0;
calc->prev_trans = 0.0;
calc->current_avg_rate = 0.0;
calc->rate_min = 0.0;
calc->rate_max = 0.0;
calc->rate_sum = 0.0;
calc->ratesquared_sum = 0.0;
calc->measurements_taken = 0;
calc->prev_transferred = 0;
calc->percentage = 0.0;
calc->history_first = calc->history_last = 0;
if (NULL != calc->history) {
calc->history[0].elapsed_sec = 0.0;
}
}
/*
* Clear the "transfer" part of a state structure.
*/
void pv_reset_transfer(pvtransferstate_t transfer)
{
if (NULL == transfer)
return;
transfer->elapsed_seconds = 0.0;
transfer->read_position = 0;
transfer->write_position = 0;
transfer->to_write = 0;
transfer->written = 0;
transfer->total_bytes_read = 0;
transfer->total_written = 0;
transfer->written_but_not_consumed = 0;
transfer->read_errors_in_a_row = 0;
transfer->last_read_skip_fd = 0;
#ifdef HAVE_SPLICE
transfer->splice_failed_fd = -1;
#endif /* HAVE_SPLICE */
transfer->line_positions_length = 0;
transfer->line_positions_head = 0;
transfer->last_output_position = 0;
transfer->output_not_seekable = false;
}
/*
* Reset the calculated parts of the "flags" state structure.
*/
void pv_reset_flags(pvtransientflags_t flags)
{
if (NULL == flags)
return;
flags->reparse_display = 1;
}
/*
* Reset the calculated parts of a "display" state structure.
*/
void pv_reset_display(pvdisplay_t display)
{
if (NULL == display)
return;
display->initial_offset = 0;
display->output_produced = false;
}
@@ -55,60 +166,21 @@ void pv_state_reset(pvstate_t state)
if (NULL == state)
return;
state->flag.reparse_display = 1;
pv_reset_flags(&(state->flags));
state->status.current_input_file = -1;
state->display.initial_offset = 0;
state->display.display_visible = false;
pv_reset_display(&(state->display));
pv_reset_display(&(state->extra_display));
state->extra_display.initial_offset = 0;
state->extra_display.display_visible = false;
/*
* Explicitly set important floating point values to 0, as memset()
* is not recommended for this.
*/
state->calc.transfer_rate = 0.0;
state->calc.average_rate = 0.0;
state->calc.prev_elapsed_sec = 0.0;
state->calc.prev_rate = 0.0;
state->calc.prev_trans = 0.0;
state->calc.current_avg_rate = 0.0;
state->calc.rate_min = 0.0;
state->calc.rate_max = 0.0;
state->calc.rate_sum = 0.0;
state->calc.ratesquared_sum = 0.0;
state->calc.measurements_taken = 0;
state->calc.prev_transferred = 0;
state->calc.percentage = 0.0;
state->calc.history_first = state->calc.history_last = 0;
if (NULL != state->calc.history) {
state->calc.history[0].elapsed_sec = 0.0;
}
state->transfer.elapsed_seconds = 0.0;
state->transfer.read_position = 0;
state->transfer.write_position = 0;
state->transfer.to_write = 0;
state->transfer.written = 0;
state->transfer.total_written = 0;
state->transfer.written_but_not_consumed = 0;
state->transfer.read_errors_in_a_row = 0;
state->transfer.last_read_skip_fd = 0;
#ifdef HAVE_SPLICE
state->transfer.splice_failed_fd = -1;
#endif /* HAVE_SPLICE */
state->transfer.line_positions_length = 0;
state->transfer.line_positions_head = 0;
state->transfer.last_output_position = 0;
pv_reset_calc(&(state->calc));
pv_reset_transfer(&(state->transfer));
}
/*
* Create a new state structure, and return it, or 0 (NULL) on error.
*/
pvstate_t pv_state_alloc(const char *program_name)
pvstate_t pv_state_alloc(void)
{
pvstate_t state;
@@ -117,19 +189,7 @@ pvstate_t pv_state_alloc(const char *program_name)
return NULL;
memset(state, 0, sizeof(*state));
/* splint 3.1.2 thinks this is required for some reason. */
if (NULL != state->status.program_name) {
free(state->status.program_name);
}
state->status.program_name = pv_strdup(program_name);
if (NULL == state->status.program_name) {
free(state);
return NULL;
}
state->control.watch_pid = 0;
state->control.watch_fd = -1;
state->watchfd.count = 0;
state->control.output_fd = -1;
#ifdef HAVE_IPC
state->cursor.shmid = -1;
@@ -157,6 +217,111 @@ pvstate_t pv_state_alloc(const char *program_name)
}
/*
* Free dynamic contents of a display structure.
*/
void pv_freecontents_display(pvdisplay_t display)
{
if (NULL != display->display_buffer)
free(display->display_buffer);
display->display_buffer = NULL;
}
/*
* Free dynamic contents of a transfer state structure.
*/
void pv_freecontents_transfer(pvtransferstate_t transfer)
{
/*@-keeptrans@ */
if (NULL != transfer->transfer_buffer)
free(transfer->transfer_buffer);
transfer->transfer_buffer = NULL;
/*@+keeptrans@ */
/* splint - explicitly freeing this structure, so free() here is OK. */
if (NULL != transfer->line_positions)
free(transfer->line_positions);
transfer->line_positions = NULL;
}
/*
* Free dynamic contents of a calculated transfer state structure.
*/
void pv_freecontents_calc(pvtransfercalc_t calc)
{
if (NULL != calc->history)
free(calc->history);
calc->history = NULL;
}
/*
* Free the contents of a watchfd watched-items array.
*/
void pv_freecontents_watchfd_items(struct pvwatcheditem_s *watching, unsigned int count)
{
unsigned int watch_idx;
if (NULL == watching)
return;
/*@-compdestroy@ */
for (watch_idx = 0; watch_idx < count; watch_idx++) {
int info_idx;
if (NULL == watching[watch_idx].info_array)
continue;
for (info_idx = 0; info_idx < watching[watch_idx].array_length; info_idx++) {
pv_freecontents_watchfd(&(watching[watch_idx].info_array[info_idx]));
}
free(watching[watch_idx].info_array);
watching[watch_idx].info_array = NULL;
watching[watch_idx].array_length = 0;
}
return;
/*@+compdestroy @ */
/*
* splint warns that watching[].info_array->transfer.transfer_buffer
* and other deep structures may not be deallocated and so leak
* memory, but that's what pv_freecontents_watchfd() takes care of.
*/
}
/*
* Truncate the output file descriptor to its current position, if it's a
* valid fd, we're in sparse output mode, and no lseek() failed.
*/
static void pv_truncate_output(pvstate_t state)
{
off_t current_offset;
if (!state->control.sparse_output)
return;
if (state->transfer.output_not_seekable)
return;
if (state->control.output_fd < 0)
return;
current_offset = (off_t) lseek(state->control.output_fd, (off_t) 0, SEEK_CUR);
if (current_offset == (off_t) - 1)
return;
debug("%s: %ld", "truncating to current offset", (long) current_offset);
/*@+longintegral@ */
/*
* splint has trouble with off_t / __off_t.
*/
if (0 != ftruncate(state->control.output_fd, current_offset)) {
debug("%s: %s", "output ftruncate() failed", strerror(errno));
}
/*@-longintegral@ */
}
/*
* Free a state structure, after which it can no longer be used.
*/
@@ -170,11 +335,12 @@ void pv_state_free(pvstate_t state)
* still know the program name and output filename.
*/
if (state->control.output_fd >= 0) {
pv_truncate_output(state);
if (STDOUT_FILENO != state->control.output_fd) {
if (close(state->control.output_fd) < 0) {
fprintf(stderr, "%s: %s: %s\n", state->status.program_name,
NULL == state->control.output_name ? "(null)" : state->control.output_name,
strerror(errno));
pv_error("%s: %s",
NULL == state->control.output_name ? "(null)" : state->control.output_name,
strerror(errno));
}
}
state->control.output_fd = -1;
@@ -185,17 +351,8 @@ void pv_state_free(pvstate_t state)
state->control.output_name = NULL;
}
if (NULL != state->status.program_name)
free(state->status.program_name);
state->status.program_name = NULL;
if (NULL != state->display.display_buffer)
free(state->display.display_buffer);
state->display.display_buffer = NULL;
if (NULL != state->extra_display.display_buffer)
free(state->extra_display.display_buffer);
state->extra_display.display_buffer = NULL;
pv_freecontents_display(&(state->display));
pv_freecontents_display(&(state->extra_display));
if (NULL != state->control.name) {
free(state->control.name);
@@ -212,25 +369,19 @@ void pv_state_free(pvstate_t state)
state->control.format_string = NULL;
}
if (NULL != state->control.extra_display_spec) {
free(state->control.extra_display_spec);
state->control.extra_display_spec = NULL;
}
if (NULL != state->control.extra_format_string) {
free(state->control.extra_format_string);
state->control.extra_format_string = NULL;
}
/*@-keeptrans@ */
if (NULL != state->transfer.transfer_buffer)
free(state->transfer.transfer_buffer);
state->transfer.transfer_buffer = NULL;
/*@+keeptrans@ */
/* splint - explicitly freeing this structure, so free() here is OK. */
pv_freecontents_transfer(&(state->transfer));
if (NULL != state->transfer.line_positions)
free(state->transfer.line_positions);
state->transfer.line_positions = NULL;
if (NULL != state->calc.history)
free(state->calc.history);
state->calc.history = NULL;
pv_freecontents_calc(&(state->calc));
if (NULL != state->files.filename) {
unsigned int file_idx;
@@ -244,6 +395,12 @@ void pv_state_free(pvstate_t state)
state->files.filename = NULL;
}
if (NULL != state->watchfd.watching) {
pv_freecontents_watchfd_items(state->watchfd.watching, state->watchfd.count);
free(state->watchfd.watching);
state->watchfd.watching = NULL;
}
free(state);
return;
@@ -262,6 +419,16 @@ void pv_state_set_format(pvstate_t state, bool progress, bool timer, bool eta, b
(void) pv_strlcat(state->control.default_format, y, sizeof(state->control.default_format)); \
}
state->control.format_option.progress = progress;
state->control.format_option.timer = timer;
state->control.format_option.eta = eta;
state->control.format_option.fineta = fineta;
state->control.format_option.rate = rate;
state->control.format_option.average_rate = average_rate;
state->control.format_option.bytes = bytes;
state->control.format_option.bufpercent = bufpercent;
state->control.format_option.lastwritten = lastwritten;
state->control.default_format[0] = '\0';
if (false == state->control.numeric) {
@@ -316,7 +483,7 @@ void pv_state_set_format(pvstate_t state, bool progress, bool timer, bool eta, b
state->control.name = pv_strdup(name);
/* Tell pv_format() that the format has changed. */
state->flag.reparse_display = 1;
state->flags.reparse_display = 1;
}
@@ -406,6 +573,11 @@ void pv_state_direct_io_set(pvstate_t state, bool val)
state->control.direct_io_changed = true;
}
void pv_state_sparse_output_set(pvstate_t state, bool val)
{
state->control.sparse_output = val;
}
void pv_state_discard_input_set(pvstate_t state, bool val)
{
state->control.discard_input = val;
@@ -485,6 +657,11 @@ void pv_state_extra_display_set(pvstate_t state, /*@null@ */ const char *val)
const char *word_start;
size_t offset;
if (NULL != state->control.extra_display_spec) {
free(state->control.extra_display_spec);
state->control.extra_display_spec = NULL;
}
if (NULL != state->control.extra_format_string) {
free(state->control.extra_format_string);
state->control.extra_format_string = NULL;
@@ -494,6 +671,9 @@ void pv_state_extra_display_set(pvstate_t state, /*@null@ */ const char *val)
if (NULL == val)
return;
if (NULL != val)
state->control.extra_display_spec = pv_strdup(val);
word_start = val;
while (NULL != word_start && '\0' != word_start[0]) {
offset = 0;
@@ -531,27 +711,18 @@ void pv_state_extra_display_set(pvstate_t state, /*@null@ */ const char *val)
}
}
void pv_state_watch_pid_set(pvstate_t state, pid_t val)
{
state->control.watch_pid = val;
}
void pv_state_watch_fd_set(pvstate_t state, int val)
{
state->control.watch_fd = val;
}
void pv_state_output_set(pvstate_t state, int fd, const char *name)
{
/*
* Close any previous output file first, so we can report any errors
* before we store the new output filename.
*/
pv_truncate_output(state);
if (state->control.output_fd >= 0 && state->control.output_fd != STDOUT_FILENO) {
if (close(state->control.output_fd) < 0) {
fprintf(stderr, "%s: %s: %s\n", state->status.program_name,
NULL == state->control.output_name ? "(null)" : state->control.output_name,
strerror(errno));
pv_error("%s: %s",
NULL == state->control.output_name ? "(null)" : state->control.output_name,
strerror(errno));
}
}
if (NULL != state->control.output_name)
@@ -567,6 +738,22 @@ void pv_state_output_set(pvstate_t state, int fd, const char *name)
*/
fcntl(state->control.output_fd, F_SETFL, O_NONBLOCK | fcntl(state->control.output_fd, F_GETFL));
#endif /* MAKE_OUTPUT_NONBLOCKING */
/*
* In sparse output mode, if the output is in append mode (>>),
* explicitly lseek() to the end of the file. Otherwise, the file
* offset is not set until the first write(), which means that if
* the input starts with null bytes, when we lseek() past them
* relative to the current position, the "current position" is 0
* rather than the end of the file, and the file gets truncated on
* exit to the wrong size.
*/
if (state->control.sparse_output && 0 != (fcntl(fd, F_GETFL) & O_APPEND)) {
debug("%s", "sparse output mode, and appending - seeking output to the end");
if ((off_t) lseek(fd, 0, SEEK_END) == (off_t) - 1) {
debug("%s: %s", "lseek failed", strerror(errno));
}
}
}
void pv_state_average_rate_window_set(pvstate_t state, unsigned int val)
@@ -574,19 +761,12 @@ void pv_state_average_rate_window_set(pvstate_t state, unsigned int val)
if (val < 1)
val = 1;
state->control.average_rate_window = val;
if (val >= 20) {
state->calc.history_len = (size_t) (val / 5 + 1);
state->control.history_interval = 5;
} else {
state->calc.history_len = (size_t) (val + 1);
state->control.history_interval = 1;
}
pv_alloc_history(state);
state->control.history_interval = pv_update_calc_average_rate_window(&(state->calc), val);
}
void pv_state_set_can_display_utf8(pvstate_t state, bool val)
void pv_state_set_terminal_supports_utf8(pvstate_t state, bool val)
{
state->control.can_display_utf8 = val;
state->status.terminal_supports_utf8 = val;
}
/*
@@ -595,43 +775,86 @@ void pv_state_set_can_display_utf8(pvstate_t state, bool val)
void pv_state_inputfiles(pvstate_t state, unsigned int input_file_count, const char **input_files)
{
unsigned int file_idx;
/*@only@ */ nullable_string_t *new_array;
/* Free the old array and its contents, if there was one. */
if (NULL != state->files.filename) {
for (file_idx = 0; file_idx < state->files.file_count; file_idx++) {
/*@-unqualifiedtrans@ */
free(state->files.filename[file_idx]);
/*@+unqualifiedtrans@ */
/*
* TODO: find a way to tell splint the array
* contents are "only" and "null" as well as the
* array itself.
*/
}
free(state->files.filename);
state->files.filename = NULL;
state->files.file_count = 0;
}
state->files.filename = calloc((size_t) (input_file_count + 1), sizeof(char *));
if (NULL == state->files.filename) {
/* Allocate an empty new array of the right size. */
new_array = calloc((size_t) (input_file_count + 1), sizeof(char *));
if (NULL == new_array) {
/*@-mustfreefresh@ *//* see similar _() issue above */
fprintf(stderr, "%s: %s: %s\n", state->status.program_name, _("file list allocation failed"),
strerror(errno));
pv_error("%s: %s", _("file list allocation failed"), strerror(errno));
/*@+mustfreefresh@ */
return;
}
state->files.filename = new_array;
/* Populate the new array with copies of the filenames. */
for (file_idx = 0; file_idx < input_file_count; file_idx++) {
/*@-nullstate@ */
state->files.filename[file_idx] = pv_strdup(input_files[file_idx]);
if (NULL == state->files.filename[file_idx]) {
/*@only@ */ char *new_string;
new_string = pv_strdup(input_files[file_idx]);
if (NULL == new_string) {
/*@-mustfreefresh@ *//* see similar _() issue above */
fprintf(stderr, "%s: %s: %s\n", state->status.program_name,
_("file list allocation failed"), strerror(errno));
pv_error("%s: %s", _("file list allocation failed"), strerror(errno));
/*@+mustfreefresh@ */
return;
}
state->files.filename[file_idx] = new_string;
}
state->files.file_count = input_file_count;
}
/*@+nullstate@*/
/* splint: see unqualifiedtrans note by free() above. */
/*
* Set the arrays of watchfd process IDs and file descriptors.
*/
void pv_state_watchfds(pvstate_t state, unsigned int watchfd_count, const pid_t *pids, const int *fds)
{
unsigned int item_idx;
/*@only@ */ struct pvwatcheditem_s *new_array = NULL;
/* Free the old arrays, if there were any. */
if (NULL != state->watchfd.watching) {
/*@-compdestroy@ */
pv_freecontents_watchfd_items(state->watchfd.watching, state->watchfd.count);
free(state->watchfd.watching);
state->watchfd.watching = NULL;
/*@+compdestroy@ */
/*
* splint warns about deep structures not being deallocated,
* but that's what pv_freecontents_watchfd_items() does.
*/
}
state->watchfd.count = 0;
state->watchfd.multiple_pids = false;
/* Allocate an empty new array of the right size. */
new_array = malloc((1 + watchfd_count) * sizeof(*new_array));
if (NULL == new_array) {
/*@-mustfreefresh@ *//* see similar _() issue above */
pv_error("%s: %s", _("buffer allocation failed"), strerror(errno));
/*@+mustfreefresh@ */
return;
}
memset(new_array, 0, (1 + watchfd_count) * sizeof(*new_array));
state->watchfd.watching = new_array;
/* Populate the new array with the values supplied. */
for (item_idx = 0; item_idx < watchfd_count; item_idx++) {
state->watchfd.watching[item_idx].pid = pids[item_idx];
state->watchfd.watching[item_idx].fd = fds[item_idx];
if ((item_idx > 0) && (pids[item_idx] != pids[item_idx - 1]))
state->watchfd.multiple_pids = true;
}
state->watchfd.count = watchfd_count;
debug("%s=%d, %s=%s", "watchfd.count", state->watchfd.count, "multiple_pids",
state->watchfd.multiple_pids ? "true" : "false");
}
+3 -1
View File
@@ -1,7 +1,7 @@
/*
* Functions for portably managing strings.
*
* Copyright 2023-2025 Andrew Wood
* Copyright 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -86,7 +86,9 @@ size_t pv_strlcat(char *dst, const char *src, size_t dstsize)
#ifdef HAVE_STRLCAT
size_t result;
/*@-unrecog@ *//* splint doesn't recognise strlcat. */
result = strlcat(dst, src, dstsize);
/*@+unrecog@ */
if ((NULL != dst) && (dstsize > 0))
dst[dstsize - 1] = '\0';
+111 -34
View File
@@ -1,7 +1,7 @@
/*
* Functions for transferring data between file descriptors.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -300,41 +300,63 @@ static ssize_t pv__transfer_write_repeated(int fd, char *buf, size_t count, bool
* returns 1.
*
* At most, the number of bytes read will be the number of bytes remaining
* in the input buffer. If state->control.rate_limit is >0, and/or "allowed" is >0,
* then the maximum number of bytes read will be the number remaining unused
* in the input buffer or the value of "allowed", whichever is smaller.
* in the input buffer, capped to the number of bytes left until
* state->control.size is reached if state->control.stop_at_size is true.
* If state->control.rate_limit is >0, and/or "max_to_write" is >0, and
* splice() is used, then the maximum number of bytes read will be further
* capped to the value of "max_to_write", since splice() writes as well as
* reads.
*
* If splice() was successfully used, sets state->transfer.splice_used to true; if it
* failed, then state->transfer.splice_failed_fd is updated to the current fd so
* splice() won't be tried again until the next input file.
* If splice() was successfully used, sets state->transfer.splice_used to
* true; if it failed, then state->transfer.splice_failed_fd is updated to
* the current fd so splice() won't be tried again until the next input
* file.
*
* Updates state->transfer.read_position by the number of bytes read, unless splice()
* was used, in which case it does not since there's nothing in the buffer
* (and it also adds the bytes to state->transfer.written since they've been written
* to the output).
* Updates state->transfer.read_position by the number of bytes read, unless
* splice() was used, in which case it does not since there's nothing in the
* buffer (and it also adds the bytes to state->transfer.written since
* they've been written to the output).
*
* On read error, updates state->status.exit_status, and if allowed by
* Also increases state->transfer.total_bytes_read by the number of bytes
* read, regardless of whether splice() was used, since total_bytes_read is
* what it says it is, rather than being a buffer indicator.
*
* On read error, updates state->status.exit_status, and if max_to_write by
* state->control.skip_errors, tries to skip past the problem.
*
* If the end of the input file is reached or the error is unrecoverable,
* sets *eof_in to true. If all data in the buffer has been written at this
* point, then also sets *eof_out to true.
*/
static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_out, off_t allowed)
static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_out, off_t max_to_write)
{
bool do_not_skip_errors;
size_t bytes_can_read;
off_t amount_to_skip, amount_skipped, orig_offset, skip_offset;
ssize_t nread;
#ifdef HAVE_SPLICE
size_t bytes_to_splice;
#endif /* HAVE_SPLICE */
do_not_skip_errors = false;
if (0 == state->control.skip_errors)
do_not_skip_errors = true;
bytes_can_read = state->transfer.buffer_size - state->transfer.read_position;
/*
* Don't read past control.size if stop_at_size is true (issue
* #166).
*
* This isn't workable in line mode.
*/
if (state->control.stop_at_size && !state->control.linemode) {
off_t bytes_remaining_to_read = state->control.size - state->transfer.total_bytes_read;
if ((long long) bytes_can_read > (long long) bytes_remaining_to_read) {
debug("%lld > (%lld-%lld=%lld): %s", (long long) bytes_can_read,
(long long) (state->control.size), (long long) state->transfer.total_bytes_read,
(long long) bytes_remaining_to_read, "truncating for stop-at-size");
bytes_can_read = (size_t) bytes_remaining_to_read;
}
}
nread = 0;
#ifdef HAVE_SPLICE
@@ -342,8 +364,10 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
if ((!state->control.linemode) && (!state->control.no_splice)
&& (fd != state->transfer.splice_failed_fd)
&& (0 == state->transfer.to_write)) {
if (state->control.rate_limit > 0 || allowed != 0) {
bytes_to_splice = (size_t) allowed;
size_t bytes_to_splice;
if (state->control.rate_limit > 0 || max_to_write != 0) {
bytes_to_splice = (size_t) max_to_write;
} else {
bytes_to_splice = bytes_can_read;
}
@@ -365,6 +389,7 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
*/
} else if (nread > 0) {
state->transfer.written = nread;
state->transfer.total_bytes_read += nread;
#ifdef HAVE_FDATASYNC
if (state->control.sync_after_write) {
/*
@@ -430,6 +455,8 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
#else
state->transfer.read_position += nread;
#endif /* HAVE_SPLICE */
/* Update the counter of all bytes read so far. */
state->transfer.total_bytes_read += nread;
return 1;
}
@@ -460,7 +487,7 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
* reached the end of this file.
*/
if (do_not_skip_errors) {
pv_error(state, "%s: %s: %s", pv_current_file_name(state), _("read failed"), strerror(errno));
pv_error("%s: %s: %s", pv_current_file_name(state), _("read failed"), strerror(errno));
*eof_in = true;
if (state->transfer.write_position >= state->transfer.read_position) {
*eof_out = true;
@@ -476,7 +503,7 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
if (!state->transfer.read_error_warning_shown) {
/*@-compdef@ */
pv_error(state, "%s: %s: %s", pv_current_file_name(state), _("warning: read errors detected"),
pv_error("%s: %s: %s", pv_current_file_name(state), _("warning: read errors detected"),
strerror(errno));
/*@+compdef@ */
/* splint - see previous pv_current_file_name() call. */
@@ -492,7 +519,7 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
*/
if (0 > orig_offset) {
/*@-compdef@ */
pv_error(state, "%s: %s: %s", pv_current_file_name(state), _("file is not seekable"), strerror(errno));
pv_error("%s: %s: %s", pv_current_file_name(state), _("file is not seekable"), strerror(errno));
/*@+compdef@ */
/* splint - see previous pv_current_file_name() calls. */
*eof_in = true;
@@ -569,8 +596,7 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
*/
if (EINVAL != errno) {
/*@-compdef@ */
pv_error(state,
"%s: %s: %s", pv_current_file_name(state), _("failed to seek past error"),
pv_error("%s: %s: %s", pv_current_file_name(state), _("failed to seek past error"),
strerror(errno));
/*@+compdef@ */
/* splint - see previous pv_current_file_name() calls. */
@@ -588,7 +614,7 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou
state->transfer.read_position += amount_skipped;
if (state->control.skip_errors < 2) {
/*@-compdef@ */
pv_error(state, "%s: %s: %ld - %ld (%ld %s)",
pv_error("%s: %s: %ld - %ld (%ld %s)",
pv_current_file_name(state),
_("skipped past read error"), (long) orig_offset, (long) skip_offset,
(long) amount_skipped, _("B"));
@@ -629,9 +655,12 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
{
ssize_t nwritten;
int write_errno;
bool all_nulls;
off_t output_offset;
size_t write_check_position, write_end_position;
if (NULL == state->transfer.transfer_buffer) {
pv_error(state, "%s", _("no transfer buffer allocated"));
pv_error("%s", _("no transfer buffer allocated"));
state->status.exit_status |= PV_ERROREXIT_MEMORY;
*eof_out = true;
state->transfer.written = -1;
@@ -645,6 +674,52 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
nwritten = state->transfer.to_write;
} else if (state->transfer.to_write > 0) {
/*
* In sparse output mode, check whether all of the bytes to
* be written are null, and if so, try to seek the output
* instead of writing the null bytes.
*/
if (state->control.sparse_output && !state->transfer.output_not_seekable) {
write_check_position = state->transfer.write_position;
write_end_position = write_check_position + (size_t) (state->transfer.to_write);
all_nulls = true;
while (all_nulls && write_check_position < write_end_position) {
if ('\0' == state->transfer.transfer_buffer[write_check_position]) {
write_check_position++;
} else {
all_nulls = false;
}
}
if (all_nulls) {
/*
* Use lseek() to move forward in the file,
* and then ftruncate() it to its new size.
*
* If any step fails, mark the output not
* seekable so we stop trying.
*/
/*@+longintegral@ */
/*
* splint has trouble with off_t / __off_t, in the lseek() call.
*/
output_offset =
lseek(state->control.output_fd, (off_t) (state->transfer.to_write), SEEK_CUR);
if (output_offset == (off_t) - 1) {
debug("%s: %s", "output lseek() failed", strerror(errno));
state->transfer.output_not_seekable = true;
} else {
/* Seek successful - skip write. */
debug("%s (%ld) -> %s: %ld", "skipped null writes",
(long) (state->transfer.to_write), "new position", (long) output_offset);
nwritten = state->transfer.to_write;
goto pv__transfer_write_completed;
}
/*@-longintegral@ */
}
}
/*
* Set an interval timer or an alarm to interrupt the write
* with a signal if the write takes too long, so we can
@@ -673,7 +748,7 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
(long) (new_timer.it_value.tv_usec));
if (0 != setitimer(ITIMER_REAL, &new_timer, NULL)) {
pv_error(state, "%s: %s", _("failed to set interval timer"), strerror(errno));
pv_error("%s: %s", _("failed to set interval timer"), strerror(errno));
}
#else /* ! HAVE_SETITIMER */
@@ -699,7 +774,7 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
new_timer.it_value.tv_sec = 0;
new_timer.it_value.tv_usec = 0;
if (0 != setitimer(ITIMER_REAL, &new_timer, NULL)) {
pv_error(state, "%s: %s", _("failed to clear interval timer"), strerror(errno));
pv_error("%s: %s", _("failed to clear interval timer"), strerror(errno));
}
/*@+unrecog@ */
@@ -709,6 +784,9 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
#endif /* HAVE_SETITIMER */
}
pv__transfer_write_completed:
/* If lseek() worked for sparse output, it jumps down here. */
if (nwritten > 0) {
bool tracking_lines = false;
@@ -741,7 +819,7 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
state->transfer.line_positions =
calloc((size_t) (state->transfer.line_positions_capacity), sizeof(off_t));
if (NULL == state->transfer.line_positions) {
pv_error(state, "%s: %s", _("line position buffer allocation failed"),
pv_error("%s: %s", _("line position buffer allocation failed"),
strerror(errno));
}
/*@+mustfreeonly@ */
@@ -910,12 +988,12 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
if (EPIPE == write_errno) {
*eof_in = true;
*eof_out = true;
state->flag.pipe_closed = 1;
state->flags.pipe_closed = 1;
debug("%s", "SIGPIPE received - setting pipe_closed");
return 0;
}
pv_error(state, "%s: %s", _("write failed"), strerror(write_errno));
pv_error("%s: %s", _("write failed"), strerror(write_errno));
state->status.exit_status |= PV_ERROREXIT_TRANSFER;
*eof_out = true;
state->transfer.written = -1;
@@ -940,7 +1018,7 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long
/*@only@*/
static char *pv__allocate_aligned_buffer(int outfd, int infd, size_t target_size)
{
char *newptr;
void *newptr;
#if defined(HAVE_FPATHCONF) && defined(HAVE_POSIX_MEMALIGN) && defined(_PC_REC_XFER_ALIGN)
long input_alignment, output_alignment, min_alignment;
@@ -1054,7 +1132,7 @@ ssize_t pv_transfer(pvstate_t state, int fd, bool *eof_in, bool *eof_out, off_t
state->transfer.transfer_buffer =
pv__allocate_aligned_buffer(state->control.output_fd, fd, state->control.target_buffer_size + 32);
if (NULL == state->transfer.transfer_buffer) {
pv_error(state, "%s: %s", _("buffer allocation failed"), strerror(errno));
pv_error("%s: %s", _("buffer allocation failed"), strerror(errno));
state->status.exit_status |= PV_ERROREXIT_MEMORY;
return -1;
}
@@ -1156,8 +1234,7 @@ ssize_t pv_transfer(pvstate_t state, int fd, bool *eof_in, bool *eof_out, off_t
* Any other error is a problem and we must report back.
*/
/*@-compdef@ */
pv_error(state, "%s: %s: %d: %s", pv_current_file_name(state), _("select call failed"), n,
strerror(errno));
pv_error("%s: %s: %d: %s", pv_current_file_name(state), _("select call failed"), n, strerror(errno));
/*@+compdef@ */
/* splint - see previous pv_current_file_name() calls. */
+177 -137
View File
@@ -1,7 +1,7 @@
/*
* Functions for watching file descriptors in other processes.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -42,6 +42,8 @@
*/
static bool filesize(pvwatchfd_t info)
{
if (NULL == info)
return false;
if (S_ISBLK(info->sb_fd.st_mode)) {
int fd;
@@ -96,7 +98,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (kill(info->watch_pid, 0) != 0) {
if (!automatic)
pv_error(state, "%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
pv_error("%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
return 1;
}
@@ -105,8 +107,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
PROC_PIDFDVNODEPATHINFO, &vnodeInfo,
PROC_PIDFDVNODEPATHINFO_SIZE);
if (size != PROC_PIDFDVNODEPATHINFO_SIZE) {
pv_error(state, "%s %u: %s %d: %s",
_("pid"), info->watch_pid, _("fd"), info->watch_fd, strerror(errno));
pv_error("%s %u: %s %d: %s", _("pid"), info->watch_pid, _("fd"), info->watch_fd, strerror(errno));
return 3;
}
@@ -116,7 +117,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (!(0 == stat(info->file_fdpath, &(info->sb_fd)))) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
pv_error("%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath, strerror(errno));
return 3;
@@ -124,7 +125,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (!filesize(info)) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
pv_error("%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"), info->watch_fd, info->file_fdpath, _("not a regular file or block device"));
@@ -162,7 +163,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (kill(info->watch_pid, 0) != 0) {
if (!automatic)
pv_error(state, "%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
pv_error("%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
return 1;
}
(void) pv_snprintf(info->file_fdinfo, PV_SIZEOF_FILE_FDINFO,
@@ -180,7 +181,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
* and then only if it's a block device - see filesize().
*/
if (!automatic)
pv_error(state, "%s %u: %s %d: %s",
pv_error("%s %u: %s %d: %s",
_("pid"), info->watch_pid, _("fd"), info->watch_fd, strerror(errno));
return 2;
}
@@ -188,7 +189,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (!((0 == stat(info->file_fd, &(info->sb_fd)))
&& (0 == lstat(info->file_fd, &(info->sb_fd_link))))) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
pv_error("%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath, strerror(errno));
return 3;
@@ -198,7 +199,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (!filesize(info)) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
pv_error("%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"), info->watch_fd, info->file_fdpath, _("not a regular file or block device"));
@@ -223,6 +224,9 @@ bool pv_watchfd_changed(pvwatchfd_t info)
{
struct stat sb_fd, sb_fd_link;
if (NULL == info)
return false;
memset(&sb_fd, 0, sizeof(sb_fd));
memset(&sb_fd_link, 0, sizeof(sb_fd_link));
@@ -266,6 +270,9 @@ off_t pv_watchfd_position(pvwatchfd_t info)
long long pos_long;
FILE *fptr;
if (NULL == info)
return -1;
if (pv_watchfd_changed(info))
return -1;
@@ -297,7 +304,7 @@ static int pidfds(pvstate_t state, unsigned int pid, struct proc_fdinfo **fds, i
{
int size_needed = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, 0, 0);
if (size_needed == -1) {
pv_error(state, "%s: unable to list pid fds: %s", _("pid"), strerror(errno));
pv_error("%s: unable to list pid fds: %s", _("pid"), strerror(errno));
return -1;
}
@@ -305,7 +312,7 @@ static int pidfds(pvstate_t state, unsigned int pid, struct proc_fdinfo **fds, i
*fds = (struct proc_fdinfo *) malloc(size_needed);
if (*fds == NULL) {
pv_error(state, "%s: alloc failed: %s", _("pid"), strerror(errno));
pv_error("%s: alloc failed: %s", _("pid"), strerror(errno));
return -1;
}
memset(*fds, 0, size_needed);
@@ -329,7 +336,7 @@ static int pidfds(pvstate_t state, unsigned int pid, struct proc_fdinfo **fds, i
/*
* Extend the info array by one, returning false on error.
*/
static bool extend_info_array(int *array_length_ptr, pvwatchfd_t * info_array_ptr)
static bool extend_info_array(int *array_length_ptr, pvwatchfd_t *info_array_ptr)
{
int array_length = 0;
struct pvwatchfd_s *info_array = NULL;
@@ -354,6 +361,10 @@ static bool extend_info_array(int *array_length_ptr, pvwatchfd_t * info_array_pt
return false;
}
new_info_array[array_length - 1].unused = true;
debug("%s", "extended info array");
*info_array_ptr = new_info_array;
*array_length_ptr = array_length;
return true;
@@ -364,25 +375,76 @@ static bool extend_info_array(int *array_length_ptr, pvwatchfd_t * info_array_pt
/*@+compdef @ */
/*
* Reset calculated values in the given watchfd info structure.
*/
void pv_reset_watchfd(pvwatchfd_t info)
{
if (NULL == info)
return;
pv_reset_calc(&(info->calc));
pv_reset_transfer(&(info->transfer));
pv_reset_flags(&(info->flags));
pv_reset_display(&(info->display));
}
/*
* Free dynamically allocated areas in the given watchfd info structure.
*/
void pv_freecontents_watchfd(pvwatchfd_t info)
{
if (NULL == info)
return;
pv_freecontents_calc(&(info->calc));
pv_freecontents_transfer(&(info->transfer));
pv_freecontents_display(&(info->display));
}
/*
* Comparison function for qsort, to compare two pvwatchfd_s structures.
*/
static int pv_compare_watchfd(const void *a, const void *b)
{
int fd_a, fd_b;
fd_a = 0;
fd_b = 0;
if (NULL != a)
fd_a = ((pvwatchfd_t) a)->watch_fd;
if (NULL != b)
fd_b = ((pvwatchfd_t) b)->watch_fd;
if (fd_a < fd_b)
return -1;
if (fd_a > fd_b)
return 1;
return 0;
}
/*
* Scan the given process and update the arrays with any new file
* descriptors.
* descriptors. If "watch_fd" is not -1, then all other file descriptor
* numbers will be ignored,
*
* Returns 0 on success, 1 if the process no longer exists or could not be
* read, or 2 for a memory allocation error.
*/
int pv_watchpid_scanfds(pvstate_t state,
pid_t watch_pid, int *array_length_ptr, pvwatchfd_t * info_array_ptr, int *fd_to_idx)
int pv_watchpid_scanfds(pvstate_t state, pid_t watch_pid, int watch_fd, int *array_length_ptr,
pvwatchfd_t *info_array_ptr)
{
int array_length = 0;
struct pvwatchfd_s *info_array = NULL;
bool changes_made;
#ifdef __APPLE__
struct proc_fdinfo *fd_infos = NULL;
int fd_infos_count = 0;
if (pidfds(state, watch_pid, &fd_infos, &fd_infos_count) != 0) {
pv_error(state, "%s: pidfds failed", _("pid"));
pv_error("%s: pidfds failed", _("pid"));
return -1;
}
#else
@@ -401,18 +463,19 @@ int pv_watchpid_scanfds(pvstate_t state,
array_length = *array_length_ptr;
info_array = *info_array_ptr;
changes_made = false;
#ifdef __APPLE__
if (fd_infos_count < 1) {
pv_error(state, "%s: no fds found", _("pid"));
pv_error("%s: no fds found", _("pid"));
return -1;
}
for (int i = 0; i < fd_infos_count; i++) {
#else
while ((d = readdir(dptr)) != NULL) {
#endif
int fd, check_idx, use_idx, rc;
int fd, check_idx, found_idx, use_idx, rc;
off_t position_now;
const char *use_format_string;
fd = -1;
#ifdef __APPLE__
@@ -422,24 +485,45 @@ int pv_watchpid_scanfds(pvstate_t state,
continue;
#endif
/* Skip if the fd is outside the array. */
if ((fd < 0) || (fd >= FD_SETSIZE))
/* Skip if the fd is negative. */
if (fd < 0)
continue;
/* If a watch_fd was specified, skip if this isn't it. */
if (watch_fd >= 0 && watch_fd != fd)
continue;
/*
* Skip if this fd is already known to us.
*/
if (fd_to_idx[fd] != -1) {
continue;
found_idx = -1;
for (check_idx = 0; check_idx < array_length && NULL != info_array; check_idx++) {
if (info_array[check_idx].unused)
continue;
if (info_array[check_idx].watch_fd != fd)
continue;
if (info_array[check_idx].closed) {
/*
* If the fd is known but closed,
* immediately free it for re-use.
*/
info_array[check_idx].unused = true;
info_array[check_idx].displayable = false;
pv_freecontents_watchfd(&(info_array[check_idx]));
continue;
}
found_idx = check_idx;
break;
}
if (found_idx >= 0)
continue;
/*
* See if there's an empty slot we can re-use. An empty slot
* has a watch_pid of 0.
* See if there's an empty slot we can re-use.
*/
use_idx = -1;
for (check_idx = 0; check_idx < array_length; check_idx++) {
if (info_array[check_idx].watch_pid == 0) {
for (check_idx = 0; check_idx < array_length && NULL != info_array; check_idx++) {
if (info_array[check_idx].unused) {
use_idx = check_idx;
break;
}
@@ -456,71 +540,32 @@ int pv_watchpid_scanfds(pvstate_t state,
use_idx = array_length - 1;
}
/* At this point, the array should exist. */
if (NULL == info_array)
return 2;
debug("%s: %d => index %d", "found new fd", fd, use_idx);
changes_made = true;
/*
* Initialise the details of this new entry.
*/
memset(&(info_array[use_idx]), 0, sizeof(info_array[use_idx]));
pv_reset_watchfd(&(info_array[use_idx]));
info_array[use_idx].watch_pid = watch_pid;
info_array[use_idx].watch_fd = fd;
/* Allocate new display state. */
/*@-mustfreeonly@ *//* splint - this is not a leak, this is a new entry. */
info_array[use_idx].state = pv_state_alloc(state->status.program_name);
/*@+mustfreeonly@ */
if (NULL == info_array[use_idx].state)
return 2;
/* Copy the main status.cwd value to the new state. */
memcpy(&(info_array[use_idx].state->status.cwd), &(state->status.cwd), sizeof(state->status.cwd)); /* flawfinder: ignore */
/* flawfinder: bounded to destination object size. */
info_array[use_idx].closed = false;
info_array[use_idx].unused = false;
info_array[use_idx].displayable = true;
/*
* Copy over all the control values, blanking out the
* dynamically allocated strings, and setting the default
* format (fixed buffer) to the required format string
* instead of allocating a new dynamic format string for the
* copy (so there's less dynamic allocation going on).
* Set the average rate window so that a new history buffer
* is allocated for this state.
*/
memcpy(&(info_array[use_idx].state->control), &(state->control), sizeof(state->control)); /* flawfinder: ignore */
/* flawfinder: bounded to destination object size. */
/*@-mustfreeonly@ *//* splint - this is not a leak, this is a new entry. */
info_array[use_idx].state->control.name = NULL;
info_array[use_idx].state->control.format_string = NULL;
info_array[use_idx].state->control.output_name = NULL;
info_array[use_idx].state->control.default_bar_style = NULL;
/*@+mustfreeonly@ */
info_array[use_idx].state->control.default_format[0] = '\0';
use_format_string =
NULL != state->control.format_string ? state->control.format_string : state->control.default_format;
if (NULL != use_format_string)
(void) pv_snprintf(info_array[use_idx].state->control.default_format, PV_SIZEOF_DEFAULT_FORMAT,
"%.510s", use_format_string);
/*
* Duplicate the default bar style string, if there is one.
*/
if (NULL != state->control.default_bar_style) {
pv_state_default_bar_style_set(info_array[use_idx].state, state->control.default_bar_style);
}
/*
* Copy over all the display values, blanking out the
* dynamically allocated parts as above; then set the
* average rate window so that a new history buffer is
* allocated for this state.
*/
memcpy(&(info_array[use_idx].state->display), &(state->display), sizeof(state->display)); /* flawfinder: ignore */
/* flawfinder: bounded to destination object size. */
/*@-mustfreeonly@ *//* splint - this is not a leak, this is a new entry. */
info_array[use_idx].state->display.display_buffer = NULL;
info_array[use_idx].state->display.display_buffer_size = 0;
info_array[use_idx].state->calc.history = NULL;
info_array[use_idx].state->calc.history_len = 0;
/*@+mustfreeonly@ */
pv_state_average_rate_window_set(info_array[use_idx].state, state->control.average_rate_window);
(void) pv_update_calc_average_rate_window(&(info_array[use_idx].calc),
state->control.average_rate_window);
#ifdef __APPLE__
if (fd_infos[i].proc_fdtype != PROX_FDTYPE_VNODE) {
@@ -528,70 +573,33 @@ int pv_watchpid_scanfds(pvstate_t state,
}
#endif
/* Retrieve the details of this file descriptor. */
rc = pv_watchfd_info(state, &(info_array[use_idx]), true);
rc = pv_watchfd_info(state, &(info_array[use_idx]), -1 == watch_fd ? true : false);
/*
* Lookup failed - mark this slot as being free for re-use.
*/
if ((rc != 0) && (rc != 4)) {
debug("%s %d: %s: %d", "fd", fd, "lookup failed - marking slot for re-use", use_idx);
info_array[use_idx].watch_pid = 0;
if (NULL != info_array[use_idx].state)
pv_state_free(info_array[use_idx].state);
/*@-mustfreeonly@ *//* not a leak - we've just free()d it. */
info_array[use_idx].state = NULL;
/*@+mustfreeonly@ */
pv_freecontents_watchfd(&(info_array[use_idx]));
info_array[use_idx].unused = true;
info_array[use_idx].displayable = false;
continue;
}
fd_to_idx[fd] = use_idx;
/*
* Not displayable - set fd to -1 so the main loop doesn't
* show it.
* Not displayable - mark it as such so the main loop
* doesn't show it.
*/
if (rc != 0) {
debug("%s %d: %s", "fd", fd, "marking as not displayable");
info_array[use_idx].watch_fd = -1;
}
/* NULL check on the state - skip if not usable. */
if (NULL == info_array[use_idx].state) {
debug("%s %d: %s", "fd", fd, "state is NULL - marking as not displayable");
info_array[use_idx].watch_fd = -1;
continue;
}
/*
* Set the displayed size appropriately; if the size is 0,
* or not known, remove %e and %I from the state's default
* format string so that neither estimated time remaining
* nor estimated time of completion are displayed.
*/
info_array[use_idx].state->control.size = info_array[use_idx].size;
if (info_array[use_idx].state->control.size < 1) {
char *fmt;
while (NULL != (fmt = strstr(info_array[use_idx].state->control.default_format, "%e"))) {
debug("%s", "zero size - removing estimated time remaining");
/* strlen-1 here to include trailing \0 */
memmove(fmt, fmt + 2, strlen(fmt) - 1); /* flawfinder: ignore */
info_array[use_idx].state->flag.reparse_display = 1;
}
while (NULL != (fmt = strstr(info_array[use_idx].state->control.default_format, "%I"))) {
debug("%s", "zero size - removing estimated completion time");
/* strlen-1 here to include trailing \0 */
memmove(fmt, fmt + 2, strlen(fmt) - 1); /* flawfinder: ignore */
info_array[use_idx].state->flag.reparse_display = 1;
}
/* flawfinder: default_format is always \0-terminated. */
info_array[use_idx].displayable = false;
}
/* Set the info display_name appropriately. */
pv_watchpid_setname(state, &(info_array[use_idx]));
/* Carry the display_name through to the display state, and reparse. */
pv_state_name_set(info_array[use_idx].state, info_array[use_idx].display_name);
info_array[use_idx].state->flag.reparse_display = 1;
/* Force the display to be re-parsed. */
info_array[use_idx].flags.reparse_display = 1;
pv_elapsedtime_read(&(info_array[use_idx].start_time));
@@ -600,11 +608,11 @@ int pv_watchpid_scanfds(pvstate_t state,
* display), if known, so that ETA and so on are calculated
* correctly.
*/
info_array[use_idx].state->display.initial_offset = 0;
info_array[use_idx].display.initial_offset = 0;
info_array[use_idx].position = 0;
position_now = pv_watchfd_position(&(info_array[use_idx]));
if (position_now >= 0) {
info_array[use_idx].state->display.initial_offset = position_now;
info_array[use_idx].display.initial_offset = position_now;
info_array[use_idx].position = position_now;
}
}
@@ -616,6 +624,14 @@ int pv_watchpid_scanfds(pvstate_t state,
(void) closedir(dptr);
#endif
/*
* If any changes were made (i.e. new file descriptors were found),
* sort the array so that file descriptors are always displayed in
* ascending numerical order.
*/
if (changes_made && NULL != info_array && array_length > 1)
qsort(info_array, (size_t) array_length, sizeof(info_array[0]), pv_compare_watchfd);
return 0;
}
@@ -624,6 +640,9 @@ int pv_watchpid_scanfds(pvstate_t state,
* Set the display name for the given watched file descriptor, truncating at
* the relevant places according to the current screen width.
*
* If more than one distinct PID is being watched, include the PID in the
* name as well as the file descriptor number.
*
* If the file descriptor is pointing to a file under the current working
* directory, show its relative path, not the full path.
*/
@@ -631,7 +650,12 @@ void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
{
size_t path_length, cwd_length;
int max_display_length;
char *file_fdpath = info->file_fdpath;
char *file_fdpath;
if (NULL == info)
return;
file_fdpath = info->file_fdpath;
memset(info->display_name, 0, PV_SIZEOF_DISPLAY_NAME);
@@ -646,20 +670,36 @@ void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
}
max_display_length = (int) (state->control.width / 2) - 6;
if (state->watchfd.multiple_pids)
max_display_length -= 9;
if (max_display_length >= (int) path_length) {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME, "%4d:%.498s", info->watch_fd, file_fdpath);
if (state->watchfd.multiple_pids) {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME, "%8d:%4d:%.498s", (int) (info->watch_pid),
info->watch_fd, file_fdpath);
} else {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME, "%4d:%.498s", info->watch_fd, file_fdpath);
}
} else {
int prefix_length, suffix_length;
prefix_length = max_display_length / 4;
suffix_length = max_display_length - prefix_length - 3;
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME,
"%4d:%.*s...%.*s",
info->watch_fd, prefix_length,
file_fdpath, suffix_length, file_fdpath + path_length - suffix_length);
if (state->watchfd.multiple_pids) {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME,
"%8d:%4d:%.*s...%.*s",
(int) (info->watch_pid), info->watch_fd, prefix_length,
file_fdpath, suffix_length, file_fdpath + path_length - suffix_length);
} else {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME,
"%4d:%.*s...%.*s",
info->watch_fd, prefix_length,
file_fdpath, suffix_length, file_fdpath + path_length - suffix_length);
}
}
debug("%s: %d: [%s]", "set name for fd", info->watch_fd, info->display_name);
+39
View File
@@ -65,4 +65,43 @@ pid=$!
sleep 0.1
{ runWithValgrind -P "${workFile3}" -d "${pid}" -f -i 0.5 >/dev/null 2>&1; } 4>&1 || exit 1
# Check "--watchfd PID1 PID2".
seq 1 100 > "${workFile1}"
seq 1 300 > "${workFile2}"
true > "${workFile3}"
# shellcheck disable=SC2030
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
read -r line
exec 9<"${workFile2}"
sleep 1
exec 8<"${workFile1}"
exec 7</dev/null
sleep 1
exec 9<&-
# shellcheck disable=SC2034
read -r line
sleep 1
) <"${workFile1}" &
pid1=$!
# shellcheck disable=SC2030
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
read -r line
exec 9<"${workFile2}"
sleep 1
exec 8<"${workFile1}"
exec 7</dev/null
sleep 1
exec 9<&-
# shellcheck disable=SC2034
read -r line
sleep 1
) <"${workFile1}" &
pid2=$!
sleep 0.1
{ runWithValgrind -P "${workFile3}" -f -i 0.5 -d "${pid1}" "${pid2}" >/dev/null 2>&1; } 4>&1 || exit 1
exit 0
+67
View File
@@ -0,0 +1,67 @@
#!/bin/sh
#
# Similar to the "--size" check but, instead, using directory's size with
# "--size @".
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
# Process 100 bytes at 100 bytes per second, interval 0.1 seconds, with the
# size set from a directory containing 10 files of $1/10 bytes, and
# expecting a percentage of $2 at the end.
sizeCheck () {
# Make a directory containing 10 files of $1/10 bytes each.
rm -rf "${workFile2}"
mkdir "${workFile2}"
mkdir "${workFile2}/subdir"
s="$1"
s=$((s/10))
for f in 1 2 3 4 5; do
dd if=/dev/zero bs="$s" count=1 2>/dev/null >"${workFile2}/$f"
dd if=/dev/zero bs="$s" count=1 2>/dev/null >"${workFile2}/subdir/$f"
done
# Run 100 bytes through the program, using the reference directory's
# total size as the percentage reference.
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| "${testSubject}" -s "@${workFile2}" -n -i 0.1 -L 100 >/dev/null 2>"${workFile1}"
# If "-s @<directory>" is unsupported, skip the test.
if test $? -eq 64; then
rm -rf "${workFile2}"
echo 'not available on this build'
exit 77
fi
rm -rf "${workFile2}"
lineCount=$(wc -l < "${workFile1}" | tr -dc '0-9')
finalLine=$(sed -n '$p' < "${workFile1}")
# The number of output lines should be >5 and <13, and the final
# percentage should be $2.
#
if ! test "${lineCount}" -gt 5; then
echo "(reference size=$1) fewer than 6 output lines (${lineCount})"
exit 1
fi
if ! test "${lineCount}" -lt 13; then
echo "(reference size=$1) more than 12 output lines (${lineCount})"
exit 1
fi
if ! test "${finalLine}" = "$2"; then
echo "(reference size=$1): final percentage was not $2 (${finalLine})"
cat "${workFile1}"
exit 1
fi
}
sizeCheck 100 100
sizeCheck 200 50
sizeCheck 50 200
exit 0
+89
View File
@@ -0,0 +1,89 @@
#!/bin/sh
#
# Transfer a large chunk of data through pv using pipes, sending it in a
# bursty fashion, and make sure some of it consists of blocks of null bytes.
# Check data correctness afterwards, and if dd can produce a sparse file,
# check that pv's output is also sparse.
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
true "${workFile3:?not set - call this from 'make check'}"
# generate some data, with a hole in the middle.
dd if=/dev/urandom of="${workFile1}" bs=4096 count=640 2>/dev/null
dd if=/dev/null of="${workFile1}" bs=4096 count=0 seek=1280 2>/dev/null
dd if=/dev/urandom of="${workFile1}" bs=4096 count=1280 seek=1280 2>/dev/null
# check that sparse files are supported.
cat < "${workFile1}" > "${workFile3}"
inputBlocks="$(ls -1s "${workFile1}" | awk '{print $1}')"
nonSparseBlocks="$(ls -1s "${workFile3}" | awk '{print $1}')"
if test "${inputBlocks}" -eq "${nonSparseBlocks}"; then
echo 'sparse files not supported'
exit 77
fi
inputChecksum=$(cksum "${workFile1}" | awk '{print $1}')
# read through pv and test afterwards
(
dd if="${workFile1}" bs=1 count=9000
sleep 1
dd if="${workFile1}" bs=1 skip=9000 count=1240
sleep 1
dd if="${workFile1}" bs=1024 skip=10 count=1014
sleep 1
dd if="${workFile1}" bs=1024 skip=1024 count=1024
sleep 1
dd if="${workFile1}" bs=1024 skip=2048
) 2>/dev/null | "${testSubject}" -q -O -L 2M | cat > "${workFile2}"
outputChecksum=$(cksum "${workFile2}" | awk '{print $1}')
if ! test "${inputChecksum}" = "${outputChecksum}"; then
echo "checksum mismatch with dd | pv | cat"
exit 1
fi
# same again but with one less pipe
(
dd if="${workFile1}" bs=1 count=9000
sleep 1
dd if="${workFile1}" bs=1 skip=9000 count=1240
sleep 1
dd if="${workFile1}" bs=1024 skip=10 count=1014
sleep 1
dd if="${workFile1}" bs=1024 skip=1024 count=1024
sleep 1
dd if="${workFile1}" bs=1024 skip=2048
) 2>/dev/null | "${testSubject}" -q -O -L 2M > "${workFile2}"
outputChecksum=$(cksum "${workFile2}" | awk '{print $1}')
if ! test "${inputChecksum}" = "${outputChecksum}"; then
echo "checksum mismatch with dd | pv > file"
exit 1
fi
outputBlocks="$(ls -1s "${workFile2}" | awk '{print $1}')"
# Note that we only check that the output has any holes at all (and that the
# input had holes). We don't compare pv's output with dd's output directly,
# because the exact number of holes might differ intermittently.
if test "${nonSparseBlocks}" -gt "${inputBlocks}" && ! test "${outputBlocks}" -lt "${nonSparseBlocks}"; then
echo "output is not sparse"
echo "input file:"
ls -ls "${workFile1}"
echo "output file:"
ls -ls "${workFile2}"
echo "input file without holes:"
ls -ls "${workFile3}"
exit 1
fi
exit 0
+75
View File
@@ -0,0 +1,75 @@
#!/bin/sh
#
# Make sure -S stops reading at the given size.
#
# See https://codeberg.org/ivarch/pv/issues/166
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
printf '%s\n' 'abcdefghi' | (
"${testSubject}" -qSs5 > "${workFile1}"
cat > "${workFile2}"
)
# pv should have read 5 bytes and put them into workFile1.
pvOutput="$(cat "${workFile1}")"
if ! test "${pvOutput}" = 'abcde'; then
echo "expected pv to write [abcde], got [${pvOutput}]"
exit 1
fi
# cat should have read the remaining bytes and put them into workFile2.
catOutput="$(cat "${workFile2}")"
if ! test "${catOutput}" = 'fghi'; then
echo "expected cat to write [fghi], got [${catOutput}]"
exit 1
fi
# Now repeat the test with -X to make sure there's no over-read there either.
printf '%s\n' 'abcdefghi' | (
"${testSubject}" -qXSs5 > "${workFile1}"
cat > "${workFile2}"
)
# pv should have read 5 bytes and put nothing into workFile1.
pvOutput="$(cat "${workFile1}")"
if test -s "${workFile1}"; then
echo "with -X, expected pv to write nothing, got [${pvOutput}]"
exit 1
fi
# cat should have read the remaining bytes and put them into workFile2.
catOutput="$(cat "${workFile2}")"
if ! test "${catOutput}" = 'fghi'; then
echo "with pv -X, expected cat to write [fghi], got [${catOutput}]"
exit 1
fi
# Test again with -C to ensure that it works with splice turned off.
printf '%s\n' 'abcdefghi' | (
"${testSubject}" -qCSs5 > "${workFile1}"
cat > "${workFile2}"
)
# pv should have read 5 bytes and put them into workFile1.
pvOutput="$(cat "${workFile1}")"
if ! test "${pvOutput}" = 'abcde'; then
echo "with -C, expected pv to write [abcde], got [${pvOutput}]"
exit 1
fi
# cat should have read the remaining bytes and put them into workFile2.
catOutput="$(cat "${workFile2}")"
if ! test "${catOutput}" = 'fghi'; then
echo "with pv -C, expected cat to write [fghi], got [${catOutput}]"
exit 1
fi
exit 0
+101
View File
@@ -0,0 +1,101 @@
#!/bin/sh
#
# Check that watching a process's file descriptors works as expected when
# given multiple arguments.
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
true "${workFile3:?not set - call this from 'make check'}"
true "${workFile4:?not set - call this from 'make check'}"
# Skip the test if "-d" is not available.
if ! "${testSubject}" -h | grep -Fq ' -d'; then
echo "no \`--watchfd' / \`-d' option on this platform"
exit 77
fi
seq 1 100 > "${workFile1}"
seq 1 300 > "${workFile2}"
# Run two background processes to perform a few reads from a file.
#
# Each one only starts doing anything once the PV process below has started
# (the workFile3 check).
true > "${workFile3}"
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
# shellcheck disable=SC2034 # line is deliberately unused
read -r line <&8
sleep 1
) <&- 8<"${workFile1}" &
pid1=$!
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
# shellcheck disable=SC2034 # line is deliberately unused
read -r line <&9
sleep 1
) <&- 9<"${workFile2}" &
pid2=$!
sleep 0.1
"${testSubject}" -P "${workFile3}" -f -i 0.5 -d "${pid1}" "${pid2}" >/dev/null 2>"${workFile4}"
# Skip the test if "-d" does not work.
if grep -Fq ' -d: not available' "${workFile4}"; then
echo "no \`--watchfd' / \`-d' option on this platform"
exit 77
fi
# Process the output to make it easier to handle.
# NB "ESC [ A" is "cursor up", we turn that into "-" and a newline.
tr '\r' '\n' < "${workFile4}" | sed 's/.\[A/-!/g' | tr '!' '\n' > "${workFile1}"
# We should see at least 2 file positions for fd 8.
positionsReported="$(awk '/^[0-9 ]+: *8:/ {print $3}' < "${workFile1}" | sort -n | uniq)"
differentNumbers="$(printf "%s\n" "${positionsReported}" | grep -Ec .)"
if ! test "${differentNumbers}" -gt 1; then
printf "%s\n" "Expected at least 2 different numbers to be output for fd 8"
printf "%s:\n%s\n" "Positions reported" "${positionsReported}"
printf "%s: %s\n" "Number of different values seen" "${differentNumbers}"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
# We should see at least 2 file positions for fd 9.
positionsReported="$(awk '/^[0-9 ]+: *9:/ {print $3}' < "${workFile1}" | sort -n | uniq)"
differentNumbers="$(printf "%s\n" "${positionsReported}" | grep -Ec .)"
if ! test "${differentNumbers}" -gt 1; then
printf "%s\n" "Expected at least 2 different numbers to be output for fd 9"
printf "%s:\n%s\n" "Positions reported" "${positionsReported}"
printf "%s: %s\n" "Number of different values seen" "${differentNumbers}"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
# We should see the last 6 characters of fd 8's filename appear.
lastChars="$(printf "%s\n" "${workFile1}" | rev | cut -b1-6 | rev)"
if ! grep -Fq "${lastChars}:" < "${workFile1}"; then
printf "%s\n" "Expected to see a filename for fd 8"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
# We should see the last 6 characters of fd 9's filename appear.
lastChars="$(printf "%s\n" "${workFile2}" | rev | cut -b1-6 | rev)"
if ! grep -Fq "${lastChars}:" < "${workFile1}"; then
printf "%s\n" "Expected to see a filename for fd 9"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
exit 0
+1 -1
View File
@@ -54,7 +54,7 @@ runWithValgrind () {
ignore-initproctitle-leak
Memcheck:Leak
fun:malloc
fun:initproctitle
src:proctitle.c
fun:main
}
EOF