A colleague encountered a problem during loadmodule compilation.
Gmake: execvp:/bin/sh: argument list too long Gmake: *** [. O] Error 127
This situation has not been encountered before. It was only after Google that it was known that this was a limitation of OS Kernal.
In some operating systems, it is definedArg_max or ncargs is used to define the maximum length of parameters in OS.
When this problem occurs, we should pay attention to argv [] and envp [], that is, the parameters themselves and the environment variables. You can use env to view environment variables. If the Env length is too long, you can consider deleting unnecessary environment variables. In fact, you can use the following command to estimate the length of the process that can be used for argrment:
Expr 'getconf arg_max '-'env | WC-C'-'env | WC-L' \ * 4-2048
Among them, 2048 is the buffer recommended for POSIX to ensure that the process can safely modify the environment variable.
Because arg_max/ncargs is used as the kernel parameter, modification is not easy. At least you need the root permission...
For example, in Aix, run chdev-l sys0-A ncargs = newvalue to specify the new length.
This is a problem in IDE compilation. In fact, it may be a headache and not transparent during analysis. Later, I changed the command line compilation and OK (MAGIC, speechless ing)
You have not tried modifying kernel parameters. If you have time, please try ^_^.
PS:
if a problem occurs only in shell or our Program , you can split the parameter, or use xargs to pass Parameters.