On Sun, 13 May 2001, Andrew Morgan wrote: > Off hand, it looks like you've hit this: > > for(i = 0; i < RLIM_NLIMITS; i++) > retval |= getrlimit(i, &pl->limits[i].limit); > > Now, if you compiled this module with the headers for 2.4, but used it > with a 2.2 kernel where RLIM_NLIMITS might not be the same, I could see > that this might fail. Could you check that this is so? Yes, RLIM_NLIMITS is 11 in 2.4 but only 10 in 2.2. Nevertheless, getrlimit() should return EINVAL iff its first argument is incorrect (i.e. has a value not supported by the running kernel). This means the following code could solve the problem: char supported[RLIM_NLIMITS]; ... for (i = 0; i < RLIM_NLIMITS; ++i) { int r = getrlimit(i, ...); supported[i] = 1; if (r == -1 && errno == EINVAL) { supported[i] = 0; r = 0; } retval |= r; } ... for (i = 0; i < RLIM_NLIMITS; ++i) { if (!supported[i]) continue; ... ... = setrlimit(i, ...); ... } --Pavel Kankovsky aka Peak [ Boycott Microsoft--http://www.vcnet.com/bms ] "Resistance is futile. Open your source code and prepare for assimilation."