the limit on the size of the filename of the executable when extracted with AT_EXECFN

Viewed 45

I'm trying to understand how long (maximum size) is the binary path name, when it is extracted with AT_EXECFN. I've been digging through a lot of documentation but can't seem to find a mention anywhere on the maximum possible length for this value. I feel like I'm looking in all the wrong places. Here is how one extracts it through AT_EXECFN. Any help is appreciated.

1 Answers

The ABI doesn't set a limit. Particular implementations might, but it could vary between OS and kernel versions. In most cases, you ought to design your code to work properly no matter what it is. (Note that it's a null-terminated string, so you shouldn't need to know the length in advance in order to work with it.)

In current versions of Linux, the upper limit appears to be MAX_ARG_STRLEN, which is defined as 128KB. But again, on other systems or other versions, it could very well be higher or lower.

Related