diff options
author | Pádraig Brady <P@draigBrady.com> | 2008-12-17 11:30:03 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2009-06-17 14:54:29 +0100 |
commit | a5a2a406f8d65f0e852d9ed7fbfb630c6b81dd7f (patch) | |
tree | d6ec40e289bbe748eb05f5e6cb9e8d376d79f446 /doc | |
parent | ff6fe3d17d9294f2494b4535a320bc9bfc86cc49 (diff) | |
download | coreutils-a5a2a406f8d65f0e852d9ed7fbfb630c6b81dd7f.tar.xz |
stdbuf: A new program to run a command with modified stdio buffering
* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add stdbuf command to list.
* configure.ac: Only enable on ELF systems with GCC.
* cfg.mk (sc_system_h_headers): Use VC_LIST_EXCEPT rather than
VC_LIST, so we can add an exception, if needed.
* .x-sc_system_h_headers: New file. Exempt libstdbuf.c.
* Makefile.am (syntax_check_exceptions): Add .x-sc_system_h_headers.
* doc/coreutils.texi (stdbuf invocation): Add stdbuf info.
* man/.gitignore: Ignore generated manpage.
* src/.gitignore: Ignore stdbuf and libstdbuf.so binaries.
* man/Makefile.am (stdbuf.1): Add dependency.
* man/stdbuf.x: New file with example usage.
* po/POTFILES.in: Reference new command and shared library sources.
* src/Makefile.am (build_if_possible__progs): Add stdbuf and libstdbuf,
(pkglib_PROGRAMS): Reference optional shared lib,
(libstdbuf_so_LDADD): Ensure we don't link with non PIC libcoreutils.a.
(libstdbuf_so_LDFLAGS): Add -shared GCC option,
(libstdbuf_so_CFLAGS): Add -fPIC GCC option.
(check-README): Exclude libstbuf.
(check-AUTHORS): ditto.
(sc_tight_scope): Exclude functions starting with __.
* src/libstdbuf.c: The LD_PRELOAD shared library to control buffering.
* src/stdbuf.c: New file to setup env variables before execing command.
* tests/Makefile.am: Reference new test file.
* tests/misc/help-version: Set expected exit codes.
* tests/misc/invalid-opt: ditto.
* tests/misc/stdbuf: Add 9 tests.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/coreutils.texi | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 180629520..91b3f5781 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -105,6 +105,7 @@ * sort: (coreutils)sort invocation. Sort text files. * split: (coreutils)split invocation. Split into fixed-size pieces. * stat: (coreutils)stat invocation. Report file(system) status. +* stdbuf: (coreutils)stdbuf invocation. Modify stdio buffering. * stty: (coreutils)stty invocation. Print/change terminal settings. * su: (coreutils)su invocation. Modify user and group ID. * sum: (coreutils)sum invocation. Print traditional checksum. @@ -197,7 +198,7 @@ Free Documentation License''. * User information:: id logname whoami groups users who * System context:: date uname hostname hostid uptime * SELinux context:: chcon runcon -* Modified command invocation:: chroot env nice nohup su timeout +* Modified command invocation:: chroot env nice nohup stdbuf su timeout * Process control:: kill * Delaying:: sleep * Numeric operations:: factor seq @@ -434,6 +435,7 @@ Modified command invocation * env invocation:: Run a command in a modified environment * nice invocation:: Run a command with modified niceness * nohup invocation:: Run a command immune to hangups +* stdbuf invocation:: Run a command with modified I/O buffering * su invocation:: Run a command with substitute user and group ID * timeout invocation:: Run a command with a time limit @@ -14160,6 +14162,7 @@ user, etc. * env invocation:: Modify environment variables. * nice invocation:: Modify niceness. * nohup invocation:: Immunize to hangups. +* stdbuf invocation:: Modify buffering of standard streams. * su invocation:: Modify user and group ID. * timeout invocation:: Run with time limit. @end menu @@ -14523,6 +14526,85 @@ the exit status of @var{command} otherwise @end display +@node stdbuf invocation +@section @command{stdbuf}: Run a command with modified I/O stream buffering + +@pindex stdbuf +@cindex standard streams, buffering +@cindex line buffered + +@command{stdbuf} allows one modify the buffering operations of the +three standard I/O streams associated with a program. Synopsis: + +@example +stdbuf @var{option}@dots{} @var{command} +@end example + +Any additional @var{arg}s are passed as additional arguments to the +@var{command}. + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item -i @var{mode} +@itemx --input=@var{mode} +@opindex -i +@opindex --input +Adjust the standard input stream buffering. + +@item -o @var{mode} +@itemx --output=@var{mode} +@opindex -o +@opindex --output +Adjust the standard output stream buffering. + +@item -e @var{mode} +@itemx --error=@var{mode} +@opindex -e +@opindex --error +Adjust the standard error stream buffering. + +@end table + +The @var{mode} can be specified as follows: + +@table @samp + +@item L +Set the stream to line buffered mode. +In this mode data is coalesced until a newline is output or +input is read from any stream attached to a terminal device. +This option is invalid with standard input. + +@item 0 +Disable buffering of the selected stream. +In this mode data is output immediately and only the +amount of data requested is read from input. + +@item @var{size} +Specify the size of the buffer to use in fully buffered mode. +@multiplierSuffixesNoBlocks{size} + +@end table + +NOTE: If @var{command} adjusts the buffering of its standard streams +(@command{tee} does for e.g.) then that will override corresponding settings +changed by @command{stdbuf}. Also some filters (like @command{dd} and +@command{cat} etc.) don't use streams for I/O, and are thus unaffected +by @command{stdbuf} settings. + +@cindex exit status of @command{stdbuf} +Exit status: + +@display +125 if @command{stdbuf} itself fails +126 if @var{command} is found but cannot be invoked +127 if @var{command} cannot be found +the exit status of @var{command} otherwise +@end display + + @node su invocation @section @command{su}: Run a command with substitute user and group ID |