The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
procfs.c File Reference

a read-only filesystem that shows kernel state as text. More...

#include "procfs.h"
#include "common/div64.h"
#include "common/memory.h"
#include "common/stdio.h"
#include "common/string.h"
#include "kernel/errno.h"
#include "kernel/fs/block_cache.h"
#include "drivers/pci/pci.h"
#include "drivers/pci/pci_irq.h"
#include "arch/arch_cpu.h"
#include "kernel/audio/audio.h"
#include "kernel/cpu/cpu.h"
#include "kernel/memory/heap.h"
#include "kernel/memory/pmm.h"
#include "kernel/process/process.h"
#include "kernel/sync/mutex.h"
#include "kernel/time/timer.h"
#include "kernel/net/netif.h"
#include "kernel/vfs/stat.h"
#include "kernel/vfs/vfs.h"

Macros

#define PROCFS_TEXT_MAX   8192
#define PROCFS_PIDS_MAX   PROCESS_MAX
#define ROOT_FILE_COUNT   10
#define FORMAT(...)

Enumerations

enum  node_kind_t { NODE_ROOT , NODE_PID_DIR , NODE_TEXT }

Functions

kerr_t procfs_mount (fs_mount_t *mount)
 set up procfs on a mount.

Detailed Description

a read-only filesystem that shows kernel state as text.

/proc/meminfo physical memory and kernel heap use /proc/uptime seconds since boot /proc/pci the PCI functions (drivers/pci) /proc/interrupts the device interrupts and their counts /proc/audio the sound device and its counters /proc/net the network interfaces and their counters /proc/cpuinfo the cores that run /proc/stat the time of each core: user, nice, system, idle /proc/<pid>/status a process's name, state, parent and resources /proc/self the calling process's directory

a file's text is made when the file is opened and kept with the open file, so a reader sees one consistent snapshot.

Macro Definition Documentation

◆ PROCFS_TEXT_MAX

#define PROCFS_TEXT_MAX   8192

◆ PROCFS_PIDS_MAX

#define PROCFS_PIDS_MAX   PROCESS_MAX

◆ ROOT_FILE_COUNT

#define ROOT_FILE_COUNT   10

◆ FORMAT

#define FORMAT ( ...)
Value:
stdio_printf_to(format_putchar, __VA_ARGS__)
void stdio_printf_to(StdioPutCharFn out, const char *fmt,...)
Definition stdio.c:273

Enumeration Type Documentation

◆ node_kind_t

Enumerator
NODE_ROOT 
NODE_PID_DIR 
NODE_TEXT 

Function Documentation

◆ procfs_mount()

kerr_t procfs_mount ( fs_mount_t * mount)

set up procfs on a mount.

hand it to vfs_mount afterwards.

Parameters
mountfilesystem mount object to initialize.
Returns
KERR_OK.