|
Lines 61-66
Link Here
|
| 61 |
#include <sys/proc.h> |
61 |
#include <sys/proc.h> |
| 62 |
#include <sys/ptrace.h> |
62 |
#include <sys/ptrace.h> |
| 63 |
#include <sys/resourcevar.h> |
63 |
#include <sys/resourcevar.h> |
|
|
64 |
#include <sys/resource.h> |
| 64 |
#include <sys/sbuf.h> |
65 |
#include <sys/sbuf.h> |
| 65 |
#include <sys/sem.h> |
66 |
#include <sys/sem.h> |
| 66 |
#include <sys/smp.h> |
67 |
#include <sys/smp.h> |
|
Lines 118-123
Link Here
|
| 118 |
#define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* pages to kbytes */ |
119 |
#define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* pages to kbytes */ |
| 119 |
#define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 10000) |
120 |
#define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 10000) |
| 120 |
|
121 |
|
|
|
122 |
#define RLIM_NONE -1 |
| 123 |
|
| 121 |
/** |
124 |
/** |
| 122 |
* @brief Mapping of ki_stat in struct kinfo_proc to the linux state |
125 |
* @brief Mapping of ki_stat in struct kinfo_proc to the linux state |
| 123 |
* |
126 |
* |
|
Lines 1366-1371
Link Here
|
| 1366 |
return (0); |
1369 |
return (0); |
| 1367 |
} |
1370 |
} |
| 1368 |
|
1371 |
|
|
|
1372 |
/* |
| 1373 |
* Filler function for proc/pid/limits |
| 1374 |
*/ |
| 1375 |
|
| 1376 |
static const struct limit_info { |
| 1377 |
const char *desc; |
| 1378 |
const char *unit; |
| 1379 |
unsigned long long rlim_id; |
| 1380 |
} limits_info[] = { |
| 1381 |
{ "Max cpu time", "seconds", RLIMIT_CPU }, |
| 1382 |
{ "Max file size", "bytes", RLIMIT_FSIZE }, |
| 1383 |
{ "Max data size", "bytes", RLIMIT_DATA }, |
| 1384 |
{ "Max stack size", "bytes", RLIMIT_STACK }, |
| 1385 |
{ "Max core file size", "bytes", RLIMIT_CORE }, |
| 1386 |
{ "Max resident set", "bytes", RLIMIT_RSS }, |
| 1387 |
{ "Max processes", "processes", RLIMIT_NPROC }, |
| 1388 |
{ "Max open files", "files", RLIMIT_NOFILE }, |
| 1389 |
{ "Max locked memory", "bytes", RLIMIT_MEMLOCK }, |
| 1390 |
{ "Max address space", "bytes", RLIMIT_AS }, |
| 1391 |
{ "Max file locks", "locks", RLIM_INFINITY }, |
| 1392 |
{ "Max pending signals", "signals", RLIM_INFINITY }, |
| 1393 |
{ "Max msgqueue size", "bytes", RLIM_NONE }, |
| 1394 |
{ "Max nice priority", "", RLIM_NONE }, |
| 1395 |
{ "Max realtime priority", "", RLIM_NONE }, |
| 1396 |
{ "Max realtime timeout", "us", RLIM_INFINITY}, |
| 1397 |
{ 0, 0, 0 } |
| 1398 |
}; |
| 1399 |
|
| 1400 |
static int |
| 1401 |
linprocfs_doproclimits(PFS_FILL_ARGS) |
| 1402 |
{ |
| 1403 |
const struct limit_info *li; |
| 1404 |
struct rlimit li_rlimits; |
| 1405 |
struct plimit *cur_proc_lim; |
| 1406 |
|
| 1407 |
cur_proc_lim = lim_alloc(); |
| 1408 |
lim_copy(cur_proc_lim, p->p_limit); |
| 1409 |
sbuf_printf(sb, "%-26s%-21s%-21s%-21s\n", "Limit", "Soft Limit", |
| 1410 |
"Hard Limit", "Units"); |
| 1411 |
for (li = limits_info; li->desc != NULL; ++li) { |
| 1412 |
if (li->rlim_id != RLIM_INFINITY && li->rlim_id != RLIM_NONE) |
| 1413 |
li_rlimits = cur_proc_lim->pl_rlimit[li->rlim_id]; |
| 1414 |
else { |
| 1415 |
li_rlimits.rlim_cur = 0; |
| 1416 |
li_rlimits.rlim_max = 0; |
| 1417 |
} |
| 1418 |
if (li->rlim_id == RLIM_INFINITY || |
| 1419 |
li_rlimits.rlim_cur == RLIM_INFINITY) |
| 1420 |
sbuf_printf(sb, "%-26s%-21s%-21s%-10s\n", |
| 1421 |
li->desc, "unlimited", "unlimited", li->unit); |
| 1422 |
else |
| 1423 |
sbuf_printf(sb, "%-26s%-21ld%-21ld%-10s\n", |
| 1424 |
li->desc, (long)li_rlimits.rlim_cur, |
| 1425 |
(long)li_rlimits.rlim_max, li->unit); |
| 1426 |
} |
| 1427 |
lim_free(cur_proc_lim); |
| 1428 |
return (0); |
| 1429 |
} |
| 1430 |
|
| 1369 |
|
1431 |
|
| 1370 |
/* |
1432 |
/* |
| 1371 |
* Filler function for proc/sys/kernel/random/uuid |
1433 |
* Filler function for proc/sys/kernel/random/uuid |
|
Lines 1504-1509
Link Here
|
| 1504 |
NULL, NULL, NULL, 0); |
1566 |
NULL, NULL, NULL, 0); |
| 1505 |
pfs_create_file(dir, "auxv", &linprocfs_doauxv, |
1567 |
pfs_create_file(dir, "auxv", &linprocfs_doauxv, |
| 1506 |
NULL, &procfs_candebug, NULL, PFS_RD|PFS_RAWRD); |
1568 |
NULL, &procfs_candebug, NULL, PFS_RD|PFS_RAWRD); |
|
|
1569 |
pfs_create_file(dir, "limits", &linprocfs_doproclimits, |
| 1570 |
NULL, NULL, NULL, PFS_RD); |
| 1507 |
|
1571 |
|
| 1508 |
/* /proc/scsi/... */ |
1572 |
/* /proc/scsi/... */ |
| 1509 |
dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0); |
1573 |
dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0); |