Chinaunix首页 | 论坛 | 博客
  • 博客访问: 234371
  • 博文数量: 52
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 731
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-25 17:46
文章分类
文章存档

2009年(13)

2008年(39)

我的朋友

分类: LINUX

2008-11-28 19:29:42

本人最近会把proc目录详解给大家弄一下,欢迎翻译,有问题则留言。虽然是英文的,但都比较好理解,如有问题,请留言,我们共同为Linux社区而努力。我们翻译效果还不一定好,因为这玩意毕竟是老外搞的吗!!!咯咯,翻译可能引起误解。这玩意看懂需要tcp/ip方面的知识,学好proc对于性能优化是相当重要的。这次proc /sys/fm。这个子目录包含特使的文件系统,文件句柄,目录表和配额信息。
一  aio-max-nr
   aio-max-nr allows you to change the maximum value
can grow to.
二  aio-nr
    aio-nr shows the current system-wide number of asynchronous io requests.
三  binfmt_misc
    This subdirectory handles the kernel support for miscellaneous binary formats.

   It provides the ability to register additional binary formats to the kernel without compiling an additional module/kernel. Therefore, binfmt_misc needs to know magic numbers at the beginning or the filename extension of the binary.

    It works by maintaining a linked list of structs that contain a description of a binary format, including a magic with size (or the filename extension), offset and mask, and the interpreter name. On request it invokes the given interpreter with the original program as argument, as binfmt_java and binfmt_em86 and binfmt_mz do. Since binfmt_misc does not define any default binary-formats, you have to register an additional binary-format.

   Each registered handler has an entry in /proc/sys/fs/binfmt_misc.

These files perform the same function as , but their scope is limited to the actual binary format. By cating this file, you also  receive all related information about the interpreter/magic of the binfmt.

    1  register

    To register a new binary format you have to issue the command

    echo :name:type:offset:magic:mask:interpreter:  > /proc/sys/fs/binfmt_misc/register

    with appropriate name (the name for the /proc-dir entry), offset (defaults to 0, if omitted), magic, mask (which can be omitted, defaults to all 0xff) and last but not least, the interpreter that is to be invoked (for example and testing /bin/echo). Type can be M for usual magic matching or E for filename extension matching (give extension in place of magic).

     2 status

     If you do a cat on this file, you will get the current status (enabled/disabled) of binfmt_misc. Change the status by echoing 0 (disables) or 1 (enables) or -1 (caution: this clears all previously registered binary formats) to status

四  dentry_state

Status of the directory cache. Since directory entries are dynamically allocated and deallocated, this file indicates the current status. It holds six values of which only the first three are used:

  • nr_dentry - number of dentries currently allocated
  • nr_unused - nuber of unused dentries
  • age_limit - seconds after the entry may be reclaimed, when memory is short

Last three values are not used and are always zero.

五  dir-notify-enable

This file controls dnotify, a directory notification mechanism, and will not appear if dnotify support is compiled out. It was introduced with inotify in case some people want to disable dnotify support at runtime.

There are two possible values:

  • 1 - dnotify is enabled (default)
  • 0 - dnotify is disabled

六 file-max

The kernel allocates file handles dynamically, but doesn't free them again at this time.

The value in file-max denotes the maximum number of file handles that the Linux kernel will allocate. When you get a lot of error messages about running out of file handles, you might want to raise this limit. The default value is 10% of RAM in kilobytes

七  file-nr

    Historically, the three values in file-nr denoted the number of allocated file handles, the number of allocated but unused file handles, and the maximum number of file handles. Linux 2.6 always reports 0 as the number of free file handles - this is not an error, it just means that the number of allocated file handles exactly matches the number of used file handles.

八 inode-nr

   The file inode-nr contains the first two items from .

九  inode-state

   inode-state contains two actual numbers and five dummy values. The numbers are:

  • nr_inodes - denotes the number of inodes the system has allocated. This number will grow and shrink dynamically.
  • nr_free_inodes - represents the number of free inodes. Ie. the number of inuse inodes is (nr_inodes - nr_free_inodes).

十 inotify

  The following interfaces can be used to limit the amount of kernel memory consumed by the inotify file system event-monitoring mechanism.

     1 max_queued_events

      The value in this file is used when an application calls inotify_init(2) to set an upper limit on the number of events that can be queued to the corresponding inotify instance. Events in excess of this limit are dropped, but an IN_Q_OVERFLOW event is always generated.

     2  max_queued_events

     The value in this file is used when an application calls inotify_init(2) to set an upper limit on the number of events that can be queued to the corresponding inotify instance. Events in excess of this limit are dropped, but an IN_Q_OVERFLOW event is always generated.

     3 max_user_instances

   This specifies an upper limit on the number of inotify instances that can be created per real user ID.

    4 max_user_watches

    This specifies a limit on the number of watches that can be associated with each inotify instance.

十一 lease-break-time

    This file specifies the grace period (in seconds) that the kernel grants to a process holding a file lease after it has sent a signal to that process notifying it that another process is waiting to open the file. If the lease holder does not remove or downgrade the lease within this grace period, the kernel forcibly breaks the lease

十二 leases-enable

This file can be used to enable or disable file leases on a system-wide basis. If this file contains the value 0, leases are disabled. A non-zero value enables leases.

十三 mqueue

  This subdirectory contains files that are used for controlling the resources used by POSIX message queues

     1 msg_max

    msg_max is a read/write file for setting/getting the maximum number of messages in a queue value. In fact it is the limiting value for another (user) limit which is set in mq_open invocation. This attribute of a queue must be less or equal than msg_max.

     2 msgsize_max

    msgsize_max is a read/write file for setting/getting the maximum message size value (it is every message queue's attribute set during its creation).

     3  queues_max

    queues_max is a read/write file for setting/getting the maximum number of message queues allowed on the system.

十四 nfs

   This subdirectory contains files that allow users to change some NFS parameters

    1 nlm_grace_period

   Time to wait for client lock daemons to reclaim locks. Allowed values: 0 - 240. The default is 0.

     2 nlm_tcpport

   Allows explicit setting of TCP port number for lock daemon. The default is 0, meaning no default (choose dynamically).

     3 nlm_timeout

    Retransmit interval for lock requests. Allowed values: 3 - 20 seconds. The default is 10 seconds.

     4 nlm_udpport

     Allows explicit setting of UDP port number for lock daemon. The default is 0, meaning no default (choose dynamically).

十五 ntfs-debug

   This file exists only if the kernel is compiled with NTFS debugging support (CONFIG_NTFS_DEBUG). Write non-zero value to this file to enable NTFS debug messages. This is disabled by default.

   Enabling debug messages results in very significant slowdown of the system, so enable them only if you are experiencing problems with the NTFS file system.

十六 overflowgid 

  Some filesystems only support 16-bit GIDs, although in Linux GIDs are 32 bits. When one of these filesystems is mounted with writes enabled, any GID that would exceed 65535 is translated to a fixed value before being written to disk.

   This sysctl allows you to change the value of the fixed GID. The default is 65534.

十七 overflowuid

Some filesystems only support 16-bit UIDs, although in Linux UIDs are 32 bits. When one of these filesystems is mounted with writes enabled, any UID that would exceed 65535 is translated to a fixed value before being written to disk.

This sysctl allows you to change the value of the fixed UID. The default is 65534

十九 suid_dumpable

  

The value in this file determines whether core dump files are produced for set-user-ID or otherwise protected/tainted binaries. Three different integer values can be specified:

  • 0 (default) - This provides the traditional behaviour. A core dump will not be produced for a process which has changed credentials (by calling seteuid(2), setgid(2), or similar, or by executing a set-user-ID or set-group-ID program) or whose binary does not have read permission enabled.
  • 1 ("debug") - All processes dump core when possible. The core dump is owned by the file system user ID of the dumping process and no security is applied. This is intended for system debugging situations only. Ptrace is unchecked.
  • 2 ("suidsafe") - Any binary which normally would not be dumped (see "0" above) is dumped readable by root only. This allows the user to remove the core dump file but not to read it. For security reasons core dumps in this mode will not overwrite one another or other files. This mode is appropriate when administrators are attempting to debug problems in a normal environment.

二十 xfs

   This directory contains sysctls corresponding to the XFS filesystem. This directory will not be available if you have no XFS support loaded into the kernel.

      1 age_buffer_centisecs

     The age at which xfsbufd flushes dirty metadata buffers to disk.

         Min: 100
         Default: 1500
         Max: 720000

      2 error_level      

  A volume knob for error reporting when internal  errors occur.This will generate detailed messages & backtraces for filesystem shutdowns, for example. Current threshold values are:

         XFS_ERRLEVEL_OFF: 0

         XFS_ERRLEVEL_LOW: 1

         XFS_ERRLEVEL_HIGH: 5

         Min: 0
         Default: 3
         Max: 11

      3 inherit_noatime   

       Setting this to 1 will cause the "noatime" flag set by the xfs_io (8) chattr command on a directory to be inherited by files in that directory.

        Min: 0
        Default: 1
        Max: 1

      4  inherit_nodump

     Setting this to 1 will cause the "nodump" flag set by the xfs_io(8) chattr command on a directory to be inherited by files in that directory.

        Min: 0
        Default: 1
        Max: 1

      5 inherit_nosymlinks

      Setting this to 1 will cause the "nosymlinks" flag set by the xfs_io(8) chattr command on a directory to be inherited by files in that directory.

         Min: 0
         Default: 0
         Max: 1

      6 inherit_sync

      Setting this to 1 will cause the "sync" flag set by the xfs_io(8) chattr command on a directory to be inherited by files in that directory.

        Min: 0
        Default: 1
        Max: 1

      7  irix_sgid_inherit 

      Controls files created in SGID directories.

     If the group ID of the new file does not match the effective group ID or one of the supplementary group IDs of the parent dir, the ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl is set.

        Min: 0
        Default: 0
        Max: 1

      8 irix_symlink_mode

     

      Controls whether symlinks are created with mode 0777 (default) or whether their mode is affected by the umask (irix mode).

        Min: 0
        Default: 0
        Max: 1

    9 panic_mask 

    Causes certain error conditions to call BUG(). Value is a bitmask; AND together the tags which represent errors which should cause panics:

  • XFS_NO_PTAG - 0x00000000
  • XFS_PTAG_IFLUSH - 0x00000001
  • XFS_PTAG_LOGRES - 0x00000002
  • XFS_PTAG_AILDELETE - 0x00000004
  • XFS_PTAG_ERROR_REPORT - 0x00000008
  • XFS_PTAG_SHUTDOWN_CORRUPT - 0x00000010
  • XFS_PTAG_SHUTDOWN_IOERROR - 0x00000020
  • XFS_PTAG_SHUTDOWN_LOGERROR - 0x00000040

   This option is intended for debugging only.

        Min: 0
        Default: 0
        Max: 127

   10 restrict_chown 

   Controls whether unprivileged users can use chown to "give away" a file to another user.

        Min: 0
        Default: 1
        Max: 1

   11  rotorstep

    In "inode32" allocation mode, this option determines how many files the allocator attempts to allocate in the same allocation group before moving to the next allocation group. The intent is to control the rate at which the allocator moves between allocation groups when allocating extents for new files.

          Min: 0
          Default  : 1
          Max: 256

   12 stats_clear 

    Setting this to 1 clears accumulated XFS statistics in . It then immediately resets to 0.

        Min: 0
        Default: 0
        Max: 1

  13  xfsbufd_centisecs 

    The interval at which xfsbufd scans the dirty metadata buffers list.

         Min: 50
         Default: 100
         Max: 3000

   14  xfssyncd_centisecs

    The interval at which the xfssyncd thread flushes metadata out to disk. This thread will flush log activity out, and do some processing on unlinked inodes.

        Min: 100
        Default: 3000
        Max: 720000

阅读(2308) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~