Max length for SHM names on Apple is 30!

Bloody CrApple
This commit is contained in:
Kovid Goyal 2022-03-10 07:37:57 +05:30
parent d3b63a9c45
commit 4528173ff5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -341,10 +341,14 @@ PyInit_fast_data_types(void) {
PyModule_AddIntMacro(m, APC);
PyModule_AddIntMacro(m, OSC);
PyModule_AddIntMacro(m, FILE_TRANSFER_CODE);
// FreeBSD's man page says this is 1023. Linux says its PATH_MAX.
#ifdef __APPLE__
// Apple says its SHM_NAME_MAX but SHM_NAME_MAX is not actually declared in typical CrApple style.
// Experimentation shows that 1023 is allowed on macOS Catalina
// This value is based on experimentation
PyModule_AddIntConstant(m, "SHM_NAME_MAX", 30);
#else
// FreeBSD's man page says this is 1023. Linux says its PATH_MAX.
PyModule_AddIntConstant(m, "SHM_NAME_MAX", MIN(1023, PATH_MAX));
#endif
return m;
}