Re: [PATCH 03/13] ipcs: determine ipc limits from /proc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 14, 2012 at 09:22:15PM +0100, Sami Kerola wrote:
> +static int shmctl_limits_wrapper(struct proc_limits *lim, int use_proc)

 The basic rule is to call function by functionality, nobody cares if
 the function is wrapper ;-)

 IMHO for example ipc_shm_get_limits() is better.

> +{
> +	struct shminfo shminfo;
> +	lim->shmmax = SHMMAX;

 really no, shmmax is also in /proc and it maybe changed by sysctl.

> +	lim->shmmin = SHMMIN;
> +	if (use_proc) {
> +		FILE *f;
> +		if ((f = fopen(_PATH_PROC_IPC_SHMMNI, "r")) == NULL)
> +			return 1;
> +		fscanf(f, "%d", &(lim->shmmni));
> +		fclose(f);
> +		if ((f = fopen(_PATH_PROC_IPC_SHMALL, "r")) == NULL)
> +			return 1;
> +		fscanf(f, "%zu", &(lim->shmall));
> +		fclose(f);
> +		return 0;
> +	}
> +

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux