This source file includes following definitions.
- read_core
- read_profile
- write_profile
- get_loadavg
- get_kstat
- get_uptime
- get_meminfo
- get_version
- get_task
- get_phys_addr
- get_array
- get_env
- get_arg
- get_wchan
- get_stat
- statm_pte_range
- statm_pmd_range
- statm_pgd_range
- get_statm
- read_maps
- get_root_array
- get_process_array
- fill_array
- array_read
- arraylong_read
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 #include <linux/types.h>
31 #include <linux/errno.h>
32 #include <linux/sched.h>
33 #include <linux/kernel.h>
34 #include <linux/kernel_stat.h>
35 #include <linux/tty.h>
36 #include <linux/user.h>
37 #include <linux/a.out.h>
38 #include <linux/string.h>
39 #include <linux/mman.h>
40 #include <linux/proc_fs.h>
41 #include <linux/ioport.h>
42 #include <linux/config.h>
43 #include <linux/mm.h>
44
45 #include <asm/segment.h>
46 #include <asm/pgtable.h>
47 #include <asm/io.h>
48
49 #define LOAD_INT(x) ((x) >> FSHIFT)
50 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
51
52 #ifdef CONFIG_DEBUG_MALLOC
53 int get_malloc(char * buffer);
54 #endif
55
56
57 static int read_core(struct inode * inode, struct file * file,char * buf, int count)
58 {
59 unsigned long p = file->f_pos;
60 int read;
61 int count1;
62 char * pnt;
63 struct user dump;
64
65 memset(&dump, 0, sizeof(struct user));
66 dump.magic = CMAGIC;
67 dump.u_dsize = high_memory >> 12;
68
69 if (count < 0)
70 return -EINVAL;
71 if (p >= high_memory + PAGE_SIZE)
72 return 0;
73 if (count > high_memory + PAGE_SIZE - p)
74 count = high_memory + PAGE_SIZE - p;
75 read = 0;
76
77 if (p < sizeof(struct user) && count > 0) {
78 count1 = count;
79 if (p + count1 > sizeof(struct user))
80 count1 = sizeof(struct user)-p;
81 pnt = (char *) &dump + p;
82 memcpy_tofs(buf,(void *) pnt, count1);
83 buf += count1;
84 p += count1;
85 count -= count1;
86 read += count1;
87 }
88
89 while (p < 2*PAGE_SIZE && count > 0) {
90 put_user(0,buf);
91 buf++;
92 p++;
93 count--;
94 read++;
95 }
96 memcpy_tofs(buf,(void *) (p - PAGE_SIZE),count);
97 read += count;
98 file->f_pos += read;
99 return read;
100 }
101
102 static struct file_operations proc_kcore_operations = {
103 NULL,
104 read_core,
105 };
106
107 struct inode_operations proc_kcore_inode_operations = {
108 &proc_kcore_operations,
109 };
110
111
112 #ifdef CONFIG_PROFILE
113
114 extern unsigned long prof_len;
115 extern unsigned long * prof_buffer;
116
117
118
119
120
121
122 static int read_profile(struct inode *inode, struct file *file, char *buf, int count)
123 {
124 unsigned long p = file->f_pos;
125 int read;
126 char * pnt;
127 unsigned long sample_step = 1 << CONFIG_PROFILE_SHIFT;
128
129 if (count < 0)
130 return -EINVAL;
131 if (p >= (prof_len+1)*sizeof(unsigned long))
132 return 0;
133 if (count > (prof_len+1)*sizeof(unsigned long) - p)
134 count = (prof_len+1)*sizeof(unsigned long) - p;
135 read = 0;
136
137 while (p < sizeof(unsigned long) && count > 0) {
138 put_user(*((char *)(&sample_step)+p),buf);
139 buf++; p++; count--; read++;
140 }
141 pnt = (char *)prof_buffer + p - sizeof(unsigned long);
142 memcpy_tofs(buf,(void *)pnt,count);
143 read += count;
144 file->f_pos += read;
145 return read;
146 }
147
148
149 static int write_profile(struct inode * inode, struct file * file, const char * buf, int count)
150 {
151 int i=prof_len;
152
153 while (i--)
154 prof_buffer[i]=0UL;
155 return count;
156 }
157
158 static struct file_operations proc_profile_operations = {
159 NULL,
160 read_profile,
161 write_profile,
162 };
163
164 struct inode_operations proc_profile_inode_operations = {
165 &proc_profile_operations,
166 };
167
168 #endif
169
170
171 static int get_loadavg(char * buffer)
172 {
173 int a, b, c;
174
175 a = avenrun[0] + (FIXED_1/200);
176 b = avenrun[1] + (FIXED_1/200);
177 c = avenrun[2] + (FIXED_1/200);
178 return sprintf(buffer,"%d.%02d %d.%02d %d.%02d %d/%d\n",
179 LOAD_INT(a), LOAD_FRAC(a),
180 LOAD_INT(b), LOAD_FRAC(b),
181 LOAD_INT(c), LOAD_FRAC(c),
182 nr_running, nr_tasks);
183 }
184
185 static int get_kstat(char * buffer)
186 {
187 int i, len;
188 unsigned sum = 0;
189
190 for (i = 0 ; i < 16 ; i++)
191 sum += kstat.interrupts[i];
192 len = sprintf(buffer,
193 "cpu %u %u %u %lu\n"
194 "disk %u %u %u %u\n"
195 "page %u %u\n"
196 "swap %u %u\n"
197 "intr %u",
198 kstat.cpu_user,
199 kstat.cpu_nice,
200 kstat.cpu_system,
201 jiffies - (kstat.cpu_user + kstat.cpu_nice + kstat.cpu_system),
202 kstat.dk_drive[0],
203 kstat.dk_drive[1],
204 kstat.dk_drive[2],
205 kstat.dk_drive[3],
206 kstat.pgpgin,
207 kstat.pgpgout,
208 kstat.pswpin,
209 kstat.pswpout,
210 sum);
211 for (i = 0 ; i < 16 ; i++)
212 len += sprintf(buffer + len, " %u", kstat.interrupts[i]);
213 len += sprintf(buffer + len,
214 "\nctxt %u\n"
215 "btime %lu\n",
216 kstat.context_swtch,
217 xtime.tv_sec - jiffies / HZ);
218 return len;
219 }
220
221
222 static int get_uptime(char * buffer)
223 {
224 unsigned long uptime;
225 unsigned long idle;
226
227 uptime = jiffies;
228 idle = task[0]->utime + task[0]->stime;
229
230
231
232
233
234
235
236
237
238
239 #if HZ!=100
240 return sprintf(buffer,"%lu.%02lu %lu.%02lu\n",
241 uptime / HZ,
242 (((uptime % HZ) * 100) / HZ) % 100,
243 idle / HZ,
244 (((idle % HZ) * 100) / HZ) % 100);
245 #else
246 return sprintf(buffer,"%lu.%02lu %lu.%02lu\n",
247 uptime / HZ,
248 uptime % HZ,
249 idle / HZ,
250 idle % HZ);
251 #endif
252 }
253
254 static int get_meminfo(char * buffer)
255 {
256 struct sysinfo i;
257
258 si_meminfo(&i);
259 si_swapinfo(&i);
260 return sprintf(buffer, " total: used: free: shared: buffers:\n"
261 "Mem: %8lu %8lu %8lu %8lu %8lu\n"
262 "Swap: %8lu %8lu %8lu\n",
263 i.totalram, i.totalram-i.freeram, i.freeram, i.sharedram, i.bufferram,
264 i.totalswap, i.totalswap-i.freeswap, i.freeswap);
265 }
266
267 static int get_version(char * buffer)
268 {
269 extern char *linux_banner;
270
271 strcpy(buffer, linux_banner);
272 return strlen(buffer);
273 }
274
275 static struct task_struct ** get_task(pid_t pid)
276 {
277 struct task_struct ** p;
278
279 p = task;
280 while (++p < task+NR_TASKS) {
281 if (*p && (*p)->pid == pid)
282 return p;
283 }
284 return NULL;
285 }
286
287 static unsigned long get_phys_addr(struct task_struct * p, unsigned long ptr)
288 {
289 pgd_t *page_dir;
290 pmd_t *page_middle;
291 pte_t pte;
292
293 if (!p || ptr >= TASK_SIZE)
294 return 0;
295 page_dir = pgd_offset(p,ptr);
296 if (pgd_none(*page_dir))
297 return 0;
298 if (pgd_bad(*page_dir)) {
299 printk("bad page directory entry %08lx\n", pgd_val(*page_dir));
300 pgd_clear(page_dir);
301 return 0;
302 }
303 page_middle = pmd_offset(page_dir,ptr);
304 if (pmd_none(*page_middle))
305 return 0;
306 if (pmd_bad(*page_middle)) {
307 printk("bad page middle entry %08lx\n", pmd_val(*page_middle));
308 pmd_clear(page_middle);
309 return 0;
310 }
311 pte = *pte_offset(page_middle,ptr);
312 if (!pte_present(pte))
313 return 0;
314 return pte_page(pte) + (ptr & ~PAGE_MASK);
315 }
316
317 static int get_array(struct task_struct ** p, unsigned long start, unsigned long end, char * buffer)
318 {
319 unsigned long addr;
320 int size = 0, result = 0;
321 char c;
322
323 if (start >= end)
324 return result;
325 for (;;) {
326 addr = get_phys_addr(*p, start);
327 if (!addr)
328 goto ready;
329 do {
330 c = *(char *) addr;
331 if (!c)
332 result = size;
333 if (size < PAGE_SIZE)
334 buffer[size++] = c;
335 else
336 goto ready;
337 addr++;
338 start++;
339 if (!c && start >= end)
340 goto ready;
341 } while (addr & ~PAGE_MASK);
342 }
343 ready:
344
345 while (result>0 && buffer[result-1]==' ')
346 result--;
347 return result;
348 }
349
350 static int get_env(int pid, char * buffer)
351 {
352 struct task_struct ** p = get_task(pid);
353
354 if (!p || !*p)
355 return 0;
356 return get_array(p, (*p)->mm->env_start, (*p)->mm->env_end, buffer);
357 }
358
359 static int get_arg(int pid, char * buffer)
360 {
361 struct task_struct ** p = get_task(pid);
362
363 if (!p || !*p)
364 return 0;
365 return get_array(p, (*p)->mm->arg_start, (*p)->mm->arg_end, buffer);
366 }
367
368 static unsigned long get_wchan(struct task_struct *p)
369 {
370 #ifdef __i386__
371 unsigned long ebp, eip;
372 unsigned long stack_page;
373 int count = 0;
374
375 if (!p || p == current || p->state == TASK_RUNNING)
376 return 0;
377 stack_page = p->kernel_stack_page;
378 if (!stack_page)
379 return 0;
380 ebp = p->tss.ebp;
381 do {
382 if (ebp < stack_page || ebp >= 4092+stack_page)
383 return 0;
384 eip = *(unsigned long *) (ebp+4);
385 if ((void *)eip != sleep_on &&
386 (void *)eip != interruptible_sleep_on)
387 return eip;
388 ebp = *(unsigned long *) ebp;
389 } while (count++ < 16);
390 #endif
391 return 0;
392 }
393
394 #define KSTK_EIP(stack) (((unsigned long *)stack)[1019])
395 #define KSTK_ESP(stack) (((unsigned long *)stack)[1022])
396
397 static int get_stat(int pid, char * buffer)
398 {
399 struct task_struct ** p = get_task(pid);
400 unsigned long sigignore=0, sigcatch=0, bit=1, wchan;
401 unsigned long vsize, eip, esp;
402 int i,tty_pgrp;
403 char state;
404
405 if (!p || !*p)
406 return 0;
407 if ((*p)->state < 0 || (*p)->state > 5)
408 state = '.';
409 else
410 state = "RSDZTD"[(*p)->state];
411 eip = esp = 0;
412 vsize = (*p)->kernel_stack_page;
413 if (vsize) {
414 eip = KSTK_EIP(vsize);
415 esp = KSTK_ESP(vsize);
416 vsize = (*p)->mm->brk - (*p)->mm->start_code + PAGE_SIZE-1;
417 if (esp)
418 vsize += TASK_SIZE - esp;
419 }
420 wchan = get_wchan(*p);
421 for(i=0; i<32; ++i) {
422 switch((unsigned long) (*p)->sigaction[i].sa_handler) {
423 case 1: sigignore |= bit; break;
424 case 0: break;
425 default: sigcatch |= bit;
426 } bit <<= 1;
427 }
428 if ((*p)->tty)
429 tty_pgrp = (*p)->tty->pgrp;
430 else
431 tty_pgrp = -1;
432 return sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
433 %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu \
434 %lu %lu %lu %lu\n",
435 pid,
436 (*p)->comm,
437 state,
438 (*p)->p_pptr->pid,
439 (*p)->pgrp,
440 (*p)->session,
441 (*p)->tty ? (*p)->tty->device : 0,
442 tty_pgrp,
443 (*p)->flags,
444 (*p)->mm->min_flt,
445 (*p)->mm->cmin_flt,
446 (*p)->mm->maj_flt,
447 (*p)->mm->cmaj_flt,
448 (*p)->utime,
449 (*p)->stime,
450 (*p)->cutime,
451 (*p)->cstime,
452 (*p)->counter,
453
454 (*p)->priority,
455
456 (*p)->timeout,
457 (*p)->it_real_value,
458 (*p)->start_time,
459 vsize,
460 (*p)->mm->rss,
461 (*p)->rlim[RLIMIT_RSS].rlim_cur,
462 (*p)->mm->start_code,
463 (*p)->mm->end_code,
464 (*p)->mm->start_stack,
465 esp,
466 eip,
467 (*p)->signal,
468 (*p)->blocked,
469 sigignore,
470 sigcatch,
471 wchan);
472 }
473
474 static inline void statm_pte_range(pmd_t * pmd, unsigned long address, unsigned long size,
475 int * pages, int * shared, int * dirty, int * total)
476 {
477 pte_t * pte;
478 unsigned long end;
479
480 if (pmd_none(*pmd))
481 return;
482 if (pmd_bad(*pmd)) {
483 printk("statm_pte_range: bad pmd (%08lx)\n", pmd_val(*pmd));
484 pmd_clear(pmd);
485 return;
486 }
487 pte = pte_offset(pmd, address);
488 address &= ~PMD_MASK;
489 end = address + size;
490 if (end > PMD_SIZE)
491 end = PMD_SIZE;
492 do {
493 pte_t page = *pte;
494
495 address += PAGE_SIZE;
496 pte++;
497 if (pte_none(page))
498 continue;
499 ++*total;
500 if (!pte_present(page))
501 continue;
502 ++*pages;
503 if (pte_dirty(page))
504 ++*dirty;
505 if (pte_page(page) >= high_memory)
506 continue;
507 if (mem_map[MAP_NR(pte_page(page))] > 1)
508 ++*shared;
509 } while (address < end);
510 }
511
512 static inline void statm_pmd_range(pgd_t * pgd, unsigned long address, unsigned long size,
513 int * pages, int * shared, int * dirty, int * total)
514 {
515 pmd_t * pmd;
516 unsigned long end;
517
518 if (pgd_none(*pgd))
519 return;
520 if (pgd_bad(*pgd)) {
521 printk("statm_pmd_range: bad pgd (%08lx)\n", pgd_val(*pgd));
522 pgd_clear(pgd);
523 return;
524 }
525 pmd = pmd_offset(pgd, address);
526 address &= ~PGDIR_MASK;
527 end = address + size;
528 if (end > PGDIR_SIZE)
529 end = PGDIR_SIZE;
530 do {
531 statm_pte_range(pmd, address, end - address, pages, shared, dirty, total);
532 address = (address + PMD_SIZE) & PMD_MASK;
533 pmd++;
534 } while (address < end);
535 }
536
537 static void statm_pgd_range(pgd_t * pgd, unsigned long address, unsigned long end,
538 int * pages, int * shared, int * dirty, int * total)
539 {
540 while (address < end) {
541 statm_pmd_range(pgd, address, end - address, pages, shared, dirty, total);
542 address = (address + PGDIR_SIZE) & PGDIR_MASK;
543 pgd++;
544 }
545 }
546
547 static int get_statm(int pid, char * buffer)
548 {
549 struct task_struct ** p = get_task(pid);
550 int size=0, resident=0, share=0, trs=0, lrs=0, drs=0, dt=0;
551
552 if (!p || !*p)
553 return 0;
554 if ((*p)->state != TASK_ZOMBIE) {
555 struct vm_area_struct * vma = (*p)->mm->mmap;
556
557 while (vma) {
558 pgd_t *pgd = pgd_offset(*p, vma->vm_start);
559 int pages = 0, shared = 0, dirty = 0, total = 0;
560
561 statm_pgd_range(pgd, vma->vm_start, vma->vm_end, &pages, &shared, &dirty, &total);
562 resident += pages;
563 share += shared;
564 dt += dirty;
565 size += total;
566 if (vma->vm_flags & VM_EXECUTABLE)
567 trs += pages;
568 else if (vma->vm_flags & VM_GROWSDOWN)
569 drs += pages;
570 else if (vma->vm_end > 0x60000000)
571 lrs += pages;
572 else
573 drs += pages;
574 vma = vma->vm_next;
575 }
576 }
577 return sprintf(buffer,"%d %d %d %d %d %d %d\n",
578 size, resident, share, trs, lrs, drs, dt);
579 }
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597 #define MAPS_LINE_LENGTH 1024
598 #define MAPS_LINE_SHIFT 10
599
600
601
602
603 #define MAPS_LINE_FORMAT "%08lx-%08lx %s %08lx %02x:%02x %lu\n"
604 #define MAPS_LINE_MAX 49
605
606 static int read_maps (int pid, struct file * file, char * buf, int count)
607 {
608 struct task_struct ** p = get_task(pid);
609 char * destptr;
610 loff_t lineno;
611 int column;
612 struct vm_area_struct * map;
613 int i;
614
615 if (!p || !*p)
616 return -EINVAL;
617
618 if (count == 0)
619 return 0;
620
621
622 lineno = file->f_pos >> MAPS_LINE_SHIFT;
623 column = file->f_pos & (MAPS_LINE_LENGTH-1);
624
625
626 for (map = (*p)->mm->mmap, i = 0; map && (i < lineno); map = map->vm_next, i++)
627 continue;
628
629 destptr = buf;
630
631 for ( ; map ; ) {
632
633 char line[MAPS_LINE_MAX+1];
634 char str[5], *cp = str;
635 int flags;
636 dev_t dev;
637 unsigned long ino;
638 int len;
639
640 flags = map->vm_flags;
641
642 *cp++ = flags & VM_READ ? 'r' : '-';
643 *cp++ = flags & VM_WRITE ? 'w' : '-';
644 *cp++ = flags & VM_EXEC ? 'x' : '-';
645 *cp++ = flags & VM_MAYSHARE ? 's' : 'p';
646 *cp++ = 0;
647
648 if (map->vm_inode != NULL) {
649 dev = map->vm_inode->i_dev;
650 ino = map->vm_inode->i_ino;
651 } else {
652 dev = 0;
653 ino = 0;
654 }
655
656 len = sprintf(line, MAPS_LINE_FORMAT,
657 map->vm_start, map->vm_end, str, map->vm_offset,
658 MAJOR(dev),MINOR(dev), ino);
659
660 if (column >= len) {
661 column = 0;
662 lineno++;
663 map = map->vm_next;
664 continue;
665 }
666
667 i = len-column;
668 if (i > count)
669 i = count;
670 memcpy_tofs(destptr, line+column, i);
671 destptr += i; count -= i;
672 column += i;
673 if (column >= len) {
674 column = 0;
675 lineno++;
676 map = map->vm_next;
677 }
678
679
680 if (count == 0)
681 break;
682
683
684
685
686 if (*p != current)
687 break;
688 }
689
690
691 file->f_pos = (lineno << MAPS_LINE_SHIFT) + column;
692
693 return destptr-buf;
694 }
695
696 extern int get_module_list(char *);
697 extern int get_device_list(char *);
698 extern int get_filesystem_list(char *);
699 extern int get_ksyms_list(char *, char **, off_t, int);
700 extern int get_irq_list(char *);
701 extern int get_dma_list(char *);
702 extern int get_cpuinfo(char *);
703 extern int get_pci_list(char*);
704
705 static int get_root_array(char * page, int type, char **start, off_t offset, int length)
706 {
707 switch (type) {
708 case PROC_LOADAVG:
709 return get_loadavg(page);
710
711 case PROC_UPTIME:
712 return get_uptime(page);
713
714 case PROC_MEMINFO:
715 return get_meminfo(page);
716
717 #ifdef CONFIG_PCI
718 case PROC_PCI:
719 return get_pci_list(page);
720 #endif
721
722 case PROC_CPUINFO:
723 return get_cpuinfo(page);
724
725 case PROC_VERSION:
726 return get_version(page);
727
728 #ifdef CONFIG_DEBUG_MALLOC
729 case PROC_MALLOC:
730 return get_malloc(page);
731 #endif
732
733 case PROC_MODULES:
734 return get_module_list(page);
735
736 case PROC_STAT:
737 return get_kstat(page);
738
739 case PROC_DEVICES:
740 return get_device_list(page);
741
742 case PROC_INTERRUPTS:
743 return get_irq_list(page);
744
745 case PROC_FILESYSTEMS:
746 return get_filesystem_list(page);
747
748 case PROC_KSYMS:
749 return get_ksyms_list(page, start, offset, length);
750
751 case PROC_DMA:
752 return get_dma_list(page);
753
754 case PROC_IOPORTS:
755 return get_ioport_list(page);
756 }
757 return -EBADF;
758 }
759
760 static int get_process_array(char * page, int pid, int type)
761 {
762 switch (type) {
763 case PROC_PID_ENVIRON:
764 return get_env(pid, page);
765 case PROC_PID_CMDLINE:
766 return get_arg(pid, page);
767 case PROC_PID_STAT:
768 return get_stat(pid, page);
769 case PROC_PID_STATM:
770 return get_statm(pid, page);
771 }
772 return -EBADF;
773 }
774
775
776 static inline int fill_array(char * page, int pid, int type, char **start, off_t offset, int length)
777 {
778 if (pid)
779 return get_process_array(page, pid, type);
780 return get_root_array(page, type, start, offset, length);
781 }
782
783 #define PROC_BLOCK_SIZE (3*1024)
784
785 static int array_read(struct inode * inode, struct file * file,char * buf, int count)
786 {
787 unsigned long page;
788 char *start;
789 int length;
790 int end;
791 unsigned int type, pid;
792
793 if (count < 0)
794 return -EINVAL;
795 if (count > PROC_BLOCK_SIZE)
796 count = PROC_BLOCK_SIZE;
797 if (!(page = __get_free_page(GFP_KERNEL)))
798 return -ENOMEM;
799 type = inode->i_ino;
800 pid = type >> 16;
801 type &= 0x0000ffff;
802 start = NULL;
803 length = fill_array((char *) page, pid, type,
804 &start, file->f_pos, count);
805 if (length < 0) {
806 free_page(page);
807 return length;
808 }
809 if (start != NULL) {
810
811 memcpy_tofs(buf, start, length);
812 file->f_pos += length;
813 count = length;
814 } else {
815
816 if (file->f_pos >= length) {
817 free_page(page);
818 return 0;
819 }
820 if (count + file->f_pos > length)
821 count = length - file->f_pos;
822 end = count + file->f_pos;
823 memcpy_tofs(buf, (char *) page + file->f_pos, count);
824 file->f_pos = end;
825 }
826 free_page(page);
827 return count;
828 }
829
830 static struct file_operations proc_array_operations = {
831 NULL,
832 array_read,
833 NULL,
834 NULL,
835 NULL,
836 NULL,
837 NULL,
838 NULL,
839 NULL,
840 NULL
841 };
842
843 struct inode_operations proc_array_inode_operations = {
844 &proc_array_operations,
845 NULL,
846 NULL,
847 NULL,
848 NULL,
849 NULL,
850 NULL,
851 NULL,
852 NULL,
853 NULL,
854 NULL,
855 NULL,
856 NULL,
857 NULL,
858 NULL
859 };
860
861 static int arraylong_read (struct inode * inode, struct file * file, char * buf, int count)
862 {
863 unsigned int pid = inode->i_ino >> 16;
864 unsigned int type = inode->i_ino & 0x0000ffff;
865
866 if (count < 0)
867 return -EINVAL;
868
869 switch (type) {
870 case PROC_PID_MAPS:
871 return read_maps(pid, file, buf, count);
872 }
873 return -EINVAL;
874 }
875
876 static struct file_operations proc_arraylong_operations = {
877 NULL,
878 arraylong_read,
879 NULL,
880 NULL,
881 NULL,
882 NULL,
883 NULL,
884 NULL,
885 NULL,
886 NULL
887 };
888
889 struct inode_operations proc_arraylong_inode_operations = {
890 &proc_arraylong_operations,
891 NULL,
892 NULL,
893 NULL,
894 NULL,
895 NULL,
896 NULL,
897 NULL,
898 NULL,
899 NULL,
900 NULL,
901 NULL,
902 NULL,
903 NULL,
904 NULL
905 };