Resource limits of Process
来源:互联网 发布:php跨域访问 编辑:程序博客网 时间:2024/05/16 15:11
每个进程都有自己的资源的限制,可以用getrlimit and setrlimit修改
下面这个代码显示了当前进程的资源情况。
/*
* =====================================================================================
*
* Filename: process_limit.c
*
* Description:
*
* Version: 1.0
* Created: 08/13/2010 01:36:24 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Company:
*
* =====================================================================================
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#if defined(BSD) || defined(MACOS)
#include <sys/time.h>
#define FMT "%10lld "
#else
#define FMT "%10ld "
#endif
#include <sys/resource.h>
#define doit(name) pr_limits(#name, name)
static void pr_limits(char *, int);
int
main(void)
{
#ifdef RLIMIT_AS
doit(RLIMIT_AS);
#endif
doit(RLIMIT_CORE);
doit(RLIMIT_CPU);
doit(RLIMIT_DATA);
doit(RLIMIT_FSIZE);
#ifdef RLIMIT_LOCKS
doit(RLIMIT_LOCKS);
#endif
#ifdef RLIMIT_MEMLOCK
doit(RLIMIT_MEMLOCK);
#endif
doit(RLIMIT_NOFILE);
#ifdef RLIMIT_NPROC
doit(RLIMIT_NPROC);
#endif
#ifdef RLIMIT_RSS
doit(RLIMIT_RSS);
#endif
#ifdef RLIMIT_SBSIZE
doit(RLIMIT_SBSIZE);
#endif
doit(RLIMIT_STACK);
#ifdef RLIMIT_VMEM
doit(RLIMIT_VMEM);
#endif
exit(0);
}
static void
pr_limits(char *name, int resource)
{
struct rlimit limit;
if (getrlimit(resource, &limit) < 0)
printf("getrlimit error for %s", name);
printf("%-14s ", name);
if (limit.rlim_cur == RLIM_INFINITY)
printf("(infinite) ");
else
printf(FMT, limit.rlim_cur);
if (limit.rlim_max == RLIM_INFINITY)
printf("(infinite)");
else
printf(FMT, limit.rlim_max);
putchar((int)'/n');
}
- Resource limits of Process
- A discussion of Dead Connection Detection, Resource Limits, V$SESSION, V$PROCESS and OS processes
- Adjusting user process resource limits for ITDS
- 关于 Dead Connection Detection, Resource Limits, V$SESSION, V$PROCESS and OS processes ( 601605.1)
- The Limits of Agile
- Multi-process Resource Loading
- limits
- 7.2. Limits and Weaknesses of Packet Filtering
- Table of Notes and Domino known limits
- Physical Limits of ASM
- ORACLE profile系列1 --About User Resource Limits
- The process of testing
- features of Unified Process
- The Process Of BFS.
- Process of Linux
- Memory of process
- The Process Of PCI
- starting of process of android
- php代码
- 二叉搜索树的数组实现
- 在OpenOffice.org中使用python宏
- jQuery插件应用实例
- XPSP3无法关机,一直是正在关机中
- Resource limits of Process
- 改变datagrid的背景色
- Windows下的Mysql日志操作
- 记录添加不同背景色
- 网站访问不了
- COM
- linux学习点滴
- Html大杂烩
- 查看MySQL运行状况