Questions tagged [streams]

In computer networking, STREAMS is the native framework in Unix System V for implementing character devices.

STREAMS's design is a modular architecture for implementing full-duplex I/O between kernel or user space processes and between device drivers. Its most frequent uses have been in developing terminal I/O (line discipline) and networking subsystems.

References

32 questions
23
votes
3 answers

How can I set up a "USB proxy" for /dev/ttyUSB0 over the network?

I have a device under test (DUT) and I measure its power usage the using a Power Analyzer Datalogger using the data from /dev/ttyUSB0. The problem is that the DUT is now remotely from the workstation I used to gather data with, but in the same…
Eduard Florinescu
  • 11,153
  • 18
  • 57
  • 67
22
votes
4 answers

How to use sed to manipulate continuously streaming output?

I am putting together a presentation for a non-technical audience. I have a program running in bash that outputs a continuous stream of values, a few of which are important. I would like to highlight the important results as they are displayed so…
P Jones
  • 333
  • 1
  • 2
  • 7
13
votes
2 answers

Why is appending different streams to a file safe?

It's well known that redirecting standard output and error to the same file with cmd >out_err.txt 2>out_err.txt can lead to loss of data, as per the example below: work:/tmp$ touch file.txt work:/tmp$ ls another_file.txt ls: cannot access…
8
votes
2 answers

How I/O channels are implemented in Linux kernel?

stdin, stdout, stderr are some integers that index into a data structure which 'knows' which I/O channels are to be used for the process. I understand this data structure is unique to every process. Are I/O channels nothing but some data array…
KawaiKx
  • 445
  • 1
  • 6
  • 9
5
votes
2 answers

Reading partially downloaded gzip with an offset

Let's say that there is one huge db.sql.gz of size 100GB available https://example.com/db/backups/db.sql.gz and the server supports range requests. So instead of downloading the entire file, I downloaded y bytes(let's say 1024bytes) with an offset…
bravokeyl
  • 153
  • 1
  • 6
5
votes
1 answer

Watch not showing subshell output

Why does the following not output "hello" line? watch bash -c 'echo hello' As this one? watch 'echo hello' I expected to have echo write to bash output directly and this to be read by watch and formatted to terminal. Does bash -c not use stdout?
sevo
  • 1,217
  • 2
  • 10
  • 22
4
votes
3 answers

How do pipes and infinite streams work?

I usually use command1 | command2 | command3 a lot in Linux but most of them are dealing with definite content. When I tried this with an infinite stream cat | sed '' | sed '' which hopefully simulates an infinite stream it didn't work utill I…
Nishant
  • 563
  • 9
  • 21
3
votes
0 answers

How to pipe all output streams to another process?

Take the following Bash script 3-output-writer.sh: echo A >&1 echo B >&2 echo C >&3 Of course when ran as . 3-output-writer.sh it gets the error 3: Bad file descriptor, because Bash doesn't know what to do with the 3rd output stream. One can easily…
3
votes
1 answer

Piping curl http://cheat.sh/python to less is showing strange ESC[38;5;246m

I am kinda new to Linux. My base issue: I need to show the output of curl cheat.sh/python like a man or less page, so that I can easily scroll up and down. What have I tried: curl cheat.sh/python | less outout: some weird text like…
3
votes
1 answer

Is there any control character or hack to prevent simple command line tools from showing subsequent data?

I'ld like to hide ugly data from being shown by command line tools like cat (and maybe simple text editors too) which often get confused by binary data. For example a VT100 terminal sometimes gets misconfigured by binary outputs.
Pinke Helga
  • 321
  • 1
  • 2
  • 10
3
votes
2 answers

What are two caveats of line buffering in Unix?

A paragraph from APUE Chapter 5.4 about line buffer: Line buffered. In this case, the standard I/O library performs I/O when a newline character is encountered on input or output. This allows us to output a single character at a time (with the…
user3837980
  • 151
  • 4
3
votes
2 answers

How to pass multiple files in one stream to process them pipe-like (without saving) on the receiving side?

I need to determine the filetype on an indeterminate number of base64-encoded filestreams coming from stdin (image files base64-encoded and cat'ed). A single file would simply be ... | base64 -d | identify -. The issue for multiple files is…
Nick Coleman
  • 243
  • 1
  • 5
3
votes
2 answers

Why were STREAMS marked obsolescent in POSIX.1-2008?

The POSIX.1-2008 XRAT rationale states that X/Open STREAMS may be removed from future versions of the standard, and that strictly conforming applications shouldn't use them, but it doesn't explain why. Why were they effectively removed from the…
osvein
  • 199
  • 3
  • 14
3
votes
2 answers

Remove data from the STDIN stream buffer of another TTY session

I encountered a problem the other day while running multiple tty sessions in separate terminal windows. I was running a expensive disk access command and was waiting for it to return. Meanwhile I was working in another tty session in a separate…
111---
  • 4,424
  • 3
  • 27
  • 50
2
votes
0 answers

How to receive "v4l2-ctl --stream-to-host" stream from a machine on the same LAN on said host for use with, e.g., video conferencing software?

There is an example that streams a webcam to another computer by piping a V4L2 stream into netcat (v4l2-ctl --stream-to - | nc ), and this works, but it feels redundant when v4l2-ctl --stream-to-host [:] exists. I was able…
Alex
  • 121
  • 3
1
2 3