[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stder
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr. |
Date: |
Sun, 10 May 2020 21:53:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
+static char *
+ios_dev_stream_handler_normalize (const char *handler)
+{
+ if (strcmp (handler, "stdin")
+ && strcmp (handler, "stdout")
+ && strcmp (handler, "stderr"))
+ return NULL;
+
+ return strdup (handler);
+}
I think we should introduce a new flag to use in ios_open,
IOS_F_STREAM. This way, ios_open can do the following:
- If IOS_M_RDONLY & IOS_F_STREAM -> Use the stream IOD to open the given
filename.
- If IOS_M_WRONLY & IOS_F_STREAM -> Use the stream IOD to open the given
filename.
At the Poke level this translates to:
open ("foo/bar", IOS_F_STREAM & IOS_M_RDONLY)
-> Open the file foo/bar as a read-only stream.
open ("foo/bar", IOS_F_STREAM & IOS_M_WRONLY)
-> Open the file foo/bar as a write-only stream.
open ("foo/bar", IOS_F_STREAM & IOS_M_RDWR)
-> ERROR. Not possible to open a stream for both read and write.
This means that handler of the stream IOD won't ever be used, so it can
just return NULL in all cases...
This will allow us to poke character devices, and named pipes created
with mkfifo.
- [PATCH 1/2] ios: Introduce ios_flush and ios_dev_<...>_flush., Egeyar Bagcioglu, 2020/05/10
- [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr., Egeyar Bagcioglu, 2020/05/10
- Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr., Jose E. Marchesi, 2020/05/10
- Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr., Jose E. Marchesi, 2020/05/10
- Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr.,
Jose E. Marchesi <=
- Re: [PATCH 1/2] ios: Introduce ios_flush and ios_dev_<...>_flush., Jose E. Marchesi, 2020/05/10