Change ARG_MAX value

I installed FreeBSD 10 and now I want to change ARG_MAX value
Code:
getconf ARG_MAX
262144
Which file I have to patch in /usr/src?

Code:
root@freebsd:/usr/src # grep ARG_MAX */*
include/limits.h:#define   _POSIX_ARG_MAX     4096
include/unistd.h:#define   _SC_ARG_MAX      1

Please help.
Thanks.
 
Last edited by a moderator:
OK, I'm trying to recompile the kernel..
Isn't there a way to set this value without having to recompile ??
 
Last edited by a moderator:
ok I'm trying to recompile the kernel..
isn't there a way to set this value without having to recompile ??
No, I don't think so. Why do you need to increase it anyway?

It's probably best if you not only recompile the kernel but also the base system if you change it.
 
I need to set it at 16777216..
I have a lot of file and script should be rewritten to work.. sSo it's easier at the moment to change ARG_MAX.
 
Last edited by a moderator:
ok
I recompiled and now ARG_MAX is ok

1. what about RAM? Does it eat a lot of RAM?
I have 16 GB on this PC, and I need to run grep and other command line software
2. what about if I set it to 134217728? Do I need more RAM?

P.S..: Why don't you let the user to modify this value on the fly by editing a file in /etc/?
 
Another question:
After having modified ARG_MAX
I have executed freebsd-update fetch install
After the reboot ARG_MAX is newly 262.144..
How to avoid kernel updates with freebsd-update(8)?

For example:
Code:
# freebsd-update fetch
Looking up update.FreeBSD.org mirrors... none found.
Fetching metadata signature for 10.2-RELEASE from update.FreeBSD.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

The following files will be updated as part of updating to 10.2-RELEASE-p11:
/boot/kernel/kernel
/boot/kernel/kernel.symbols
/boot/kernel/linux.ko

Now how to update only /usr/src and understand when is needed to recompile all to update the base software??
 
Last edited by a moderator:
ok
I recompiled and now ARG_MAX is ok

1. what about RAM? Does it eat a lot of RAM?

Possibly. This question should be asked before deciding to modify the system.

I have 16 GB on this PC, and I need to run grep and other command line software
2. what about if I set it to 134217728? Do I need more RAM?

Why do you think you need to change this system constant?

P.S..: Why don't you let the user to modify this value on the fly by editing a file in /etc/?

It is a defined constant that works for most people. Making it dynamically modifiable would probably be a pretty big project, so the benefit would have to justify the effort. What is the benefit?
 
I have directories with more than 500,000 files
so without setting ARG_MAX to a bigger value I can't use programs in normal way.. such as grep mytext *.txt
I have to use workaround such as find(1), xargs(1) etc etc
setting ARG_MAX to a bigger value works really nice for me

I've read on internet that some UNIX operating systems like AIX®, HPUX®, etc let the user to set this value without having to reboot. It would be really nice, instead of making world and kernel..
 
xargs(1) is the normal way to deal with that. Actually, some would say that putting half a million files in a single directory is the real problem, and it's not just causing trouble with the number of arguments to commands.
 
Interesting. I found PR 58803 that seems to have a patch to make it run-time (or at least boot-time) adjustable. It was submitted for FreeBSD 5.0(!) but apparently never made it in. Perhaps you could refresh it and maybe it'll be included in 11.0-RELEASE.
 
If you want that to happen, pitch in. Test the last revision of that patch. Find problems, and fix them, or hire someone to fix them. Update the bug report. Contact the mailing lists about it, asking about current problems and how to get it included.
 
Back
Top