Fork me on GitHub

root/include/fiwix/fs_proc.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/fs_proc.h
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_FS_PROC_H
   9 #define _FIWIX_FS_PROC_H
  10 
  11 #include <fiwix/types.h>
  12 
  13 #define PROC_DEV                0xFFF1  /* special device number for nodev fs */
  14 #define PROC_ROOT_INO           1       /* root inode */
  15 #define PROC_SUPER_MAGIC        0x9FA0  /* same as in Linux */
  16 
  17 #define PROC_PID_INO            0x40000000      /* base for PID inodes */
  18 #define PROC_PID_LEV            1       /* array level for PID */
  19 
  20 #define PROC_ARRAY_ENTRIES      20
  21 
  22 enum pid_dir_inodes {
  23         PROC_PID_FD = PROC_PID_INO + 1001,
  24         PROC_PID_CMDLINE,
  25         PROC_PID_CWD,
  26         PROC_PID_ENVIRON,
  27         PROC_PID_EXE,
  28         PROC_PID_MAPS,
  29         PROC_PID_MOUNTINFO,
  30         PROC_PID_ROOT,
  31         PROC_PID_STAT,
  32         PROC_PID_STATM,
  33         PROC_PID_STATUS
  34 };
  35 
  36 struct procfs_inode {
  37         unsigned int i_lev;             /* array level (directory depth) */
  38 };
  39 
  40 struct procfs_dir_entry {
  41         __ino_t inode;
  42         __mode_t mode;
  43         __nlink_t nlink;
  44         int lev;                        /* array level (directory depth) */
  45         unsigned short int name_len;
  46         char *name;
  47         int (*data_fn)(char *, __pid_t);
  48 };
  49 
  50 extern struct procfs_dir_entry procfs_array[][PROC_ARRAY_ENTRIES + 1];
  51 
  52 int data_proc_cmdline(char *, __pid_t);
  53 int data_proc_cpuinfo(char *, __pid_t);
  54 int data_proc_devices(char *, __pid_t);
  55 int data_proc_dma(char *, __pid_t);
  56 int data_proc_filesystems(char *, __pid_t);
  57 int data_proc_interrupts(char *, __pid_t);
  58 int data_proc_loadavg(char *, __pid_t);
  59 int data_proc_locks(char *, __pid_t);
  60 int data_proc_meminfo(char *, __pid_t);
  61 int data_proc_mounts(char *, __pid_t);
  62 int data_proc_partitions(char *, __pid_t);
  63 int data_proc_rtc(char *, __pid_t);
  64 int data_proc_self(char *, __pid_t);
  65 int data_proc_stat(char *, __pid_t);
  66 int data_proc_uptime(char *, __pid_t);
  67 int data_proc_fullversion(char *, __pid_t);
  68 int data_proc_domainname(char *, __pid_t);
  69 int data_proc_filemax(char *, __pid_t);
  70 int data_proc_filenr(char *, __pid_t);
  71 int data_proc_hostname(char *, __pid_t);
  72 int data_proc_inodemax(char *, __pid_t);
  73 int data_proc_inodenr(char *, __pid_t);
  74 int data_proc_osrelease(char *, __pid_t);
  75 int data_proc_ostype(char *, __pid_t);
  76 int data_proc_version(char *, __pid_t);
  77 
  78 /* PID related functions */
  79 int data_proc_pid_fd(char *, __pid_t);
  80 int data_proc_pid_cmdline(char *, __pid_t);
  81 int data_proc_pid_cwd(char *, __pid_t);
  82 int data_proc_pid_environ(char *, __pid_t);
  83 int data_proc_pid_exe(char *, __pid_t);
  84 int data_proc_pid_maps(char *, __pid_t);
  85 int data_proc_pid_mountinfo(char *, __pid_t);
  86 int data_proc_pid_root(char *, __pid_t);
  87 int data_proc_pid_stat(char *, __pid_t);
  88 int data_proc_pid_statm(char *, __pid_t);
  89 int data_proc_pid_status(char *, __pid_t);
  90 
  91 #endif /* _FIWIX_FS_PROC_H */

/* [previous][next][first][last][top][bottom][index][help] */