summaryrefslogtreecommitdiff
path: root/user/madhusudancs.mdwn
blob: 903b0964b0777bbe217bfbbd784e8854e035c1c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
[[!meta copyright="Copyright © 2008 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled
[[GNU Free Documentation License|/fdl]]."]]"""]]

[[!meta title="GNU/Linux compatible procfs"]]

[[!toc]]
----

 Project Name 
----

GNU/Linux compatible procfs pseudo-filesystem

------

 Project Description
----
I wish to provide a sophisticated procfs pseudo-filesystem to “the Hurd”. An implementation of /proc pseudo-filesystem already exists in hurdextras repository. After skimming through the code it is clear that it needs a lot 
of rework and tuning. Experiences from GNU/Linux have proven procfs to be a very useful facility in implementing 
many of the process management tools. So the goal of this project is to rework on the existing procfs on “the Hurd” 
so that its not only reliable and robust but also more importantly it is fully compatible with the GNU/Linux procfs. 
The project thus aims at making the GNU/Linux process management tools  like top, sysctl, kill, 
skill, nice, snice, pgrep, free, tload, uptime, fuser, killall, pidof, pstree, etc., to run out of the box.

------

 Mentor
----

Olaf Buddenhagen

------

 Project Schedule
----

#####     1. Initial preparation and migration (Community Bonding Period: has already started – May 25th)

      This phase involves improving my translator programming skills by gaining
      hands-on experience in it and becoming well versed in it. I will also go
      through the Hurd code to understand its architecture in depth and will read
      documentations related to obtaining process related information in Hurd.
      This phase also involves the migration of existing procfs to use libnetfs.

#####     2. Analysis and Design (May 26th – June 11th )

      This phase involves the analysis of previous migration. Also involves 
      interacting with the mentor, the Hurd community and other people involved
      in development of ps. tools to draw the exact design of the proposed procfs
      including the algorithms required for coding.

#####     3.  Coding Stage I (June 12th – June 22nd )

      Finishing up the migration to libnetfs based on the finalized design and
      making necessary changes to the  existing procfs. Coding up to
      /proc/<pid>/exe in the features list.

#####&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.&nbsp;Coding Stage II (June 23rd – July 13th)

      Involves coding of the features from /proc/<pid>/environ, up to 
      /proc/<pid>/maps. These contain most of the information required for ps.
      tools and hence form the heart of the project. Will be completed by
      mid-term evaluation deadline.

#####&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5. &nbsp;Coding Stage III (July 14th – July 26th )

      Coding the rest of the features in the list including any necessary
      features that may be added in the analysis phase.

#####&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6. &nbsp;Final Testing and evaluation (July 27th – August 8th )

      Closely interacting with the community and requesting them to help me
      in overall testing and reviewing and making changes as per their 
      suggestions. Also involves testing with the ps. tools and consolidating 
      the documentation.

#####&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7. &nbsp;Packaging and Wrap-up (August 9th - August 18th )

      Final phase of testing and fixing remaining bugs. Working with the
      community to merge the project with the CVS HEAD of Hurd. Documentation
      reviews, making necessary changes as per the suggestions and wrapping 
      up the documentation.

------

 Deliverables
----

1. /proc filesystem that uses libnetfs. Using this library makes it easier for implementing a large set of functionalities and hence makes the implementation robust.
2. The core GNU/Linux compatible /proc filesystem with functionalities to support and provide information for ps. tools like procps, psmisc etc.

Non-code deliverables include an exhaustive Documentation. This documents the code of the Hurd's procfs which explains in detail the implementation of each of the functionalities of procfs implemented
during the course of this project.

------

 Code Repository
----

[http://github.com/madhusudancs/procfs/tree/master](http://github.com/madhusudancs/procfs/tree/master)

Clone URL: [git://github.com/madhusudancs/procfs.git](git://github.com/madhusudancs/procfs.git)

------

 Progress
----

1. Packages Ported: [http://www.madhusudancs.info/parted-hurdi386 parted-1.7.1]
2. Packages Porting in progress: autogen_1:5.9.4-1. Error installing texlive-bin. Error tracked to some post installation scripts of texlive-bin. Problem seems to be in fmutil. Trying to debug.
3. Have to start coding libnetfs skeleton for procfs translator.
    
**Target for next week**

      Task                                                                      To be completed by         Status Now

   1. Finish Defining the necessary netfs call  backs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25-05-2008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Completed
   2. Create Directories for each process with pid directory name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;27-05-2008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Completed
   3. Create stat file for each process within this directory and<br/> 
      put atleast 1 information into it&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                  31-05-2008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;In Progress

**Documentations Read/Reading**

1. [Hurd Hacking Guide](http://www.gnu.org/software/hurd/hacking-guide/hhg.html) (Have Concentrated mainly on Translator part)
2. [Linux Kernel Implementation of procfs](http://users.sosdg.org/~qiyong/lxr/source/Documentation/filesystems/proc.txt)

**Code Being Read**

1. libps
2. libnetfs
3. [procfs implementation in Linux kernel](http://users.sosdg.org/~qiyong/lxr/source/fs/proc/)
4. ftpfs (In Hurd main)
5. cvsfs (In Hurd extras)
6. xmlfs (In Hurd extras)
7. httpfs (In Hurd extras)
8. gopherfs (In Hurd extras)
9. libfuse (In Hurd extras)
10. procfs (libtrivfs based, In Hurd extras)

------

 Post Mid-Term Road Map
----


####Already Implemented 

#####File - /proc/&lt;PID&gt;/stat

* pid

* comm

* state

* ppid

* pgrp

* session

* tty_nr

* tpgid

* minflt
> The number of minor faults the process has made which have not required loading a memory page
> from disk.

* majflt
> The number of major faults the process has made which have required loading a memory page from
> disk.

* utime
> The number of jiffies that this process has been scheduled in user mode.

* stime
> The number of jiffies that this process has been scheduled in kernel mode.

* priority
> The standard nice value, plus fifteen. The value is never negative in the kernel.

* num_threads
> Number of threads in this process.

* starttime
> The time in jiffies the process started after system boot.

* vsize
> Virtual memory size in bytes.

* rss
> Resident Set Size: number of pages the process has in real memory, minus 3 for administrative
> purposes. This is just the pages which count towards text, data, or stack space. This does not
> include pages which have not been demand-loaded in, or which are swapped out.

* itrealvalue
> The time in jiffies before the next SIGALRM is sent to the process due to an interval timer.

* nswap
> Number of pages swapped (not maintained).

* cnswap
> Cumulative nswap for child processes (not maintained).

* flags
> PF_* fields defined in (Not Linux compatible, but nearly says the something Linux says)

* nice
> The nice value ranges from 19 to -19.

* cutime
> The number of jiffies that this process’s waited-for children have been scheduled in user
> mode.

* cstime
> The number of jiffies that this process’s waited-for children have been scheduled in kernel mode.

#####File - /proc/&lt;PID&gt;/statm

* size
> total program size

* resident
> resident set size

* lib
> library

* dt
> dirty pages

####I already know the where the information is exactly available.

#####Other Per-PID Files

#####* /proc/&lt;PID&gt;/exe

#####* /proc/&lt;PID&gt;/environ

#####Non Per-PID Files

#####* /proc/version


####I know where the information is available roughly, but need to look in detail to extract the exact information.

* cminflt
> The number of minor faults that the process’s waited-for children have made.

* cmajflt
> The number of major faults that the process’s waited-for children have made.

* signal
> The bitmap of pending signals.

* blocked
> The bitmap of blocked signals.

* sigignore
> The bitmap of ignored signals.

* sigcatch
> The bitmap of caught signals.

* policy
> Scheduling policy. 

#####File - /proc/&lt;PID&gt;/statm

* text
> text (code)

#####Other Per-PID Files

#####* /proc/&lt;PID&gt;/cwd

####The information may be available, but needs to be searched to know where it will be.

#####File - /proc/&lt;PID&gt;/stat

* rlim
> Current limit in bytes on the rss of the process (usually 4294967295 on i386).

* startcode
> The address above which program text can run.

* endcode
> The address below which program text can run.

* startstack
> The address of the start of the stack.

* kstkesp
> The current value of esp (stack pointer), as found in the kernel stack page for the process.

* kstkeip
> The current EIP (instruction pointer).

* exit_signal
> Signal to be sent to parent when we die.

#####File - /proc/&lt;PID&gt;/statm

* share
> shared pages

* data
> data/stack

#####Other Per-PID File

#####* /proc/&lt;PID&gt;/root

#####Non Per-PID Files

#####* /proc/stat

#####* /proc/meminfo

####I fear information may not be available.

#####File - /proc/&lt;PID&gt;/stat

* wchan
> This is the "channel" in which the process is waiting. It is the address of a system call, and
> can be looked up in a namelist if you need a textual name. (If you have an up-to-date
> /etc/psdatabase,

* processor
> CPU number last executed on.

* rt_priority
> Real-time scheduling priority

* delayacct_blkio_ticks
> Aggregated block I/O delays, measured in clock ticks (centiseconds).


###Newly added to Roadmap(but these were the original goals of the project)

#### procps tools need to be ported so that they run on top of the procfs

> ##### pgrep&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Done
> ##### pkill&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Done
> ##### killall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Done
> ##### pstree&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Done
> ##### top&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Mostly Done (except per-PID shared memory field, and non per-PID caches and buffers field)
> ##### free&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Mostly Done (Ditto from above)
> ##### htop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Mostly Done (Ditto again)
> ##### watch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;Done
> ##### tload&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;I think it is done. (Need someone to test it)
> ##### libgtop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;In progress
> ##### gnome-system-moitor&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;In progress



------

 Code Updates
----

1. May, 14, 2008
2. May, 18, 2008
3. May, 28, 2008
4. June, 1, 2008
5. June, 2, 2008
6. June, 4, 2008
7. June, 5, 2008 (3 commits, 00:30 HRS, 02:30 HRS, 11:15HRS, all in IST)
8. June, 9, 2008
9. June, 19, 2008 (Targets 1 and 2 successfully accomplished. Duration between the commits became inevitably longer because of the large amount of time spent on debugging the code.)

------

 Contact Details
----

Name : Madhusudan.C.S

Email  : [madhusudancs@gmail.com](mailto:madhusudancs@gmail.com)

Blog   : [http://www.madhusudancs.info](http://www.madhusudancs.info/)

Detailed proposal: [http://www.madhusudancs.info/gnu-hurd-procfs-proposal](http://www.madhusudancs.info/gnu-hurd-procfs-proposal)

Google Summer of Code Site Link: [Abstract](http://code.google.com/soc/2008/hurd/appinfo.html?csaid=D2E9266819D2EEF9)