1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

Kernel: Move E2BIG calculation from Thread to Process

Thread::make_userspace_stack_for_main_thread is only ever called from
Process::do_exec, after all the fun ELF loading and TSS setup has
occured.

The calculations in there that check if the combined argv + envp
size will exceed the default stack size are not used in the rest of
the stack setup. So, it should be safe to move this to the beginning
of do_exec and bail early with -E2BIG, just like the man pages say.

Additionally, advertise this limit in limits.h to be a good POSIX.1
citizen. :)
This commit is contained in:
Andrew Kaster 2019-10-20 10:11:40 -06:00 committed by Andreas Kling
parent 3014fdf3bd
commit 98c86e5109
4 changed files with 20 additions and 16 deletions

View file

@ -6,7 +6,7 @@
#define PATH_MAX 4096
#if !defined MAXPATHLEN && defined PATH_MAX
# define MAXPATHLEN PATH_MAX
# define MAXPATHLEN PATH_MAX
#endif
#define INT_MAX INT32_MAX
@ -30,3 +30,5 @@
#define CHAR_MAX SCHAR_MAX
#define MB_LEN_MAX 16
#define ARG_MAX 65536