MentOS  0.8.0
The Mentoring Operating System
Functions | Variables
proc_system.c File Reference

Contains callbacks for procfs system files. More...

Functions

static ssize_t procs_do_uptime (char *buffer, size_t bufsize)
 Write the uptime inside the buffer. More...
 
static ssize_t procs_do_version (char *buffer, size_t bufsize)
 Write the version inside the buffer. More...
 
static ssize_t procs_do_mounts (char *buffer, size_t bufsize)
 Write the list of mount points inside the buffer. More...
 
static ssize_t procs_do_cpuinfo (char *buffer, size_t bufsize)
 Write the cpu information inside the buffer. More...
 
static ssize_t procs_do_meminfo (char *buffer, size_t bufsize)
 Write the memory information inside the buffer. More...
 
static ssize_t procs_do_stat (char *buffer, size_t bufsize)
 Write the process statistics inside the buffer. More...
 
static ssize_t __procs_read (vfs_file_t *file, char *buf, off_t offset, size_t nbyte)
 Read function for the proc system. More...
 
int procs_module_init (void)
 Initialize the procfs system files. More...
 

Variables

static vfs_sys_operations_t procs_sys_operations
 Filesystem general operations. More...
 
static vfs_file_operations_t procs_fs_operations
 Filesystem file operations. More...
 

Detailed Description

Contains callbacks for procfs system files.

Function Documentation

◆ __procs_read()

static ssize_t __procs_read ( vfs_file_t file,
char *  buf,
off_t  offset,
size_t  nbyte 
)
static

Read function for the proc system.

Parameters
fileThe file.
bufBuffer where the read content must be placed.
offsetOffset from which we start reading from the file.
nbyteThe number of bytes to read.
Returns
The number of red bytes.

◆ procs_do_cpuinfo()

static ssize_t procs_do_cpuinfo ( char *  buffer,
size_t  bufsize 
)
static

Write the cpu information inside the buffer.

Parameters
bufferthe buffer.
bufsizethe buffer size.
Returns
the amount we wrote.

◆ procs_do_meminfo()

static ssize_t procs_do_meminfo ( char *  buffer,
size_t  bufsize 
)
static

Write the memory information inside the buffer.

Parameters
bufferthe buffer.
bufsizethe buffer size.
Returns
the amount we wrote.

◆ procs_do_mounts()

static ssize_t procs_do_mounts ( char *  buffer,
size_t  bufsize 
)
static

Write the list of mount points inside the buffer.

Parameters
bufferthe buffer.
bufsizethe buffer size.
Returns
the amount we wrote.

◆ procs_do_stat()

static ssize_t procs_do_stat ( char *  buffer,
size_t  bufsize 
)
static

Write the process statistics inside the buffer.

Parameters
bufferthe buffer.
bufsizethe buffer size.
Returns
the amount we wrote.

◆ procs_do_uptime()

static ssize_t procs_do_uptime ( char *  buffer,
size_t  bufsize 
)
static

Write the uptime inside the buffer.

Parameters
bufferthe buffer.
bufsizethe buffer size.
Returns
the amount we wrote.

◆ procs_do_version()

static ssize_t procs_do_version ( char *  buffer,
size_t  bufsize 
)
static

Write the version inside the buffer.

Parameters
bufferthe buffer.
bufsizethe buffer size.
Returns
the amount we wrote.

◆ procs_module_init()

int procs_module_init ( void  )

Initialize the procfs system files.

Returns
0 on success, 1 on failure.

Variable Documentation

◆ procs_fs_operations

vfs_file_operations_t procs_fs_operations
static
Initial value:
= {
.open_f = NULL,
.unlink_f = NULL,
.close_f = NULL,
.read_f = __procs_read,
.write_f = NULL,
.lseek_f = NULL,
.stat_f = NULL,
.ioctl_f = NULL,
.getdents_f = NULL,
.readlink_f = NULL,
}
static ssize_t __procs_read(vfs_file_t *file, char *buf, off_t offset, size_t nbyte)
Read function for the proc system.
Definition: proc_system.c:33
#define NULL
Define NULL.
Definition: stddef.h:10

Filesystem file operations.

◆ procs_sys_operations

vfs_sys_operations_t procs_sys_operations
static
Initial value:
= {
.mkdir_f = NULL,
.rmdir_f = NULL,
.stat_f = NULL,
.creat_f = NULL,
.symlink_f = NULL,
}

Filesystem general operations.