Post by J.O. AhoPost by Paul EdwardsThink 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.
Post by J.O. AhoPost by Paul EdwardsBecause 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.
Post by J.O. AhoPost by Paul EdwardsSo 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.
Post by J.O. AhoThey 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.