diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-10-02 05:17:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:13 -0400 |
commit | 20cdc894c45d2e4ab0c69e95a56b7c5ed36ae0dd (patch) | |
tree | 889b369ebf1a54a96e8a93c2d8c49921ed2fc4b4 /fs | |
parent | 28a6d67179da6964d1640d379c5e5d4f46dd0042 (diff) |
[PATCH] proc: modify proc_pident_lookup to be completely table driven
Currently proc_pident_lookup gets the names and types from a table and then
has a huge switch statement to get the inode and file operations it needs.
That is silly and is becoming increasingly hard to maintain so I just put all
of the information in the table.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/base.c | 347 |
1 files changed, 106 insertions, 241 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index cb0cf84df748..9c6a809f92b6 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -194,9 +194,36 @@ struct pid_entry { | |||
194 | int len; | 194 | int len; |
195 | char *name; | 195 | char *name; |
196 | mode_t mode; | 196 | mode_t mode; |
197 | struct inode_operations *iop; | ||
198 | struct file_operations *fop; | ||
199 | union proc_op op; | ||
197 | }; | 200 | }; |
198 | 201 | ||
199 | #define E(type,name,mode) {(type),sizeof(name)-1,(name),(mode)} | 202 | #define NOD(TYPE, NAME, MODE, IOP, FOP, OP) { \ |
203 | .type = (TYPE), \ | ||
204 | .len = sizeof(NAME) - 1, \ | ||
205 | .name = (NAME), \ | ||
206 | .mode = MODE, \ | ||
207 | .iop = IOP, \ | ||
208 | .fop = FOP, \ | ||
209 | .op = OP, \ | ||
210 | } | ||
211 | |||
212 | #define DIR(TYPE, NAME, MODE, OTYPE) \ | ||
213 | NOD(TYPE, NAME, (S_IFDIR|(MODE)), \ | ||
214 | &proc_##OTYPE##_inode_operations, &proc_##OTYPE##_operations, \ | ||
215 | {} ) | ||
216 | #define LNK(TYPE, NAME, OTYPE) \ | ||
217 | NOD(TYPE, NAME, (S_IFLNK|S_IRWXUGO), \ | ||
218 | &proc_pid_link_inode_operations, NULL, \ | ||
219 | { .proc_get_link = &proc_##OTYPE##_link } ) | ||
220 | #define REG(TYPE, NAME, MODE, OTYPE) \ | ||
221 | NOD(TYPE, NAME, (S_IFREG|(MODE)), NULL, \ | ||
222 | &proc_##OTYPE##_operations, {}) | ||
223 | #define INF(TYPE, NAME, MODE, OTYPE) \ | ||
224 | NOD(TYPE, NAME, (S_IFREG|(MODE)), \ | ||
225 | NULL, &proc_info_file_operations, \ | ||
226 | { .proc_read = &proc_##OTYPE } ) | ||
200 | 227 | ||
201 | static struct fs_struct *get_fs_struct(struct task_struct *task) | 228 | static struct fs_struct *get_fs_struct(struct task_struct *task) |
202 | { | 229 | { |
@@ -1367,17 +1394,6 @@ static struct inode_operations proc_fd_inode_operations = { | |||
1367 | .setattr = proc_setattr, | 1394 | .setattr = proc_setattr, |
1368 | }; | 1395 | }; |
1369 | 1396 | ||
1370 | static struct file_operations proc_task_operations; | ||
1371 | static struct inode_operations proc_task_inode_operations; | ||
1372 | |||
1373 | #ifdef CONFIG_SECURITY | ||
1374 | static struct file_operations proc_pid_attr_operations; | ||
1375 | static struct file_operations proc_tid_attr_operations; | ||
1376 | static struct inode_operations proc_tid_attr_inode_operations; | ||
1377 | static struct file_operations proc_tgid_attr_operations; | ||
1378 | static struct inode_operations proc_tgid_attr_inode_operations; | ||
1379 | #endif | ||
1380 | |||
1381 | /* SMP-safe */ | 1397 | /* SMP-safe */ |
1382 | static struct dentry *proc_pident_lookup(struct inode *dir, | 1398 | static struct dentry *proc_pident_lookup(struct inode *dir, |
1383 | struct dentry *dentry, | 1399 | struct dentry *dentry, |
@@ -1395,6 +1411,10 @@ static struct dentry *proc_pident_lookup(struct inode *dir, | |||
1395 | if (!task) | 1411 | if (!task) |
1396 | goto out_no_task; | 1412 | goto out_no_task; |
1397 | 1413 | ||
1414 | /* | ||
1415 | * Yes, it does not scale. And it should not. Don't add | ||
1416 | * new entries into /proc/<tgid>/ without very good reasons. | ||
1417 | */ | ||
1398 | for (p = ents; p->name; p++) { | 1418 | for (p = ents; p->name; p++) { |
1399 | if (p->len != dentry->d_name.len) | 1419 | if (p->len != dentry->d_name.len) |
1400 | continue; | 1420 | continue; |
@@ -1411,171 +1431,13 @@ static struct dentry *proc_pident_lookup(struct inode *dir, | |||
1411 | 1431 | ||
1412 | ei = PROC_I(inode); | 1432 | ei = PROC_I(inode); |
1413 | inode->i_mode = p->mode; | 1433 | inode->i_mode = p->mode; |
1414 | /* | 1434 | if (S_ISDIR(inode->i_mode)) |
1415 | * Yes, it does not scale. And it should not. Don't add | 1435 | inode->i_nlink = 2; /* Use getattr to fix if necessary */ |
1416 | * new entries into /proc/<tgid>/ without very good reasons. | 1436 | if (p->iop) |
1417 | */ | 1437 | inode->i_op = p->iop; |
1418 | switch(p->type) { | 1438 | if (p->fop) |
1419 | case PROC_TGID_TASK: | 1439 | inode->i_fop = p->fop; |
1420 | inode->i_nlink = 2; | 1440 | ei->op = p->op; |
1421 | inode->i_op = &proc_task_inode_operations; | ||
1422 | inode->i_fop = &proc_task_operations; | ||
1423 | break; | ||
1424 | case PROC_TID_FD: | ||
1425 | case PROC_TGID_FD: | ||
1426 | inode->i_nlink = 2; | ||
1427 | inode->i_op = &proc_fd_inode_operations; | ||
1428 | inode->i_fop = &proc_fd_operations; | ||
1429 | break; | ||
1430 | case PROC_TID_EXE: | ||
1431 | case PROC_TGID_EXE: | ||
1432 | inode->i_op = &proc_pid_link_inode_operations; | ||
1433 | ei->op.proc_get_link = proc_exe_link; | ||
1434 | break; | ||
1435 | case PROC_TID_CWD: | ||
1436 | case PROC_TGID_CWD: | ||
1437 | inode->i_op = &proc_pid_link_inode_operations; | ||
1438 | ei->op.proc_get_link = proc_cwd_link; | ||
1439 | break; | ||
1440 | case PROC_TID_ROOT: | ||
1441 | case PROC_TGID_ROOT: | ||
1442 | inode->i_op = &proc_pid_link_inode_operations; | ||
1443 | ei->op.proc_get_link = proc_root_link; | ||
1444 | break; | ||
1445 | case PROC_TID_ENVIRON: | ||
1446 | case PROC_TGID_ENVIRON: | ||
1447 | inode->i_fop = &proc_info_file_operations; | ||
1448 | ei->op.proc_read = proc_pid_environ; | ||
1449 | break; | ||
1450 | case PROC_TID_AUXV: | ||
1451 | case PROC_TGID_AUXV: | ||
1452 | inode->i_fop = &proc_info_file_operations; | ||
1453 | ei->op.proc_read = proc_pid_auxv; | ||
1454 | break; | ||
1455 | case PROC_TID_STATUS: | ||
1456 | case PROC_TGID_STATUS: | ||
1457 | inode->i_fop = &proc_info_file_operations; | ||
1458 | ei->op.proc_read = proc_pid_status; | ||
1459 | break; | ||
1460 | case PROC_TID_STAT: | ||
1461 | inode->i_fop = &proc_info_file_operations; | ||
1462 | ei->op.proc_read = proc_tid_stat; | ||
1463 | break; | ||
1464 | case PROC_TGID_STAT: | ||
1465 | inode->i_fop = &proc_info_file_operations; | ||
1466 | ei->op.proc_read = proc_tgid_stat; | ||
1467 | break; | ||
1468 | case PROC_TID_CMDLINE: | ||
1469 | case PROC_TGID_CMDLINE: | ||
1470 | inode->i_fop = &proc_info_file_operations; | ||
1471 | ei->op.proc_read = proc_pid_cmdline; | ||
1472 | break; | ||
1473 | case PROC_TID_STATM: | ||
1474 | case PROC_TGID_STATM: | ||
1475 | inode->i_fop = &proc_info_file_operations; | ||
1476 | ei->op.proc_read = proc_pid_statm; | ||
1477 | break; | ||
1478 | case PROC_TID_MAPS: | ||
1479 | case PROC_TGID_MAPS: | ||
1480 | inode->i_fop = &proc_maps_operations; | ||
1481 | break; | ||
1482 | #ifdef CONFIG_NUMA | ||
1483 | case PROC_TID_NUMA_MAPS: | ||
1484 | case PROC_TGID_NUMA_MAPS: | ||
1485 | inode->i_fop = &proc_numa_maps_operations; | ||
1486 | break; | ||
1487 | #endif | ||
1488 | case PROC_TID_MEM: | ||
1489 | case PROC_TGID_MEM: | ||
1490 | inode->i_fop = &proc_mem_operations; | ||
1491 | break; | ||
1492 | #ifdef CONFIG_SECCOMP | ||
1493 | case PROC_TID_SECCOMP: | ||
1494 | case PROC_TGID_SECCOMP: | ||
1495 | inode->i_fop = &proc_seccomp_operations; | ||
1496 | break; | ||
1497 | #endif /* CONFIG_SECCOMP */ | ||
1498 | case PROC_TID_MOUNTS: | ||
1499 | case PROC_TGID_MOUNTS: | ||
1500 | inode->i_fop = &proc_mounts_operations; | ||
1501 | break; | ||
1502 | #ifdef CONFIG_MMU | ||
1503 | case PROC_TID_SMAPS: | ||
1504 | case PROC_TGID_SMAPS: | ||
1505 | inode->i_fop = &proc_smaps_operations; | ||
1506 | break; | ||
1507 | #endif | ||
1508 | case PROC_TID_MOUNTSTATS: | ||
1509 | case PROC_TGID_MOUNTSTATS: | ||
1510 | inode->i_fop = &proc_mountstats_operations; | ||
1511 | break; | ||
1512 | #ifdef CONFIG_SECURITY | ||
1513 | case PROC_TID_ATTR: | ||
1514 | inode->i_nlink = 2; | ||
1515 | inode->i_op = &proc_tid_attr_inode_operations; | ||
1516 | inode->i_fop = &proc_tid_attr_operations; | ||
1517 | break; | ||
1518 | case PROC_TGID_ATTR: | ||
1519 | inode->i_nlink = 2; | ||
1520 | inode->i_op = &proc_tgid_attr_inode_operations; | ||
1521 | inode->i_fop = &proc_tgid_attr_operations; | ||
1522 | break; | ||
1523 | case PROC_TID_ATTR_CURRENT: | ||
1524 | case PROC_TGID_ATTR_CURRENT: | ||
1525 | case PROC_TID_ATTR_PREV: | ||
1526 | case PROC_TGID_ATTR_PREV: | ||
1527 | case PROC_TID_ATTR_EXEC: | ||
1528 | case PROC_TGID_ATTR_EXEC: | ||
1529 | case PROC_TID_ATTR_FSCREATE: | ||
1530 | case PROC_TGID_ATTR_FSCREATE: | ||
1531 | case PROC_TID_ATTR_KEYCREATE: | ||
1532 | case PROC_TGID_ATTR_KEYCREATE: | ||
1533 | case PROC_TID_ATTR_SOCKCREATE: | ||
1534 | case PROC_TGID_ATTR_SOCKCREATE: | ||
1535 | inode->i_fop = &proc_pid_attr_operations; | ||
1536 | break; | ||
1537 | #endif | ||
1538 | #ifdef CONFIG_KALLSYMS | ||
1539 | case PROC_TID_WCHAN: | ||
1540 | case PROC_TGID_WCHAN: | ||
1541 | inode->i_fop = &proc_info_file_operations; | ||
1542 | ei->op.proc_read = proc_pid_wchan; | ||
1543 | break; | ||
1544 | #endif | ||
1545 | #ifdef CONFIG_SCHEDSTATS | ||
1546 | case PROC_TID_SCHEDSTAT: | ||
1547 | case PROC_TGID_SCHEDSTAT: | ||
1548 | inode->i_fop = &proc_info_file_operations; | ||
1549 | ei->op.proc_read = proc_pid_schedstat; | ||
1550 | break; | ||
1551 | #endif | ||
1552 | #ifdef CONFIG_CPUSETS | ||
1553 | case PROC_TID_CPUSET: | ||
1554 | case PROC_TGID_CPUSET: | ||
1555 | inode->i_fop = &proc_cpuset_operations; | ||
1556 | break; | ||
1557 | #endif | ||
1558 | case PROC_TID_OOM_SCORE: | ||
1559 | case PROC_TGID_OOM_SCORE: | ||
1560 | inode->i_fop = &proc_info_file_operations; | ||
1561 | ei->op.proc_read = proc_oom_score; | ||
1562 | break; | ||
1563 | case PROC_TID_OOM_ADJUST: | ||
1564 | case PROC_TGID_OOM_ADJUST: | ||
1565 | inode->i_fop = &proc_oom_adjust_operations; | ||
1566 | break; | ||
1567 | #ifdef CONFIG_AUDITSYSCALL | ||
1568 | case PROC_TID_LOGINUID: | ||
1569 | case PROC_TGID_LOGINUID: | ||
1570 | inode->i_fop = &proc_loginuid_operations; | ||
1571 | break; | ||
1572 | #endif | ||
1573 | default: | ||
1574 | printk("procfs: impossible type (%d)",p->type); | ||
1575 | iput(inode); | ||
1576 | error = ERR_PTR(-EINVAL); | ||
1577 | goto out; | ||
1578 | } | ||
1579 | dentry->d_op = &pid_dentry_operations; | 1441 | dentry->d_op = &pid_dentry_operations; |
1580 | d_add(dentry, inode); | 1442 | d_add(dentry, inode); |
1581 | /* Close the race of the process dying before we return the dentry */ | 1443 | /* Close the race of the process dying before we return the dentry */ |
@@ -1720,22 +1582,22 @@ static struct file_operations proc_pid_attr_operations = { | |||
1720 | }; | 1582 | }; |
1721 | 1583 | ||
1722 | static struct pid_entry tgid_attr_stuff[] = { | 1584 | static struct pid_entry tgid_attr_stuff[] = { |
1723 | E(PROC_TGID_ATTR_CURRENT, "current", S_IFREG|S_IRUGO|S_IWUGO), | 1585 | REG(PROC_TGID_ATTR_CURRENT, "current", S_IRUGO|S_IWUGO, pid_attr), |
1724 | E(PROC_TGID_ATTR_PREV, "prev", S_IFREG|S_IRUGO), | 1586 | REG(PROC_TGID_ATTR_PREV, "prev", S_IRUGO, pid_attr), |
1725 | E(PROC_TGID_ATTR_EXEC, "exec", S_IFREG|S_IRUGO|S_IWUGO), | 1587 | REG(PROC_TGID_ATTR_EXEC, "exec", S_IRUGO|S_IWUGO, pid_attr), |
1726 | E(PROC_TGID_ATTR_FSCREATE, "fscreate", S_IFREG|S_IRUGO|S_IWUGO), | 1588 | REG(PROC_TGID_ATTR_FSCREATE, "fscreate", S_IRUGO|S_IWUGO, pid_attr), |
1727 | E(PROC_TGID_ATTR_KEYCREATE, "keycreate", S_IFREG|S_IRUGO|S_IWUGO), | 1589 | REG(PROC_TGID_ATTR_KEYCREATE, "keycreate", S_IRUGO|S_IWUGO, pid_attr), |
1728 | E(PROC_TGID_ATTR_SOCKCREATE, "sockcreate", S_IFREG|S_IRUGO|S_IWUGO), | 1590 | REG(PROC_TGID_ATTR_SOCKCREATE, "sockcreate", S_IRUGO|S_IWUGO, pid_attr), |
1729 | {0,0,NULL,0} | 1591 | {} |
1730 | }; | 1592 | }; |
1731 | static struct pid_entry tid_attr_stuff[] = { | 1593 | static struct pid_entry tid_attr_stuff[] = { |
1732 | E(PROC_TID_ATTR_CURRENT, "current", S_IFREG|S_IRUGO|S_IWUGO), | 1594 | REG(PROC_TID_ATTR_CURRENT, "current", S_IRUGO|S_IWUGO, pid_attr), |
1733 | E(PROC_TID_ATTR_PREV, "prev", S_IFREG|S_IRUGO), | 1595 | REG(PROC_TID_ATTR_PREV, "prev", S_IRUGO, pid_attr), |
1734 | E(PROC_TID_ATTR_EXEC, "exec", S_IFREG|S_IRUGO|S_IWUGO), | 1596 | REG(PROC_TID_ATTR_EXEC, "exec", S_IRUGO|S_IWUGO, pid_attr), |
1735 | E(PROC_TID_ATTR_FSCREATE, "fscreate", S_IFREG|S_IRUGO|S_IWUGO), | 1597 | REG(PROC_TID_ATTR_FSCREATE, "fscreate", S_IRUGO|S_IWUGO, pid_attr), |
1736 | E(PROC_TID_ATTR_KEYCREATE, "keycreate", S_IFREG|S_IRUGO|S_IWUGO), | 1598 | REG(PROC_TID_ATTR_KEYCREATE, "keycreate", S_IRUGO|S_IWUGO, pid_attr), |
1737 | E(PROC_TID_ATTR_SOCKCREATE, "sockcreate", S_IFREG|S_IRUGO|S_IWUGO), | 1599 | REG(PROC_TID_ATTR_SOCKCREATE, "sockcreate", S_IRUGO|S_IWUGO, pid_attr), |
1738 | {0,0,NULL,0} | 1600 | {} |
1739 | }; | 1601 | }; |
1740 | 1602 | ||
1741 | static int proc_tgid_attr_readdir(struct file * filp, | 1603 | static int proc_tgid_attr_readdir(struct file * filp, |
@@ -1813,49 +1675,52 @@ static struct inode_operations proc_self_inode_operations = { | |||
1813 | /* | 1675 | /* |
1814 | * Thread groups | 1676 | * Thread groups |
1815 | */ | 1677 | */ |
1678 | static struct file_operations proc_task_operations; | ||
1679 | static struct inode_operations proc_task_inode_operations; | ||
1680 | |||
1816 | static struct pid_entry tgid_base_stuff[] = { | 1681 | static struct pid_entry tgid_base_stuff[] = { |
1817 | E(PROC_TGID_TASK, "task", S_IFDIR|S_IRUGO|S_IXUGO), | 1682 | DIR(PROC_TGID_TASK, "task", S_IRUGO|S_IXUGO, task), |
1818 | E(PROC_TGID_FD, "fd", S_IFDIR|S_IRUSR|S_IXUSR), | 1683 | DIR(PROC_TGID_FD, "fd", S_IRUSR|S_IXUSR, fd), |
1819 | E(PROC_TGID_ENVIRON, "environ", S_IFREG|S_IRUSR), | 1684 | INF(PROC_TGID_ENVIRON, "environ", S_IRUSR, pid_environ), |
1820 | E(PROC_TGID_AUXV, "auxv", S_IFREG|S_IRUSR), | 1685 | INF(PROC_TGID_AUXV, "auxv", S_IRUSR, pid_auxv), |
1821 | E(PROC_TGID_STATUS, "status", S_IFREG|S_IRUGO), | 1686 | INF(PROC_TGID_STATUS, "status", S_IRUGO, pid_status), |
1822 | E(PROC_TGID_CMDLINE, "cmdline", S_IFREG|S_IRUGO), | 1687 | INF(PROC_TGID_CMDLINE, "cmdline", S_IRUGO, pid_cmdline), |
1823 | E(PROC_TGID_STAT, "stat", S_IFREG|S_IRUGO), | 1688 | INF(PROC_TGID_STAT, "stat", S_IRUGO, tgid_stat), |
1824 | E(PROC_TGID_STATM, "statm", S_IFREG|S_IRUGO), | 1689 | INF(PROC_TGID_STATM, "statm", S_IRUGO, pid_statm), |
1825 | E(PROC_TGID_MAPS, "maps", S_IFREG|S_IRUGO), | 1690 | REG(PROC_TGID_MAPS, "maps", S_IRUGO, maps), |
1826 | #ifdef CONFIG_NUMA | 1691 | #ifdef CONFIG_NUMA |
1827 | E(PROC_TGID_NUMA_MAPS, "numa_maps", S_IFREG|S_IRUGO), | 1692 | REG(PROC_TGID_NUMA_MAPS, "numa_maps", S_IRUGO, numa_maps), |
1828 | #endif | 1693 | #endif |
1829 | E(PROC_TGID_MEM, "mem", S_IFREG|S_IRUSR|S_IWUSR), | 1694 | REG(PROC_TGID_MEM, "mem", S_IRUSR|S_IWUSR, mem), |
1830 | #ifdef CONFIG_SECCOMP | 1695 | #ifdef CONFIG_SECCOMP |
1831 | E(PROC_TGID_SECCOMP, "seccomp", S_IFREG|S_IRUSR|S_IWUSR), | 1696 | REG(PROC_TGID_SECCOMP, "seccomp", S_IRUSR|S_IWUSR, seccomp), |
1832 | #endif | 1697 | #endif |
1833 | E(PROC_TGID_CWD, "cwd", S_IFLNK|S_IRWXUGO), | 1698 | LNK(PROC_TGID_CWD, "cwd", cwd), |
1834 | E(PROC_TGID_ROOT, "root", S_IFLNK|S_IRWXUGO), | 1699 | LNK(PROC_TGID_ROOT, "root", root), |
1835 | E(PROC_TGID_EXE, "exe", S_IFLNK|S_IRWXUGO), | 1700 | LNK(PROC_TGID_EXE, "exe", exe), |
1836 | E(PROC_TGID_MOUNTS, "mounts", S_IFREG|S_IRUGO), | 1701 | REG(PROC_TGID_MOUNTS, "mounts", S_IRUGO, mounts), |
1837 | E(PROC_TGID_MOUNTSTATS, "mountstats", S_IFREG|S_IRUSR), | 1702 | REG(PROC_TGID_MOUNTSTATS, "mountstats", S_IRUSR, mountstats), |
1838 | #ifdef CONFIG_MMU | 1703 | #ifdef CONFIG_MMU |
1839 | E(PROC_TGID_SMAPS, "smaps", S_IFREG|S_IRUGO), | 1704 | REG(PROC_TGID_SMAPS, "smaps", S_IRUGO, smaps), |
1840 | #endif | 1705 | #endif |
1841 | #ifdef CONFIG_SECURITY | 1706 | #ifdef CONFIG_SECURITY |
1842 | E(PROC_TGID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), | 1707 | DIR(PROC_TGID_ATTR, "attr", S_IRUGO|S_IXUGO, tgid_attr), |
1843 | #endif | 1708 | #endif |
1844 | #ifdef CONFIG_KALLSYMS | 1709 | #ifdef CONFIG_KALLSYMS |
1845 | E(PROC_TGID_WCHAN, "wchan", S_IFREG|S_IRUGO), | 1710 | INF(PROC_TGID_WCHAN, "wchan", S_IRUGO, pid_wchan), |
1846 | #endif | 1711 | #endif |
1847 | #ifdef CONFIG_SCHEDSTATS | 1712 | #ifdef CONFIG_SCHEDSTATS |
1848 | E(PROC_TGID_SCHEDSTAT, "schedstat", S_IFREG|S_IRUGO), | 1713 | INF(PROC_TGID_SCHEDSTAT, "schedstat", S_IRUGO, pid_schedstat), |
1849 | #endif | 1714 | #endif |
1850 | #ifdef CONFIG_CPUSETS | 1715 | #ifdef CONFIG_CPUSETS |
1851 | E(PROC_TGID_CPUSET, "cpuset", S_IFREG|S_IRUGO), | 1716 | REG(PROC_TGID_CPUSET, "cpuset", S_IRUGO, cpuset), |
1852 | #endif | 1717 | #endif |
1853 | E(PROC_TGID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO), | 1718 | INF(PROC_TGID_OOM_SCORE, "oom_score", S_IRUGO, oom_score), |
1854 | E(PROC_TGID_OOM_ADJUST,"oom_adj", S_IFREG|S_IRUGO|S_IWUSR), | 1719 | REG(PROC_TGID_OOM_ADJUST, "oom_adj", S_IRUGO|S_IWUSR, oom_adjust), |
1855 | #ifdef CONFIG_AUDITSYSCALL | 1720 | #ifdef CONFIG_AUDITSYSCALL |
1856 | E(PROC_TGID_LOGINUID, "loginuid", S_IFREG|S_IWUSR|S_IRUGO), | 1721 | REG(PROC_TGID_LOGINUID, "loginuid", S_IWUSR|S_IRUGO, loginuid), |
1857 | #endif | 1722 | #endif |
1858 | {0,0,NULL,0} | 1723 | {} |
1859 | }; | 1724 | }; |
1860 | 1725 | ||
1861 | static int proc_tgid_base_readdir(struct file * filp, | 1726 | static int proc_tgid_base_readdir(struct file * filp, |
@@ -2088,46 +1953,46 @@ out: | |||
2088 | * Tasks | 1953 | * Tasks |
2089 | */ | 1954 | */ |
2090 | static struct pid_entry tid_base_stuff[] = { | 1955 | static struct pid_entry tid_base_stuff[] = { |
2091 | E(PROC_TID_FD, "fd", S_IFDIR|S_IRUSR|S_IXUSR), | 1956 | DIR(PROC_TID_FD, "fd", S_IRUSR|S_IXUSR, fd), |
2092 | E(PROC_TID_ENVIRON, "environ", S_IFREG|S_IRUSR), | 1957 | INF(PROC_TID_ENVIRON, "environ", S_IRUSR, pid_environ), |
2093 | E(PROC_TID_AUXV, "auxv", S_IFREG|S_IRUSR), | 1958 | INF(PROC_TID_AUXV, "auxv", S_IRUSR, pid_auxv), |
2094 | E(PROC_TID_STATUS, "status", S_IFREG|S_IRUGO), | 1959 | INF(PROC_TID_STATUS, "status", S_IRUGO, pid_status), |
2095 | E(PROC_TID_CMDLINE, "cmdline", S_IFREG|S_IRUGO), | 1960 | INF(PROC_TID_CMDLINE, "cmdline", S_IRUGO, pid_cmdline), |
2096 | E(PROC_TID_STAT, "stat", S_IFREG|S_IRUGO), | 1961 | INF(PROC_TID_STAT, "stat", S_IRUGO, tid_stat), |
2097 | E(PROC_TID_STATM, "statm", S_IFREG|S_IRUGO), | 1962 | INF(PROC_TID_STATM, "statm", S_IRUGO, pid_statm), |
2098 | E(PROC_TID_MAPS, "maps", S_IFREG|S_IRUGO), | 1963 | REG(PROC_TID_MAPS, "maps", S_IRUGO, maps), |
2099 | #ifdef CONFIG_NUMA | 1964 | #ifdef CONFIG_NUMA |
2100 | E(PROC_TID_NUMA_MAPS, "numa_maps", S_IFREG|S_IRUGO), | 1965 | REG(PROC_TID_NUMA_MAPS, "numa_maps", S_IRUGO, numa_maps), |
2101 | #endif | 1966 | #endif |
2102 | E(PROC_TID_MEM, "mem", S_IFREG|S_IRUSR|S_IWUSR), | 1967 | REG(PROC_TID_MEM, "mem", S_IRUSR|S_IWUSR, mem), |
2103 | #ifdef CONFIG_SECCOMP | 1968 | #ifdef CONFIG_SECCOMP |
2104 | E(PROC_TID_SECCOMP, "seccomp", S_IFREG|S_IRUSR|S_IWUSR), | 1969 | REG(PROC_TID_SECCOMP, "seccomp", S_IRUSR|S_IWUSR, seccomp), |
2105 | #endif | 1970 | #endif |
2106 | E(PROC_TID_CWD, "cwd", S_IFLNK|S_IRWXUGO), | 1971 | LNK(PROC_TID_CWD, "cwd", cwd), |
2107 | E(PROC_TID_ROOT, "root", S_IFLNK|S_IRWXUGO), | 1972 | LNK(PROC_TID_ROOT, "root", root), |
2108 | E(PROC_TID_EXE, "exe", S_IFLNK|S_IRWXUGO), | 1973 | LNK(PROC_TID_EXE, "exe", exe), |
2109 | E(PROC_TID_MOUNTS, "mounts", S_IFREG|S_IRUGO), | 1974 | REG(PROC_TID_MOUNTS, "mounts", S_IRUGO, mounts), |
2110 | #ifdef CONFIG_MMU | 1975 | #ifdef CONFIG_MMU |
2111 | E(PROC_TID_SMAPS, "smaps", S_IFREG|S_IRUGO), | 1976 | REG(PROC_TID_SMAPS, "smaps", S_IRUGO, smaps), |
2112 | #endif | 1977 | #endif |
2113 | #ifdef CONFIG_SECURITY | 1978 | #ifdef CONFIG_SECURITY |
2114 | E(PROC_TID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), | 1979 | DIR(PROC_TID_ATTR, "attr", S_IRUGO|S_IXUGO, tid_attr), |
2115 | #endif | 1980 | #endif |
2116 | #ifdef CONFIG_KALLSYMS | 1981 | #ifdef CONFIG_KALLSYMS |
2117 | E(PROC_TID_WCHAN, "wchan", S_IFREG|S_IRUGO), | 1982 | INF(PROC_TID_WCHAN, "wchan", S_IRUGO, pid_wchan), |
2118 | #endif | 1983 | #endif |
2119 | #ifdef CONFIG_SCHEDSTATS | 1984 | #ifdef CONFIG_SCHEDSTATS |
2120 | E(PROC_TID_SCHEDSTAT, "schedstat",S_IFREG|S_IRUGO), | 1985 | INF(PROC_TID_SCHEDSTAT, "schedstat", S_IRUGO, pid_schedstat), |
2121 | #endif | 1986 | #endif |
2122 | #ifdef CONFIG_CPUSETS | 1987 | #ifdef CONFIG_CPUSETS |
2123 | E(PROC_TID_CPUSET, "cpuset", S_IFREG|S_IRUGO), | 1988 | REG(PROC_TID_CPUSET, "cpuset", S_IRUGO, cpuset), |
2124 | #endif | 1989 | #endif |
2125 | E(PROC_TID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO), | 1990 | INF(PROC_TID_OOM_SCORE, "oom_score", S_IRUGO, oom_score), |
2126 | E(PROC_TID_OOM_ADJUST, "oom_adj", S_IFREG|S_IRUGO|S_IWUSR), | 1991 | REG(PROC_TID_OOM_ADJUST, "oom_adj", S_IRUGO|S_IWUSR, oom_adjust), |
2127 | #ifdef CONFIG_AUDITSYSCALL | 1992 | #ifdef CONFIG_AUDITSYSCALL |
2128 | E(PROC_TID_LOGINUID, "loginuid", S_IFREG|S_IWUSR|S_IRUGO), | 1993 | REG(PROC_TID_LOGINUID, "loginuid", S_IWUSR|S_IRUGO, loginuid), |
2129 | #endif | 1994 | #endif |
2130 | {0,0,NULL,0} | 1995 | {} |
2131 | }; | 1996 | }; |
2132 | 1997 | ||
2133 | static int proc_tid_base_readdir(struct file * filp, | 1998 | static int proc_tid_base_readdir(struct file * filp, |