Operating System - HP-UX
1820477 Members
3093 Online
109624 Solutions
New Discussion юеВ

How to increase ulimit in csh

 
Abdullah_2
Advisor

How to increase ulimit in csh

Dear All,

I would like to increase the ulimit to 4GB in csh, but actually i do not know how to do it?
and can I assign it to a specific user ?

Regards,
9 REPLIES 9
Caesar_3
Esteemed Contributor

Re: How to increase ulimit in csh

Hello!

In ulimit you have a limit of your kernel
so you use ulimit with the wanted change,
put it in wanted user .cshrc so it will
affect on every sesion.
If you want to change the values to high than
it can you will need to change it in the
kernel, recompile kernel and only then you could use with high values.
(Change and recompile kernel use sam)

Caesar
Abdullah_2
Advisor

Re: How to increase ulimit in csh

Actually my current shell is ksh, but there is an OFA apllication which is start a csh and it is require the ulimit to be change.
this is what i want to do. How ?

Thanks in advance.
Caesar_3
Esteemed Contributor

Re: How to increase ulimit in csh

Hi,

If you can edit the program that is starten
(the one that on csh) than add the ulimit into.
Other way is to add the ulimit to your ksh
start script, sorry i don't know to much ksh.

Caesar
Bill Hassell
Honored Contributor

Re: How to increase ulimit in csh

ksh has a very poor ulimit implementation. You should look at changing to /usr/bin/sh (which is the POSIX shell) where ulimit is fully implemented. It will be very difficult to tell the difference between ksh and the POSIX sh. And contrary to other flavors of Unix, the POSIX shell (sh) is *NOT* the Bourne shell. See the man page for: sh-posix

A simple script is also provided in /usr/bin/ulimit but since it is a script, it must run in a subshell and will not propagate any changes back to the parent. Try this:

/usr/bin/ulimit -a

to see all the ulimit settings. If you are running the POSIX shell, you can change a value to unlimited if you wish, then start the csh script. csh will inherit the new ulimit value from your POSIX shell.

Or you can simply use the csh builtin: limit
which is the equivalent to ulimit for POSIX shells. See man csh


Bill Hassell, sysadmin
Michael Steele_2
Honored Contributor

Re: How to increase ulimit in csh

"...ulimit -f unlimited...", for example, but ulimit is specific to the logged in user using korn shell and not system wide and its a mostly obsolete utility. But I don't think this is what you're asking about. Its kernel parameters that mostly control these settings know. These kernel parameters apply to the overall system:

ulimit -d --> maxdsiz
ulimit -s --> maxssiz
ulimit -n --> maxfiles

If you switch to the POSIX shell then by default ulimit is unlimited, per user.

man sh-posix

ulimit is a shell builtin and supports these options:

-a List all of the current resource limits.
-c The number of 512-byte blocks in the size of core dumps.
-d The number of kilobytes in the size of the data area.
-f The number of 512-byte blocks in files written by child processes (files of any size can be read).
-n The number of file descriptors.
-s The number of kilobytes in the size of the stack area.
-t The number of seconds to be used by each process.
Support Fatherhood - Stop Family Law
Bill Hassell
Honored Contributor

Re: How to increase ulimit in csh

ulimit is indeed a local environment control but it is not uncommon to have ulimit values set in /etc/profile (and /etc/csh.login), so the system-wide values may not be exactly the same for a logged-in user. A good idea is to add:

ulimit -Sc 0

in /etc/profile so that core files will no longer be created by default. However, the -S option says that the user can override this value for a given session (ulimit -Sc 5000). As mentioned, there are a few kernel parameters that govern some of the ulimit values.

The question then becomes: do you meed ulimit -f (to limit the maximum size of files written by a process)? Or do you need ulimit -d (to limit the maximum data area inside the program)? There is no kernel parameter for ulimit -f so setting it to unlimited allows any size file to be created.

For ulimit -d, you can specify a larger data area up to (but not exceeding) maxdsiz. Typically, maxdsiz is set way too small (about 65megs) so you'll need to change the kernel to raise the protective fence. Note also that raising that fence above 950megs can be done, but now your programs must be compiled with special flags to request memory above this limit.


Bill Hassell, sysadmin
Abdullah_2
Advisor

Re: How to increase ulimit in csh

Dear All,

frist thanks all for ur support.

1) if i run
# ulimit -a
ksh: ulimit: bad option(s)
2) # csh
#ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 1048576
stack(kbytes) 8192
memory(kbytes) unlimited
coredump(blocks) 4194303
nofiles(descriptors) 800

what i want to increase is data(kbytes) to 4GB

any idea please ?

Michael Steele_2
Honored Contributor

Re: How to increase ulimit in csh

a) kmtune -q maxdsiz -l

b) CAN NOT EXCEED 'maxdsiz' !

b) uname -d ####

-d The number of kilobytes in the size of the data area.
Support Fatherhood - Stop Family Law
Bill Hassell
Honored Contributor

Re: How to increase ulimit in csh

As I mentioned in mt first response, ksh does NOT have a modern ulimit which is why you get the error. The suggestion is to use /usr/bin/sh as your shell, NOT /usr/bin/ksh. Note that /usr/bin/sh is NOT the Bourne shell, it is a POSIX shell and in most comparisons, it is a superset of ksh which means virtually all shell commands and parameters are identical.

For csh, the command is:

limit

to see the current settings, and

limit filesize 4000

to set the limit to 4Gb. See the man page for csh.


Bill Hassell, sysadmin