Proc file system editing

Source: Internet
Author: User

 

Proc file system concept

Proc is a virtual file system used for Linux kernel space and user space communication. In Linux, Proc is not alone,SysfsIs a file system similar to/proc. It appears after proc, so it improves proc's disadvantages.

struct proc_dir_entry {const char *name;// virtual file namemode_t mode;// mode permissionsuid_t uid;// File's user idgid_t gid;// File's group idstruct inode_operations *proc_iops;// Inode operations functionsstruct file_operations *proc_fops;// File operations functionsstruct proc_dir_entry *parent;// Parent directory...read_proc_t *read_proc;// /proc read functionwrite_proc_t *write_proc;// /proc write functionvoid *data;// Pointer to private dataatomic_t count;// use count...};

struct proc_dir_entry *create_proc_entry( const char *name, mode_t mode,                                             struct proc_dir_entry *parent );void remove_proc_entry( const char *name, struct proc_dir_entry *parent );

The parent parameter can be null (indicating the/proc root directory) or many other values, depending on where we want to put the file.

The following lists some other parent nodes that can be used.proc_dir_entryAnd their location in the file system.



Proc_dir_entry Location in the file system
proc_root_fs /proc
proc_net /proc/net
proc_bus /proc/bus
proc_root_driver

   
   
        /* Create a directory in the proc filesystem */struct proc_dir_entry *proc_mkdir( const char *name,                                     struct proc_dir_entry *parent );/* Create a symlink in the proc filesystem */struct proc_dir_entry *proc_symlink( const char *name,                                       struct proc_dir_entry *parent,                                       const char *dest );/* Create a proc_dir_entry with a read_proc_t in one call */struct proc_dir_entry *create_proc_read_entry( const char *name,                                                  mode_t mode,                                                  struct proc_dir_entry *base,                                                  read_proc_t *read_proc,                                                  void *data );


 

 

 

 

 

 

The preceding editing is from the following URL:

Http://www.ibm.com/developerworks/cn/linux/l-proc.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.