summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2010-08-27 13:09:37 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2010-08-27 13:09:37 +0200
commit654de17771726def274ceed4a306b7c3c2aa5138 (patch)
treefc895a6d677b718df7e89c93d454072f62049c8e
parenta65fce9e3ce244cb5691357eef14356ae40bd148 (diff)
parent7070feccb2e4d135d5620805de6cec177722b837 (diff)
Merge branch 'procfs' into procfs-moved
-rw-r--r--procfs/procfs_dir.c3
-rw-r--r--procfs/procfs_nonpid_files.c13
-rw-r--r--procfs/procfs_pid_files.c19
3 files changed, 29 insertions, 6 deletions
diff --git a/procfs/procfs_dir.c b/procfs/procfs_dir.c
index f76e6a4b..bd1e49d6 100644
--- a/procfs/procfs_dir.c
+++ b/procfs/procfs_dir.c
@@ -654,6 +654,9 @@ procfs_fill_root_dir(struct procfs_dir *dir, time_t timestamp)
if ((err = procfs_create_loadavg (dir, &node, timestamp)) != 0)
return err;
+ if ((err = procfs_create_mounts (dir, &node, timestamp)) != 0)
+ return err;
+
return 0;
}
diff --git a/procfs/procfs_nonpid_files.c b/procfs/procfs_nonpid_files.c
index 2c1209ee..f1300666 100644
--- a/procfs/procfs_nonpid_files.c
+++ b/procfs/procfs_nonpid_files.c
@@ -166,6 +166,19 @@ error_t procfs_create_loadavg (struct procfs_dir *dir,
return err;
}
+error_t procfs_create_mounts (struct procfs_dir *dir,
+ struct node **node,
+ time_t timestamp)
+{
+ struct procfs_dir_entry *dir_entry;
+ int err;
+
+ dir_entry = update_pid_entries (dir, "mounts", timestamp, "/etc/mtab");
+ err = procfs_create_node (dir_entry, "mounts", node);
+
+ return err;
+}
+
error_t get_uptime (struct timeval *uptime)
{
struct timeval boot_time, now;
diff --git a/procfs/procfs_pid_files.c b/procfs/procfs_pid_files.c
index 46861531..26a0af33 100644
--- a/procfs/procfs_pid_files.c
+++ b/procfs/procfs_pid_files.c
@@ -46,14 +46,21 @@ update_pid_entries (struct procfs_dir *dir, const char *name,
time_t timestamp,
const char *symlink_target)
{
- struct procfs_dir_entry *dir_entry;
- struct stat *stat = (struct stat *) malloc (sizeof (struct stat));
- stat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
+ struct stat stat;
- dir_entry = update_entries_list (dir, name, stat,
- timestamp, symlink_target);
+ memset (&stat, 0, sizeof stat);
+ if (symlink_target)
+ {
+ stat.st_size = strlen (symlink_target);
+ stat.st_mode = S_IFLNK | 0777;
+ }
+ else
+ {
+ stat.st_size = 0;
+ stat.st_mode = S_IFREG | 0444;
+ }
- return dir_entry;
+ return update_entries_list (dir, name, &stat, timestamp, symlink_target);
}
/* Creates files to store process information for DIR