-
Notifications
You must be signed in to change notification settings - Fork 602
win32_isatty() dont call a mostly failing syscall, NT->WIN err conv is slow #23375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bulk88
wants to merge
1
commit into
Perl:blead
Choose a base branch
from
bulk88:w32_isatty_slow_nterr2winerr
base: blead
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the description says there is a syscall that mostly fails. There is nothing that explains that statement, so we are left to guess about it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is below, GetConsoleMode() only accepts CONSOLE handles, not file handles, not serial ports, not TCPIP sockets, not process handles, not thread handles, not mutexes
On NT Kernel, what Perl calls a
Pack::age/HV*/stash, and every other lang calls it aclass. This is aPack::age/HV*/stashinside NT Kernelhttps://doxygen.reactos.org/d7/dca/ndk_2obtypes_8h_source.html#l00379
NT has 6 built in Classes that can I am calling "I/O" objects, they accept create/read/write/seek/close/delete IOCTLs, unix calls these things a file descriptor
https://doxygen.reactos.org/da/d7d/iomgr_8c_source.html#l00254
but unlike Unix, with its unreaped memory leaking zombie PID API, and you can't select() on a EXT2/EXT3 file on a 5400 RPM for some bizarre design decision, and Linux/BSD/RIP Solaris still can't figure out how to do select() on a disk file after 20 years
https://www.upwind.io/feed/io_uring-linux-performance-boost-or-security-headache
my meatspace dev friend won an iouring bug bounty last year but s/he is not a public figure and is not googleable
https://doxygen.reactos.org/df/d04/cmsysini_8c_source.html#l00980 the registry classes register themselves with
HV* and*main::`https://doxygen.reactos.org/d1/d6e/ntoskrnl_2ex_2callback_8c_source.html#l00256 here comes the APC/C function pointer closure class (posix calls them signals)
https://doxygen.reactos.org/d4/deb/ntoskrnl_2ex_2event_8c_source.html#l00039 Now we get the Kernel and User mode "Event" object, so now a Ring 0 or 3 thread, can de-schedule itself off the CPU, unlike MSDOS 8086/286 era, where there is no way on earth to stop the CPU from sucking in machine code and executing that code
https://doxygen.reactos.org/de/d7a/ntoskrnl_2ex_2timer_8c_source.html#l00223 Now we have wall time objects!
https://doxygen.reactos.org/d9/d6e/win32k_8c_source.html#l00259 And welcome to the Windows in Windows, now we have a VGA/DP/DVI port and can show things to humans
Shells Terminals TUIs and GUIs are ridiculous concepts to be baked into an OS's public API. Windows's late 1980s architecture made them end user plugins. The original Windows NT Kernel GUI design, in 3.1-3.51, the VGA driver/mouse/keyboard/screen/GUI was a ring 3 userland process that probably used kernel named pipes to talk to other processes and the VGA adapter. The design was so horrible with performance, in NT 4
win32k.syswas invented and still exists in Win 10 basically unmodified to paint the GUI pixels.win32k.sysis the ONLY DRIVER/only disk file, that is allowed to have a range of precious hardware/CPUsyscallconstants, specifically the x64sysenterinstruction constants, or i386interrupt 21hconstants.Every other kernel "Class", written by MS and burned into the kernel, or a driver file written by the general public, must accept the rules that "IRP"s, im calling them asynchronous ioctl packets, or event queue packets, is the only way to communicate with userland. Its very organized. There is a 2nd way dis recommended way to talk to userland, that I believe has been banned forever by MS's signed kernel driver program, probably around Win 8 or Win 10 era.
Windows Services for Linux was engineering wise/software/technically impossible to do, until all Windows 3rd party Hardware or Software vendors who write Kernel drivers, aged out, got banned by MS, or those HW/SW vendors left the market (no 64 bit drivers available), or went bankrupt, or actually PAID humans to rewrite and recompile the Win NT kernel drivers for a USB WebCam, or a $1.99 ethernet card with a Realtek chip from hell that an army of Linux HW devs for 10 years haven't been able to get stable.
WSL and unmodified ELF files executing on WinNT, only became possible, once ALL, and I mean ALL, lines of code, written by anyone, in the NT kernel, agreed to never ever ever again open a
mmapportal to a process and inspect its address space for "known C structs at fixed userland virtual addresses".This post is too long, ill let someone else do the talking.




So lets go back to my PERL scripts on NT and this PERL.EXE program I have.
Why would passing any NT Handle number but a Console handle number into
GetConsoleMode(), makeGetConsoleMode()return TRUE/SUCCESS?I can reverse the question, why are syscalls
tell()andseek()returning-1on my Linux VM for FD1betweenPERLandxterm?https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/tty/tty_io.c
Will the ext3 FS driver give me
/usr/bin/perl's baudrate and ECHO and vertical tab delayhelp!!!! Im a lawyer but a real estate that accidentally took on a murder trial client, What do I do now?
what is a TERMINAL HANGUP SLAVE in Linux? so not PC src code lol
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/tty/tty_io.c#n2306
What is the window size of
/lib/strict.pm?LETS FIND OUT!!!!
IM GOING TO SPEAK PENGUINESE FOR ONCE
Because most of P5P only speaks PENGUIN or TUX, maybe I say what the problem with WINPERL is in PENGUIN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The post above is not technically/engineering wise accurate. On Windows Console Handles/Console File Descriptors are 100% fake, and just userland Ring 3 magic tricks, exactly like WinPerl's Pseudo-fork is 100% fake user land magic tricks. A Windows console handle is an illegal unaligned pointer ending with the digit
0x01, All Windows kernel handles are alignedU32 *offsets into an array somewhere in Ring 0. So a U32 ending with0x000x040x080x0Cis a real NT/POSIX kernel handle, anything ending with0x01,0x02,0x03is illegal. Console handles in MS's public API always end with0x01. Reverse engineering the Windows OS will show STDIN STDOUT and STDERR are https://en.wikipedia.org/wiki/WebSocket packets over a TCPIP socket to another process. Thats why its so slow, and even TonyC proved it with benchmarks. The only way to know if a Console Handle (a U32 int between 0-4GB) is "real" or its "buffer mode" or "code page" is over a TCPIP socket to a another process calledcsrss.exethat is a daemon/root privilages/dark magic.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was excessive.
Your commit message (and the brain dump just above much more so) goes into irrelevant technical detail, when indicating that GetConsoleMode() is slow even for non-console handles and the GetFileType() shortcuts that.
and maybe a benchmark.
So your commit message might be something like: