dc59e4dc0cf8c8de1e1165ef9d1b15a1501bc51e
[monky] / src / proc.c
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
2  * vim: ts=4 sw=4 noet ai cindent syntax=c
3  *
4  * Conky, a system monitor, based on torsmo
5  *
6  * Any original torsmo code is licensed under the BSD license
7  *
8  * All code written since the fork of torsmo is licensed under the GPL
9  *
10  * Please see COPYING for details
11  *
12  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
13  * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
14  *   (see AUTHORS)
15  * All rights reserved.
16  *
17  * This program is free software: you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation, either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  * You should have received a copy of the GNU General Public License
27  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
28  *
29  */
30
31 #include <logging.h>
32 #include "conky.h"
33 #include "proc.h"
34 #include <unistd.h>
35 #include <ctype.h>
36 #include <dirent.h>
37
38 char* readfile(char* filename, int* total_read, char showerror) {
39         FILE* file;
40         char* buf = NULL;
41         int bytes_read;
42
43         *total_read = 0;
44         file = fopen(filename, "r");
45         if(file) {
46                 do {
47                         buf = realloc(buf, *total_read + READSIZE + 1);
48                         bytes_read = fread(buf + *total_read, 1, READSIZE, file);
49                         *total_read += bytes_read;
50                         buf[*total_read] = 0;
51                 }while(bytes_read != 0);
52                 fclose(file);
53         } else if(showerror != 0) {
54                 NORM_ERR(READERR, filename);
55         }
56         return buf;
57 }
58
59 void pid_readlink(char *file, char *p, int p_max_size)
60 {
61         char buf[p_max_size];
62
63         memset(buf, 0, p_max_size);
64         if(readlink(file, buf, p_max_size) >= 0) {
65                 snprintf(p, p_max_size, "%s", buf);
66         } else {
67                 NORM_ERR(READERR, file);
68         }
69 }
70
71 struct ll_string {
72         char *string;
73         struct ll_string* next;
74 };
75
76 struct ll_string* addnode(struct ll_string* end, char* string) {
77         struct ll_string* current = malloc(sizeof(struct ll_string));
78         current->string = strdup(string);
79         current->next = NULL;
80         if(end != NULL) end->next = current;
81         return current;
82 }
83
84 void freelist(struct ll_string* front) {
85         if(front != NULL) {
86                 free(front->string);
87                 if(front->next != NULL) {
88                         freelist(front->next);
89                 }
90                 free(front);
91         }
92 }
93
94 int inlist(struct ll_string* front, char* string) {
95         struct ll_string* current;
96
97         for(current = front; current != NULL; current = current->next) {
98                 if(strcmp(current->string, string) == 0) {
99                         return 1;
100                 }
101         }
102         return 0;
103 }
104
105 void print_pid_chroot(struct text_object *obj, char *p, int p_max_size) {
106         char *buffer;
107
108         asprintf(&buffer, PROCDIR "/%s/root", obj->data.s);
109         pid_readlink(buffer, p, p_max_size);
110         free(buffer);
111 }
112
113 void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size)
114 {
115         char* buf;
116         int i, bytes_read;
117
118         asprintf(&buf, PROCDIR "/%s/cmdline", obj->data.s);
119         strcpy(obj->data.s, buf);
120         free(buf);
121         buf = readfile(obj->data.s, &bytes_read, 1);
122         if(buf != NULL) {
123                 for(i = 0; i < bytes_read-1; i++) {
124                         if(buf[i] == 0) {
125                                 buf[i] = ' ';
126                         }
127                 }
128                 snprintf(p, p_max_size, "%s", buf);
129                 free(buf);
130         }
131 }
132
133 void print_pid_cwd(struct text_object *obj, char *p, int p_max_size)
134 {
135         char buf[p_max_size];
136         int bytes_read;
137
138         sprintf(buf, PROCDIR "/%s/cwd", obj->data.s);
139         strcpy(obj->data.s, buf);
140         bytes_read = readlink(obj->data.s, buf, p_max_size);
141         if(bytes_read != -1) {
142                 buf[bytes_read] = 0;
143                 snprintf(p, p_max_size, "%s", buf);
144         } else {
145                 NORM_ERR(READERR, obj->data.s);
146         }
147 }
148
149 void print_pid_environ(struct text_object *obj, char *p, int p_max_size)
150 {
151         int i, total_read;
152         pid_t pid;
153         char *buf, *file, *var=strdup(obj->data.s);;
154
155         if(sscanf(obj->data.s, "%d %s", &pid, var) == 2) {
156                 for(i = 0; var[i] != 0; i++) {
157                         var[i] = toupper(var[i]);
158                 }
159                 asprintf(&file, PROCDIR "/%d/environ", pid);
160                 buf = readfile(file, &total_read, 1);
161                 free(file);
162                 if(buf != NULL) {
163                         for(i = 0; i < total_read; i += strlen(buf + i) + 1) {
164                                 if(strncmp(buf + i, var, strlen(var)) == 0 && *(buf + i + strlen(var)) == '=') {
165                                         snprintf(p, p_max_size, "%s", buf + i + strlen(var) + 1);
166                                         free(buf);
167                                         free(var);
168                                         return;
169                                 }
170                         }
171                         free(buf);
172                 }
173                 free(var);
174                 *p = 0;
175         }
176 }
177
178 void print_pid_environ_list(struct text_object *obj, char *p, int p_max_size)
179 {
180         char *buf = NULL;
181         char *buf2;
182         int bytes_read, total_read;
183         int i = 0;
184
185         asprintf(&buf, PROCDIR "/%s/environ", obj->data.s);
186         strcpy(obj->data.s, buf);
187         free(buf);
188         buf = readfile(obj->data.s, &total_read, 1);
189         if(buf != NULL) {
190                 for(bytes_read = 0; bytes_read < total_read; buf[i-1] = ';') {
191                         buf2 = strdup(buf+bytes_read);
192                         bytes_read += strlen(buf2)+1;
193                         sscanf(buf2, "%[^=]", buf+i);
194                         free(buf2);
195                         i = strlen(buf) + 1;
196                 }
197                 buf[i-1] = 0;
198                 snprintf(p, p_max_size, "%s", buf);
199                 free(buf);
200         }
201 }
202
203 void print_pid_exe(struct text_object *obj, char *p, int p_max_size) {
204         char *buffer;
205
206         asprintf(&buffer, PROCDIR "/%s/exe", obj->data.s);
207         pid_readlink(buffer, p, p_max_size);
208         free(buffer);
209 }
210
211 void print_pid_openfiles(struct text_object *obj, char *p, int p_max_size) {
212         DIR* dir;
213         struct dirent *entry;
214         char buf[p_max_size];
215         int length, totallength = 0;
216         struct ll_string* files_front = NULL;
217         struct ll_string* files_back = NULL;
218
219         dir = opendir(obj->data.s);
220         if(dir != NULL) {
221                 while ((entry = readdir(dir))) {
222                         if(entry->d_name[0] != '.') {
223                                 snprintf(buf, p_max_size, "%s/%s", obj->data.s, entry->d_name);
224                                 length = readlink(buf, buf, p_max_size);
225                                 buf[length] = 0;
226                                 if(inlist(files_front, buf) == 0) {
227                                         files_back = addnode(files_back, buf);
228                                         snprintf(p + totallength, p_max_size - totallength, "%s; " , buf);
229                                         totallength += length + strlen("; ");
230                                 }
231                                 if(files_front == NULL) {
232                                         files_front = files_back;
233                                 }
234                         }
235                 }
236                 closedir(dir);
237                 freelist(files_front);
238                 p[totallength - strlen("; ")] = 0;
239         } else {
240                 p[0] = 0;
241         }
242 }
243
244 void print_pid_parent(struct text_object *obj, char *p, int p_max_size) {
245 #define PARENT_ENTRY "PPid:\t"
246 #define PARENTNOTFOUND  "Can't find the process parent in '%s'"
247         char *begin, *end, *buf = NULL;
248         int bytes_read;
249
250         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
251         strcpy(obj->data.s, buf);
252         free(buf);
253         buf = readfile(obj->data.s, &bytes_read, 1);
254         if(buf != NULL) {
255                 begin = strstr(buf, PARENT_ENTRY);
256                 if(begin != NULL) {
257                         begin += strlen(PARENT_ENTRY);
258                         end = strchr(begin, '\n');
259                         if(end != NULL) {
260                                 *(end) = 0;
261                         }
262                         snprintf(p, p_max_size, "%s", begin);
263                 } else {
264                         NORM_ERR(PARENTNOTFOUND, obj->data.s);
265                 }
266                 free(buf);
267         }
268 }
269
270 void print_pid_state(struct text_object *obj, char *p, int p_max_size) {
271 #define STATE_ENTRY "State:\t"
272 #define STATENOTFOUND   "Can't find the process state in '%s'"
273         char *begin, *end, *buf = NULL;
274         int bytes_read;
275
276         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
277         strcpy(obj->data.s, buf);
278         free(buf);
279         buf = readfile(obj->data.s, &bytes_read, 1);
280         if(buf != NULL) {
281                 begin = strstr(buf, STATE_ENTRY);
282                 if(begin != NULL) {
283                         begin += strlen(STATE_ENTRY) + 3;       // +3 will strip the char representing the short state and the space and '(' that follow
284                         end = strchr(begin, '\n');
285                         if(end != NULL) {
286                                 *(end-1) = 0;   // -1 strips the ')'
287                         }
288                         snprintf(p, p_max_size, "%s", begin);
289                 } else {
290                         NORM_ERR(STATENOTFOUND, obj->data.s);
291                 }
292                 free(buf);
293         }
294 }
295
296 void print_pid_state_short(struct text_object *obj, char *p, int p_max_size) {
297         char *begin, *buf = NULL;
298         int bytes_read;
299
300         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
301         strcpy(obj->data.s, buf);
302         free(buf);
303         buf = readfile(obj->data.s, &bytes_read, 1);
304         if(buf != NULL) {
305                 begin = strstr(buf, STATE_ENTRY);
306                 if(begin != NULL) {
307                         snprintf(p, p_max_size, "%c", *begin);
308                 } else {
309                         NORM_ERR(STATENOTFOUND, obj->data.s);
310                 }
311                 free(buf);
312         }
313 }
314
315 void print_pid_stderr(struct text_object *obj, char *p, int p_max_size) {
316         char *buffer;
317
318         asprintf(&buffer, PROCDIR "/%s/fd/2", obj->data.s);
319         pid_readlink(buffer, p, p_max_size);
320         free(buffer);
321 }
322
323 void print_pid_stdin(struct text_object *obj, char *p, int p_max_size) {
324         char *buffer;
325
326         asprintf(&buffer, PROCDIR "/%s/fd/0", obj->data.s);
327         pid_readlink(buffer, p, p_max_size);
328         free(buffer);
329 }
330
331 void print_pid_stdout(struct text_object *obj, char *p, int p_max_size) {
332         char *buffer;
333
334         asprintf(&buffer, PROCDIR "/%s/fd/1", obj->data.s);
335         pid_readlink(buffer, p, p_max_size);
336         free(buffer);
337 }
338
339 void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* free_at_crash) {
340         unsigned int i;
341
342         if(strlen(arg) > 0) {
343                 obj->data.s = strdup(arg);
344                 for(i = 0; obj->data.s[i] != 0; i++) {
345                         while(obj->data.s[i] == ' ' && obj->data.s[i + 1] == ' ') {
346                                 memmove(obj->data.s + i, obj->data.s + i + 1, strlen(obj->data.s + i + 1) + 1);
347                         }
348                 }
349                 if(obj->data.s[i - 1] == ' ') {
350                         obj->data.s[i - 1] = 0;
351                 }
352         } else {
353                 CRIT_ERR(obj, free_at_crash, "${cmdline_to_pid commandline}");
354         }
355 }
356
357 void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size) {
358         DIR* dir;
359         struct dirent *entry;
360         char *filename, *buf;
361         int bytes_read, i;
362
363         dir = opendir(PROCDIR);
364         if(dir != NULL) {
365                 while ((entry = readdir(dir))) {
366                         asprintf(&filename, PROCDIR "/%s/cmdline", entry->d_name);
367                         buf = readfile(filename, &bytes_read, 0);
368                         free(filename);
369                         if(buf != NULL) {
370                                 for(i = 0; i < bytes_read - 1; i++) {
371                                         if(buf[i] == 0) buf[i] = ' ';
372                                 }
373                                 if(strstr(buf, obj->data.s) != NULL) {
374                                         snprintf(p, p_max_size, "%s", entry->d_name);
375                                         free(buf);
376                                         closedir(dir);
377                                         return;
378                                 }
379                                 free(buf);
380                         }
381                 }
382                 closedir(dir);
383         } else {
384                 NORM_ERR(READERR, PROCDIR);
385         }
386 }
387
388 #define UID_ENTRY "Uid:\t"
389 void print_pid_uid(struct text_object *obj, char *p, int p_max_size) {
390 #define UIDNOTFOUND     "Can't find the process real uid in '%s'"
391         char *begin, *end, *buf = NULL;
392         int bytes_read;
393
394         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
395         strcpy(obj->data.s, buf);
396         free(buf);
397         buf = readfile(obj->data.s, &bytes_read, 1);
398         if(buf != NULL) {
399                 begin = strstr(buf, UID_ENTRY);
400                 if(begin != NULL) {
401                         begin += strlen(UID_ENTRY);
402                         end = strchr(begin, '\t');
403                         if(end != NULL) {
404                                 *(end) = 0;
405                         }
406                         snprintf(p, p_max_size, "%s", begin);
407                 } else {
408                         NORM_ERR(UIDNOTFOUND, obj->data.s);
409                 }
410                 free(buf);
411         }
412 }
413
414 void print_pid_euid(struct text_object *obj, char *p, int p_max_size) {
415 #define EUIDNOTFOUND    "Can't find the process effective uid in '%s'"
416         char *begin, *end, *buf = NULL;
417         int bytes_read;
418
419         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
420         strcpy(obj->data.s, buf);
421         free(buf);
422         buf = readfile(obj->data.s, &bytes_read, 1);
423         if(buf != NULL) {
424                 begin = strstr(buf, UID_ENTRY);
425                 if(begin != NULL) {
426                         begin = strchr(begin, '\t'); begin++;
427                         begin = strchr(begin, '\t'); begin++;
428                         end = strchr(begin, '\t');
429                         if(end != NULL) {
430                                 *(end) = 0;
431                         }
432                         snprintf(p, p_max_size, "%s", begin);
433                 } else {
434                         NORM_ERR(EUIDNOTFOUND, obj->data.s);
435                 }
436                 free(buf);
437         }
438 }
439
440 void print_pid_suid(struct text_object *obj, char *p, int p_max_size) {
441 #define SUIDNOTFOUND    "Can't find the process saved set uid in '%s'"
442         char *begin, *end, *buf = NULL;
443         int bytes_read;
444
445         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
446         strcpy(obj->data.s, buf);
447         free(buf);
448         buf = readfile(obj->data.s, &bytes_read, 1);
449         if(buf != NULL) {
450                 begin = strstr(buf, UID_ENTRY);
451                 if(begin != NULL) {
452                         begin = strchr(begin, '\t'); begin++;
453                         begin = strchr(begin, '\t'); begin++;
454                         begin = strchr(begin, '\t'); begin++;
455                         end = strchr(begin, '\t');
456                         if(end != NULL) {
457                                 *(end) = 0;
458                         }
459                         snprintf(p, p_max_size, "%s", begin);
460                 } else {
461                         NORM_ERR(SUIDNOTFOUND, obj->data.s);
462                 }
463                 free(buf);
464         }
465 }
466
467 void print_pid_fsuid(struct text_object *obj, char *p, int p_max_size) {
468 #define FSUIDNOTFOUND   "Can't find the process file system uid in '%s'"
469         char *begin, *end, *buf = NULL;
470         int bytes_read;
471
472         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
473         strcpy(obj->data.s, buf);
474         free(buf);
475         buf = readfile(obj->data.s, &bytes_read, 1);
476         if(buf != NULL) {
477                 begin = strstr(buf, UID_ENTRY);
478                 if(begin != NULL) {
479                         begin = strchr(begin, '\t'); begin++;
480                         begin = strchr(begin, '\t'); begin++;
481                         begin = strchr(begin, '\t'); begin++;
482                         begin = strchr(begin, '\t'); begin++;
483                         end = strchr(begin, '\n');
484                         if(end != NULL) {
485                                 *(end) = 0;
486                         }
487                         snprintf(p, p_max_size, "%s", begin);
488                 } else {
489                         NORM_ERR(FSUIDNOTFOUND, obj->data.s);
490                 }
491                 free(buf);
492         }
493 }
494
495 #define GID_ENTRY "Gid:\t"
496 void print_pid_gid(struct text_object *obj, char *p, int p_max_size) {
497 #define GIDNOTFOUND     "Can't find the process real gid in '%s'"
498         char *begin, *end, *buf = NULL;
499         int bytes_read;
500
501         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
502         strcpy(obj->data.s, buf);
503         free(buf);
504         buf = readfile(obj->data.s, &bytes_read, 1);
505         if(buf != NULL) {
506                 begin = strstr(buf, GID_ENTRY);
507                 if(begin != NULL) {
508                         begin += strlen(GID_ENTRY);
509                         end = strchr(begin, '\t');
510                         if(end != NULL) {
511                                 *(end) = 0;
512                         }
513                         snprintf(p, p_max_size, "%s", begin);
514                 } else {
515                         NORM_ERR(GIDNOTFOUND, obj->data.s);
516                 }
517                 free(buf);
518         }
519 }
520
521 void print_pid_egid(struct text_object *obj, char *p, int p_max_size) {
522 #define EGIDNOTFOUND    "Can't find the process effective gid in '%s'"
523         char *begin, *end, *buf = NULL;
524         int bytes_read;
525
526         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
527         strcpy(obj->data.s, buf);
528         free(buf);
529         buf = readfile(obj->data.s, &bytes_read, 1);
530         if(buf != NULL) {
531                 begin = strstr(buf, GID_ENTRY);
532                 if(begin != NULL) {
533                         begin = strchr(begin, '\t'); begin++;
534                         begin = strchr(begin, '\t'); begin++;
535                         end = strchr(begin, '\t');
536                         if(end != NULL) {
537                                 *(end) = 0;
538                         }
539                         snprintf(p, p_max_size, "%s", begin);
540                 } else {
541                         NORM_ERR(EGIDNOTFOUND, obj->data.s);
542                 }
543                 free(buf);
544         }
545 }
546
547 void print_pid_sgid(struct text_object *obj, char *p, int p_max_size) {
548 #define SGIDNOTFOUND    "Can't find the process saved set gid in '%s'"
549         char *begin, *end, *buf = NULL;
550         int bytes_read;
551
552         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
553         strcpy(obj->data.s, buf);
554         free(buf);
555         buf = readfile(obj->data.s, &bytes_read, 1);
556         if(buf != NULL) {
557                 begin = strstr(buf, GID_ENTRY);
558                 if(begin != NULL) {
559                         begin = strchr(begin, '\t'); begin++;
560                         begin = strchr(begin, '\t'); begin++;
561                         begin = strchr(begin, '\t'); begin++;
562                         end = strchr(begin, '\t');
563                         if(end != NULL) {
564                                 *(end) = 0;
565                         }
566                         snprintf(p, p_max_size, "%s", begin);
567                 } else {
568                         NORM_ERR(SGIDNOTFOUND, obj->data.s);
569                 }
570                 free(buf);
571         }
572 }
573
574 void print_pid_fsgid(struct text_object *obj, char *p, int p_max_size) {
575 #define FSGIDNOTFOUND   "Can't find the process file system gid in '%s'"
576         char *begin, *end, *buf = NULL;
577         int bytes_read;
578
579         asprintf(&buf, PROCDIR "/%s/status", obj->data.s);
580         strcpy(obj->data.s, buf);
581         free(buf);
582         buf = readfile(obj->data.s, &bytes_read, 1);
583         if(buf != NULL) {
584                 begin = strstr(buf, GID_ENTRY);
585                 if(begin != NULL) {
586                         begin = strchr(begin, '\t'); begin++;
587                         begin = strchr(begin, '\t'); begin++;
588                         begin = strchr(begin, '\t'); begin++;
589                         begin = strchr(begin, '\t'); begin++;
590                         end = strchr(begin, '\n');
591                         if(end != NULL) {
592                                 *(end) = 0;
593                         }
594                         snprintf(p, p_max_size, "%s", begin);
595                 } else {
596                         NORM_ERR(FSGIDNOTFOUND, obj->data.s);
597                 }
598                 free(buf);
599         }
600 }
601
602 void internal_print_pid_vm(char* pid, char *p, int p_max_size, const char* entry, const char* errorstring) {
603         char *begin, *end, *buf = NULL;
604         int bytes_read;
605
606         asprintf(&buf, PROCDIR "/%s/status", pid);
607         strcpy(pid, buf);
608         free(buf);
609         buf = readfile(pid, &bytes_read, 1);
610         if(buf != NULL) {
611                 begin = strstr(buf, entry);
612                 if(begin != NULL) {
613                         begin += strlen(entry);
614                         while(*begin == '\t' || *begin == ' ') {
615                                 begin++;
616                         }
617                         end = strchr(begin, '\n');
618                         if(end != NULL) {
619                                 *(end) = 0;
620                         }
621                         snprintf(p, p_max_size, "%s", begin);
622                 } else {
623                         NORM_ERR(errorstring, pid);
624                 }
625                 free(buf);
626         }
627 }
628
629 void print_pid_vmpeak(struct text_object *obj, char *p, int p_max_size) {
630         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmPeak:\t", "Can't find the process peak virtual memory size in '%s'");
631 }
632
633 void print_pid_vmsize(struct text_object *obj, char *p, int p_max_size) {
634         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmSize:\t", "Can't find the process virtual memory size in '%s'");
635 }
636
637 void print_pid_vmlck(struct text_object *obj, char *p, int p_max_size) {
638         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmLck:\t", "Can't find the process locked memory size in '%s'");
639 }
640
641 void print_pid_vmhwm(struct text_object *obj, char *p, int p_max_size) {
642         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmHWM:\t", "Can't find the process peak resident set size in '%s'");
643 }
644
645 void print_pid_vmrss(struct text_object *obj, char *p, int p_max_size) {
646         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmHWM:\t", "Can't find the process resident set size in '%s'");
647 }
648
649 void print_pid_vmdata(struct text_object *obj, char *p, int p_max_size) {
650         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmData:\t", "Can't find the process data segment size in '%s'");
651 }
652
653 void print_pid_vmstk(struct text_object *obj, char *p, int p_max_size) {
654         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmData:\t", "Can't find the process stack segment size in '%s'");
655 }
656
657 void print_pid_vmexe(struct text_object *obj, char *p, int p_max_size) {
658         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmData:\t", "Can't find the process text segment size in '%s'");
659 }
660
661 void print_pid_vmlib(struct text_object *obj, char *p, int p_max_size) {
662         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmLib:\t", "Can't find the process shared library code size in '%s'");
663 }
664
665 void print_pid_vmpte(struct text_object *obj, char *p, int p_max_size) {
666         internal_print_pid_vm(obj->data.s, p, p_max_size, "VmPTE:\t", "Can't find the process page table entries size in '%s'");
667 }