-
Notifications
You must be signed in to change notification settings - Fork 36
/
cgpu-procfs.c
809 lines (658 loc) · 17.9 KB
/
cgpu-procfs.c
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
/*
* Copyright © 2019-now Alibaba Cloud Inc. All rights reserved.
*
*/
#include <linux/proc_fs.h>
#include <linux/vmalloc.h>
#include <linux/memory.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/seq_file.h>
#include "version.h"
#define IOCTL_BUF_SIZE 256
#define CGPU_IOCTL_A _IOC(_IOC_READ|_IOC_WRITE,'C', 1, IOCTL_BUF_SIZE)
#define CGPU_IOCTL_B _IOC(_IOC_READ|_IOC_WRITE,'C', 2, IOCTL_BUF_SIZE)
#define PROCFS_ROOT_DIR "cgpu_km"
#define PROCFS_INST_CTL_NODE "inst_ctl"
#define PROCFS_POLICY_NODE "policy"
#define PROCFS_MAX_INST_NODE "max_inst"
#define PROCFS_FREE_WEIGHT_NODE "free_weight"
#define NODE_NAME_LEN 12
#define PROCFS_DEF_MEMSIZE_NODE "default_memsize"
#define PROCFS_MAJOR_NODE "major"
#define MAX_GROUP_NUM 8
struct cgpu_meminfo_entry {
int pid;
uint64_t mem_size;
};
struct cgpu_meminfo {
unsigned int num;
uint64_t free_size;
struct cgpu_meminfo_entry entries[0];
};
static struct proc_dir_entry *proc_root;
static struct proc_dir_entry *proc_insts[MAX_GROUP_NUM];
static struct proc_dir_entry *node_inst_ctl;
static struct proc_dir_entry *node_default_memsize;
static struct proc_dir_entry *node_major;
static struct proc_dir_entry *node_version;
static int group_num;
extern int inst_get_minor(void *priv);
extern uint64_t inst_get_total_mem(void *priv);
extern int inst_set_total_mem(void *priv, uint64_t total_mem);
extern void *inst_get_node(char *name, int i);
extern void inst_set_name(void *priv, char *buf);
extern int group_get_policy(int idx);
extern void group_set_policy(int idx, int policy);
extern int group_get_max_inst(int idx);
extern int group_set_max_inst(int idx, int policy);
extern struct cgpu_meminfo *inst_get_meminfo(void *priv);
extern int inst_get_free_weight(int idx);
extern int inst_set_weight(void *priv, int weight);
extern int inst_get_weight(void *priv);
extern int cgpu_ioctl(int code, void *argi, void *argo, void *data);
extern int cgpu_major;
static int read_version(struct seq_file *seqf, void *data)
{
seq_printf(seqf, "%d.%d.%d\n", CGPU_MAJOR_VERSION, CGPU_MINOR_VERSION,
CGPU_BUILD_VERSION);
return 0;
}
static int cgpu_version_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
return single_open(filp, read_version, data);
}
static const struct file_operations cgpu_version_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_version_node_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int read_id_node(struct seq_file *seqf, void *data)
{
int minor = inst_get_minor(seqf->private);
seq_printf(seqf, "%d\n", minor);
return 0;
}
static int cgpu_id_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
if (!data) {
pr_err("cannot get data from inode %p\n", inode);
return -EINVAL;
}
return single_open(filp, read_id_node, data);
}
static const struct file_operations cgpu_id_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_id_node_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int read_meminfo_node(struct seq_file *seqf, void *data)
{
struct cgpu_meminfo *info = inst_get_meminfo(seqf->private);
struct cgpu_meminfo_entry *entry;
int i;
if (!info)
return -EFAULT;
seq_printf(seqf, "Free: %lld\n", info->free_size);
for (i = 0; i < info->num; i++) {
entry = &info->entries[i];
seq_printf(seqf, "PID: %d Mem: %lld\n", entry->pid,
entry->mem_size);
}
kfree(info);
return 0;
}
static int cgpu_meminfo_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
if (!data) {
pr_err("cannot get data from inode %p\n", inode);
return -EINVAL;
}
return single_open(filp, read_meminfo_node, data);
}
static const struct file_operations cgpu_meminfo_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_meminfo_node_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int read_memsize_node(struct seq_file *seqf, void *data)
{
uint64_t total_mem = inst_get_total_mem(seqf->private);
seq_printf(seqf, "%lld\n", total_mem);
return 0;
}
static int cgpu_memsize_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
if (!data) {
pr_err("cannot get data from inode %p\n", inode);
return -EINVAL;
}
return single_open(filp, read_memsize_node, data);
}
static ssize_t cgpu_memsize_node_write(struct file *filp,
const char __user *buf, size_t count, loff_t *ppos)
{
void *priv;
char tmp[16];
int ret;
uint64_t size;
if (!filp || !file_inode(filp) || !buf)
return -EINVAL;
priv = PDE_DATA(file_inode(filp));
if (!priv)
return -EINVAL;
if (count > 15) {
pr_err("invalid buff size %ld\n", count);
return -EINVAL;
}
ret = copy_from_user(tmp, buf, count);
if (ret) {
pr_err("failed to copy from user %d\n", ret);
return ret;
}
tmp[count] = '\0';
ret = sscanf(tmp, "%lld\n", &size);
if (ret != 1) {
pr_err("failed to parse string %s\n", tmp);
return -EINVAL;
}
ret = inst_set_total_mem(priv, size);
return count;
}
static const struct file_operations cgpu_memsize_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_memsize_node_open,
.read = seq_read,
.write = cgpu_memsize_node_write,
.llseek = seq_lseek,
.release = single_release,
};
static int read_weight_node(struct seq_file *seqf, void *data)
{
int weight = inst_get_weight(seqf->private);
seq_printf(seqf, "%d\n", weight);
return 0;
}
static int cgpu_weight_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
if (!data) {
pr_err("cannot get data from inode %p\n", inode);
return -EINVAL;
}
return single_open(filp, read_weight_node, data);
}
static ssize_t cgpu_weight_node_write(struct file *filp,
const char __user *buf, size_t count, loff_t *ppos)
{
void *priv;
char tmp[4];
int ret;
int weight;
if (!filp || !file_inode(filp) || !buf)
return -EINVAL;
priv = PDE_DATA(file_inode(filp));
if (!priv)
return -EINVAL;
if (count > 3) {
pr_err("invalid buff weight %ld\n", count);
return -EINVAL;
}
ret = copy_from_user(tmp, buf, count);
if (ret) {
pr_err("failed to copy from user %d\n", ret);
return ret;
}
tmp[count] = '\0';
ret = sscanf(tmp, "%d\n", &weight);
if (ret != 1) {
pr_err("failed to parse string %s\n", tmp);
return -EINVAL;
}
ret = inst_set_weight(priv, weight);
if (ret) {
pr_err("failed to set weight \n");
}
return count;
}
static const struct file_operations cgpu_weight_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_weight_node_open,
.read = seq_read,
.write = cgpu_weight_node_write,
.llseek = seq_lseek,
.release = single_release,
};
static int read_freeweight_node(struct seq_file *seqf, void *data)
{
int free_weight;
unsigned long idx = (unsigned long)seqf->private;
free_weight = inst_get_free_weight(idx);
seq_printf(seqf, "%d\n", free_weight);
return 0;
}
static int cgpu_freeweight_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
return single_open(filp, read_freeweight_node, data);
}
static const struct file_operations cgpu_freeweight_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_freeweight_node_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
int create_new_node(char *name, int i)
{
int ret = 0;
char *tmp;
struct proc_dir_entry *inst_root, *inst;
void *priv;
if (i < 0 || i >= group_num) {
pr_err("invalid new node num %d\n", i);
return -EINVAL;
}
if (!name || !proc_insts[i]) {
pr_err("create new node null ptr\n");
return -EINVAL;
}
priv = inst_get_node(NULL, i);
if (!priv) {
pr_err("no instance available \n");
return -ENOSPC;
}
tmp = kmalloc(NODE_NAME_LEN + 1, GFP_KERNEL);
if (!tmp) {
pr_err("faild to allocate node name %d\n", NODE_NAME_LEN);
return -ENOMEM;
}
strcpy(tmp, name);
tmp[NODE_NAME_LEN] = '\0';
inst_set_name(priv, tmp);
inst_root = proc_mkdir(tmp, proc_insts[i]);
if (!inst_root) {
pr_err("failed to create node %s\n", tmp);
goto err_free;
}
inst = proc_create_data("id", 0444, inst_root,
&cgpu_id_node_fops, priv);
if (!inst) {
pr_err("failed to create node \"id\"\n");
goto err_procfs;
}
inst = proc_create_data("meminfo", 0444, inst_root,
&cgpu_meminfo_node_fops, priv);
if (!inst) {
pr_err("failed to create node \"meminfo\"\n");
goto err_procfs;
}
inst = proc_create_data("memsize", 0666, inst_root,
&cgpu_memsize_node_fops, priv);
if (!inst) {
pr_err("failed to create node \"memsize\"\n");
goto err_procfs;
}
inst = proc_create_data("weight", 0666, inst_root,
&cgpu_weight_node_fops, priv);
if (!inst) {
pr_err("failed to create node \"weight\"\n");
goto err_procfs;
}
pr_info("create cgpu id %d\n", inst_get_minor(priv));
return 0;
err_procfs:
proc_remove(inst_root);
err_free:
inst_set_name(priv, NULL);
return ret;
}
int destroy_node(char *name)
{
int ret = 0;
void *priv;
int i = 0;
if (!name) {
pr_err("create new node null ptr\n");
return -EINVAL;
}
for (i = 0; i < group_num; i++) {
priv = inst_get_node(name, i);
if (!priv) {
continue;
}
inst_set_name(priv, NULL);
inst_set_weight(priv, 0);
ret = remove_proc_subtree(name, proc_insts[i]);
}
return ret;
}
static ssize_t cgpu_inst_ctl_read(struct file *filp, char __user *buf,
size_t count, loff_t *ppos)
{
return -EBADF;
}
static ssize_t cgpu_inst_ctl_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
{
char *node_name;
int ret = 0;
if (!buf || (count != NODE_NAME_LEN + 1)) {
pr_err("invalid input buf %p count %ld\n", buf, count);
return -EINVAL;
}
node_name = kmalloc(count + 1, GFP_KERNEL);
if (!node_name) {
pr_err("failed to allocate buf len %ld\n", count);
return -ENOMEM;
}
ret = copy_from_user(node_name, buf, count);
if (ret) {
pr_err("failed to copy data %d \n", ret);
goto out_free;
}
node_name[count] = '\0';
if (node_name[0] == '-') {
ret = destroy_node(node_name + 1);
if (ret) {
pr_err("failed to destroy node %s\n", node_name + 1);
goto out_free;
}
} else {
int i = node_name[0] - '0';
ret = create_new_node(node_name + 1, i);
if (ret) {
pr_err("failed to create new node %s\n", node_name);
goto out_free;
}
}
ret = count;
out_free:
kfree(node_name);
return ret;
}
static long cgpu_inst_ctl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
void *argp = (void *)arg;
void *argi, *argo;
size_t size = 0;
int code, ret = 0;
if (!filp)
return -EINVAL;
size = _IOC_SIZE(cmd);
code = _IOC_NR(cmd);
if (size != IOCTL_BUF_SIZE)
return -EINVAL;
argi = kmalloc(size, GFP_KERNEL);
if (!argi)
return -ENOMEM;
argo = kmalloc(size, GFP_KERNEL);
if (!argo)
return -ENOMEM;
ret = copy_from_user(argi, argp, size);
if (ret)
goto out;
ret = cgpu_ioctl(code, argi, argo, &filp->private_data);
if (!ret)
ret = copy_to_user(argp, argo, size);
out:
kfree(argo);
kfree(argi);
return ret;
}
static const struct file_operations cgpu_inst_ctl_fops= {
.owner = THIS_MODULE,
.open = nonseekable_open,
.read = cgpu_inst_ctl_read,
.write = cgpu_inst_ctl_write,
.unlocked_ioctl = cgpu_inst_ctl_ioctl,
.llseek = no_llseek,
};
static int read_default_ms_node(struct seq_file *seqf, void *data)
{
uint64_t total_mem = inst_get_total_mem(NULL);
seq_printf(seqf, "%lld\n", total_mem);
return 0;
}
static int cgpu_default_ms_node_open(struct inode *inode, struct file *filp)
{
return single_open(filp, read_default_ms_node, NULL);
}
static ssize_t cgpu_default_ms_node_write(struct file *filp,
const char __user *buf, size_t count, loff_t *ppos)
{
char tmp[16];
int ret;
uint64_t size;
if (!filp || !buf)
return -EINVAL;
if (count > 15) {
pr_err("invalid buff size %ld\n", count);
return -EINVAL;
}
ret = copy_from_user(tmp, buf, count);
if (ret) {
pr_err("failed to copy from user %d\n", ret);
return ret;
}
tmp[count] = '\0';
ret = sscanf(tmp, "%lld\n", &size);
if (ret != 1) {
pr_err("failed to parse string %s\n", tmp);
return -EINVAL;
}
ret = inst_set_total_mem(NULL, size);
return count;
}
static const struct file_operations cgpu_default_ms_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_default_ms_node_open,
.read = seq_read,
.write = cgpu_default_ms_node_write,
.llseek = seq_lseek,
.release = single_release,
};
static int read_major_node(struct seq_file *seqf, void *data)
{
seq_printf(seqf, "%d\n", cgpu_major);
return 0;
}
static int cgpu_major_node_open(struct inode *inode, struct file *filp)
{
return single_open(filp, read_major_node, NULL);
}
static const struct file_operations cgpu_major_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_major_node_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int read_policy_node(struct seq_file *seqf, void *data)
{
unsigned long idx;
int policy;
idx = (unsigned long)seqf->private;
policy = group_get_policy(idx);
seq_printf(seqf, "%d\n", policy);
return 0;
}
static int cgpu_policy_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
return single_open(filp, read_policy_node, data);
}
static ssize_t cgpu_policy_node_write(struct file *filp,
const char __user *buf, size_t count, loff_t *ppos)
{
char tmp[3];
int ret;
unsigned long policy, idx;
if (!filp || !file_inode(filp) || !buf)
return -EINVAL;
idx = (unsigned long)PDE_DATA(file_inode(filp));
if (idx >= MAX_GROUP_NUM)
return -EINVAL;
if (count > 2) {
pr_err("invalid buff size %ld\n", count);
return -EINVAL;
}
ret = copy_from_user(tmp, buf, count);
if (ret) {
pr_err("failed to copy from user %d\n", ret);
return ret;
}
tmp[count] = '\0';
ret = sscanf(tmp, "%ld\n", &policy);
if (ret != 1) {
pr_err("failed to parse string %s\n", tmp);
return -EINVAL;
}
group_set_policy(idx, policy);
return count;
}
static const struct file_operations cgpu_policy_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_policy_node_open,
.read = seq_read,
.write = cgpu_policy_node_write,
.llseek = seq_lseek,
.release = single_release,
};
static int read_max_inst_node(struct seq_file *seqf, void *data)
{
unsigned long idx;
int max_inst;
idx = (unsigned long)seqf->private;
max_inst = group_get_max_inst(idx);
seq_printf(seqf, "%d\n", max_inst);
return 0;
}
static int cgpu_max_inst_node_open(struct inode *inode, struct file *filp)
{
void *data = PDE_DATA(inode);
return single_open(filp, read_max_inst_node, data);
}
static ssize_t cgpu_max_inst_node_write(struct file *filp,
const char __user *buf, size_t count, loff_t *ppos)
{
char tmp[4];
int ret;
unsigned long max_inst, idx;
if (!filp || !file_inode(filp) || !buf)
return -EINVAL;
idx = (unsigned long)PDE_DATA(file_inode(filp));
if (idx >= MAX_GROUP_NUM)
return -EINVAL;
if (count > 3) {
pr_err("invalid buff size %ld\n", count);
return -EINVAL;
}
ret = copy_from_user(tmp, buf, count);
if (ret) {
pr_err("failed to copy from user %d\n", ret);
return ret;
}
tmp[count] = '\0';
ret = sscanf(tmp, "%ld\n", &max_inst);
if (ret != 1) {
pr_err("failed to parse string %s\n", tmp);
return -EINVAL;
}
ret = group_set_max_inst(idx, max_inst);
if (ret)
return ret;
return count;
}
static const struct file_operations cgpu_max_inst_node_fops= {
.owner = THIS_MODULE,
.open = cgpu_max_inst_node_open,
.read = seq_read,
.write = cgpu_max_inst_node_write,
.llseek = seq_lseek,
.release = single_release,
};
int cgpu_km_procfs_init(int num)
{
int ret = 0;
int i = 0;
char inst_dir[] = "0";
if (num < 0 || num > MAX_GROUP_NUM)
return -EINVAL;
proc_root = proc_mkdir(PROCFS_ROOT_DIR, NULL);
if (!proc_root) {
pr_err("failed to create procfs node %s\n",
PROCFS_ROOT_DIR);
return -EFAULT;
}
for (i = 0; i < num; i++) {
struct proc_dir_entry *node_policy, *node_max_inst, *node_weight;
unsigned long data = i;
proc_insts[i] = proc_mkdir(inst_dir, proc_root);
if (!proc_insts[i]) {
pr_err("failed to create procfs node %s\n",
inst_dir);
ret = -EFAULT;
goto err;
}
node_policy = proc_create_data(PROCFS_POLICY_NODE, 0666,
proc_insts[i], &cgpu_policy_node_fops, (void *)data);
node_max_inst = proc_create_data(PROCFS_MAX_INST_NODE, 0666,
proc_insts[i], &cgpu_max_inst_node_fops, (void *)data);
node_weight = proc_create_data(PROCFS_FREE_WEIGHT_NODE, 0444,
proc_insts[i], &cgpu_freeweight_node_fops, (void *)data);
inst_dir[0]++;
}
node_inst_ctl = proc_create_data(PROCFS_INST_CTL_NODE, 0666, proc_root,
&cgpu_inst_ctl_fops, NULL);
if (!node_inst_ctl) {
pr_err("failed to create procfs node %s\n",
PROCFS_INST_CTL_NODE);
ret = -EFAULT;
goto err;
}
node_default_memsize = proc_create_data(PROCFS_DEF_MEMSIZE_NODE, 0666,
proc_root, &cgpu_default_ms_node_fops, NULL);
if (!node_default_memsize) {
pr_err("failed to create procfs node %s\n",
PROCFS_DEF_MEMSIZE_NODE);
ret = -EFAULT;
goto err;
}
node_major = proc_create_data(PROCFS_MAJOR_NODE, 0444,
proc_root, &cgpu_major_node_fops, NULL);
if (!node_major) {
pr_err("failed to create procfs node %s\n",
PROCFS_MAJOR_NODE);
ret = -EFAULT;
goto err;
}
node_version = proc_create_data("version", 0444,
proc_root, &cgpu_version_node_fops, NULL);
group_num = num;
return 0;
err:
proc_remove(proc_root);
proc_root = NULL;
return ret;
}
int cgpu_km_procfs_deinit(void)
{
if (proc_root) {
proc_remove(proc_root);
proc_root = NULL;
}
return 0;
}