https://github.com/dmoj/setbufsize.so
LD_PRELOAD library for controlling standard stream buffer sizes.
https://github.com/dmoj/setbufsize.so
buffering linux override unbuffered
Last synced: about 1 month ago
JSON representation
LD_PRELOAD library for controlling standard stream buffer sizes.
- Host: GitHub
- URL: https://github.com/dmoj/setbufsize.so
- Owner: DMOJ
- License: agpl-3.0
- Created: 2019-04-14T23:59:25.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T23:31:55.000Z (about 7 years ago)
- Last Synced: 2025-01-26T07:23:25.042Z (over 1 year ago)
- Topics: buffering, linux, override, unbuffered
- Language: C
- Homepage: https://dmoj.ca/
- Size: 20.5 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# setbufsize.so [](https://travis-ci.org/DMOJ/setbufsize.so)
`LD_PRELOAD` library for controlling standard stream buffer sizes.
You can grab prebuilt 32- and 64-bit binaries from the [Releases](https://github.com/DMOJ/setbufsize/releases) tab.
These are built by [Travis](https://travis-ci.org/DMOJ/setbufsize) on a [CentOS 5 Docker image](https://github.com/pypa/manylinux),
so they should "just work" on any Linux distribution newer than that.
## Example Usage
For instance, if you wished to set the `stdout` of a program `app` to be unbuffered when connected to a terminal
(rather than the default line-buffering), the invocation would be:
```bash
$ LD_PRELOAD=/path/to/setbufsize64.so STDOUT_BUFFER_SIZE=0 ./app
```
`STDERR_BUFFER_SIZE` does the obvious thing, for `stderr`.
## Caveats
Due to its nature as an `LD_PRELOAD` object, `setbufsize` requires the target program to use `libc` for its output,
and furthermore be dynamically linked.