Search code examples
linuxprocessclasspathpidlimits

How do I increase the /proc/pid/cmdline 4096 byte limit?


For my Java apps with very long classpaths, I cannot see the main class specified near the end of the arg list when using ps. I think this stems from my Ubuntu system's size limit on /proc/pid/cmdline. How can I increase this limit?


Solution

  • You can't change this dynamically, the limit is hard-coded in the kernel to PAGE_SIZE in fs/proc/base.c:

     274        int res = 0;
     275        unsigned int len;
     276        struct mm_struct *mm = get_task_mm(task);
     277        if (!mm)
     278                goto out;
     279        if (!mm->arg_end)
     280                goto out_mm;    /* Shh! No looking before we're done */
     281
     282        len = mm->arg_end - mm->arg_start;
     283 
     284        if (len > PAGE_SIZE)
     285                len = PAGE_SIZE;
     286 
     287        res = access_process_vm(task, mm->arg_start, buffer, len, 0);