OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [proc/] [proc_misc.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *  linux/fs/proc/proc_misc.c
3
 *
4
 *  linux/fs/proc/array.c
5
 *  Copyright (C) 1992  by Linus Torvalds
6
 *  based on ideas by Darren Senn
7
 *
8
 *  This used to be the part of array.c. See the rest of history and credits
9
 *  there. I took this into a separate file and switched the thing to generic
10
 *  proc_file_inode_operations, leaving in array.c only per-process stuff.
11
 *  Inumbers allocation made dynamic (via create_proc_entry()).  AV, May 1999.
12
 *
13
 * Changes:
14
 * Fulton Green      :  Encapsulated position metric calculations.
15
 *                      <kernel@FultonGreen.com>
16
 */
17
 
18
#include <linux/types.h>
19
#include <linux/errno.h>
20
#include <linux/sched.h>
21
#include <linux/kernel.h>
22
#include <linux/kernel_stat.h>
23
#include <linux/tty.h>
24
#include <linux/string.h>
25
#include <linux/mman.h>
26
#include <linux/proc_fs.h>
27
#include <linux/ioport.h>
28
#include <linux/config.h>
29
#include <linux/mm.h>
30
#include <linux/pagemap.h>
31
#include <linux/swap.h>
32
#include <linux/slab.h>
33
#include <linux/smp.h>
34
#include <linux/signal.h>
35
#include <linux/module.h>
36
#include <linux/init.h>
37
#include <linux/smp_lock.h>
38
#include <linux/seq_file.h>
39
#include <linux/sysrq.h>
40
 
41
#include <asm/uaccess.h>
42
#include <asm/pgtable.h>
43
#include <asm/io.h>
44
 
45
#define LOAD_INT(x) ((x) >> FSHIFT)
46
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
47
/*
48
 * Warning: stuff below (imported functions) assumes that its output will fit
49
 * into one page. For some of those functions it may be wrong. Moreover, we
50
 * have a way to deal with that gracefully. Right now I used straightforward
51
 * wrappers, but this needs further analysis wrt potential overflows.
52
 */
53
extern int get_hardware_list(char *);
54
extern int get_stram_list(char *);
55
#ifdef CONFIG_MODULES
56
extern int get_module_list(char *);
57
#endif
58
extern int get_device_list(char *);
59
extern int get_filesystem_list(char *);
60
extern int get_exec_domain_list(char *);
61
#ifndef CONFIG_X86
62
extern int get_irq_list(char *);
63
#endif
64
extern int get_dma_list(char *);
65
extern int get_locks_status (char *, char **, off_t, int);
66
extern int get_swaparea_info (char *);
67
#ifdef CONFIG_SGI_DS1286
68
extern int get_ds1286_status(char *);
69
#endif
70
 
71
void proc_sprintf(char *page, off_t *off, int *lenp, const char *format, ...)
72
{
73
        int len = *lenp;
74
        va_list args;
75
 
76
        /* try to only print whole lines */
77
        if (len > PAGE_SIZE-512)
78
                return;
79
 
80
        va_start(args, format);
81
        len += vsnprintf(page + len, PAGE_SIZE-len, format, args);
82
        va_end(args);
83
 
84
        if (len <= *off) {
85
                *off -= len;
86
                len = 0;
87
        }
88
 
89
        *lenp = len;
90
}
91
 
92
static int proc_calc_metrics(char *page, char **start, off_t off,
93
                                 int count, int *eof, int len)
94
{
95
        if (len <= off+count) *eof = 1;
96
        *start = page + off;
97
        len -= off;
98
        if (len>count) len = count;
99
        if (len<0) len = 0;
100
        return len;
101
}
102
 
103
static int loadavg_read_proc(char *page, char **start, off_t off,
104
                                 int count, int *eof, void *data)
105
{
106
        int a, b, c;
107
        int len;
108
 
109
        a = avenrun[0] + (FIXED_1/200);
110
        b = avenrun[1] + (FIXED_1/200);
111
        c = avenrun[2] + (FIXED_1/200);
112
        len = sprintf(page,"%d.%02d %d.%02d %d.%02d %d/%d %d\n",
113
                LOAD_INT(a), LOAD_FRAC(a),
114
                LOAD_INT(b), LOAD_FRAC(b),
115
                LOAD_INT(c), LOAD_FRAC(c),
116
                nr_running, nr_threads, last_pid);
117
        return proc_calc_metrics(page, start, off, count, eof, len);
118
}
119
 
120
static int uptime_read_proc(char *page, char **start, off_t off,
121
                                 int count, int *eof, void *data)
122
{
123
        unsigned long uptime;
124
        unsigned long idle;
125
        int len;
126
 
127
        uptime = jiffies;
128
        idle = init_tasks[0]->times.tms_utime + init_tasks[0]->times.tms_stime;
129
 
130
        /* The formula for the fraction parts really is ((t * 100) / HZ) % 100, but
131
           that would overflow about every five days at HZ == 100.
132
           Therefore the identity a = (a / b) * b + a % b is used so that it is
133
           calculated as (((t / HZ) * 100) + ((t % HZ) * 100) / HZ) % 100.
134
           The part in front of the '+' always evaluates as 0 (mod 100). All divisions
135
           in the above formulas are truncating. For HZ being a power of 10, the
136
           calculations simplify to the version in the #else part (if the printf
137
           format is adapted to the same number of digits as zeroes in HZ.
138
         */
139
#if HZ!=100
140
        len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
141
                uptime / HZ,
142
                (((uptime % HZ) * 100) / HZ) % 100,
143
                idle / HZ,
144
                (((idle % HZ) * 100) / HZ) % 100);
145
#else
146
        len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
147
                uptime / HZ,
148
                uptime % HZ,
149
                idle / HZ,
150
                idle % HZ);
151
#endif
152
        return proc_calc_metrics(page, start, off, count, eof, len);
153
}
154
 
155
static int meminfo_read_proc(char *page, char **start, off_t off,
156
                                 int count, int *eof, void *data)
157
{
158
        struct sysinfo i;
159
        int len;
160
        int pg_size ;
161
 
162
/*
163
 * display in kilobytes.
164
 */
165
#define K(x) ((x) << (PAGE_SHIFT - 10))
166
#define B(x) ((unsigned long long)(x) << PAGE_SHIFT)
167
        si_meminfo(&i);
168
        si_swapinfo(&i);
169
        pg_size = page_cache_size - i.bufferram;
170
 
171
        len = sprintf(page, "        total:    used:    free:  shared: buffers:  cached:\n"
172
                "Mem:  %8Lu %8Lu %8Lu %8Lu %8Lu %8Lu\n"
173
                "Swap: %8Lu %8Lu %8Lu\n",
174
                B(i.totalram), B(i.totalram-i.freeram), B(i.freeram),
175
                B(i.sharedram), B(i.bufferram),
176
                B(pg_size), B(i.totalswap),
177
                B(i.totalswap-i.freeswap), B(i.freeswap));
178
        /*
179
         * Tagged format, for easy grepping and expansion.
180
         * The above will go away eventually, once the tools
181
         * have been updated.
182
         */
183
        len += sprintf(page+len,
184
                "MemTotal:     %8lu kB\n"
185
                "MemFree:      %8lu kB\n"
186
                "MemShared:    %8lu kB\n"
187
                "Buffers:      %8lu kB\n"
188
                "Cached:       %8lu kB\n"
189
                "SwapCached:   %8lu kB\n"
190
                "Active:       %8u kB\n"
191
                "Inactive:     %8u kB\n"
192
                "HighTotal:    %8lu kB\n"
193
                "HighFree:     %8lu kB\n"
194
                "LowTotal:     %8lu kB\n"
195
                "LowFree:      %8lu kB\n"
196
                "SwapTotal:    %8lu kB\n"
197
                "SwapFree:     %8lu kB\n",
198
                K(i.totalram),
199
                K(i.freeram),
200
                K(i.sharedram),
201
                K(i.bufferram),
202
                K(pg_size - swapper_space.nrpages),
203
                K(swapper_space.nrpages),
204
                K(nr_active_pages),
205
                K(nr_inactive_pages),
206
                K(i.totalhigh),
207
                K(i.freehigh),
208
                K(i.totalram-i.totalhigh),
209
                K(i.freeram-i.freehigh),
210
                K(i.totalswap),
211
                K(i.freeswap));
212
 
213
        return proc_calc_metrics(page, start, off, count, eof, len);
214
#undef B
215
#undef K
216
}
217
 
218
static int version_read_proc(char *page, char **start, off_t off,
219
                                 int count, int *eof, void *data)
220
{
221
        extern char *linux_banner;
222
        int len;
223
 
224
        strcpy(page, linux_banner);
225
        len = strlen(page);
226
        return proc_calc_metrics(page, start, off, count, eof, len);
227
}
228
 
229
extern struct seq_operations cpuinfo_op;
230
static int cpuinfo_open(struct inode *inode, struct file *file)
231
{
232
        return seq_open(file, &cpuinfo_op);
233
}
234
static struct file_operations proc_cpuinfo_operations = {
235
        open:           cpuinfo_open,
236
        read:           seq_read,
237
        llseek:         seq_lseek,
238
        release:        seq_release,
239
};
240
 
241
#ifdef CONFIG_PROC_HARDWARE
242
static int hardware_read_proc(char *page, char **start, off_t off,
243
                                 int count, int *eof, void *data)
244
{
245
        int len = get_hardware_list(page);
246
        return proc_calc_metrics(page, start, off, count, eof, len);
247
}
248
#endif
249
 
250
#ifdef CONFIG_STRAM_PROC
251
static int stram_read_proc(char *page, char **start, off_t off,
252
                                 int count, int *eof, void *data)
253
{
254
        int len = get_stram_list(page);
255
        return proc_calc_metrics(page, start, off, count, eof, len);
256
}
257
#endif
258
 
259
extern struct seq_operations partitions_op;
260
static int partitions_open(struct inode *inode, struct file *file)
261
{
262
        return seq_open(file, &partitions_op);
263
}
264
static struct file_operations proc_partitions_operations = {
265
        open:           partitions_open,
266
        read:           seq_read,
267
        llseek:         seq_lseek,
268
        release:        seq_release,
269
};
270
 
271
#ifdef CONFIG_MODULES
272
static int modules_read_proc(char *page, char **start, off_t off,
273
                                 int count, int *eof, void *data)
274
{
275
        int len = get_module_list(page);
276
        return proc_calc_metrics(page, start, off, count, eof, len);
277
}
278
 
279
extern struct seq_operations ksyms_op;
280
static int ksyms_open(struct inode *inode, struct file *file)
281
{
282
        return seq_open(file, &ksyms_op);
283
}
284
static struct file_operations proc_ksyms_operations = {
285
        open:           ksyms_open,
286
        read:           seq_read,
287
        llseek:         seq_lseek,
288
        release:        seq_release,
289
};
290
#endif
291
 
292
extern struct seq_operations slabinfo_op;
293
extern ssize_t slabinfo_write(struct file *, const char *, size_t, loff_t *);
294
static int slabinfo_open(struct inode *inode, struct file *file)
295
{
296
        return seq_open(file, &slabinfo_op);
297
}
298
static struct file_operations proc_slabinfo_operations = {
299
        open:           slabinfo_open,
300
        read:           seq_read,
301
        write:          slabinfo_write,
302
        llseek:         seq_lseek,
303
        release:        seq_release,
304
};
305
 
306
static int kstat_read_proc(char *page, char **start, off_t off,
307
                                 int count, int *eof, void *data)
308
{
309
        int i, len = 0;
310
        extern unsigned long total_forks;
311
        unsigned long jif = jiffies;
312
        unsigned int sum = 0, user = 0, nice = 0, system = 0;
313
        int major, disk;
314
 
315
        for (i = 0 ; i < smp_num_cpus; i++) {
316
                int cpu = cpu_logical_map(i), j;
317
 
318
                user += kstat.per_cpu_user[cpu];
319
                nice += kstat.per_cpu_nice[cpu];
320
                system += kstat.per_cpu_system[cpu];
321
#if !defined(CONFIG_ARCH_S390)
322
                for (j = 0 ; j < NR_IRQS ; j++)
323
                        sum += kstat.irqs[cpu][j];
324
#endif
325
        }
326
 
327
        proc_sprintf(page, &off, &len,
328
                      "cpu  %u %u %u %lu\n", user, nice, system,
329
                      jif * smp_num_cpus - (user + nice + system));
330
        for (i = 0 ; i < smp_num_cpus; i++)
331
                proc_sprintf(page, &off, &len,
332
                        "cpu%d %u %u %u %lu\n",
333
                        i,
334
                        kstat.per_cpu_user[cpu_logical_map(i)],
335
                        kstat.per_cpu_nice[cpu_logical_map(i)],
336
                        kstat.per_cpu_system[cpu_logical_map(i)],
337
                        jif - (  kstat.per_cpu_user[cpu_logical_map(i)] \
338
                                   + kstat.per_cpu_nice[cpu_logical_map(i)] \
339
                                   + kstat.per_cpu_system[cpu_logical_map(i)]));
340
        proc_sprintf(page, &off, &len,
341
                "page %u %u\n"
342
                "swap %u %u\n"
343
                "intr %u",
344
                        kstat.pgpgin >> 1,
345
                        kstat.pgpgout >> 1,
346
                        kstat.pswpin,
347
                        kstat.pswpout,
348
                        sum
349
        );
350
#if !defined(CONFIG_ARCH_S390) && !defined(CONFIG_ALPHA)
351
        for (i = 0 ; i < NR_IRQS ; i++)
352
                proc_sprintf(page, &off, &len,
353
                             " %u", kstat_irqs(i));
354
#endif
355
 
356
        proc_sprintf(page, &off, &len, "\ndisk_io: ");
357
 
358
        for (major = 0; major < DK_MAX_MAJOR; major++) {
359
                for (disk = 0; disk < DK_MAX_DISK; disk++) {
360
                        int active = kstat.dk_drive[major][disk] +
361
                                kstat.dk_drive_rblk[major][disk] +
362
                                kstat.dk_drive_wblk[major][disk];
363
                        if (active)
364
                                proc_sprintf(page, &off, &len,
365
                                        "(%u,%u):(%u,%u,%u,%u,%u) ",
366
                                        major, disk,
367
                                        kstat.dk_drive[major][disk],
368
                                        kstat.dk_drive_rio[major][disk],
369
                                        kstat.dk_drive_rblk[major][disk],
370
                                        kstat.dk_drive_wio[major][disk],
371
                                        kstat.dk_drive_wblk[major][disk]
372
                        );
373
                }
374
        }
375
 
376
        proc_sprintf(page, &off, &len,
377
                "\nctxt %u\n"
378
                "btime %lu\n"
379
                "processes %lu\n",
380
                kstat.context_swtch,
381
                xtime.tv_sec - jif / HZ,
382
                total_forks);
383
 
384
        return proc_calc_metrics(page, start, off, count, eof, len);
385
}
386
 
387
static int devices_read_proc(char *page, char **start, off_t off,
388
                                 int count, int *eof, void *data)
389
{
390
        int len = get_device_list(page);
391
        return proc_calc_metrics(page, start, off, count, eof, len);
392
}
393
 
394
#ifndef CONFIG_X86
395
#if !defined(CONFIG_ARCH_S390)
396
static int interrupts_read_proc(char *page, char **start, off_t off,
397
                                 int count, int *eof, void *data)
398
{
399
        int len = get_irq_list(page);
400
        return proc_calc_metrics(page, start, off, count, eof, len);
401
}
402
#endif
403
 
404
#else /* !CONFIG_X86 */
405
 
406
extern int show_interrupts(struct seq_file *p, void *v);
407
static int interrupts_open(struct inode *inode, struct file *file)
408
{
409
        unsigned size = PAGE_SIZE * (1 + smp_num_cpus / 8);
410
        char *buf = kmalloc(size, GFP_KERNEL);
411
        struct seq_file *m;
412
        int res;
413
 
414
        if (!buf)
415
                return -ENOMEM;
416
        res = single_open(file, show_interrupts, NULL);
417
        if (!res) {
418
                m = file->private_data;
419
                m->buf = buf;
420
                m->size = size;
421
        } else
422
                kfree(buf);
423
        return res;
424
}
425
static struct file_operations proc_interrupts_operations = {
426
        .open           = interrupts_open,
427
        .read           = seq_read,
428
        .llseek         = seq_lseek,
429
        .release        = single_release,
430
};
431
#endif /* !CONFIG_X86 */
432
 
433
extern struct file_operations proc_ioports_operations;
434
extern struct file_operations proc_iomem_operations;
435
 
436
static int filesystems_read_proc(char *page, char **start, off_t off,
437
                                 int count, int *eof, void *data)
438
{
439
        int len = get_filesystem_list(page);
440
        return proc_calc_metrics(page, start, off, count, eof, len);
441
}
442
 
443
static int dma_read_proc(char *page, char **start, off_t off,
444
                                 int count, int *eof, void *data)
445
{
446
        int len = get_dma_list(page);
447
        return proc_calc_metrics(page, start, off, count, eof, len);
448
}
449
 
450
static int cmdline_read_proc(char *page, char **start, off_t off,
451
                                 int count, int *eof, void *data)
452
{
453
        extern char saved_command_line[];
454
        int len = 0;
455
 
456
        proc_sprintf(page, &off, &len, "%s\n", saved_command_line);
457
        return proc_calc_metrics(page, start, off, count, eof, len);
458
}
459
 
460
#ifdef CONFIG_SGI_DS1286
461
static int ds1286_read_proc(char *page, char **start, off_t off,
462
                                 int count, int *eof, void *data)
463
{
464
        int len = get_ds1286_status(page);
465
        return proc_calc_metrics(page, start, off, count, eof, len);
466
}
467
#endif
468
 
469
static int locks_read_proc(char *page, char **start, off_t off,
470
                                 int count, int *eof, void *data)
471
{
472
        int len;
473
        lock_kernel();
474
        len = get_locks_status(page, start, off, count);
475
        unlock_kernel();
476
        if (len < count) *eof = 1;
477
        return len;
478
}
479
 
480
static int execdomains_read_proc(char *page, char **start, off_t off,
481
                                 int count, int *eof, void *data)
482
{
483
        int len = get_exec_domain_list(page);
484
        return proc_calc_metrics(page, start, off, count, eof, len);
485
}
486
 
487
static int swaps_read_proc(char *page, char **start, off_t off,
488
                                 int count, int *eof, void *data)
489
{
490
        int len = get_swaparea_info(page);
491
        return proc_calc_metrics(page, start, off, count, eof, len);
492
}
493
 
494
/*
495
 * This function accesses profiling information. The returned data is
496
 * binary: the sampling step and the actual contents of the profile
497
 * buffer. Use of the program readprofile is recommended in order to
498
 * get meaningful info out of these data.
499
 */
500
static ssize_t read_profile(struct file *file, char *buf,
501
                            size_t count, loff_t *ppos)
502
{
503
        unsigned long p = *ppos;
504
        ssize_t read;
505
        char * pnt;
506
        unsigned int sample_step = 1 << prof_shift;
507
 
508
        if (p >= (prof_len+1)*sizeof(unsigned int))
509
                return 0;
510
        if (count > (prof_len+1)*sizeof(unsigned int) - p)
511
                count = (prof_len+1)*sizeof(unsigned int) - p;
512
        read = 0;
513
 
514
        while (p < sizeof(unsigned int) && count > 0) {
515
                put_user(*((char *)(&sample_step)+p),buf);
516
                buf++; p++; count--; read++;
517
        }
518
        pnt = (char *)prof_buffer + p - sizeof(unsigned int);
519
        if (copy_to_user(buf,(void *)pnt,count))
520
                return -EFAULT;
521
        read += count;
522
        *ppos += read;
523
        return read;
524
}
525
 
526
/*
527
 * Writing to /proc/profile resets the counters
528
 *
529
 * Writing a 'profiling multiplier' value into it also re-sets the profiling
530
 * interrupt frequency, on architectures that support this.
531
 */
532
static ssize_t write_profile(struct file * file, const char * buf,
533
                             size_t count, loff_t *ppos)
534
{
535
#ifdef CONFIG_SMP
536
        extern int setup_profiling_timer (unsigned int multiplier);
537
 
538
        if (count==sizeof(int)) {
539
                unsigned int multiplier;
540
 
541
                if (copy_from_user(&multiplier, buf, sizeof(int)))
542
                        return -EFAULT;
543
 
544
                if (setup_profiling_timer(multiplier))
545
                        return -EINVAL;
546
        }
547
#endif
548
 
549
        memset(prof_buffer, 0, prof_len * sizeof(*prof_buffer));
550
        return count;
551
}
552
 
553
static struct file_operations proc_profile_operations = {
554
        read:           read_profile,
555
        write:          write_profile,
556
};
557
 
558
#ifdef CONFIG_MAGIC_SYSRQ
559
/*
560
 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
561
 */
562
static ssize_t write_sysrq_trigger(struct file *file, const char *buf,
563
                                     size_t count, loff_t *ppos)
564
{
565
        if (count) {
566
                char c;
567
 
568
                if (get_user(c, buf))
569
                        return -EFAULT;
570
                handle_sysrq(c, NULL, NULL, NULL);
571
        }
572
        return count;
573
}
574
 
575
static struct file_operations proc_sysrq_trigger_operations = {
576
        .write          = write_sysrq_trigger,
577
};
578
#endif
579
 
580
struct proc_dir_entry *proc_root_kcore;
581
 
582
static void create_seq_entry(char *name, mode_t mode, struct file_operations *f)
583
{
584
        struct proc_dir_entry *entry;
585
        entry = create_proc_entry(name, mode, NULL);
586
        if (entry)
587
                entry->proc_fops = f;
588
}
589
 
590
void __init proc_misc_init(void)
591
{
592
        struct proc_dir_entry *entry;
593
        static struct {
594
                char *name;
595
                int (*read_proc)(char*,char**,off_t,int,int*,void*);
596
        } *p, simple_ones[] = {
597
                {"loadavg",     loadavg_read_proc},
598
                {"uptime",      uptime_read_proc},
599
                {"meminfo",     meminfo_read_proc},
600
                {"version",     version_read_proc},
601
#ifdef CONFIG_PROC_HARDWARE
602
                {"hardware",    hardware_read_proc},
603
#endif
604
#ifdef CONFIG_STRAM_PROC
605
                {"stram",       stram_read_proc},
606
#endif
607
#ifdef CONFIG_MODULES
608
                {"modules",     modules_read_proc},
609
#endif
610
                {"stat",        kstat_read_proc},
611
                {"devices",     devices_read_proc},
612
#if !defined(CONFIG_ARCH_S390) && !defined(CONFIG_X86)
613
                {"interrupts",  interrupts_read_proc},
614
#endif
615
                {"filesystems", filesystems_read_proc},
616
                {"dma",         dma_read_proc},
617
                {"cmdline",     cmdline_read_proc},
618
#ifdef CONFIG_SGI_DS1286
619
                {"rtc",         ds1286_read_proc},
620
#endif
621
                {"locks",       locks_read_proc},
622
                {"swaps",       swaps_read_proc},
623
                {"execdomains", execdomains_read_proc},
624
                {NULL,}
625
        };
626
        for (p = simple_ones; p->name; p++)
627
                create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
628
 
629
        proc_symlink("mounts", NULL, "self/mounts");
630
 
631
        /* And now for trickier ones */
632
        entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
633
        if (entry)
634
                entry->proc_fops = &proc_kmsg_operations;
635
        create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
636
#if defined(CONFIG_X86)
637
        create_seq_entry("interrupts", 0, &proc_interrupts_operations);
638
#endif
639
        create_seq_entry("ioports", 0, &proc_ioports_operations);
640
        create_seq_entry("iomem", 0, &proc_iomem_operations);
641
        create_seq_entry("partitions", 0, &proc_partitions_operations);
642
        create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
643
#ifdef CONFIG_MODULES
644
        create_seq_entry("ksyms", 0, &proc_ksyms_operations);
645
#endif
646
        proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
647
        if (proc_root_kcore) {
648
                proc_root_kcore->proc_fops = &proc_kcore_operations;
649
                proc_root_kcore->size =
650
                                (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
651
        }
652
        if (prof_shift) {
653
                entry = create_proc_entry("profile", S_IWUSR | S_IRUGO, NULL);
654
                if (entry) {
655
                        entry->proc_fops = &proc_profile_operations;
656
                        entry->size = (1+prof_len) * sizeof(unsigned int);
657
                }
658
        }
659
#ifdef CONFIG_MAGIC_SYSRQ
660
        entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
661
        if (entry)
662
                entry->proc_fops = &proc_sysrq_trigger_operations;
663
#endif
664
#ifdef CONFIG_PPC32
665
        {
666
                extern struct file_operations ppc_htab_operations;
667
                entry = create_proc_entry("ppc_htab", S_IRUGO|S_IWUSR, NULL);
668
                if (entry)
669
                        entry->proc_fops = &ppc_htab_operations;
670
        }
671
#endif
672
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.