From c15f3bee8d46f05afe1d3f582778d74c7e706485 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Thu, 14 Aug 2008 15:24:00 +0200 Subject: 2008-08-14 Madhusudan.C.S * ChangeLog: New file added to procfs * AUTHORS: New file added to procfs * COPYING: New file added to procfs * README: New file added to procfs * Makefile: New file added to procfs * bootstrap.c: New file added to procfs * netfs.c: New file added to procfs * node.c: New file added to procfs * procfs.c: New file added to procfs * procfs.h: New file added to procfs * procfs_dir.c: New file added to procfs * procfs_nonpid_files.c: New file added to procfs * procfs_pid.h: New file added to procfs * procfs_pid_files.c: New file added to procfs --- ChangeLog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ChangeLog (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..36f6bf5c --- /dev/null +++ b/ChangeLog @@ -0,0 +1,20 @@ +2008-08-14 Madhusudan.C.S + + * ChangeLog: New file added to procfs + * AUTHORS: New file added to procfs + * COPYING: New file added to procfs + * README: New file added to procfs + * Makefile: New file added to procfs + * bootstrap.c: New file added to procfs + * netfs.c: New file added to procfs + * node.c: New file added to procfs + * procfs.c: New file added to procfs + * procfs.h: New file added to procfs + * procfs_dir.c: New file added to procfs + * procfs_nonpid_files.c: New file added to procfs + * procfs_pid.h: New file added to procfs + * procfs_pid_files.c: New file added to procfs + +2008-05-13 Madhusudan.C.S + + * /sources/hurd/procfs: New directory added to the repository -- cgit v1.2.3 From 802ea16ef91b30bc4fa9a61779b5c3602219bb1d Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Mon, 18 Aug 2008 16:53:00 +0200 Subject: 2008-08-18 Madhusudan.C.S * procfs/ChangeLog: ChangeLog: Revised. --- ChangeLog | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 36f6bf5c..eb175529 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,20 +1,20 @@ 2008-08-14 Madhusudan.C.S - * ChangeLog: New file added to procfs - * AUTHORS: New file added to procfs - * COPYING: New file added to procfs - * README: New file added to procfs - * Makefile: New file added to procfs - * bootstrap.c: New file added to procfs - * netfs.c: New file added to procfs - * node.c: New file added to procfs - * procfs.c: New file added to procfs - * procfs.h: New file added to procfs - * procfs_dir.c: New file added to procfs - * procfs_nonpid_files.c: New file added to procfs - * procfs_pid.h: New file added to procfs - * procfs_pid_files.c: New file added to procfs + * ChangeLog: New file. + * AUTHORS: New file. + * COPYING: New file. + * README: New file. + * Makefile: New file. + * bootstrap.c: New file. + * netfs.c: New file. + * node.c: New file. + * procfs.c: New file. + * procfs.h: New file. + * procfs_dir.c: New file. + * procfs_nonpid_files.c: New file. + * procfs_pid.h: New file. + * procfs_pid_files.c: New file. 2008-05-13 Madhusudan.C.S - * /sources/hurd/procfs: New directory added to the repository + * /sources/hurd/procfs: New directory added to the repository. -- cgit v1.2.3 From 0419c2813a91d0746cc70f4ecab33efca4b9440c Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Mon, 18 Aug 2008 17:15:00 +0200 Subject: 2008-08-14 Madhusudan.C.S * procfs.h: (jiffy_t): New typedef. * procfs_pid.h: "procfs.h" is included. (struct procfs_pid_files): Changed all the occurrences of time_t to jiffy_t. * procfs_pid_files.c: Removed "procfs.h". (adjust_jiffy_time): Changed return type from time_t to jiffy_t. Changed the type of jiffy_time variable from time_t to jiffy_t. (get_live_threads_time): Changed the type of utime and stime from time_t to jiffy_t. (get_stat_data): Changed the type of utime and stime from time_t to jiffy_t. --- ChangeLog | 15 +++++++++++++++ procfs.h | 2 ++ procfs_pid.h | 10 ++++++---- procfs_pid_files.c | 9 ++++----- 4 files changed, 27 insertions(+), 9 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index eb175529..7cf16618 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-08-14 Madhusudan.C.S + * procfs.h: (jiffy_t): New typedef. + * procfs_pid.h: "procfs.h" is included. + (struct procfs_pid_files): Changed all the + occurrences of time_t to jiffy_t. + * procfs_pid_files.c: Removed "procfs.h". + (adjust_jiffy_time): Changed return type + from time_t to jiffy_t. + Changed the type of jiffy_time variable + from time_t to jiffy_t. + (get_live_threads_time): Changed the type + of utime and stime from time_t to jiffy_t. + (get_stat_data): Changed the type of utime + and stime from time_t to jiffy_t. + 2008-08-14 Madhusudan.C.S * ChangeLog: New file. diff --git a/procfs.h b/procfs.h index 95d4ee35..fa2fb7f7 100644 --- a/procfs.h +++ b/procfs.h @@ -53,6 +53,8 @@ #include #include +typedef unsigned long long jiffy_t; + /* A single entry in a directory. */ struct procfs_dir_entry { diff --git a/procfs_pid.h b/procfs_pid.h index 811cca84..566c83ea 100644 --- a/procfs_pid.h +++ b/procfs_pid.h @@ -26,6 +26,8 @@ #ifndef __PROCFS_PID_H__ #define __PROCFS_PID_H__ +#include "procfs.h" + struct procfs_pid_files { struct procfs_cwd *procfs_cwd; @@ -52,10 +54,10 @@ struct procfs_stat long unsigned cminflt; long unsigned majflt; long unsigned cmajflt; - time_t utime; - time_t stime; - time_t cutime; - time_t cstime; + jiffy_t utime; + jiffy_t stime; + jiffy_t cutime; + jiffy_t cstime; long priority; long nice; long num_threads; diff --git a/procfs_pid_files.c b/procfs_pid_files.c index 1012510b..55cc52c1 100644 --- a/procfs_pid_files.c +++ b/procfs_pid_files.c @@ -37,7 +37,6 @@ #include #include -#include "procfs.h" #include "procfs_pid.h" /* Update the files named NAME within the directory named @@ -148,9 +147,9 @@ error_t set_field_value (struct proc_stat *ps, int pstat_flag) Microseconds into the value in jiffies. The value of jiffy is a hack to adjust to what procps uses. */ -time_t adjust_jiffy_time (time_value_t time_val) +jiffy_t adjust_jiffy_time (time_value_t time_val) { - time_t jiffy_time = time_val.seconds * JIFFY_ADJUST; + jiffy_t jiffy_time = time_val.seconds * JIFFY_ADJUST; jiffy_time += (time_val.microseconds * JIFFY_ADJUST) / (1000 * 1000); @@ -178,7 +177,7 @@ error_t get_task_thread_times (task_t task, MACH directly since this is neither made available by libps nor by proc server. */ error_t get_live_threads_time (struct proc_stat *ps, - time_t *utime, time_t *stime) + jiffy_t *utime, jiffy_t *stime) { struct task_thread_times_info live_threads_times; error_t err = set_field_value (ps, PSTAT_TASK); @@ -208,7 +207,7 @@ error_t get_stat_data (pid_t pid, malloc (sizeof (struct procfs_stat)); struct proc_stat *ps; - time_t utime, stime; + jiffy_t utime, stime; err = _proc_stat_create (pid, ps_context, &ps); -- cgit v1.2.3 From a027dcc41d381a3c76a5b20d4d55ad9821af2308 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Mon, 18 Aug 2008 17:27:00 +0200 Subject: 2008-08-18 Madhusudan.C.S * procfs_nonpid_files.c: (procfs_write_nonpid_version): New function. * procfs_pid_files.c: (procfs_write_files_contents): Add a check to find if the read is requested for the version file and corresponding a call to it. --- ChangeLog | 8 ++++++++ procfs_nonpid_files.c | 18 +++++++++++++++++- procfs_pid_files.c | 7 +++++++ 3 files changed, 32 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 7cf16618..6079292d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-08-18 Madhusudan.C.S + * procfs_nonpid_files.c: + (procfs_write_nonpid_version): New function. + * procfs_pid_files.c: + (procfs_write_files_contents): Add a check + to find if the read is requested for the + version file and corresponding a call to it. + 2008-08-14 Madhusudan.C.S * procfs.h: (jiffy_t): New typedef. * procfs_pid.h: "procfs.h" is included. diff --git a/procfs_nonpid_files.c b/procfs_nonpid_files.c index 104ae8b3..ab1341ff 100644 --- a/procfs_nonpid_files.c +++ b/procfs_nonpid_files.c @@ -269,7 +269,7 @@ error_t procfs_write_nonpid_stat (struct dir_entry *dir_entry, idle_time_secs = uptime_secs - total_system_time_secs; - /* If the values are multiplied by 100, it iss done so to adjust + /* If the values are multiplied by 100, it is done so to adjust values in seconds to jiffies. */ if (asprintf (&stat_data, "cpu %ld %ld %ld %ld %ld %ld %d %d %d\n" "cpu0 %ld %ld %ld %ld %ld %ld %d %d %d\n" @@ -460,3 +460,19 @@ error_t procfs_write_nonpid_uptime (struct dir_entry *dir_entry, free (uptime_data); return err; } + +error_t procfs_write_nonpid_version (struct dir_entry *dir_entry, + off_t offset, size_t *len, void *data) +{ + char *version_data; + error_t err = 0; + + if (asprintf (&version_data, "Linux version 2.6.18\n", NULL) == -1) + return errno; + + memcpy (data, version_data, strlen(version_data)); + *len = strlen (data); + + free (version_data); + return err; +} diff --git a/procfs_pid_files.c b/procfs_pid_files.c index 55cc52c1..3ad77340 100644 --- a/procfs_pid_files.c +++ b/procfs_pid_files.c @@ -565,5 +565,12 @@ procfs_write_files_contents (struct node *node, else err = ENOENT; + if (! strcmp (node->nn->dir_entry->name, "version")) + if (! strcmp (node->nn->dir_entry->dir->fs_path, "")) + err = procfs_write_nonpid_version (node->nn->dir_entry, + offset, len, data); + else + err = ENOENT; + return err; } -- cgit v1.2.3 From 5bb07a3cb626b18aedfa463b6b344bf0fd963e71 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Mon, 18 Aug 2008 19:34:00 +0200 Subject: 2008-08-18 Madhusudan.C.S * procfs_nonpid_files.c: (get_uptime): Changed the parameter type from double to struct timeval. Changed the parameter name from uptime_secs to uptime. Removed uptime variable. Changed timersub to use the passed pointer instead of the local variable. Removed the calculation of uptime_secs. (get_total_times): Changed the parameters type from double to struct timeval. Changed the parameters name from total_user_time_secs to total_user_time and total_system_time_secs to total_system_time. New variables total_user_time_tmp, total_system_time_tmp and tmpval of type struct timeval. Call timerclear to clear the tmp variables. Remove calculation of times in seconds and do the same on struct timeval variables throughout using the timeradd macro. Assign values of temporary local variables to the pointers passed as parameters. (procfs_write_nonpid_stat): Replaced variables that hold time in seconds with struct timeval type variables and jiffy_t type variables. Argument to get_uptime changed from uptime_secs to uptime. Arguments to get_total_times changed from total_user_time_secs to total_user_time and total_system_time_secs to total_system_time. Replace arithematic time subtraction with timersub macro. Convert all the times in struct timeval type variables to jiffy_t type. Changed the type casting for the asprintf arguments to be compatible with jiffy_t type. (procfs_write_nonpid_uptime): Replaced variables that hold time in seconds with struct timeval type variables. Argument to get_uptime changed from uptime_secs to uptime. Arguments to get_total_times changed from total_user_time_secs to total_user_time and total_system_time_secs to total_system_time. Replace arithematic time subtraction with timersub macro. Convert all the times in struct timeval type variables to seconds. --- ChangeLog | 53 +++++++++++++++++++ procfs_nonpid_files.c | 138 +++++++++++++++++++++++++++++++------------------- 2 files changed, 140 insertions(+), 51 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 6079292d..2e027f58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,56 @@ +2008-08-18 Madhusudan.C.S + * procfs_nonpid_files.c: (get_uptime): + Changed the parameter type from double to + struct timeval. + Changed the parameter name from uptime_secs + to uptime. + Removed uptime variable. + Changed timersub to use the passed pointer + instead of the local variable. + Removed the calculation of uptime_secs. + (get_total_times): Changed the parameters + type from double to struct timeval. + Changed the parameters name from + total_user_time_secs to total_user_time + and total_system_time_secs to + total_system_time. + New variables total_user_time_tmp, + total_system_time_tmp and tmpval of type + struct timeval. + Call timerclear to clear the tmp variables. + Remove calculation of times in seconds and + do the same on struct timeval variables + throughout using the timeradd macro. + Assign values of temporary local variables + to the pointers passed as parameters. + (procfs_write_nonpid_stat): Replaced + variables that hold time in seconds with + struct timeval type variables and jiffy_t + type variables. + Argument to get_uptime changed from + uptime_secs to uptime. + Arguments to get_total_times changed from + total_user_time_secs to total_user_time and + total_system_time_secs to total_system_time. + Replace arithematic time subtraction with + timersub macro. + Convert all the times in struct timeval type + variables to jiffy_t type. + Changed the type casting for the asprintf + arguments to be compatible with jiffy_t type. + (procfs_write_nonpid_uptime): Replaced + variables that hold time in seconds with + struct timeval type variables. + Argument to get_uptime changed from + uptime_secs to uptime. + Arguments to get_total_times changed from + total_user_time_secs to total_user_time and + total_system_time_secs to total_system_time. + Replace arithematic time subtraction with + timersub macro. + Convert all the times in struct timeval type + variables to seconds. + 2008-08-18 Madhusudan.C.S * procfs_nonpid_files.c: (procfs_write_nonpid_version): New function. diff --git a/procfs_nonpid_files.c b/procfs_nonpid_files.c index ab1341ff..9cb0c57a 100644 --- a/procfs_nonpid_files.c +++ b/procfs_nonpid_files.c @@ -166,9 +166,9 @@ error_t procfs_create_loadavg (struct procfs_dir *dir, return err; } -error_t get_uptime (double *uptime_secs) +error_t get_uptime (struct timeval *uptime) { - struct timeval boot_time, uptime, now; + struct timeval boot_time, now; error_t err; struct proc_stat *ps; @@ -188,15 +188,15 @@ error_t get_uptime (double *uptime_secs) boot_time.tv_usec = tv->microseconds; if (gettimeofday (&now, 0) < 0) error (0, errno, "gettimeofday"); - timersub (&now, &boot_time, &uptime); - *uptime_secs = (double)uptime.tv_sec + ((double)uptime.tv_usec / 1000000); + timersub (&now, &boot_time, uptime); } _proc_stat_free (ps); return err; } -error_t get_total_times (double *total_user_time_secs , double *total_system_time_secs ) +error_t get_total_times (struct timeval *total_user_time, + struct timeval *total_system_time) { error_t err; pid_t *pids; @@ -204,8 +204,12 @@ error_t get_total_times (double *total_user_time_secs , double *total_system_tim struct proc_stat *ps; struct task_thread_times_info live_threads_times; - *total_user_time_secs = 0; - *total_system_time_secs = 0; + struct timeval total_user_time_tmp; + struct timeval total_system_time_tmp; + struct timeval tmpval; + + timerclear (&total_user_time_tmp); + timerclear (&total_system_time_tmp); pids = NULL; err = proc_getallpids (getproc (), &pids, &pidslen); @@ -222,33 +226,40 @@ error_t get_total_times (double *total_user_time_secs , double *total_system_tim err = EGRATUITOUS; if (! err) - { - *total_user_time_secs += - ((double) (proc_stat_task_basic_info (ps)->user_time.seconds)) + - (((double) (proc_stat_task_basic_info (ps)->user_time.microseconds)) / - (1000 * 1000)); + { + tmpval.tv_sec = proc_stat_task_basic_info (ps)->user_time.seconds; + tmpval.tv_usec = proc_stat_task_basic_info (ps)->user_time.seconds; + timeradd (&total_user_time_tmp, &tmpval, &total_user_time_tmp); + + tmpval.tv_sec = proc_stat_task_basic_info (ps)->system_time.seconds; + tmpval.tv_usec = proc_stat_task_basic_info (ps)->system_time.seconds; + timeradd (&total_system_time_tmp, &tmpval, &total_system_time_tmp); - *total_system_time_secs += - ((double) (proc_stat_task_basic_info (ps)->system_time.seconds)) + - (((double) (proc_stat_task_basic_info (ps)->system_time.microseconds)) / (1000 * 1000)); - error_t err = set_field_value (ps, PSTAT_TASK); if (! err) { err = get_task_thread_times (ps->task, &live_threads_times); if (! err) { - *total_user_time_secs += ((double) (live_threads_times.user_time.seconds)) + - (((double) (live_threads_times.user_time.microseconds)) / (1000 * 1000)); - *total_system_time_secs += ((double) (live_threads_times.system_time.seconds)) + - (((double) (live_threads_times.system_time.microseconds)) / (1000 * 1000)); - + tmpval.tv_sec = live_threads_times.user_time.seconds; + tmpval.tv_usec = live_threads_times.user_time.microseconds; + timeradd (&total_user_time_tmp, &tmpval, &total_user_time_tmp); + + tmpval.tv_sec = live_threads_times.system_time.seconds; + tmpval.tv_usec = live_threads_times.system_time.microseconds; + timeradd (&total_system_time_tmp, &tmpval, &total_system_time_tmp); } } } _proc_stat_free (ps); } - + + total_user_time->tv_sec = total_user_time_tmp.tv_sec; + total_user_time->tv_usec = total_user_time_tmp.tv_usec; + + total_system_time->tv_sec = total_system_time_tmp.tv_sec; + total_system_time->tv_usec = total_system_time_tmp.tv_usec; + return err; } @@ -257,30 +268,45 @@ error_t procfs_write_nonpid_stat (struct dir_entry *dir_entry, { char *stat_data; error_t err; - double uptime_secs, total_user_time_secs; - double total_system_time_secs, idle_time_secs; + jiffy_t total_user_time_jiffy, total_system_time_jiffy; + jiffy_t idle_time_jiffy; + struct timeval uptime, total_user_time, total_system_time; + struct timeval idle_time; - err = get_uptime (&uptime_secs); + err = get_uptime (&uptime); + if (! err) { - err = get_total_times (&total_user_time_secs, &total_system_time_secs); + err = get_total_times (&total_user_time, &total_system_time); + if (! err) { - idle_time_secs = uptime_secs - - total_system_time_secs; - - /* If the values are multiplied by 100, it is done so to adjust - values in seconds to jiffies. */ - if (asprintf (&stat_data, "cpu %ld %ld %ld %ld %ld %ld %d %d %d\n" - "cpu0 %ld %ld %ld %ld %ld %ld %d %d %d\n" - "intr %ld %ld %ld %ld %ld %ld %d %d %d\n", - (long)(total_user_time_secs * 100), 0, - (long)(total_system_time_secs * 100), - (long) (idle_time_secs * 100), 0, 0, 0, 0, - 0, (long)(total_user_time_secs * 100), 0, - (long)(total_system_time_secs * 100), - (long)(idle_time_secs * 100), 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == -1) + timersub (&uptime, &total_system_time, + &idle_time); + + total_user_time_jiffy = 100 * ((double) total_user_time.tv_sec + + (double) total_user_time.tv_usec / (1000 * 1000)); + total_system_time_jiffy = 100 * ((double) total_system_time.tv_sec + + (double) total_system_time.tv_usec / (1000 * 1000)); + idle_time_jiffy = 100 * ((double) idle_time.tv_sec + + (double) idle_time.tv_usec / (1000 * 1000)); + + if (asprintf (&stat_data, "cpu %llu %llu %llu %llu %llu %llu %d %d %d\n" + "cpu0 %llu %llu %llu %llu %llu %llu %d %d %d\n" + "intr %llu %llu %llu %llu %llu %llu %d %d %d\n", + total_user_time_jiffy, (long long unsigned) 0, + total_system_time_jiffy, idle_time_jiffy, + (long long unsigned) 0, (long long unsigned) 0, + 0, 0, 0, + total_user_time_jiffy, (long long unsigned) 0, + total_system_time_jiffy, idle_time_jiffy, + (long long unsigned) 0, (long long unsigned) 0, + 0, 0, 0, + (long long unsigned) 0, + (long long unsigned) 0, (long long unsigned) 0, (long long unsigned) 0, + (long long unsigned) 0, + (long long unsigned) 0, (long long unsigned) 0, + (long long unsigned) 0, (long long unsigned) 0) == -1) return errno; } } @@ -434,23 +460,33 @@ error_t procfs_write_nonpid_uptime (struct dir_entry *dir_entry, { char *uptime_data; error_t err; - double uptime_secs, total_user_time_secs; - double total_system_time_secs, idle_time_secs; + double uptime_secs, idle_time_secs; + + struct timeval uptime_val; + struct timeval uptime, total_user_time, total_system_time; + struct timeval idle_time; + - err = get_uptime (&uptime_secs); + err = get_uptime (&uptime); if (! err) { - err = get_total_times (&total_user_time_secs, - &total_system_time_secs); + err = get_total_times (&total_user_time, + &total_system_time); if (! err) { - idle_time_secs = uptime_secs - - total_system_time_secs; - - if (asprintf (&uptime_data, "%.2f %.2f \n", + timersub (&uptime, &total_system_time, + &idle_time); + + uptime_secs = (double) uptime.tv_sec + + (double) uptime.tv_usec / (1000 * 1000); + + idle_time_secs = (double) idle_time.tv_sec + + (double) idle_time.tv_usec / (1000 * 1000); + + if (asprintf (&uptime_data, "%.2f %.2f\n", uptime_secs, idle_time_secs) == -1) return errno; - } + } } -- cgit v1.2.3 From 151d56afe0d7d9eb527fb0a194f383435b2c0f65 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Mon, 18 Aug 2008 19:45:00 +0200 Subject: 2008-08-18 Madhusudan.C.S * README: Initial Documentation. --- ChangeLog | 3 +++ README | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 2e027f58..e5bb2414 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2008-08-18 Madhusudan.C.S + * README: Initial Documentation. + 2008-08-18 Madhusudan.C.S * procfs_nonpid_files.c: (get_uptime): Changed the parameter type from double to diff --git a/README b/README index e69de29b..28b4aa3e 100644 --- a/README +++ b/README @@ -0,0 +1,77 @@ +~~~~~~~~~~~~~~~ +1. Introduction +~~~~~~~~~~~~~~~ + + This program is called procfs, the /proc translator. This +program provides a GNU/Linux compatible /proc pseudo file- +system on GNU Hurd. This is called a translator since it +translates the process related information stored in the +MACH Microkernel which is made available through the proc +server and the libps library into a virtual filesystem. + +~~~~~~~ +2. Goal +~~~~~~~ + + The major goal of writing this translator was to make the +process related tools like pgrep, pkill, kill which are +packaged in procps, killall, pstree which are packaged in +psmisc and various other process related tools that rely +on GNU/Linux's /proc filesystem to run out of the box on +Hurd. + +~~~~~~~~~~ +3. Install +~~~~~~~~~~ + + To install this translator you can simply do the following. +Just cd to the top level directory of the hurd main source +tree. Run the configure script with the following command. +(In BASH) + +$ ./configure + +(If your shell is something else run the equivalent command). + +Now you can run make with procfs as a parameter if you want +to build only procfs. + +$ make procfs + +(This first builds all the dependencies of procfs and then +builds procfs as a part of Hurd main source tree.) + +After building the translator, you get a binary named procfs. +You need to set it as a translator. To do so you can type the +following command from the top level directory of Hurd main +source tree directory from where you ran make. + +$ settrans -fgap /proc procfs/procfs + +Viola! You are done setting up the translator. + +~~~~~~~~~~ +4. Testing +~~~~~~~~~~ + + Now in case you want to use the debian hurd binaries to work +with tools like pgrep, pkill, kill, htop etc, you can just +download the binaries which I have uploaded here: + +http://madhusudancs.info/procfs-testing-how-to-mini + +The patches to the source packages will be made available soon. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +5. Reporting Bugs and contacts +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + I request all of you to help me in identifying the bugs in +procfs or in the procps or htop packages, so that I can fix +them. You are also free to submit patches if you feel so. The +patches can be sent either to bug-hurd mailing list or to my +e-mail adress. The e-mail IDs are as follows: + +bug-hurd@gnu.org +madhusudancs@gmail.com +madhusudan@madhusudancs.info -- cgit v1.2.3 From 4cce52a1ec161008243f5bee63df7f6230c0f7e6 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Mon, 18 Aug 2008 20:26:00 +0200 Subject: 2008-08-18 Madhusudan.C.S * procfs_nonpid_files.c: (procfs_write_nonpid_stat): Changed to procfs_read_nonpid_stat. (procfs_write_nonpid_meminfo): Changed to procfs_read_nonpid_meminfo. (procfs_write_nonpid_loadavg): Changed to procfs_read_nonpid_loadavg. (procfs_write_nonpid_uptime): Changed to procfs_read_nonpid_uptime. (procfs_write_nonpid_version):Changed to procfs_read_nonpid_version. * procfs_pid_files.c: (procfs_write_stat_file): Changed to procfs_read_stat_file. Changed the comment correspondingly from Write to Read. (procfs_write_cmdline_file ): Changed to procfs_read_cmdline_file. Changed the comment correspondingly from Write to Read. (procfs_write_status_file): Changed to procfs_read_status_file. Changed the comment correspondingly from Write to Read. (procfs_write_statm_file): Changed to procfs_read_statm_file. Changed the comment correspondingly from Write to Read. (procfs_write_files_contents): Changed to procfs_read_files_contents. Changed the comment correspondingly from Write to Read. Changed the call to procfs_write_nonpid_stat to procfs_read_nonpid_stat. Changed the call to procfs_write_stat_file to procfs_read_stat_file. Changed the call to procfs_write_cmdline_file to procfs_read_cmdline_file. Changed the call to procfs_write_status_file to procfs_read_status_file. Changed the call to procfs_write_statm_file to procfs_read_statm_file. Changed the call to procfs_write_nonpid_meminfo to procfs_read_nonpid_meminfo. Changed the call to procfs_write_nonpid_loadavg to procfs_read_nonpid_loadavg. Changed the call to procfs_write_nonpid_uptime to procfs_read_nonpid_uptime. Changed the call to procfs_write_nonpid_version to procfs_read_nonpid_version. netfs.c: (netfs_attempt_read): Changed the call from procfs_write_files_contents to procfs_read_files_contents. --- ChangeLog | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ netfs.c | 2 +- procfs_nonpid_files.c | 10 +++++----- procfs_pid_files.c | 46 +++++++++++++++++++++--------------------- 4 files changed, 84 insertions(+), 29 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index e5bb2414..730ad727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,58 @@ +2008-08-18 Madhusudan.C.S + * procfs_nonpid_files.c: + (procfs_write_nonpid_stat): Changed to + procfs_read_nonpid_stat. + (procfs_write_nonpid_meminfo): Changed to + procfs_read_nonpid_meminfo. + (procfs_write_nonpid_loadavg): Changed to + procfs_read_nonpid_loadavg. + (procfs_write_nonpid_uptime): Changed to + procfs_read_nonpid_uptime. + (procfs_write_nonpid_version):Changed to + procfs_read_nonpid_version. + * procfs_pid_files.c: + (procfs_write_stat_file): Changed to + procfs_read_stat_file. + Changed the comment correspondingly from + Write to Read. + (procfs_write_cmdline_file ): Changed to + procfs_read_cmdline_file. + Changed the comment correspondingly from + Write to Read. + (procfs_write_status_file): Changed to + procfs_read_status_file. + Changed the comment correspondingly from + Write to Read. + (procfs_write_statm_file): Changed to + procfs_read_statm_file. + Changed the comment correspondingly from + Write to Read. + (procfs_write_files_contents): Changed to + procfs_read_files_contents. + Changed the comment correspondingly from + Write to Read. + Changed the call to procfs_write_nonpid_stat + to procfs_read_nonpid_stat. + Changed the call to procfs_write_stat_file + to procfs_read_stat_file. + Changed the call to procfs_write_cmdline_file + to procfs_read_cmdline_file. + Changed the call to procfs_write_status_file + to procfs_read_status_file. + Changed the call to procfs_write_statm_file + to procfs_read_statm_file. + Changed the call to procfs_write_nonpid_meminfo + to procfs_read_nonpid_meminfo. + Changed the call to procfs_write_nonpid_loadavg + to procfs_read_nonpid_loadavg. + Changed the call to procfs_write_nonpid_uptime + to procfs_read_nonpid_uptime. + Changed the call to procfs_write_nonpid_version + to procfs_read_nonpid_version. + netfs.c: (netfs_attempt_read): Changed + the call from procfs_write_files_contents + to procfs_read_files_contents. + 2008-08-18 Madhusudan.C.S * README: Initial Documentation. diff --git a/netfs.c b/netfs.c index 31ffe1b5..7e00e4d4 100644 --- a/netfs.c +++ b/netfs.c @@ -435,7 +435,7 @@ error_t netfs_attempt_read (struct iouser *cred, struct node *node, if (! err) { if (*len > 0) - procfs_write_files_contents (node, offset, + procfs_read_files_contents (node, offset, len, data); if (*len > 0) if (offset >= *len) diff --git a/procfs_nonpid_files.c b/procfs_nonpid_files.c index 9cb0c57a..15c09190 100644 --- a/procfs_nonpid_files.c +++ b/procfs_nonpid_files.c @@ -263,7 +263,7 @@ error_t get_total_times (struct timeval *total_user_time, return err; } -error_t procfs_write_nonpid_stat (struct dir_entry *dir_entry, +error_t procfs_read_nonpid_stat (struct dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *stat_data; @@ -387,7 +387,7 @@ SWAP_FIELD (get_swap_page_size, def_pager_info.dpi_page_size) SWAP_FIELD (get_swap_active, (def_pager_info.dpi_total_space - def_pager_info.dpi_free_space)) -error_t procfs_write_nonpid_meminfo (struct dir_entry *dir_entry, +error_t procfs_read_nonpid_meminfo (struct dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *meminfo_data; @@ -427,7 +427,7 @@ error_t procfs_write_nonpid_meminfo (struct dir_entry *dir_entry, return err; } -error_t procfs_write_nonpid_loadavg (struct dir_entry *dir_entry, +error_t procfs_read_nonpid_loadavg (struct dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *loadavg_data; @@ -455,7 +455,7 @@ error_t procfs_write_nonpid_loadavg (struct dir_entry *dir_entry, return err; } -error_t procfs_write_nonpid_uptime (struct dir_entry *dir_entry, +error_t procfs_read_nonpid_uptime (struct dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *uptime_data; @@ -497,7 +497,7 @@ error_t procfs_write_nonpid_uptime (struct dir_entry *dir_entry, return err; } -error_t procfs_write_nonpid_version (struct dir_entry *dir_entry, +error_t procfs_read_nonpid_version (struct dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *version_data; diff --git a/procfs_pid_files.c b/procfs_pid_files.c index 3ad77340..ed3a3bdc 100644 --- a/procfs_pid_files.c +++ b/procfs_pid_files.c @@ -367,12 +367,12 @@ error_t get_stat_data (pid_t pid, return err; } -/* Writes required process information to stat file +/* Reads required process information from stat file within the directory represented by pid. Return the data in DATA and actual length to be written in LEN. */ error_t -procfs_write_stat_file (struct procfs_dir_entry *dir_entry, +procfs_read_stat_file (struct procfs_dir_entry *dir_entry, off_t offset, size_t *len, void *data) { error_t err; @@ -417,12 +417,12 @@ procfs_write_stat_file (struct procfs_dir_entry *dir_entry, return err; } -/* Writes required process's command line information - to cmline file within the directory represented by - pid. Return the data in DATA and actual length to - be written in LEN. */ +/* Reads required process's command line information + from cmline file within the directory represented + by pid. Return the data in DATA and actual length + to be written in LEN. */ error_t -procfs_write_cmdline_file (struct procfs_dir_entry *dir_entry, +procfs_read_cmdline_file (struct procfs_dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *cmdline_data; @@ -445,12 +445,12 @@ procfs_write_cmdline_file (struct procfs_dir_entry *dir_entry, return err; } -/* Writes required process's information that is represented by - stat and statm in a human readable format to status file +/* Reads required process's information that is represented by + stat and statm in a human readable format from status file within the directory represented by pid. Return the data in DATA and actual length to be written in LEN. */ error_t -procfs_write_status_file (struct procfs_dir_entry *dir_entry, +procfs_read_status_file (struct procfs_dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *status_data; @@ -478,12 +478,12 @@ procfs_write_status_file (struct procfs_dir_entry *dir_entry, return err; } -/* Writes required process information to statm file +/* Reads required process information from statm file within the directory represented by pid. Return the data in DATA and actual length to be written in LEN. */ error_t -procfs_write_statm_file (struct procfs_dir_entry *dir_entry, +procfs_read_statm_file (struct procfs_dir_entry *dir_entry, off_t offset, size_t *len, void *data) { char *statm_data; @@ -514,60 +514,60 @@ procfs_write_statm_file (struct procfs_dir_entry *dir_entry, return err; } -/* Writes required process information to each of files +/* Reads required process information from each of files within directory represented by pid, for files specified by NODE. Return the data in DATA and actual length of data in LEN. */ error_t -procfs_write_files_contents (struct node *node, +procfs_read_files_contents (struct node *node, off_t offset, size_t *len, void *data) { error_t err; if (! strcmp (node->nn->dir_entry->name, "stat")) if (! strcmp (node->nn->dir_entry->dir->fs_path, "")) - err = procfs_write_nonpid_stat (node->nn->dir_entry, + err = procfs_read_nonpid_stat (node->nn->dir_entry, offset, len, data); else - err = procfs_write_stat_file (node->nn->dir_entry, + err = procfs_read_stat_file (node->nn->dir_entry, offset, len, data); if (! strcmp (node->nn->dir_entry->name, "cmdline")) - err = procfs_write_cmdline_file (node->nn->dir_entry, + err = procfs_read_cmdline_file (node->nn->dir_entry, offset, len, data); if (! strcmp (node->nn->dir_entry->name, "status")) - err = procfs_write_status_file (node->nn->dir_entry, + err = procfs_read_status_file (node->nn->dir_entry, offset, len, data); if (! strcmp (node->nn->dir_entry->name, "statm")) - err = procfs_write_statm_file (node->nn->dir_entry, + err = procfs_read_statm_file (node->nn->dir_entry, offset, len, data); if (! strcmp (node->nn->dir_entry->name, "meminfo")) if (! strcmp (node->nn->dir_entry->dir->fs_path, "")) - err = procfs_write_nonpid_meminfo (node->nn->dir_entry, + err = procfs_read_nonpid_meminfo (node->nn->dir_entry, offset, len, data); else err = ENOENT; if (! strcmp (node->nn->dir_entry->name, "loadavg")) if (! strcmp (node->nn->dir_entry->dir->fs_path, "")) - err = procfs_write_nonpid_loadavg (node->nn->dir_entry, + err = procfs_read_nonpid_loadavg (node->nn->dir_entry, offset, len, data); else err = ENOENT; if (! strcmp (node->nn->dir_entry->name, "uptime")) if (! strcmp (node->nn->dir_entry->dir->fs_path, "")) - err = procfs_write_nonpid_uptime (node->nn->dir_entry, + err = procfs_read_nonpid_uptime (node->nn->dir_entry, offset, len, data); else err = ENOENT; if (! strcmp (node->nn->dir_entry->name, "version")) if (! strcmp (node->nn->dir_entry->dir->fs_path, "")) - err = procfs_write_nonpid_version (node->nn->dir_entry, + err = procfs_read_nonpid_version (node->nn->dir_entry, offset, len, data); else err = ENOENT; -- cgit v1.2.3 From 80e2bfc9ee29a5ecac3a9b8eaa2d470ae30222c9 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Fri, 29 Aug 2008 18:42:00 +0200 Subject: 2008-08-29 Madhusudan.C.S * Makefile: (Copyright): 1997, 2000 -> 2008 (CC): Removed. (CFLAGS): Removed. (INCLUDES): Removed. (all): Removed. ($(target)): Removed. (%.o): Removed. (HURDLIBS): -lnetfs -> netfs, -lfshelp -> fshelp, -liohelp -> iohelp, -lthreads -> threads, -lports -> ports, -lihash -> ihash, -lps -> ps, -lshouldbeinlibc -> shouldbeinlibc. (include): Add include ../Makeconf --- ChangeLog | 16 ++++++++++++++++ Makefile | 18 ++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 730ad727..a56b992d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2008-08-29 Madhusudan.C.S + * Makefile: (Copyright): 1997, 2000 -> 2008 + (CC): Removed. + (CFLAGS): Removed. + (INCLUDES): Removed. + (all): Removed. + ($(target)): Removed. + (%.o): Removed. + (HURDLIBS): -lnetfs -> netfs, + -lfshelp -> fshelp, + -liohelp -> iohelp, -lthreads -> threads, + -lports -> ports, -lihash -> ihash, + -lps -> ps, + -lshouldbeinlibc -> shouldbeinlibc. + (include): Add include ../Makeconf + 2008-08-18 Madhusudan.C.S * procfs_nonpid_files.c: (procfs_write_nonpid_stat): Changed to diff --git a/Makefile b/Makefile index dae406d3..500a2371 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile - for procfs # -# Copyright (C) 1997, 2000 Free Software Foundation, Inc. +# Copyright (C) 2008 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -21,20 +21,10 @@ makemode := server target = procfs -CC = gcc -CFLAGS = -Wall -g -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -INCLUDES = -I. - SRCS = procfs.c bootstrap.c netfs.c procfs_dir.c node.c procfs_pid_files.c procfs_nonpid_files.c LCLHDRS = procfs.h procfs_pid.h OBJS = $(SRCS:.c=.o) -HURDLIBS = -lnetfs -lfshelp -liohelp -lthreads -lports -lihash -lps -lshouldbeinlibc - -all: $(target) - -$(target): $(OBJS) - $(CC) $(CFLAGS) -o $(target) $(OBJS) $(HURDLIBS) - -%.o: %.c $(LCLHDRS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< +HURDLIBS = netfs fshelp iohelp threads ports ihash ps shouldbeinlibc + +include ../Makeconf -- cgit v1.2.3 From b33bac72fa26be8676a6da73e0b13f51bcd40034 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Fri, 29 Aug 2008 21:34:00 +0200 Subject: 2008-08-29 Madhusudan.C.S * ChangeLog: Revised. --- ChangeLog | 290 +++++++++++++++++++++++++++----------------------------------- 1 file changed, 127 insertions(+), 163 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index a56b992d..91399f23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,170 +1,134 @@ -2008-08-29 Madhusudan.C.S - * Makefile: (Copyright): 1997, 2000 -> 2008 - (CC): Removed. - (CFLAGS): Removed. - (INCLUDES): Removed. - (all): Removed. - ($(target)): Removed. - (%.o): Removed. - (HURDLIBS): -lnetfs -> netfs, - -lfshelp -> fshelp, - -liohelp -> iohelp, -lthreads -> threads, - -lports -> ports, -lihash -> ihash, - -lps -> ps, - -lshouldbeinlibc -> shouldbeinlibc. - (include): Add include ../Makeconf - -2008-08-18 Madhusudan.C.S - * procfs_nonpid_files.c: - (procfs_write_nonpid_stat): Changed to - procfs_read_nonpid_stat. - (procfs_write_nonpid_meminfo): Changed to - procfs_read_nonpid_meminfo. - (procfs_write_nonpid_loadavg): Changed to - procfs_read_nonpid_loadavg. - (procfs_write_nonpid_uptime): Changed to - procfs_read_nonpid_uptime. - (procfs_write_nonpid_version):Changed to - procfs_read_nonpid_version. - * procfs_pid_files.c: - (procfs_write_stat_file): Changed to - procfs_read_stat_file. - Changed the comment correspondingly from - Write to Read. - (procfs_write_cmdline_file ): Changed to - procfs_read_cmdline_file. - Changed the comment correspondingly from - Write to Read. - (procfs_write_status_file): Changed to - procfs_read_status_file. - Changed the comment correspondingly from - Write to Read. - (procfs_write_statm_file): Changed to - procfs_read_statm_file. - Changed the comment correspondingly from - Write to Read. - (procfs_write_files_contents): Changed to - procfs_read_files_contents. - Changed the comment correspondingly from - Write to Read. - Changed the call to procfs_write_nonpid_stat - to procfs_read_nonpid_stat. - Changed the call to procfs_write_stat_file - to procfs_read_stat_file. - Changed the call to procfs_write_cmdline_file - to procfs_read_cmdline_file. - Changed the call to procfs_write_status_file - to procfs_read_status_file. - Changed the call to procfs_write_statm_file - to procfs_read_statm_file. - Changed the call to procfs_write_nonpid_meminfo - to procfs_read_nonpid_meminfo. - Changed the call to procfs_write_nonpid_loadavg - to procfs_read_nonpid_loadavg. - Changed the call to procfs_write_nonpid_uptime - to procfs_read_nonpid_uptime. - Changed the call to procfs_write_nonpid_version - to procfs_read_nonpid_version. - netfs.c: (netfs_attempt_read): Changed - the call from procfs_write_files_contents - to procfs_read_files_contents. - -2008-08-18 Madhusudan.C.S - * README: Initial Documentation. +2008-08-29 Madhusudan.C.S -2008-08-18 Madhusudan.C.S - * procfs_nonpid_files.c: (get_uptime): - Changed the parameter type from double to - struct timeval. - Changed the parameter name from uptime_secs - to uptime. - Removed uptime variable. - Changed timersub to use the passed pointer - instead of the local variable. - Removed the calculation of uptime_secs. - (get_total_times): Changed the parameters - type from double to struct timeval. - Changed the parameters name from - total_user_time_secs to total_user_time - and total_system_time_secs to - total_system_time. - New variables total_user_time_tmp, - total_system_time_tmp and tmpval of type - struct timeval. - Call timerclear to clear the tmp variables. - Remove calculation of times in seconds and - do the same on struct timeval variables - throughout using the timeradd macro. - Assign values of temporary local variables - to the pointers passed as parameters. - (procfs_write_nonpid_stat): Replaced - variables that hold time in seconds with - struct timeval type variables and jiffy_t - type variables. - Argument to get_uptime changed from - uptime_secs to uptime. - Arguments to get_total_times changed from - total_user_time_secs to total_user_time and - total_system_time_secs to total_system_time. - Replace arithematic time subtraction with - timersub macro. - Convert all the times in struct timeval type - variables to jiffy_t type. - Changed the type casting for the asprintf - arguments to be compatible with jiffy_t type. - (procfs_write_nonpid_uptime): Replaced - variables that hold time in seconds with - struct timeval type variables. - Argument to get_uptime changed from - uptime_secs to uptime. - Arguments to get_total_times changed from - total_user_time_secs to total_user_time and - total_system_time_secs to total_system_time. - Replace arithematic time subtraction with - timersub macro. - Convert all the times in struct timeval type - variables to seconds. + * Makefile: (Copyright): 1997, 2000 -> 2008. + (CC): Removed. + (CFLAGS): Removed. + (INCLUDES): Removed. + (all): Removed. + ($(target)): Removed. + (%.o): Removed. + (HURDLIBS): -lnetfs -> netfs, -lfshelp -> fshelp, + -liohelp -> iohelp, -lthreads -> threads, -lports -> ports, + -lihash -> ihash, -lps -> ps, -lshouldbeinlibc -> shouldbeinlibc. + (include): Add include ../Makeconf -2008-08-18 Madhusudan.C.S - * procfs_nonpid_files.c: - (procfs_write_nonpid_version): New function. - * procfs_pid_files.c: - (procfs_write_files_contents): Add a check - to find if the read is requested for the - version file and corresponding a call to it. +2008-08-18 Madhusudan.C.S + + * procfs_nonpid_files.c: (procfs_write_nonpid_stat): Changed to + procfs_read_nonpid_stat. + (procfs_write_nonpid_meminfo): Changed to procfs_read_nonpid_meminfo. + (procfs_write_nonpid_loadavg): Changed to procfs_read_nonpid_loadavg. + (procfs_write_nonpid_uptime): Changed to procfs_read_nonpid_uptime. + (procfs_write_nonpid_version):Changed to procfs_read_nonpid_version. + * procfs_pid_files.c: (procfs_write_stat_file): Changed to + procfs_read_stat_file. + Changed the comment correspondingly from Write to Read. + (procfs_write_cmdline_file ): Changed to procfs_read_cmdline_file. + Changed the comment correspondingly from Write to Read. + (procfs_write_status_file): Changed to procfs_read_status_file. + Changed the comment correspondingly from Write to Read. + (procfs_write_statm_file): Changed to procfs_read_statm_file. + Changed the comment correspondingly from Write to Read. + (procfs_write_files_contents): Changed to procfs_read_files_contents. + Changed the comment correspondingly from Write to Read. + Changed the call to procfs_write_nonpid_stat to procfs_read_nonpid_stat. + Changed the call to procfs_write_stat_file to procfs_read_stat_file. + Changed the call to procfs_write_cmdline_file to + procfs_read_cmdline_file. + Changed the call to procfs_write_status_file to + procfs_read_status_file. + Changed the call to procfs_write_statm_file to + procfs_read_statm_file. + Changed the call to procfs_write_nonpid_meminfo to + procfs_read_nonpid_meminfo. + Changed the call to procfs_write_nonpid_loadavg to + procfs_read_nonpid_loadavg. + Changed the call to procfs_write_nonpid_uptime to + procfs_read_nonpid_uptime. + Changed the call to procfs_write_nonpid_version to + procfs_read_nonpid_version. + netfs.c: (netfs_attempt_read): Changed the call from + procfs_write_files_contents to procfs_read_files_contents. -2008-08-14 Madhusudan.C.S - * procfs.h: (jiffy_t): New typedef. - * procfs_pid.h: "procfs.h" is included. - (struct procfs_pid_files): Changed all the - occurrences of time_t to jiffy_t. - * procfs_pid_files.c: Removed "procfs.h". - (adjust_jiffy_time): Changed return type - from time_t to jiffy_t. - Changed the type of jiffy_time variable - from time_t to jiffy_t. - (get_live_threads_time): Changed the type - of utime and stime from time_t to jiffy_t. - (get_stat_data): Changed the type of utime - and stime from time_t to jiffy_t. +2008-08-18 Madhusudan.C.S + + * README: Initial Documentation. + +2008-08-18 Madhusudan.C.S + + * procfs_nonpid_files.c: (get_uptime): Changed the parameter type from + double to struct timeval. + Changed the parameter name from uptime_secs to uptime. + Removed uptime variable. + Changed timersub to use the passed pointer instead of the local + variable. + Removed the calculation of uptime_secs. + (get_total_times): Changed the parameters type from double to struct + timeval. + Changed the parameters name from total_user_time_secs to + total_user_time and total_system_time_secs to total_system_time. + New variables total_user_time_tmp, total_system_time_tmp and tmpval + of type struct timeval. + Call timerclear to clear the tmp variables. + Remove calculation of times in seconds and do the same on struct + timeval variables throughout using the timeradd macro. + Assign values of temporary local variables to the pointers passed + as parameters. + (procfs_write_nonpid_stat): Replaced variables that hold time in + seconds with struct timeval type variables and jiffy_t type variables. + Argument to get_uptime changed from uptime_secs to uptime. + Arguments to get_total_times changed from total_user_time_secs to + total_user_time and total_system_time_secs to total_system_time. + Replace arithematic time subtraction with timersub macro. + Convert all the times in struct timeval type variables to jiffy_t type. + Changed the type casting for the asprintf arguments to be compatible + with jiffy_t type. + (procfs_write_nonpid_uptime): Replaced variables that hold time in + seconds with struct timeval type variables. + Argument to get_uptime changed from uptime_secs to uptime. + Arguments to get_total_times changed from total_user_time_secs to + total_user_time and total_system_time_secs to total_system_time. + Replace arithematic time subtraction with timersub macro. + Convert all the times in struct timeval type variables to seconds. + +2008-08-18 Madhusudan.C.S + + * procfs_nonpid_files.c: (procfs_write_nonpid_version): New function. + * procfs_pid_files.c: (procfs_write_files_contents): Add a check + to find if the read is requested for the version file and + corresponding a call to it. + +2008-08-14 Madhusudan.C.S + + * procfs.h: (jiffy_t): New typedef. + * procfs_pid.h: "procfs.h" is included. + (struct procfs_pid_files): Changed all the occurrences of time_t to + jiffy_t. + * procfs_pid_files.c: Removed "procfs.h". + (adjust_jiffy_time): Changed return type from time_t to jiffy_t. + Changed the type of jiffy_time variable from time_t to jiffy_t. + (get_live_threads_time): Changed the type of utime and stime from + time_t to jiffy_t. + (get_stat_data): Changed the type of utime and stime from time_t to + jiffy_t. -2008-08-14 Madhusudan.C.S +2008-08-14 Madhusudan.C.S - * ChangeLog: New file. - * AUTHORS: New file. - * COPYING: New file. - * README: New file. - * Makefile: New file. - * bootstrap.c: New file. - * netfs.c: New file. - * node.c: New file. - * procfs.c: New file. - * procfs.h: New file. - * procfs_dir.c: New file. - * procfs_nonpid_files.c: New file. - * procfs_pid.h: New file. - * procfs_pid_files.c: New file. + * ChangeLog: New file. + * AUTHORS: New file. + * COPYING: New file. + * README: New file. + * Makefile: New file. + * bootstrap.c: New file. + * netfs.c: New file. + * node.c: New file. + * procfs.c: New file. + * procfs.h: New file. + * procfs_dir.c: New file. + * procfs_nonpid_files.c: New file. + * procfs_pid.h: New file. + * procfs_pid_files.c: New file. -2008-05-13 Madhusudan.C.S +2008-05-13 Madhusudan.C.S - * /sources/hurd/procfs: New directory added to the repository. + * /sources/hurd/procfs: New directory added to the repository. -- cgit v1.2.3 From fdd74966f222b67aa3161e809c6e9d8aacb16b12 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Sat, 30 Aug 2008 22:20:00 +0200 Subject: 2008-08-29 Madhusudan.C.S * AUTHORS: File removed. * COPYING: Likewise. * README: Likewise. --- AUTHORS | 10 -- COPYING | 340 -------------------------------------------------------------- ChangeLog | 6 ++ README | 77 -------------- 4 files changed, 6 insertions(+), 427 deletions(-) delete mode 100644 AUTHORS delete mode 100644 COPYING delete mode 100644 README (limited to 'ChangeLog') diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 622b6488..00000000 --- a/AUTHORS +++ /dev/null @@ -1,10 +0,0 @@ -Written By -~~~~~~~~~~ - -Madhusudan.C.S - - -Mentored By -~~~~~~~~~~~ - -Olaf Buddenhagen diff --git a/COPYING b/COPYING deleted file mode 100644 index 60549be5..00000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/ChangeLog b/ChangeLog index 91399f23..e22887dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-29 Madhusudan.C.S + + * AUTHORS: File removed. + * COPYING: Likewise. + * README: Likewise. + 2008-08-29 Madhusudan.C.S * Makefile: (Copyright): 1997, 2000 -> 2008. diff --git a/README b/README deleted file mode 100644 index 28b4aa3e..00000000 --- a/README +++ /dev/null @@ -1,77 +0,0 @@ -~~~~~~~~~~~~~~~ -1. Introduction -~~~~~~~~~~~~~~~ - - This program is called procfs, the /proc translator. This -program provides a GNU/Linux compatible /proc pseudo file- -system on GNU Hurd. This is called a translator since it -translates the process related information stored in the -MACH Microkernel which is made available through the proc -server and the libps library into a virtual filesystem. - -~~~~~~~ -2. Goal -~~~~~~~ - - The major goal of writing this translator was to make the -process related tools like pgrep, pkill, kill which are -packaged in procps, killall, pstree which are packaged in -psmisc and various other process related tools that rely -on GNU/Linux's /proc filesystem to run out of the box on -Hurd. - -~~~~~~~~~~ -3. Install -~~~~~~~~~~ - - To install this translator you can simply do the following. -Just cd to the top level directory of the hurd main source -tree. Run the configure script with the following command. -(In BASH) - -$ ./configure - -(If your shell is something else run the equivalent command). - -Now you can run make with procfs as a parameter if you want -to build only procfs. - -$ make procfs - -(This first builds all the dependencies of procfs and then -builds procfs as a part of Hurd main source tree.) - -After building the translator, you get a binary named procfs. -You need to set it as a translator. To do so you can type the -following command from the top level directory of Hurd main -source tree directory from where you ran make. - -$ settrans -fgap /proc procfs/procfs - -Viola! You are done setting up the translator. - -~~~~~~~~~~ -4. Testing -~~~~~~~~~~ - - Now in case you want to use the debian hurd binaries to work -with tools like pgrep, pkill, kill, htop etc, you can just -download the binaries which I have uploaded here: - -http://madhusudancs.info/procfs-testing-how-to-mini - -The patches to the source packages will be made available soon. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -5. Reporting Bugs and contacts -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - I request all of you to help me in identifying the bugs in -procfs or in the procps or htop packages, so that I can fix -them. You are also free to submit patches if you feel so. The -patches can be sent either to bug-hurd mailing list or to my -e-mail adress. The e-mail IDs are as follows: - -bug-hurd@gnu.org -madhusudancs@gmail.com -madhusudan@madhusudancs.info -- cgit v1.2.3 From 7a8b315855fc8edba2003fa69cb86cf664f4c2ec Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Sat, 30 Aug 2008 22:48:00 +0200 Subject: 2008-08-30 Madhusudan.C.S * procfs_dir.c: (procfs_dir_create): Assign newly created directory to its pointer in netnode. (procfs_dir_remove): Removed function. (free_entry): New function. (ordered_unlink): Likewise. (delete): Likewise. (sweep): Likewise. (procfs_dir_entries_remove): Likewise. (is_in_pid_list): Removed call to make_dir_invalid (). (procfs_fill_root_dir): struct stat *stat -> struct stat stat. Add Read and Execute permissions to all in stat.st_mode. Set stat.st_nlink to 1. Set stat.st_size to 0. Add struct proc_stat *ps definition. Set struct proc_stat data from _proc_stat_create () function and set stat.st_uid and stat.st_gid from the data in that structure. * procfs_pid_files.c: (update_pid_entries): Add Read permissions to all in stat->st_mode. --- ChangeLog | 21 ++++++++++ procfs_dir.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++------- procfs_pid_files.c | 2 +- 3 files changed, 126 insertions(+), 16 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index e22887dd..0e62b6f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2008-08-30 Madhusudan.C.S + + * procfs_dir.c: (procfs_dir_create): Assign newly created directory to + its pointer in netnode. + (procfs_dir_remove): Removed function. + (free_entry): New function. + (ordered_unlink): Likewise. + (delete): Likewise. + (sweep): Likewise. + (procfs_dir_entries_remove): Likewise. + (is_in_pid_list): Removed call to make_dir_invalid (). + (procfs_fill_root_dir): struct stat *stat -> struct stat stat. + Add Read and Execute permissions to all in stat.st_mode. + Set stat.st_nlink to 1. + Set stat.st_size to 0. + Add struct proc_stat *ps definition. + Set struct proc_stat data from _proc_stat_create () function and + set stat.st_uid and stat.st_gid from the data in that structure. + * procfs_pid_files.c: (update_pid_entries): Add Read permissions + to all in stat->st_mode. + 2008-08-29 Madhusudan.C.S * AUTHORS: File removed. diff --git a/procfs_dir.c b/procfs_dir.c index b9b0410e..f76e6a4b 100644 --- a/procfs_dir.c +++ b/procfs_dir.c @@ -77,6 +77,9 @@ error_t procfs_dir_create (struct procfs *fs, struct node *node, *dir = new; + if (fs->root != 0) + node->nn->dir = new; + return 0; } @@ -343,14 +346,50 @@ procfs_dir_null_lookup (struct procfs_dir *dir, struct node **node) return err; } -/* Remove the specified DIR and free all its allocated - storage. */ -void procfs_dir_remove (struct procfs_dir *dir) +/* Free the directory entry DIR_ENTRY and all resources it consumes. */ +void +free_entry (struct procfs_dir_entry *dir_entry) { - /* STUB */ + assert (! dir_entry->self_p); /* We should only free deleted nodes. */ + free (dir_entry->name); + if (dir_entry->symlink_target) + free (dir_entry->symlink_target); + free (dir_entry->node->nn->dir); + free (dir_entry->node->nn); + free (dir_entry->node); + free (dir_entry); +} + +/* Remove DIR_ENTRY from its position in the ordered_next chain. */ +static void +ordered_unlink (struct procfs_dir_entry *dir_entry) +{ + if (dir_entry->ordered_self_p) + *dir_entry->ordered_self_p = dir_entry->ordered_next; + if (dir_entry->ordered_next) + dir_entry->ordered_next->self_p = dir_entry->ordered_self_p; +} + +/* Delete DIR_ENTRY from its directory, freeing any resources it holds. */ +static void +delete (struct procfs_dir_entry *dir_entry, struct procfs_dir *dir) +{ + dir->num_entries--; - return 0; + /* Take out of the hash chain. */ + if (dir_entry->self_p) + *dir_entry->self_p = dir_entry->next; + if (dir_entry->next) + dir_entry->next->self_p = dir_entry->self_p; + + /* Take out of the directory ordered list. */ + ordered_unlink (dir_entry); + + /* If there's a node attached, we'll delete the entry whenever it goes + away, otherwise, just delete it now. */ + if (! dir_entry->node) + free_entry (dir_entry); } /* Make all the directory entries invalid */ @@ -373,6 +412,41 @@ make_dir_invalid (struct procfs_dir *dir) } } +/* Delete any entries in DIR which don't have their valid bit set. */ +static void +sweep (struct procfs_dir *dir) +{ + size_t len = dir->htable_len, i; + struct procfs_dir_entry **htable = dir->htable, *dir_entry; + + for (i = 0; i < len; i++) + { + dir_entry = htable[i]; + while (dir_entry) + { + if (!dir_entry->valid && !dir_entry->noent && dir->num_entries) + delete (dir_entry, dir); + dir_entry = dir_entry->next; + } + if (htable[i]) + { + free (htable[i]); + htable[i] = 0; + } + + } + +} + +/* Remove the specified DIR and free all its allocated + storage. */ +void procfs_dir_entries_remove (struct procfs_dir *dir) +{ + /* Free all entries. */ + make_dir_invalid (dir); + sweep (dir); +} + /* Checks if the DIR name is in list of Active pids. */ int is_in_pid_list (struct procfs_dir *dir) @@ -417,7 +491,6 @@ error_t procfs_dir_refresh (struct procfs_dir *dir, int isroot) error_t err; int is_parent_pid; struct node *node; - make_dir_invalid (dir); struct timeval tv; maptime_read (procfs_maptime, &tv); @@ -513,14 +586,18 @@ procfs_fill_root_dir(struct procfs_dir *dir, time_t timestamp) char *data; pid_t *pids; int pidslen; - struct stat *stat = (struct stat *) malloc (sizeof (struct stat)); - stat->st_mode = S_IFDIR; + struct stat stat; + stat.st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | + S_IROTH | S_IXOTH; + stat.st_nlink = 1; + stat.st_size = 0; int count; char *dir_name_pid; struct node *node; struct procfs_dir *new_dir; struct procfs_dir_entry *dir_entry; + struct proc_stat *ps; pids = NULL; pidslen = 0; @@ -540,13 +617,25 @@ procfs_fill_root_dir(struct procfs_dir *dir, time_t timestamp) if (! node || ! new_dir ) return ENOMEM; #endif - dir_entry = update_entries_list (dir, dir_name_pid, - stat, timestamp, NULL); - err = procfs_create_node (dir_entry, dir_name_pid, &node); - - procfs_dir_create (dir->fs, node, - dir_name_pid, &new_dir); - free(dir_name_pid); + err = _proc_stat_create (pids[count], ps_context, &ps); + if (! err) + { + err = set_field_value (ps, PSTAT_PROC_INFO); + if (! err) + { + stat.st_uid = proc_stat_proc_info (ps)->owner; + stat.st_gid = proc_stat_proc_info (ps)->pgrp; + + dir_entry = update_entries_list (dir, dir_name_pid, + &stat, timestamp, NULL); + err = procfs_create_node (dir_entry, dir_name_pid, &node); + + procfs_dir_create (dir->fs, node, + dir_name_pid, &new_dir); + free(dir_name_pid); + _proc_stat_free (ps); + } + } } } diff --git a/procfs_pid_files.c b/procfs_pid_files.c index ed3a3bdc..46861531 100644 --- a/procfs_pid_files.c +++ b/procfs_pid_files.c @@ -48,7 +48,7 @@ update_pid_entries (struct procfs_dir *dir, const char *name, { struct procfs_dir_entry *dir_entry; struct stat *stat = (struct stat *) malloc (sizeof (struct stat)); - stat->st_mode = S_IFREG; + stat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; dir_entry = update_entries_list (dir, name, stat, timestamp, symlink_target); -- cgit v1.2.3 From 7e7201c453ad7faa5d26625ca9d263ee625ef5ed Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Tue, 2 Sep 2008 00:33:00 +0200 Subject: 2008-09-02 Madhusudan.C.S * netfs.c: (netfs_get_dirents): Add call to procfs_dir_entries_remove(). --- ChangeLog | 5 +++++ netfs.c | 1 + 2 files changed, 6 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 0e62b6f4..1750c16d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-09-02 Madhusudan.C.S + + * netfs.c: (netfs_get_dirents): Add call to + procfs_dir_entries_remove(). + 2008-08-30 Madhusudan.C.S * procfs_dir.c: (procfs_dir_create): Assign newly created directory to diff --git a/netfs.c b/netfs.c index 7e00e4d4..4f6fd5ce 100644 --- a/netfs.c +++ b/netfs.c @@ -278,6 +278,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, return ENOTDIR; } + procfs_dir_entries_remove (dir->nn->dir); return err; } -- cgit v1.2.3 From e58f247f9c3a95ea2805fe132777d192ef51f6d1 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 12 Dec 2008 01:48:00 +0100 Subject: 2008-12-12 Samuel Thibault * procfs_nonpid_files.c (procfs_read_nonpid_meminfo): Divide by 1024 value returned by get_swap_size and get_swap_free to get kilobytes. --- ChangeLog | 6 ++++++ procfs_nonpid_files.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 1750c16d..67a106b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-12-12 Samuel Thibault + + * procfs_nonpid_files.c (procfs_read_nonpid_meminfo): Divide by + 1024 value returned by get_swap_size and get_swap_free to get + kilobytes. + 2008-09-02 Madhusudan.C.S * netfs.c: (netfs_get_dirents): Add call to diff --git a/procfs_nonpid_files.c b/procfs_nonpid_files.c index 15c09190..d8b3a7d1 100644 --- a/procfs_nonpid_files.c +++ b/procfs_nonpid_files.c @@ -417,7 +417,7 @@ error_t procfs_read_nonpid_meminfo (struct dir_entry *dir_entry, mem_size, (PAGES_TO_BYTES(vmstats.free_count)) / 1024 , 0, 0, 0, (PAGES_TO_BYTES(vmstats.active_count)) / 1024, (PAGES_TO_BYTES(vmstats.inactive_count)) / 1024, 0, 0, 0, 0, - get_swap_size (), get_swap_free ()) == -1) + get_swap_size () / 1024, get_swap_free () / 1024) == -1) return errno; memcpy (data, meminfo_data, strlen(meminfo_data)); -- cgit v1.2.3 From edb4593c38d421b5d538b221a991b50c36fdba15 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 31 May 2010 02:23:00 +0200 Subject: 2010-05-31 Samuel Thibault * procfs_nonpid_files.c (procfs_read_nonpid_meminfo): Print swap sizes using %llu. --- ChangeLog | 5 +++++ procfs_nonpid_files.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 67a106b8..47cbeaf2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-05-31 Samuel Thibault + + * procfs_nonpid_files.c (procfs_read_nonpid_meminfo): Print swap sizes + using %llu. + 2008-12-12 Samuel Thibault * procfs_nonpid_files.c (procfs_read_nonpid_meminfo): Divide by diff --git a/procfs_nonpid_files.c b/procfs_nonpid_files.c index d8b3a7d1..2c1209ee 100644 --- a/procfs_nonpid_files.c +++ b/procfs_nonpid_files.c @@ -412,8 +412,8 @@ error_t procfs_read_nonpid_meminfo (struct dir_entry *dir_entry, "HighFree:\t%lu kB\n" "LowTotal:\t%lu kB\n" "LowFree:\t%lu kB\n" - "SwapTotal:\t%lu kB\n" - "SwapFree:\t%lu kB\n", + "SwapTotal:\t%llu kB\n" + "SwapFree:\t%llu kB\n", mem_size, (PAGES_TO_BYTES(vmstats.free_count)) / 1024 , 0, 0, 0, (PAGES_TO_BYTES(vmstats.active_count)) / 1024, (PAGES_TO_BYTES(vmstats.inactive_count)) / 1024, 0, 0, 0, 0, -- cgit v1.2.3 From d76613f23eec2a66f4727c69fcec3b5e3be3da22 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sun, 1 Aug 2010 13:28:31 +0200 Subject: Switch to the new ChangeLog style. * ChangeLog: Wipe out content, and add instructions about how to get it back. --- ChangeLog | 179 ++------------------------------------------------------------ 1 file changed, 4 insertions(+), 175 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 47cbeaf2..0cd74d02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,177 +1,6 @@ -2010-05-31 Samuel Thibault +edb4593c38d421b5d538b221a991b50c36fdba15 is the last commit imported from CVS. +All commits after that one have valid author and committer information. - * procfs_nonpid_files.c (procfs_read_nonpid_meminfo): Print swap sizes - using %llu. +Use this to examine the change log for earlier changes: -2008-12-12 Samuel Thibault - - * procfs_nonpid_files.c (procfs_read_nonpid_meminfo): Divide by - 1024 value returned by get_swap_size and get_swap_free to get - kilobytes. - -2008-09-02 Madhusudan.C.S - - * netfs.c: (netfs_get_dirents): Add call to - procfs_dir_entries_remove(). - -2008-08-30 Madhusudan.C.S - - * procfs_dir.c: (procfs_dir_create): Assign newly created directory to - its pointer in netnode. - (procfs_dir_remove): Removed function. - (free_entry): New function. - (ordered_unlink): Likewise. - (delete): Likewise. - (sweep): Likewise. - (procfs_dir_entries_remove): Likewise. - (is_in_pid_list): Removed call to make_dir_invalid (). - (procfs_fill_root_dir): struct stat *stat -> struct stat stat. - Add Read and Execute permissions to all in stat.st_mode. - Set stat.st_nlink to 1. - Set stat.st_size to 0. - Add struct proc_stat *ps definition. - Set struct proc_stat data from _proc_stat_create () function and - set stat.st_uid and stat.st_gid from the data in that structure. - * procfs_pid_files.c: (update_pid_entries): Add Read permissions - to all in stat->st_mode. - -2008-08-29 Madhusudan.C.S - - * AUTHORS: File removed. - * COPYING: Likewise. - * README: Likewise. - -2008-08-29 Madhusudan.C.S - - * Makefile: (Copyright): 1997, 2000 -> 2008. - (CC): Removed. - (CFLAGS): Removed. - (INCLUDES): Removed. - (all): Removed. - ($(target)): Removed. - (%.o): Removed. - (HURDLIBS): -lnetfs -> netfs, -lfshelp -> fshelp, - -liohelp -> iohelp, -lthreads -> threads, -lports -> ports, - -lihash -> ihash, -lps -> ps, -lshouldbeinlibc -> shouldbeinlibc. - (include): Add include ../Makeconf - -2008-08-18 Madhusudan.C.S - - * procfs_nonpid_files.c: (procfs_write_nonpid_stat): Changed to - procfs_read_nonpid_stat. - (procfs_write_nonpid_meminfo): Changed to procfs_read_nonpid_meminfo. - (procfs_write_nonpid_loadavg): Changed to procfs_read_nonpid_loadavg. - (procfs_write_nonpid_uptime): Changed to procfs_read_nonpid_uptime. - (procfs_write_nonpid_version):Changed to procfs_read_nonpid_version. - * procfs_pid_files.c: (procfs_write_stat_file): Changed to - procfs_read_stat_file. - Changed the comment correspondingly from Write to Read. - (procfs_write_cmdline_file ): Changed to procfs_read_cmdline_file. - Changed the comment correspondingly from Write to Read. - (procfs_write_status_file): Changed to procfs_read_status_file. - Changed the comment correspondingly from Write to Read. - (procfs_write_statm_file): Changed to procfs_read_statm_file. - Changed the comment correspondingly from Write to Read. - (procfs_write_files_contents): Changed to procfs_read_files_contents. - Changed the comment correspondingly from Write to Read. - Changed the call to procfs_write_nonpid_stat to procfs_read_nonpid_stat. - Changed the call to procfs_write_stat_file to procfs_read_stat_file. - Changed the call to procfs_write_cmdline_file to - procfs_read_cmdline_file. - Changed the call to procfs_write_status_file to - procfs_read_status_file. - Changed the call to procfs_write_statm_file to - procfs_read_statm_file. - Changed the call to procfs_write_nonpid_meminfo to - procfs_read_nonpid_meminfo. - Changed the call to procfs_write_nonpid_loadavg to - procfs_read_nonpid_loadavg. - Changed the call to procfs_write_nonpid_uptime to - procfs_read_nonpid_uptime. - Changed the call to procfs_write_nonpid_version to - procfs_read_nonpid_version. - netfs.c: (netfs_attempt_read): Changed the call from - procfs_write_files_contents to procfs_read_files_contents. - -2008-08-18 Madhusudan.C.S - - * README: Initial Documentation. - -2008-08-18 Madhusudan.C.S - - * procfs_nonpid_files.c: (get_uptime): Changed the parameter type from - double to struct timeval. - Changed the parameter name from uptime_secs to uptime. - Removed uptime variable. - Changed timersub to use the passed pointer instead of the local - variable. - Removed the calculation of uptime_secs. - (get_total_times): Changed the parameters type from double to struct - timeval. - Changed the parameters name from total_user_time_secs to - total_user_time and total_system_time_secs to total_system_time. - New variables total_user_time_tmp, total_system_time_tmp and tmpval - of type struct timeval. - Call timerclear to clear the tmp variables. - Remove calculation of times in seconds and do the same on struct - timeval variables throughout using the timeradd macro. - Assign values of temporary local variables to the pointers passed - as parameters. - (procfs_write_nonpid_stat): Replaced variables that hold time in - seconds with struct timeval type variables and jiffy_t type variables. - Argument to get_uptime changed from uptime_secs to uptime. - Arguments to get_total_times changed from total_user_time_secs to - total_user_time and total_system_time_secs to total_system_time. - Replace arithematic time subtraction with timersub macro. - Convert all the times in struct timeval type variables to jiffy_t type. - Changed the type casting for the asprintf arguments to be compatible - with jiffy_t type. - (procfs_write_nonpid_uptime): Replaced variables that hold time in - seconds with struct timeval type variables. - Argument to get_uptime changed from uptime_secs to uptime. - Arguments to get_total_times changed from total_user_time_secs to - total_user_time and total_system_time_secs to total_system_time. - Replace arithematic time subtraction with timersub macro. - Convert all the times in struct timeval type variables to seconds. - -2008-08-18 Madhusudan.C.S - - * procfs_nonpid_files.c: (procfs_write_nonpid_version): New function. - * procfs_pid_files.c: (procfs_write_files_contents): Add a check - to find if the read is requested for the version file and - corresponding a call to it. - -2008-08-14 Madhusudan.C.S - - * procfs.h: (jiffy_t): New typedef. - * procfs_pid.h: "procfs.h" is included. - (struct procfs_pid_files): Changed all the occurrences of time_t to - jiffy_t. - * procfs_pid_files.c: Removed "procfs.h". - (adjust_jiffy_time): Changed return type from time_t to jiffy_t. - Changed the type of jiffy_time variable from time_t to jiffy_t. - (get_live_threads_time): Changed the type of utime and stime from - time_t to jiffy_t. - (get_stat_data): Changed the type of utime and stime from time_t to - jiffy_t. - -2008-08-14 Madhusudan.C.S - - * ChangeLog: New file. - * AUTHORS: New file. - * COPYING: New file. - * README: New file. - * Makefile: New file. - * bootstrap.c: New file. - * netfs.c: New file. - * node.c: New file. - * procfs.c: New file. - * procfs.h: New file. - * procfs_dir.c: New file. - * procfs_nonpid_files.c: New file. - * procfs_pid.h: New file. - * procfs_pid_files.c: New file. - -2008-05-13 Madhusudan.C.S - - * /sources/hurd/procfs: New directory added to the repository. + $ git show edb4593c38d421b5d538b221a991b50c36fdba15:ChangeLog -- cgit v1.2.3