MentOS  0.8.0
The Mentoring Operating System
Classes | Typedefs | Functions
procfs.h File Reference

Proc file system public functions and structures. More...

Go to the source code of this file.

Classes

struct  proc_dir_entry_t
 Stores information about a procfs directory entry. More...
 

Typedefs

typedef struct proc_dir_entry_t proc_dir_entry_t
 Stores information about a procfs directory entry.
 

Functions

int procfs_module_init (void)
 Initialize the procfs filesystem. More...
 
int procfs_cleanup_module (void)
 Clean up the procfs filesystem. More...
 
proc_dir_entry_tproc_dir_entry_get (const char *name, proc_dir_entry_t *parent)
 Finds the direntry inside /proc or under the given parent. More...
 
proc_dir_entry_tproc_mkdir (const char *name, proc_dir_entry_t *parent)
 Creates a new directory inside the procfs filesystem. More...
 
int proc_rmdir (const char *name, proc_dir_entry_t *parent)
 Removes a directory from the procfs filesystem. More...
 
proc_dir_entry_tproc_create_entry (const char *name, proc_dir_entry_t *parent)
 Creates a new entry inside the procfs filesystem. More...
 
int proc_destroy_entry (const char *name, proc_dir_entry_t *parent)
 Removes an entry from the procfs filesystem. More...
 
int proc_entry_set_mask (proc_dir_entry_t *entry, mode_t mask)
 Sets the mask of a given procfs entry. More...
 
int procr_create_entry_pid (task_struct *entry)
 Create the entire procfs entry tree for the give process. More...
 
int procr_destroy_entry_pid (task_struct *entry)
 Destroy the entire procfs entry tree for the give process. More...
 

Detailed Description

Proc file system public functions and structures.

Function Documentation

◆ proc_create_entry()

proc_dir_entry_t* proc_create_entry ( const char *  name,
proc_dir_entry_t parent 
)

Creates a new entry inside the procfs filesystem.

Parameters
nameThe name of the entry we are creating.
parentThe parent (optional).
Returns
A pointer to the entry, or NULL if fails.

◆ proc_destroy_entry()

int proc_destroy_entry ( const char *  name,
proc_dir_entry_t parent 
)

Removes an entry from the procfs filesystem.

Parameters
nameThe name of the entry we are removing.
parentThe parent (optional).
Returns
0 if succeed, or -errno in case of error.

◆ proc_dir_entry_get()

proc_dir_entry_t* proc_dir_entry_get ( const char *  name,
proc_dir_entry_t parent 
)

Finds the direntry inside /proc or under the given parent.

Parameters
nameThe name of the entry we are searching.
parentThe parent (optional).
Returns
A pointer to the entry, or NULL.

◆ proc_entry_set_mask()

int proc_entry_set_mask ( proc_dir_entry_t entry,
mode_t  mask 
)

Sets the mask of a given procfs entry.

Parameters
entryPointer to the entry.
maskThe mask to set.
Returns
0 if succeed, or -errno in case of error.

◆ proc_mkdir()

proc_dir_entry_t* proc_mkdir ( const char *  name,
proc_dir_entry_t parent 
)

Creates a new directory inside the procfs filesystem.

Parameters
nameThe name of the entry we are creating.
parentThe parent (optional).
Returns
A pointer to the entry, or NULL if fails.

◆ proc_rmdir()

int proc_rmdir ( const char *  name,
proc_dir_entry_t parent 
)

Removes a directory from the procfs filesystem.

Parameters
nameThe name of the entry we are removing.
parentThe parent (optional).
Returns
0 if succeed, or -errno in case of error.

◆ procfs_cleanup_module()

int procfs_cleanup_module ( void  )

Clean up the procfs filesystem.

Returns
0 if fails, 1 if succeed.

◆ procfs_module_init()

int procfs_module_init ( void  )

Initialize the procfs filesystem.

Returns
0 if fails, 1 if succeed.

◆ procr_create_entry_pid()

int procr_create_entry_pid ( task_struct entry)

Create the entire procfs entry tree for the give process.

Parameters
entryPointer to the task_struct of the process.
Returns
0 if succeed, or -errno in case of error.

◆ procr_destroy_entry_pid()

int procr_destroy_entry_pid ( task_struct entry)

Destroy the entire procfs entry tree for the give process.

Parameters
entryPointer to the task_struct of the process.
Returns
0 if succeed, or -errno in case of error.