4 ms·
Linux does the same! (Well, almost:) On Linux, write() (and similar system calls) will transfer at most 0x7ffff000 (2,147,479,552) bytes, returning the numb
by namibj 5y ago
Linux does the same!
(Well, almost:)
On Linux, write() (and similar system calls) will transfer at most 0x7ffff000 (2,147,479,552) bytes, returning the number of bytes actually transferred. (This is true on both 32-bit and 64-bit systems.)
- amelius 5y agoWhat I find more ridiculous in Linux is the argument limit of processes. On a machine with 64GB of RAM I still often get "Argument list too long" when invoking commands with wildcards, even if the total size of all filenames combined is much less than 1GB.
- cesarb 5y agoBut is the total size of all filenames combined much less than the stack size? The argument list is stored on the stack of the new process, and it still has to leave enough space there for the program to use. See bprm_stack_limits in fs/exec.c for details.
- josephcsible 5y agoThe situation is worse than this. There's a hard limit of 6MB for arguments and environment variables combined, no matter how big the stack is: https://lore.kernel.org/lkml/20170707185729.GA70967@beast/T/#m1a27b742141be749be06f276730756642b90d635 https://lore.kernel.org/lkml/20170707185729.GA70967@beast/T/... (which was merged as commit da029c1).
- amelius 5y agoI don't know much about Linux kernel internals, but I suppose the stack grows down in a virtual address space, where pages of the stack are allocated as needed by the kernel (?)
- josephcsible 5y agoWhat Linux does is what I meant by "doing something sane like a partial write".