Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Power corrupts. And atomic power corrupts atomically.


computers / alt.os.linux / O_TEXT for PDOS/386

SubjectAuthor
* O_TEXT for PDOS/386Paul Edwards
+* Re: O_TEXT for PDOS/386Richard Kettlewell
|`* Re: O_TEXT for PDOS/386Paul Edwards
| `- Re: O_TEXT for PDOS/386Richard Kettlewell
+* Re: O_TEXT for PDOS/386Lew Pitcher
|+* Re: O_TEXT for PDOS/386Paul Edwards
||`* Re: O_TEXT for PDOS/386Lew Pitcher
|| +* Re: O_TEXT for PDOS/386Paul Edwards
|| |`* Re: O_TEXT for PDOS/386Lew Pitcher
|| | `* Re: O_TEXT for PDOS/386Paul Edwards
|| |  `* Re: O_TEXT for PDOS/386Richard Kettlewell
|| |   +* Re: O_TEXT for PDOS/386Paul Edwards
|| |   |`* Re: O_TEXT for PDOS/386Richard Kettlewell
|| |   | `* Re: O_TEXT for PDOS/386Paul Edwards
|| |   |  `* Re: O_TEXT for PDOS/386Richard Kettlewell
|| |   |   `* Re: O_TEXT for PDOS/386Paul Edwards
|| |   |    `* Re: O_TEXT for PDOS/386Richard Kettlewell
|| |   |     +* Re: O_TEXT for PDOS/386Paul Edwards
|| |   |     |+* Re: O_TEXT for PDOS/386Richard Kettlewell
|| |   |     ||`* Re: O_TEXT for PDOS/386Paul Edwards
|| |   |     || `* Re: O_TEXT for PDOS/386Richard Kettlewell
|| |   |     ||  `* Re: O_TEXT for PDOS/386Paul Edwards
|| |   |     ||   `- Re: O_TEXT for PDOS/386Paul Edwards
|| |   |     |`- Re: O_TEXT for PDOS/386Jasen Betts
|| |   |     `* OT: O_TEXT for PDOS/386J.O. Aho
|| |   |      `* Re: OT: O_TEXT for PDOS/386Paul Edwards
|| |   |       `* Re: OT: O_TEXT for PDOS/386Lew Pitcher
|| |   |        `* Re: OT: O_TEXT for PDOS/386Paul Edwards
|| |   |         `* Re: OT: O_TEXT for PDOS/386J.O. Aho
|| |   |          `- Re: OT: O_TEXT for PDOS/386Paul Edwards
|| |   `- Re: O_TEXT for PDOS/386Jasen Betts
|| `* Re: O_TEXT for PDOS/386Peter 'Shaggy' Haywood
||  `* Re: O_TEXT for PDOS/386Paul Edwards
||   `* Re: O_TEXT for PDOS/386Lew Pitcher
||    `- Re: O_TEXT for PDOS/386Paul Edwards
|`- Re: O_TEXT for PDOS/386Richard Kettlewell
`* Re: O_TEXT for PDOS/386Lew Pitcher
 `* Re: O_TEXT for PDOS/386Paul Edwards
  `* Re: O_TEXT for PDOS/386J.O. Aho
   `* Re: O_TEXT for PDOS/386Paul Edwards
    +* Re: O_TEXT for PDOS/386J.O. Aho
    |+- Re: O_TEXT for PDOS/386Richard Kettlewell
    |`- Re: O_TEXT for PDOS/386Paul Edwards
    `* Re: O_TEXT for PDOS/386Jasen Betts
     `- Re: O_TEXT for PDOS/386Paul Edwards

Pages:12
O_TEXT for PDOS/386

<ur1i55$2chm2$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3282&group=alt.os.linux#3282

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 14:51:15 +0800
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <ur1i55$2chm2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 20 Feb 2024 06:51:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5a42e109a14e96f3471bdcf90f68f77e";
logging-data="2508482"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EzgXSBomBz4CuQn76RpEGfDhynA4Nqg4="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:Fzoa2tMJ1wps6/mZXWHDTXW77jg=
X-Mozilla-News-Host: news://news.eternal-september.org:119
 by: Paul Edwards - Tue, 20 Feb 2024 06:51 UTC

Hi.

Cygwin has an O_TEXT on the open() call to let
"the OS layer" (can be quibbled) that the file
is being opened in text mode. And as such, it
gives that layer an opportunity to insert CRs.

PDOS/386 (available at http://pdos.org) is able
to run a hello world Linux ELF binary, and recent
developments mean that I should be able to run
more than just a hello world soon.

But even with those recent developments, I am
still missing the same thing that Cygwin was
missing, and added O_TEXT to solve.

I'd like to add an O_TEXT flag to Linux. It would
be good if Linux officially reserved a flag for
this use, but in the absence of that, I'm happy
to create my own.

I think Linux adds flags going up, so I would add
any flags I want going down.

So I'm thinking of making O_TEXT 0x80000000

Another possibility would be 0x40000000 to avoid
being seen as a negative number.

This is different from Cygwin, which uses 0x20000.

I would be happy to use the Cygwin value, but I
think Linux may have already encroached that.

And it is not important to maintain the same value
as Cygwin, because Cygwin creates PE executables,
while mine is for ELF executables.

Any suggestions?

Thanks. Paul.

Re: O_TEXT for PDOS/386

<wwv34tnwjfu.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3284&group=alt.os.linux#3284

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 09:53:25 +0000
Organization: terraraq NNTP server
Message-ID: <wwv34tnwjfu.fsf@LkoBDZeT.terraraq.uk>
References: <ur1i55$2chm2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="29848"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:BOUTxv8y/apx+9y0LjqdbwGN0W4=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Tue, 20 Feb 2024 09:53 UTC

Paul Edwards <mutazilah@gmail.com> writes:
> Cygwin has an O_TEXT on the open() call to let "the OS layer" (can be
> quibbled) that the file is being opened in text mode. And as such, it
> gives that layer an opportunity to insert CRs.
>
> PDOS/386 (available at http://pdos.org) is able to run a hello world
> Linux ELF binary, and recent developments mean that I should be able
> to run more than just a hello world soon.
>
> But even with those recent developments, I am still missing the same
> thing that Cygwin was missing, and added O_TEXT to solve.

IMO Cygwin got this one wrong. The text/binary file distinction should
be managed in the C library or higher. Applications should either use
the appropriate arguments to fopen(), or manage any translation required
themselves.

> I'd like to add an O_TEXT flag to Linux. It would be good if Linux
> officially reserved a flag for this use, but in the absence of that,
> I'm happy to create my own.

You’d need to ask on the linux-kernel mailing list, I think. But I
wouldn’t predict a very positive response.

--
https://www.greenend.org.uk/rjk/

Re: O_TEXT for PDOS/386

<ur1tti$2eqcr$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3285&group=alt.os.linux#3285

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!news.chmurka.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 18:12:00 +0800
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <ur1tti$2eqcr$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me>
<wwv34tnwjfu.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Feb 2024 10:12:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5a42e109a14e96f3471bdcf90f68f77e";
logging-data="2582939"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19F62cvi0MLAUj1WqSwY1CVt5fjinNgsMw="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:pOqumt7rASCSlmTsPQbpjNSFezw=
In-Reply-To: <wwv34tnwjfu.fsf@LkoBDZeT.terraraq.uk>
 by: Paul Edwards - Tue, 20 Feb 2024 10:12 UTC

On 20/02/24 17:53, Richard Kettlewell wrote:

> Paul Edwards <mutazilah@gmail.com> writes:
>> Cygwin has an O_TEXT on the open() call to let "the OS layer" (can be
>> quibbled) that the file is being opened in text mode. And as such, it
>> gives that layer an opportunity to insert CRs.
>>
>> PDOS/386 (available at http://pdos.org) is able to run a hello world
>> Linux ELF binary, and recent developments mean that I should be able
>> to run more than just a hello world soon.
>>
>> But even with those recent developments, I am still missing the same
>> thing that Cygwin was missing, and added O_TEXT to solve.
>
> IMO Cygwin got this one wrong. The text/binary file distinction should
> be managed in the C library or higher. Applications should either use
> the appropriate arguments to fopen(), or manage any translation required
> themselves.

Hi Richard. Thanks for your reply.

The C library that I use for Linux is a Linux port
of PDPCLIB, and is designed for Linux, and thus, no
translation will be done.

It is only when I run that Linux ELF binary on
PDOS/386 (mini Win32 clone) that I want translation
done. And even that would be a PDOS/386 configuration
thing. Maybe I would like to run a NL-only system.

So it can't easily (the non-Linux environment would
need to be detected, and assumptions made) be done in
the (Linux) C library, and it wouldn't be appropriate
either.

>> I'd like to add an O_TEXT flag to Linux. It would be good if Linux
>> officially reserved a flag for this use, but in the absence of that,
>> I'm happy to create my own.
>
> You’d need to ask on the linux-kernel mailing list, I think. But I
> wouldn’t predict a very positive response.

That's what I'm predicting too. So can you suggest
a flag? I think Linux is consuming flags going up,
so I could go down for anything I need, and have
0x80000000 mean "O_TEXT".

But that makes it a negative number, which may not
be nice, so I could make it 0x40000000.

Another possibility would be to commandeer some
existing unimportant flag. I think there might be
one for "access time"? Since I don't care whether
or not access time is updated, if access time is
requested, I could make it mean "text".

Or some combination of flags.

Any suggestions within the constraints of the Linux
people having different goals to me?

Thanks. Paul.

Re: O_TEXT for PDOS/386

<ur2c4t$2h63i$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3286&group=alt.os.linux#3286

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 14:14:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <ur2c4t$2h63i$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Feb 2024 14:14:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cf162c938af35867d0447290d7daa709";
logging-data="2660466"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8JsINHMr8j67RFw0Ewz0GwBzY4zr7stM="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:tLbwEJUcPth2ubOl4TeahgGyOy0=
 by: Lew Pitcher - Tue, 20 Feb 2024 14:14 UTC

On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:

> Hi.
>
> Cygwin has an O_TEXT on the open() call to let
> "the OS layer" (can be quibbled) that the file
> is being opened in text mode. And as such, it
> gives that layer an opportunity to insert CRs.
[snip]
> I'd like to add an O_TEXT flag to Linux.[snip]
> Any suggestions?

Yes, one. Dont.

Microsoft Windows (on top of which Cygwin must run) makes a low-level
distinction between "binary" files and "text" files. I believe it is
because Windows guarantees (or must guarantee) certain data
transformations on text that do not apply to other forms of data.
(I.e. translating <cr><lf> sequences into C newline characters, etc)

HOWEVER, Linux (or, /any/ Unix) makes NO distinction between text
and binary data, neither in the standard I/O library, nor in the OS
itself.

You are effectively asking that Linux /NOW/ make such a distinction,
even if only to ignore the O_TEXT flag that you ask for.

It ain't gonna fly. Such a flag would invalidate /decades/ worth of
Unix/Linux code, and /not/ provide any functionality either to
the OS layer, the stdio library layer, or the application code layer.

So, dont even try to "add an O_TEXT flag" to Linux. Just dont.
--
Lew Pitcher
"In Skills We Trust"

Re: O_TEXT for PDOS/386

<ur2co0$2hogi$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3287&group=alt.os.linux#3287

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 22:25:05 +0800
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <ur2co0$2hogi$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 20 Feb 2024 14:25:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5a42e109a14e96f3471bdcf90f68f77e";
logging-data="2679314"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tEQ8wT4Biq51/e0D9r1//fW8P4SjanBw="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:3HXPQgaeLtuvXslLFs4UF05tUgc=
In-Reply-To: <ur2c4t$2h63i$1@dont-email.me>
 by: Paul Edwards - Tue, 20 Feb 2024 14:25 UTC

On 20/02/24 22:14, Lew Pitcher wrote:
> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:
>
>> Hi.
>>
>> Cygwin has an O_TEXT on the open() call to let
>> "the OS layer" (can be quibbled) that the file
>> is being opened in text mode. And as such, it
>> gives that layer an opportunity to insert CRs.
> [snip]
>> I'd like to add an O_TEXT flag to Linux.[snip]
>> Any suggestions?
>
> Yes, one. Dont.
>
> Microsoft Windows (on top of which Cygwin must run) makes a low-level
> distinction between "binary" files and "text" files. I believe it is
> because Windows guarantees (or must guarantee) certain data
> transformations on text that do not apply to other forms of data.
> (I.e. translating <cr><lf> sequences into C newline characters, etc)
>
> HOWEVER, Linux (or, /any/ Unix) makes NO distinction between text
> and binary data, neither in the standard I/O library, nor in the OS
> itself.
>
> You are effectively asking that Linux /NOW/ make such a distinction,
> even if only to ignore the O_TEXT flag that you ask for.

The C library that most people use already has
that distinction - and it is indeed ignored.
Works perfectly fine.

> It ain't gonna fly. Such a flag would invalidate /decades/ worth of
> Unix/Linux code, and /not/ provide any functionality either to
> the OS layer, the stdio library layer, or the application code layer.

Sorry - what is being invalidated? Can you give an
example?

BFN. Paul.

Re: O_TEXT for PDOS/386

<wwvedd7dtr3.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3288&group=alt.os.linux#3288

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.nntp4.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 15:45:36 +0000
Organization: terraraq NNTP server
Message-ID: <wwvedd7dtr3.fsf@LkoBDZeT.terraraq.uk>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="34465"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:fIh4y+lUR/GVxHaxBnFAm27cxqE=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Tue, 20 Feb 2024 15:45 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:
>> Cygwin has an O_TEXT on the open() call to let
>> "the OS layer" (can be quibbled) that the file
>> is being opened in text mode. And as such, it
>> gives that layer an opportunity to insert CRs.
> [snip]
>> I'd like to add an O_TEXT flag to Linux.[snip]
>> Any suggestions?
>
> Yes, one. Dont.
>
> Microsoft Windows (on top of which Cygwin must run) makes a low-level
> distinction between "binary" files and "text" files. I believe it is
> because Windows guarantees (or must guarantee) certain data
> transformations on text that do not apply to other forms of data.
> (I.e. translating <cr><lf> sequences into C newline characters, etc)

AFAIK it’s not that low level. I can see no sign of it in CreateFile,
ReadFile, etc, which are approximately equivalent to open(), read() etc
in the Windows API. I think the implementation is in the C runtime
(effectively the Libc).

Cygwin does not appear rely on Windows for the implementation of its
O_TEXT and O_BINARY - you can see the translation code in
fhandler_base::read.

--
https://www.greenend.org.uk/rjk/

Re: O_TEXT for PDOS/386

<ur2p1q$2k2bi$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3289&group=alt.os.linux#3289

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 17:55:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 108
Message-ID: <ur2p1q$2k2bi$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Feb 2024 17:55:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cf162c938af35867d0447290d7daa709";
logging-data="2754930"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Jd3XTf4d9cQaCzFPCCSjXjM2WVlwMhDI="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:dFor+bjoiLhbvxtTJzYgWzNoP2w=
 by: Lew Pitcher - Tue, 20 Feb 2024 17:55 UTC

On Tue, 20 Feb 2024 22:25:05 +0800, Paul Edwards wrote:

> On 20/02/24 22:14, Lew Pitcher wrote:
>> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:
>>
>>> Hi.
>>>
>>> Cygwin has an O_TEXT on the open() call to let
>>> "the OS layer" (can be quibbled) that the file
>>> is being opened in text mode. And as such, it
>>> gives that layer an opportunity to insert CRs.
>> [snip]
>>> I'd like to add an O_TEXT flag to Linux.[snip]
>>> Any suggestions?
>>
>> Yes, one. Dont.
>>
>> Microsoft Windows (on top of which Cygwin must run) makes a low-level
>> distinction between "binary" files and "text" files. I believe it is
>> because Windows guarantees (or must guarantee) certain data
>> transformations on text that do not apply to other forms of data.
>> (I.e. translating <cr><lf> sequences into C newline characters, etc)
>>
>> HOWEVER, Linux (or, /any/ Unix) makes NO distinction between text
>> and binary data, neither in the standard I/O library, nor in the OS
>> itself.
>>
>> You are effectively asking that Linux /NOW/ make such a distinction,
>> even if only to ignore the O_TEXT flag that you ask for.
>
> The C library that most people use already has
> that distinction - and it is indeed ignored.
> Works perfectly fine.

Lets take an accounting...

1) POSIX open() does not make any distinction between "text" and "binary"
files

2) Standard C / POSIX fopen() /does/ make a distinction between "text"
and "binary" files. POSIX issues a caveat regarding the mode
parameter that "The character 'b' shall have no effect, but is allowed
for ISO C standard conformance.", referring to the mode character "b"
specified by the ISO C standard as indicating that the file should be
opened for "binary" I/O, rather than the default "text" I/O.

3) You specifically reference the open() call, not the fopen() call.

So, you ask that the open() call, a call that, under Linux and other
POSIX-compatible operating systems, makes no distinction between binary
and text files, now recognize a flag indicating that the open() should
act apon a text file.

That leaves the Linux kernel developers with a choice to make: either
a) accept your request and add an O_TEXT flag that conditions the I/O
for text data, or
b) accept your request and add an O_TEXT flag that does nothing, or
c) ignore or deny your request

Choice (a) would drastically change the behaviour of the open()
call, and any existing code that uses open() to access a text file would
have to change to specify the O_TEXT flag. I believe that this would
be a no-starter, even if the default for O_TEXT would leave behaviour
as it currently is.

Choice (b) is ... useless. It recognizes a non-issue, and does nothing.
It would be a header change that reserves a flag that would be ignored
by everyone. I believe that the maintainers would simply veto this
as being a change that makes no change.

So, choice (c) is my bet. The maintainers simply ignore (if they want
to be polite) or deny your proposal.

>
>> It ain't gonna fly. Such a flag would invalidate /decades/ worth of
>> Unix/Linux code, and /not/ provide any functionality either to
>> the OS layer, the stdio library layer, or the application code layer.
>
> Sorry - what is being invalidated? Can you give an
> example?

Today, I can
open("/etc/passwd",O_RDONLY)
and read text from the text file /etc/passwd. I can
also
open("/sbin/init",O_RDONLY)
and read binary data from the binary file /sbin/init

If I understand correctly, you propose that code now
must
open("/etc/passwd",O_RDONLY | O_TEXT)
to read text from the text file /etc/passwd.

What would happen if, under your proposal, code still
executed
open("/etc/passwd",O_RDONLY)
? Could the code still read() text data, or would the
open() fail on something like EACCESS or EINVAL or
EOPNOTSUPP? What /would/ the consequences be of setting
O_TEXT?

Of course, if you answer that, under a POSIX-like system,
there would be /no/ consequences to O_TEXT, then you
have presented choice (b), a change that changes nothing.

--
Lew Pitcher
"In Skills We Trust"

Re: O_TEXT for PDOS/386

<wwvle7ft0hh.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3290&group=alt.os.linux#3290

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 19:11:06 +0000
Organization: terraraq NNTP server
Message-ID: <wwvle7ft0hh.fsf@LkoBDZeT.terraraq.uk>
References: <ur1i55$2chm2$1@dont-email.me>
<wwv34tnwjfu.fsf@LkoBDZeT.terraraq.uk> <ur1tti$2eqcr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="37414"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:3gUnEJsoseSLK9KuMKhsHUn+Ki0=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Tue, 20 Feb 2024 19:11 UTC

Paul Edwards <mutazilah@gmail.com> writes:
> On 20/02/24 17:53, Richard Kettlewell wrote:
>> Paul Edwards <mutazilah@gmail.com> writes:
>>> I'd like to add an O_TEXT flag to Linux. It would be good if Linux
>>> officially reserved a flag for this use, but in the absence of that,
>>> I'm happy to create my own.
>>
>> You’d need to ask on the linux-kernel mailing list, I think. But I
>> wouldn’t predict a very positive response.
>
> That's what I'm predicting too. So can you suggest
> a flag? I think Linux is consuming flags going up,
> so I could go down for anything I need, and have
> 0x80000000 mean "O_TEXT".

No, I can’t suggest a flag. I have no more control over the Linux ABI
than you do. That’s why I pointed you to linux-kernel.

> Any suggestions within the constraints of the Linux people having
> different goals to me?

I think you should rethink your goals and/or your approach to meeting
them. open/read/write is the wrong place to translate between line
ending conventions.

--
https://www.greenend.org.uk/rjk/

Re: O_TEXT for PDOS/386

<ur2urm$2k2bi$4@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3291&group=alt.os.linux#3291

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Tue, 20 Feb 2024 19:34:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <ur2urm$2k2bi$4@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Feb 2024 19:34:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cf162c938af35867d0447290d7daa709";
logging-data="2754930"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ce6dX+6H4BM2+Rs0XOciTne66JDXsfAM="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:CxeKafSVrhAz5gkpbSLbXrLqM9I=
 by: Lew Pitcher - Tue, 20 Feb 2024 19:34 UTC

On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:

> Hi.
>
> Cygwin has an O_TEXT on the open() call to let
> "the OS layer" (can be quibbled) that the file
> is being opened in text mode. And as such, it
> gives that layer an opportunity to insert CRs.
[snip]
> I am
> still missing the same thing that Cygwin was
> missing, and added O_TEXT to solve.

And, what would that be? What does the Cygwin
O_TEXT flag on open(2) do?

[snip]
> And it is not important to maintain the same value
> as Cygwin, because Cygwin creates PE executables,
> while mine is for ELF executables.

Are you just trying to keep your Linux source
source-compatible with your (Cygwin-based) Windows
source? Or are you actually looking for the functionality
behind the O_TEXT flag?

If you just want to keep source compatibility, I don't see
any problem with using a system-specific predefined macro
to implement some conditional compilation. Something like

#ifndef O_TEXT
#define O_TEXT 0
#endif

open("/etc/passwd",O_RDONLY | O_TEXT);

HTH
--
Lew Pitcher
"In Skills We Trust"

Re: O_TEXT for PDOS/386

<ur363a$2mvmf$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3292&group=alt.os.linux#3292

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 05:37:45 +0800
Organization: A noiseless patient Spider
Lines: 122
Message-ID: <ur363a$2mvmf$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 20 Feb 2024 21:37:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5a42e109a14e96f3471bdcf90f68f77e";
logging-data="2850511"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UeSLBm7VOZlJcuoHMvlOeZI9jlIFcZCI="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:Z1NKyo0AVDBSebztLu2SxOadbMw=
In-Reply-To: <ur2p1q$2k2bi$1@dont-email.me>
 by: Paul Edwards - Tue, 20 Feb 2024 21:37 UTC

On 21/02/24 01:55, Lew Pitcher wrote:
> On Tue, 20 Feb 2024 22:25:05 +0800, Paul Edwards wrote:
>
>> On 20/02/24 22:14, Lew Pitcher wrote:
>>> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:
>>>
>>>> Hi.
>>>>
>>>> Cygwin has an O_TEXT on the open() call to let
>>>> "the OS layer" (can be quibbled) that the file
>>>> is being opened in text mode. And as such, it
>>>> gives that layer an opportunity to insert CRs.
>>> [snip]
>>>> I'd like to add an O_TEXT flag to Linux.[snip]
>>>> Any suggestions?
>>>
>>> Yes, one. Dont.
>>>
>>> Microsoft Windows (on top of which Cygwin must run) makes a low-level
>>> distinction between "binary" files and "text" files. I believe it is
>>> because Windows guarantees (or must guarantee) certain data
>>> transformations on text that do not apply to other forms of data.
>>> (I.e. translating <cr><lf> sequences into C newline characters, etc)
>>>
>>> HOWEVER, Linux (or, /any/ Unix) makes NO distinction between text
>>> and binary data, neither in the standard I/O library, nor in the OS
>>> itself.
>>>
>>> You are effectively asking that Linux /NOW/ make such a distinction,
>>> even if only to ignore the O_TEXT flag that you ask for.
>>
>> The C library that most people use already has
>> that distinction - and it is indeed ignored.
>> Works perfectly fine.
>
> Lets take an accounting...
>
> 1) POSIX open() does not make any distinction between "text" and "binary"
> files
>
> 2) Standard C / POSIX fopen() /does/ make a distinction between "text"
> and "binary" files. POSIX issues a caveat regarding the mode
> parameter that "The character 'b' shall have no effect, but is allowed
> for ISO C standard conformance.", referring to the mode character "b"
> specified by the ISO C standard as indicating that the file should be
> opened for "binary" I/O, rather than the default "text" I/O.
>
> 3) You specifically reference the open() call, not the fopen() call.
>
> So, you ask that the open() call, a call that, under Linux and other
> POSIX-compatible operating systems, makes no distinction between binary
> and text files, now recognize a flag indicating that the open() should
> act apon a text file.
>
> That leaves the Linux kernel developers with a choice to make: either
> a) accept your request and add an O_TEXT flag that conditions the I/O
> for text data, or
> b) accept your request and add an O_TEXT flag that does nothing, or
> c) ignore or deny your request
>
> Choice (a) would drastically change the behaviour of the open()
> call, and any existing code that uses open() to access a text file would
> have to change to specify the O_TEXT flag. I believe that this would
> be a no-starter, even if the default for O_TEXT would leave behaviour
> as it currently is.
>
> Choice (b) is ... useless. It recognizes a non-issue, and does nothing.
> It would be a header change that reserves a flag that would be ignored
> by everyone.

Almost everyone.

PDOS/386 would use it.

> I believe that the maintainers would simply veto this
> as being a change that makes no change.
>
> So, choice (c) is my bet. The maintainers simply ignore (if they want
> to be polite) or deny your proposal.

Sure. Hence my question.

I'll take a random flag myself. Any suggestions?

>>> It ain't gonna fly. Such a flag would invalidate /decades/ worth of
>>> Unix/Linux code, and /not/ provide any functionality either to
>>> the OS layer, the stdio library layer, or the application code layer.
>>
>> Sorry - what is being invalidated? Can you give an
>> example?
>
> Today, I can
> open("/etc/passwd",O_RDONLY)
> and read text from the text file /etc/passwd. I can
> also
> open("/sbin/init",O_RDONLY)
> and read binary data from the binary file /sbin/init
>
> If I understand correctly, you propose that code now
> must
> open("/etc/passwd",O_RDONLY | O_TEXT)
> to read text from the text file /etc/passwd.
>
> What would happen if, under your proposal, code still
> executed
> open("/etc/passwd",O_RDONLY)
> ? Could the code still read() text data, or would the
> open() fail on something like EACCESS or EINVAL or
> EOPNOTSUPP? What /would/ the consequences be of setting
> O_TEXT?
>
> Of course, if you answer that, under a POSIX-like system,
> there would be /no/ consequences to O_TEXT, then you
> have presented choice (b), a change that changes nothing.

Correct. Nothing is invalidated.

It is only when run on a Windows-like system that
something happens.

BFN. Paul.

Re: O_TEXT for PDOS/386

<ur368i$2mvmf$2@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3293&group=alt.os.linux#3293

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 05:40:33 +0800
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <ur368i$2mvmf$2@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2urm$2k2bi$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 20 Feb 2024 21:40:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5a42e109a14e96f3471bdcf90f68f77e";
logging-data="2850511"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RzZWx+L5PoFIP81++9e5JKs3l14Oao50="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:5A2RflA2Vxgk/3QOwafamD43N4c=
In-Reply-To: <ur2urm$2k2bi$4@dont-email.me>
 by: Paul Edwards - Tue, 20 Feb 2024 21:40 UTC

On 21/02/24 03:34, Lew Pitcher wrote:
> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:
>
>> Hi.
>>
>> Cygwin has an O_TEXT on the open() call to let
>> "the OS layer" (can be quibbled) that the file
>> is being opened in text mode. And as such, it
>> gives that layer an opportunity to insert CRs.
> [snip]
>> I am
>> still missing the same thing that Cygwin was
>> missing, and added O_TEXT to solve.
>
> And, what would that be? What does the Cygwin
> O_TEXT flag on open(2) do?

It will add CRs to such files on a write().

> [snip]
>> And it is not important to maintain the same value
>> as Cygwin, because Cygwin creates PE executables,
>> while mine is for ELF executables.
>
> Are you just trying to keep your Linux source
> source-compatible with your (Cygwin-based) Windows
> source? Or are you actually looking for the functionality
> behind the O_TEXT flag?

The latter. Functionality on PDOS/386, not Linux.

And not Linux source. Linux binaries.

> If you just want to keep source compatibility, I don't see
> any problem with using a system-specific predefined macro
> to implement some conditional compilation. Something like
>
> #ifndef O_TEXT
> #define O_TEXT 0
> #endif
>
> open("/etc/passwd",O_RDONLY | O_TEXT);

Not what I'm after.

BFN. Paul.

Re: O_TEXT for PDOS/386

<ur3ofe$2ptvg$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3295&group=alt.os.linux#3295

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 02:51:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 98
Message-ID: <ur3ofe$2ptvg$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<ur363a$2mvmf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Feb 2024 02:51:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7a1a405dfea1f8bffbdb47f3218502f6";
logging-data="2947056"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Qra+u9ci+VwEHhzp/rZiGJiYW52D+tRg="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:x6daRuX6OIgYCOkM+lt5Ly/L7+Q=
 by: Lew Pitcher - Wed, 21 Feb 2024 02:51 UTC

On Wed, 21 Feb 2024 05:37:45 +0800, Paul Edwards wrote:

> On 21/02/24 01:55, Lew Pitcher wrote:
>> On Tue, 20 Feb 2024 22:25:05 +0800, Paul Edwards wrote:
>>
>>> On 20/02/24 22:14, Lew Pitcher wrote:
>>>> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:
>>>>
>>>>> Hi.
>>>>>
>>>>> Cygwin has an O_TEXT on the open() call to let
>>>>> "the OS layer" (can be quibbled) that the file
>>>>> is being opened in text mode. And as such, it
>>>>> gives that layer an opportunity to insert CRs.
>>>> [snip]
>>>>> I'd like to add an O_TEXT flag to Linux.[snip]
>>>>> Any suggestions?
>>>>
>>>> Yes, one. Dont.
>>>>
>>>> Microsoft Windows (on top of which Cygwin must run) makes a low-level
>>>> distinction between "binary" files and "text" files. I believe it is
>>>> because Windows guarantees (or must guarantee) certain data
>>>> transformations on text that do not apply to other forms of data.
>>>> (I.e. translating <cr><lf> sequences into C newline characters, etc)
>>>>
>>>> HOWEVER, Linux (or, /any/ Unix) makes NO distinction between text
>>>> and binary data, neither in the standard I/O library, nor in the OS
>>>> itself.
>>>>
>>>> You are effectively asking that Linux /NOW/ make such a distinction,
>>>> even if only to ignore the O_TEXT flag that you ask for.
>>>
>>> The C library that most people use already has
>>> that distinction - and it is indeed ignored.
>>> Works perfectly fine.
>>
>> Lets take an accounting...
>>
>> 1) POSIX open() does not make any distinction between "text" and "binary"
>> files
>>
>> 2) Standard C / POSIX fopen() /does/ make a distinction between "text"
>> and "binary" files. POSIX issues a caveat regarding the mode
>> parameter that "The character 'b' shall have no effect, but is allowed
>> for ISO C standard conformance.", referring to the mode character "b"
>> specified by the ISO C standard as indicating that the file should be
>> opened for "binary" I/O, rather than the default "text" I/O.
>>
>> 3) You specifically reference the open() call, not the fopen() call.
>>
>> So, you ask that the open() call, a call that, under Linux and other
>> POSIX-compatible operating systems, makes no distinction between binary
>> and text files, now recognize a flag indicating that the open() should
>> act apon a text file.
>>
>> That leaves the Linux kernel developers with a choice to make: either
>> a) accept your request and add an O_TEXT flag that conditions the I/O
>> for text data, or
>> b) accept your request and add an O_TEXT flag that does nothing, or
>> c) ignore or deny your request
>>
>> Choice (a) would drastically change the behaviour of the open()
>> call, and any existing code that uses open() to access a text file would
>> have to change to specify the O_TEXT flag. I believe that this would
>> be a no-starter, even if the default for O_TEXT would leave behaviour
>> as it currently is.
>>
>> Choice (b) is ... useless. It recognizes a non-issue, and does nothing.
>> It would be a header change that reserves a flag that would be ignored
>> by everyone.
>
> Almost everyone.
>
> PDOS/386 would use it.

If PDOS/386 needs it, then PDOS/386 probably should use it.

However, the needs of PDOS/386 aren't the needs of Linux or POSIX, and
neither Linux in particular, nor POSIX in general, need bother with
it.

If you are concerned with PDOS/386 being able to use source code written
to the POSIX standard, then I suggest that you select the value and
treatment of your O_TEXT flag to work in absence, as POSIX code won't
have it or use it.

The alternative is to specify that such a flag /is/ required for PDOS/386,
which restricts you to using code written specifically for PDOS/386, and
not the more general-purpose and widely available POSIX standard.

[snip]

Best of luck.
--
Lew Pitcher
"In Skills We Trust"

Re: O_TEXT for PDOS/386

<ur3ro9$2udhn$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3296&group=alt.os.linux#3296

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 11:47:15 +0800
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <ur3ro9$2udhn$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<ur363a$2mvmf$1@dont-email.me> <ur3ofe$2ptvg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 03:47:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ddc99c20dba38873cfbfcc79cf1ee053";
logging-data="3094071"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cpC0ZpyDxn8AJYC8R2g/Wk6zBkf9ITII="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:UatRSAPf0Tp8WSl8rybzRPYgXJI=
In-Reply-To: <ur3ofe$2ptvg$1@dont-email.me>
 by: Paul Edwards - Wed, 21 Feb 2024 03:47 UTC

On 21/02/24 10:51, Lew Pitcher wrote:
> On Wed, 21 Feb 2024 05:37:45 +0800, Paul Edwards wrote:

>>> Choice (b) is ... useless. It recognizes a non-issue, and does nothing.
>>> It would be a header change that reserves a flag that would be ignored
>>> by everyone.
>>
>> Almost everyone.
>>
>> PDOS/386 would use it.
>
> If PDOS/386 needs it, then PDOS/386 probably should use it.

Not so much "needs" as "would be desirable".

> However, the needs of PDOS/386 aren't the needs of Linux or POSIX, and
> neither Linux in particular, nor POSIX in general, need bother with
> it.

Sure. As I said in a previous message - "different goals".

> If you are concerned with PDOS/386 being able to use source code written
> to the POSIX standard,

Not just source - that is easy to deal with.
The executable.

> then I suggest that you select the value and
> treatment of your O_TEXT flag to work in absence, as POSIX code won't
> have it or use it.

That's exactly what I'm doing. I'm just asking
which bit would be good to use. I showed which
bit that Cygwin was using, and I made a suggestion
that I could work downwards on the assumption
that Linux is working upwards.

> The alternative is to specify that such a flag /is/ required for PDOS/386,

That's the alternative I am after.

> which restricts you to using code written specifically for PDOS/386, and

It is only code that uses the new flag that will
work nicely on PDOS/386, yes.

The other code would still run, it just won't
automatically put the CR before the NL, so it
won't look good on (this) Windows-like environment.

> not the more general-purpose

I consider adding O_TEXT to be more general-purpose
than one that assumes the code will only be used on
a Unix-like environment, never a Windows-like
environment.

> and widely available POSIX standard.

It still follows the rest of that, so it will still
work on any POSIX environment.

The *application* code will need to have:

#ifndef O_TEXT
/* uh oh, we're on a standard POSIX environment,
missing the PDOS/386-inspired Linux enhancement
that hasn't YET (as of 2024-02-21) made it to a
formal POSIX standard */
#define O_TEXT 0
#endif

.... open(... | O_TEXT ...)

BFN. Paul.

Re: O_TEXT for PDOS/386

<l3llocFp8erU1@mid.individual.net>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3297&group=alt.os.linux#3297

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 08:06:52 +0100
Lines: 35
Message-ID: <l3llocFp8erU1@mid.individual.net>
References: <ur1i55$2chm2$1@dont-email.me> <ur2urm$2k2bi$4@dont-email.me>
<ur368i$2mvmf$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net oJFkWDjU4RWob6ZajR4ZsgF/2rXveWogfKw5UHYA8RUsOzaXKA
Cancel-Lock: sha1:fHichVmdroc5Pwt0v3Z/mfDoyYI= sha256:axFyrQx41sUi64H4dt5TBTPm/BnyVHVQGGJbE40TnBM=
User-Agent: Mozilla Thunderbird
Content-Language: en-US-large
In-Reply-To: <ur368i$2mvmf$2@dont-email.me>
 by: J.O. Aho - Wed, 21 Feb 2024 07:06 UTC

On 20/02/2024 22.40, Paul Edwards wrote:
> On 21/02/24 03:34, Lew Pitcher wrote:
>> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:

>> [snip]
>>> And it is not important to maintain the same value
>>> as Cygwin, because Cygwin creates PE executables,
>>> while mine is for ELF executables.
>>
>> Are you just trying to keep your Linux source
>> source-compatible with your (Cygwin-based) Windows
>> source? Or are you actually looking for the functionality
>> behind the O_TEXT flag?
>
> The latter. Functionality on PDOS/386, not Linux.

Think you need to look into the windows source code, as open() already
exists in windows and those cygwin don't need to reimplement that, it
only provides things that do not exists in windows but is part of POSIX.

> And not Linux source. Linux binaries.

Cygwin is not:

- a way to run native Linux apps on Windows. You must rebuild your
application from source if you want it to run on Windows.

If you want to make changes to POSIX API, you need to start contacting
Austin Group, with time changes will appear in Linux. I doubt you would
have more luck with the Austin Group than convincing Linus to add a
patch to add something that Linux don't need.

--
//Aho

Re: O_TEXT for PDOS/386

<wwvjzmy87wd.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3299&group=alt.os.linux#3299

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 09:48:50 +0000
Organization: terraraq NNTP server
Message-ID: <wwvjzmy87wd.fsf@LkoBDZeT.terraraq.uk>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<ur363a$2mvmf$1@dont-email.me> <ur3ofe$2ptvg$1@dont-email.me>
<ur3ro9$2udhn$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="50088"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:toZR+WMBpzi6NIk9q11t9Sq5JJY=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Wed, 21 Feb 2024 09:48 UTC

Paul Edwards <mutazilah@gmail.com> writes:
> On 21/02/24 10:51, Lew Pitcher wrote:
>> If you are concerned with PDOS/386 being able to use source code written
>> to the POSIX standard,
>
> Not just source - that is easy to deal with.
> The executable.

Executables won’t have your extra flag unless you’ve personally modified
and recompiled them.

>> The alternative is to specify that such a flag /is/ required for
>> PDOS/386,
>
> That's the alternative I am after.
>
>> which restricts you to using code written specifically for PDOS/386,
>> and
>
> It is only code that uses the new flag that will work nicely on
> PDOS/386, yes.

How will you modify other syscalls (for example fstat and lseek) to be
play nicely with the newline translation?

--
https://www.greenend.org.uk/rjk/

Re: O_TEXT for PDOS/386

<ur4nhi$33uer$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3300&group=alt.os.linux#3300

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 19:41:35 +0800
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <ur4nhi$33uer$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<ur363a$2mvmf$1@dont-email.me> <ur3ofe$2ptvg$1@dont-email.me>
<ur3ro9$2udhn$1@dont-email.me> <wwvjzmy87wd.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Feb 2024 11:41:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ddc99c20dba38873cfbfcc79cf1ee053";
logging-data="3275227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KY149DEHgDq8jO2nTRW9qDoKe7d8rQtc="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:UENUnF1qCnUV240mZPmcV3Yz3s4=
In-Reply-To: <wwvjzmy87wd.fsf@LkoBDZeT.terraraq.uk>
 by: Paul Edwards - Wed, 21 Feb 2024 11:41 UTC

On 21/02/24 17:48, Richard Kettlewell wrote:
> Paul Edwards <mutazilah@gmail.com> writes:
>> On 21/02/24 10:51, Lew Pitcher wrote:
>>> If you are concerned with PDOS/386 being able to use source code written
>>> to the POSIX standard,
>>
>> Not just source - that is easy to deal with.
>> The executable.
>
> Executables won’t have your extra flag unless you’ve personally modified
> and recompiled them.

Yes, that's exactly what I will do. I will start
producing executables that have that flag.

At least MY executables will live up to MY
requirements.

Which is all I'm really after.

If someone else finds that useful, for the same
reasons I find that useful, great.

If I am alone in the world, that's fine too.

The latter state could change at a later date
though. You never know what will happen a
millenia from now.

>>> which restricts you to using code written specifically for PDOS/386,
>>> and
>>
>> It is only code that uses the new flag that will work nicely on
>> PDOS/386, yes.
>
> How will you modify other syscalls (for example fstat and lseek) to be
> play nicely with the newline translation?

I only intend to run C90-compliant programs
(in this case, with a statically-linked C
runtime library).

fstat is not used by PDPCLIB, nor part of the
C90 standard.

lseek is used by PDPCLIB - that's how fseek()
is implemented.

According to C90, fseek() is not expected to
behave sensibly on text files.

And indeed - it won't (on PDOS/386 anyway; when
run on Linux it will be fine).

BFN. Paul.

Re: O_TEXT for PDOS/386

<ur4oes$346ae$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3301&group=alt.os.linux#3301

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 19:57:13 +0800
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <ur4oes$346ae$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2urm$2k2bi$4@dont-email.me>
<ur368i$2mvmf$2@dont-email.me> <l3llocFp8erU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 11:57:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ddc99c20dba38873cfbfcc79cf1ee053";
logging-data="3283278"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rng3fFSR+/ognj2ZlI/3IirWxepYIiFg="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:psjkh4ltx+nwqcpYlet5xQW2nWU=
In-Reply-To: <l3llocFp8erU1@mid.individual.net>
 by: Paul Edwards - Wed, 21 Feb 2024 11:57 UTC

On 21/02/24 15:06, J.O. Aho wrote:

>>>> And it is not important to maintain the same value
>>>> as Cygwin, because Cygwin creates PE executables,
>>>> while mine is for ELF executables.
>>>
>>> Are you just trying to keep your Linux source
>>> source-compatible with your (Cygwin-based) Windows
>>> source? Or are you actually looking for the functionality
>>> behind the O_TEXT flag?
>>
>> The latter. Functionality on PDOS/386, not Linux.
>
> Think you need to look into the windows source code, as open() already
> exists in windows

There is no such syscall. kernel32 exports CreateFile.

Regardless - Windows won't run the Linux ELF binary -
not even the one I produce myself - regardless. Although
if you install WSL it would, but that's installing
Linux - and of course Linux programs run under Linux.

It is PDOS/386 that will run it. And receive the
INT 80H. And check for the flag.

Because PDOS/386 is sort of a DOS/Windows clone,
all files are expected to use CRLF as line terminators.
That's the user requirements, basically.

So I'm trying to get my Linux ELF binaries (ones that
I build myself) to fit into that existing user
requirement.

> and those cygwin don't need to reimplement that, it
> only provides things that do not exists in windows but is part of POSIX.

It is Cygwin that invented O_TEXT, not Windows.
To satisfy that same user requirement above.

>> And not Linux source. Linux binaries.
>
> Cygwin is not:
>
> - a way to run native Linux apps on Windows. You must rebuild your
> application from source if you want it to run on Windows.

I know.

That's why I'm not using Cygwin, I'm using PDOS/386.

Which ALREADY runs a hello world Linux ELF binary.

(unlike Cygwin - which never did)

> If you want to make changes to POSIX API, you need to start contacting
> Austin Group, with time changes will appear in Linux.

https://en.wikipedia.org/wiki/Austin_Group

Ok, thanks.

> I doubt you would
> have more luck with the Austin Group than convincing Linus to add a
> patch to add something that Linux don't need.

Ok. I'll try the Austin Group first though. As you
noted, this isn't for Linux. It's for (quibbling
aside) a competitor of Linux, so the Austin Group
would be more appropriate.

BFN. Paul.

Re: O_TEXT for PDOS/386

<wwvplwqdmwc.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3302&group=alt.os.linux#3302

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!news.hispagatos.org!news.nntp4.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 12:25:55 +0000
Organization: terraraq NNTP server
Message-ID: <wwvplwqdmwc.fsf@LkoBDZeT.terraraq.uk>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<ur363a$2mvmf$1@dont-email.me> <ur3ofe$2ptvg$1@dont-email.me>
<ur3ro9$2udhn$1@dont-email.me> <wwvjzmy87wd.fsf@LkoBDZeT.terraraq.uk>
<ur4nhi$33uer$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="52315"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:XFZKz8CmMFUY9OvRjIisvUuF9Ec=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Wed, 21 Feb 2024 12:25 UTC

Paul Edwards <mutazilah@gmail.com> writes:
> On 21/02/24 17:48, Richard Kettlewell wrote:
>> How will you modify other syscalls (for example fstat and lseek) to be
>> play nicely with the newline translation?
>
> I only intend to run C90-compliant programs (in this case, with a
> statically-linked C runtime library).
>
> fstat is not used by PDPCLIB, nor part of the C90 standard.

Standard C doesn’t have open(), read() or write() either, but you seem
to want to modify the behaviour of those.

--
https://www.greenend.org.uk/rjk/

Re: O_TEXT for PDOS/386

<ur4r5m$34umv$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3303&group=alt.os.linux#3303

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 20:43:32 +0800
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <ur4r5m$34umv$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<ur363a$2mvmf$1@dont-email.me> <ur3ofe$2ptvg$1@dont-email.me>
<ur3ro9$2udhn$1@dont-email.me> <wwvjzmy87wd.fsf@LkoBDZeT.terraraq.uk>
<ur4nhi$33uer$1@dont-email.me> <wwvplwqdmwc.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Feb 2024 12:43:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ddc99c20dba38873cfbfcc79cf1ee053";
logging-data="3308255"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Oi+2at5O8FqcJYFjVXFnKOb09+C3BttU="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:u3sSmwEydVXqV9lT8mU47KbWtlM=
In-Reply-To: <wwvplwqdmwc.fsf@LkoBDZeT.terraraq.uk>
 by: Paul Edwards - Wed, 21 Feb 2024 12:43 UTC

On 21/02/24 20:25, Richard Kettlewell wrote:
> Paul Edwards <mutazilah@gmail.com> writes:
>> On 21/02/24 17:48, Richard Kettlewell wrote:
>>> How will you modify other syscalls (for example fstat and lseek) to be
>>> play nicely with the newline translation?
>>
>> I only intend to run C90-compliant programs (in this case, with a
>> statically-linked C runtime library).
>>
>> fstat is not used by PDPCLIB, nor part of the C90 standard.
>
> Standard C doesn’t have open(), read() or write() either,

Indeed - because PDPCLIB's implementation of fopen()
needs to do the open syscall (INT 80H EAX = 5H).

fopen already knows whether the file is being
opened as text or binary, and I don't want that
information lost when I do that interrupt above.
Even though Linux (currently, and very likely
forever) won't use it, PDOS/386 has a use for it
(in the short term).

> but you seem to want to modify the behaviour of those.

I don't think that is an accurate statement.

What behavior, where?

Adding an extra flag doesn't change the behavior
of anything anywhere, immediately.

PDOS/386 would then be in a position to have a
particular behavior, but it's not really a
change, is it? It's new development/enhancement.

BFN. Paul.

Re: O_TEXT for PDOS/386

<l3ma0oFsspfU1@mid.individual.net>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3304&group=alt.os.linux#3304

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 13:52:40 +0100
Lines: 43
Message-ID: <l3ma0oFsspfU1@mid.individual.net>
References: <ur1i55$2chm2$1@dont-email.me> <ur2urm$2k2bi$4@dont-email.me>
<ur368i$2mvmf$2@dont-email.me> <l3llocFp8erU1@mid.individual.net>
<ur4oes$346ae$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net LhnE4PeaEZYJgL/R+Du9tQ+oSVAbCnVbiPh6mxb4Tm3Ei5zRcK
Cancel-Lock: sha1:dy1YvltpqyM9rmr2MS/AOtABJns= sha256:vnUIAh3x49xr8suuS6kSazTvghAoztwIYx8KfrVCK7s=
User-Agent: Mozilla Thunderbird
Content-Language: en-US-large
In-Reply-To: <ur4oes$346ae$1@dont-email.me>
 by: J.O. Aho - Wed, 21 Feb 2024 12:52 UTC

On 21/02/2024 12.57, Paul Edwards wrote:
> On 21/02/24 15:06, J.O. Aho wrote:
>
>>>>> And it is not important to maintain the same value
>>>>> as Cygwin, because Cygwin creates PE executables,
>>>>> while mine is for ELF executables.
>>>>
>>>> Are you just trying to keep your Linux source
>>>> source-compatible with your (Cygwin-based) Windows
>>>> source? Or are you actually looking for the functionality
>>>> behind the O_TEXT flag?
>>>
>>> The latter. Functionality on PDOS/386, not Linux.
>>
>> Think you need to look into the windows source code, as open() already
>> exists in windows
>
> There is no such syscall. kernel32 exports CreateFile.

_sopen_s() (secure version of _open()) and _O_TEXT/_O_BINARY do exists
and I think this is what Cygwin wraps to open() and O_TEXT/O_BINARY.

> Because PDOS/386 is sort of a DOS/Windows clone,
> all files are expected to use CRLF as line terminators.
> That's the user requirements, basically.

Why don't you ask Microsoft to make ms-windows POSIX compatible, then
this issue would disappear at once ;)

> So I'm trying to get my Linux ELF binaries (ones that
> I build myself) to fit into that existing user
> requirement.

That's why other projects has solved it as define O_TEXT/O_BINARY to 0x0
if they are missing when they want to support multiple OS:es. They don't
expect that all OS has AmigaOS dos library implemented to open files
IDOS->Open("c:dir", MODE_OLDFILE)

--
//Aho

Re: O_TEXT for PDOS/386

<lm7gak-kc1.ln1@hendrix.foo>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3305&group=alt.os.linux#3305

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: phaywood@alphalink.com.au (Peter 'Shaggy' Haywood)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 14:36:21 +1100
Organization: A noiseless patient Spider
Lines: 126
Message-ID: <lm7gak-kc1.ln1@hendrix.foo>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me> <ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Injection-Info: dont-email.me; posting-host="cb3de182b3be218287d95cf165629bb1";
logging-data="3319185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CnyjfNK3caTuHub0KLVajYnWvwSsyg8w="
User-Agent: KNode/0.10.9
Cancel-Lock: sha1:J0B06P23owpNfMwP1JdvYKoNIwA=
 by: Peter 'Shaggy&# - Wed, 21 Feb 2024 03:36 UTC

Groovy hepcat Lew Pitcher was jivin' in alt.os.linux on Wed, 21 Feb 2024
04:55 am. It's a cool scene! Dig it.

> On Tue, 20 Feb 2024 22:25:05 +0800, Paul Edwards wrote:
>> On 20/02/24 22:14, Lew Pitcher wrote:
>>> On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:
>>>
>>>> Cygwin has an O_TEXT on the open() call to let
>>>> "the OS layer" (can be quibbled) that the file
>>>> is being opened in text mode. And as such, it
>>>> gives that layer an opportunity to insert CRs.
>>> [snip]
>>>> I'd like to add an O_TEXT flag to Linux.[snip]
>>>> Any suggestions?
>>>
>>> Yes, one. Dont.

[Snip.]

>> The C library that most people use already has
>> that distinction - and it is indeed ignored.
>> Works perfectly fine.
>
> Lets take an accounting...
>
> 1) POSIX open() does not make any distinction between "text" and
> "binary"
> files
>
> 2) Standard C / POSIX fopen() /does/ make a distinction between "text"
> and "binary" files. POSIX issues a caveat regarding the mode
> parameter that "The character 'b' shall have no effect, but is
> allowed for ISO C standard conformance.", referring to the mode
> character "b" specified by the ISO C standard as indicating that
> the file should be opened for "binary" I/O, rather than the default
> "text" I/O.
>
> 3) You specifically reference the open() call, not the fopen() call.
>
> So, you ask that the open() call, a call that, under Linux and other
> POSIX-compatible operating systems, makes no distinction between
> binary and text files, now recognize a flag indicating that the open()
> should act apon a text file.
>
> That leaves the Linux kernel developers with a choice to make: either
> a) accept your request and add an O_TEXT flag that conditions the I/O
> for text data, or
> b) accept your request and add an O_TEXT flag that does nothing, or
> c) ignore or deny your request
>
> Choice (a) would drastically change the behaviour of the open()
> call, and any existing code that uses open() to access a text file
> would have to change to specify the O_TEXT flag. I believe that this
> would be a no-starter, even if the default for O_TEXT would leave
> behaviour as it currently is.
>
> Choice (b) is ... useless. It recognizes a non-issue, and does
> nothing. It would be a header change that reserves a flag that would
> be ignored by everyone. I believe that the maintainers would simply
> veto this as being a change that makes no change.

This would be useless, true. But it would be harmless. It could be
defined simply as

#define O_TEXT 0

which would mean a mode argument of, say, O_RDONLY | O_TEXT would
ammount to O_RDONLY | 0, which would in turn ammount to simply
O_RDONLY.
I can't see the kernel devs going for it, though.

> So, choice (c) is my bet. The maintainers simply ignore (if they want
> to be polite) or deny your proposal.
>>
>>> It ain't gonna fly. Such a flag would invalidate /decades/ worth of
>>> Unix/Linux code, and /not/ provide any functionality either to
>>> the OS layer, the stdio library layer, or the application code
>>> layer.
>>
>> Sorry - what is being invalidated? Can you give an
>> example?
>
> Today, I can
> open("/etc/passwd",O_RDONLY)
> and read text from the text file /etc/passwd. I can
> also
> open("/sbin/init",O_RDONLY)
> and read binary data from the binary file /sbin/init
>
> If I understand correctly, you propose that code now
> must
> open("/etc/passwd",O_RDONLY | O_TEXT)
> to read text from the text file /etc/passwd.
>
> What would happen if, under your proposal, code still
> executed
> open("/etc/passwd",O_RDONLY)
> ? Could the code still read() text data, or would the
> open() fail on something like EACCESS or EINVAL or
> EOPNOTSUPP? What /would/ the consequences be of setting
> O_TEXT?

I think what the OP is proposing is option (b) above: allow an O_TEXT
identifier having no effect.

> Of course, if you answer that, under a POSIX-like system,
> there would be /no/ consequences to O_TEXT, then you
> have presented choice (b), a change that changes nothing.

Right. This is trivially doable. But, as I said, I can't see this
happening.
To the OP: a solution to your problem is simple. Put the following
lines in your source code before any use of O_TEXT:

#ifndef O_TEXT
#define O_TEXT 0
#endif

--

----- Dig the NEW and IMPROVED news sig!! -----

-------------- Shaggy was here! ---------------
Ain't I'm a dawg!!

Re: O_TEXT for PDOS/386

<ur4v9t$366tp$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3306&group=alt.os.linux#3306

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 21:54:02 +0800
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <ur4v9t$366tp$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<lm7gak-kc1.ln1@hendrix.foo>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 13:54:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ddc99c20dba38873cfbfcc79cf1ee053";
logging-data="3349433"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190YC/HXip9BeZ/W1s8EmuiVUCzblujkL4="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:rwLij/4KXvd0R/VApm2HGyKPVeU=
In-Reply-To: <lm7gak-kc1.ln1@hendrix.foo>
 by: Paul Edwards - Wed, 21 Feb 2024 13:54 UTC

On 21/02/24 11:36, Peter 'Shaggy' Haywood wrote:

>> b) accept your request and add an O_TEXT flag that does nothing, or
>>
>> Choice (b) is ... useless. It recognizes a non-issue, and does
>> nothing. It would be a header change that reserves a flag that would
>> be ignored by everyone. I believe that the maintainers would simply
>> veto this as being a change that makes no change.
>
> This would be useless, true. But it would be harmless. It could be
> defined simply as
>
> #define O_TEXT 0

No. It can't be that. It needs to be non-zero so
that I can detect it in a non-Linux environment.

> I think what the OP is proposing is option (b) above: allow an O_TEXT
> identifier having no effect.

No effect ... on Linux.

An effect ... on PDOS/386.

> To the OP: a solution to your problem is simple. Put the following
> lines in your source code before any use of O_TEXT:
>
> #ifndef O_TEXT
> #define O_TEXT 0
> #endif

No, that doesn't solve my problem.

When the ELF executable is run on PDOS/386, I will
have no way of knowing that this open is text, and
thus PDOS/386 (the OS) should add CRs whenever it
sees a LF.

Because we're beyond the point when anyone else
would add the CR.

BFN. Paul.

Re: O_TEXT for PDOS/386

<wwva5nt99ve.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3307&group=alt.os.linux#3307

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 14:20:53 +0000
Organization: terraraq NNTP server
Message-ID: <wwva5nt99ve.fsf@LkoBDZeT.terraraq.uk>
References: <ur1i55$2chm2$1@dont-email.me> <ur2c4t$2h63i$1@dont-email.me>
<ur2co0$2hogi$1@dont-email.me> <ur2p1q$2k2bi$1@dont-email.me>
<ur363a$2mvmf$1@dont-email.me> <ur3ofe$2ptvg$1@dont-email.me>
<ur3ro9$2udhn$1@dont-email.me> <wwvjzmy87wd.fsf@LkoBDZeT.terraraq.uk>
<ur4nhi$33uer$1@dont-email.me> <wwvplwqdmwc.fsf@LkoBDZeT.terraraq.uk>
<ur4r5m$34umv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="53843"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:Ji6rW/8/JN29MNBXb2iOv2ui0ic=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Wed, 21 Feb 2024 14:20 UTC

Paul Edwards <mutazilah@gmail.com> writes:
> On 21/02/24 20:25, Richard Kettlewell wrote:
>> Standard C doesn’t have open(), read() or write() either,
>
> Indeed - because PDPCLIB's implementation of fopen()
> needs to do the open syscall (INT 80H EAX = 5H).
>
> fopen already knows whether the file is being opened as text or
> binary, and I don't want that information lost when I do that
> interrupt above. Even though Linux (currently, and very likely
> forever) won't use it, PDOS/386 has a use for it (in the short term).
>
>> but you seem to want to modify the behaviour of those.
>
> I don't think that is an accurate statement.
>
> What behavior, where?

You’ve been talking about doing translation _somewhere_, and cited
Cygwin as an example in your first posting, and have been consistently
using the flag name from Cygwin. Cygwin’s O_TEXT causes read() and
write() to translate between newline conventions, so if you meant
something else then it was a confusing decision to use Cygwin as an
example.

If, in fact, you don’t want to add translation to read() and write()
then you don’t need to add any new flags to open(). As an existing
example, Windows manages to do translation in its <stdio.h>
implementation without any assistance from CreateFile and its
friends. Presumably it records the text/binary distinction in its
implementation of the FILE type.

--
https://www.greenend.org.uk/rjk/

Re: O_TEXT for PDOS/386

<wwv4je199h1.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3308&group=alt.os.linux#3308

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 14:29:30 +0000
Organization: terraraq NNTP server
Message-ID: <wwv4je199h1.fsf@LkoBDZeT.terraraq.uk>
References: <ur1i55$2chm2$1@dont-email.me> <ur2urm$2k2bi$4@dont-email.me>
<ur368i$2mvmf$2@dont-email.me> <l3llocFp8erU1@mid.individual.net>
<ur4oes$346ae$1@dont-email.me> <l3ma0oFsspfU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="53843"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:c/wolGtT2dbYlUj5n6bzg+APDgs=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Wed, 21 Feb 2024 14:29 UTC

"J.O. Aho" <user@example.net> writes:
> _sopen_s() (secure version of _open()) and _O_TEXT/_O_BINARY do exists
> and I think this is what Cygwin wraps to open() and O_TEXT/O_BINARY.

Cygwin it has its own independent implementation of newline translation.

--
https://www.greenend.org.uk/rjk/

Re: O_TEXT for PDOS/386

<ur52na$3794k$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3309&group=alt.os.linux#3309

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@gmail.com (Paul Edwards)
Newsgroups: alt.os.linux
Subject: Re: O_TEXT for PDOS/386
Date: Wed, 21 Feb 2024 22:52:24 +0800
Organization: A noiseless patient Spider
Lines: 168
Message-ID: <ur52na$3794k$1@dont-email.me>
References: <ur1i55$2chm2$1@dont-email.me> <ur2urm$2k2bi$4@dont-email.me>
<ur368i$2mvmf$2@dont-email.me> <l3llocFp8erU1@mid.individual.net>
<ur4oes$346ae$1@dont-email.me> <l3ma0oFsspfU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 14:52:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ddc99c20dba38873cfbfcc79cf1ee053";
logging-data="3384468"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mGryUm+3bmy1SU3lyS+cLL76wuy22RgY="
User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:vKK/MoM6h0YG3541UT3V2MC6Dp8=
In-Reply-To: <l3ma0oFsspfU1@mid.individual.net>
 by: Paul Edwards - Wed, 21 Feb 2024 14:52 UTC

On 21/02/24 20:52, J.O. Aho wrote:

>>> Think you need to look into the windows source code, as open() already
>>> exists in windows
>>
>> There is no such syscall. kernel32 exports CreateFile.
>
> _sopen_s() (secure version of _open()) and _O_TEXT/_O_BINARY do exists
> and I think this is what Cygwin wraps to open() and O_TEXT/O_BINARY.

Thanks for the pointer.

That allowed me to find this:

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/open-wopen?view=msvc-170

https://learn.microsoft.com/en-us/cpp/c-runtime-library/text-and-binary-mode-file-i-o?view=msvc-170

And those functions exist here:

C:\WINNT\system32>odwin -x msvcrt.dll | grep -i open
[ 218] _fdopen
[ 242] _fsopen
[ 403] _open
[ 404] _open_osfhandle
[ 414] _popen
[ 445] _sopen
[ 527] _wfdopen
[ 534] _wfopen
[ 535] _wfreopen
[ 536] _wfsopen
[ 547] _wopen
[ 550] _wpopen
[ 558] _wsopen
[ 620] fopen
[ 628] freopen

C:\WINNT\system32>

(on my Windows 2000 system)

However, do note that this msvcrt.dll is undocumented
and nominally not meant to be used directly, and only
as part of Visual Studio (and even then, it's no longer
called that - it gets a version number added).

So this is very different from a kernel32.dll equivalent
of a syscall.

However, it does at least give prior art - on top of
Cygwin.

So it is something that I can potentially go to the
Austin Group with.

>> Because PDOS/386 is sort of a DOS/Windows clone,
>> all files are expected to use CRLF as line terminators.
>> That's the user requirements, basically.
>
> Why don't you ask Microsoft to make ms-windows POSIX compatible, then
> this issue would disappear at once ;)

Well that's what everyone has been saying for decades
now, and Microsoft wins every time.

So you can continue fighting that war - no problem.

However, I do want to approach it from the other
direction - a Windows clone.

And I've been working on mine for decades too.

>> So I'm trying to get my Linux ELF binaries (ones that
>> I build myself) to fit into that existing user
>> requirement.
>
> That's why other projects has solved it as define O_TEXT/O_BINARY to 0x0
> if they are missing when they want to support multiple OS:es.

That solves a different problem a different way.

> They don't
> expect that all OS has AmigaOS dos library implemented to open files
> IDOS->Open("c:dir", MODE_OLDFILE)

Well that's an interesting analogy.

One that I have already visited.

So, let's start with PCs with the same processor,
in this case 68000. Atari is a competitor to the
Amiga. Can the Atari run Amiga software?

The equivalent of "everyone should be POSIX" is
"everyone should be Atari". And that's what Atari
thinks. And the Amiga will win every time.

So, my approach - can the Atari run Amiga software?
At least C90-compliant software.

And the answer is - no. At their heart, the Amiga
executables work (without DLLs) by hardcoding the
number 4. All the Amigados functions hang off that.

And on the Atari, address 4 cannot be used.

So should we give up?

No.

First of all, we change the Amiga applications - in
a way that doesn't affect them running on the Amiga.

See here:

https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/amistart.asm

I carry an alternate sysbase in d7. It won't be set
when running under genuine AmigaOS, but when run on
a competitor - perhaps not Atari's OS, but some
other OS running on Atari hardware - like, PDOS/Atari
or something like that - then d7 is set to a register
that points to memory that the Atari can actually
address properly.

And then those - select - AmigaOS executables - basically
ones compiled against PDPCLIB which is the only C library
I know of that implements the d7 protocol - which I only
created a couple of years ago - will run on alternate
hardware/OS.

And now I'm doing the same with Linux executables.

First I change the Linux executables with a view to
getting them to run on competing vendor platforms,
build those executables, and then later bring the
competing platform up to speed.

The d7 Amiga "standard" has been invented years (so
far) in advance of a competitor actually arising.

But that's for a different reason - I'm not that
interested in the Amiga API.

But I am interested in the OS/2 2.0 API.

And indeed - I have already prepared - or in the
midst of preparing - modifications there too.
Instead of depending on the 16-bit thunk libraries
to exist, I'm getting raw keyboard input by using
DosDevIOCtl. You can see that here:

https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/stdio.c#l2184

So now I am getting into position for PDOS/386 to
support the 32-bit MSDOS API (which I sort of
created myself because Microsoft didn't do that),
Win32, OS/2 2.0 and Linux ELF.

All in the same OS, all with very little code to
support the different OSes, and the OS hopefully
fits on a 360k floppy even with that extra
functionality (or should come very close, anyway -
noting that it isn't a design goal to fit on a
360k floppy - 720k would be period accurate I think).

BFN. Paul.

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor