[Netnice-commitlog] netnice : linux-netnice/kernel exit.c,1.1.1.1,1.1.1.1.2.1 fork.c,1.1.1.1,1.1.1.1
Status: Alpha
Brought to you by:
taost6
From: bhatt k. m. <rou...@us...> - 2006-02-16 13:12:15
|
Update of /cvsroot/netnice/linux-netnice/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19888/kernel Modified Files: Tag: patch1 exit.c fork.c Log Message: patch1 initial netnice patch applied to linux kernel version 2.6.15. developers please do not commit to the main branch directly. keep it clean. create separate branches for experimental patches. the procedure is cvs co linux-netnice [hack hack & hack till you are satisfied] //create a tag cvs tag -b "tag-name" cvs update -r "tag-name" cvs commit this way you won't end up commiting to the main tree thanks --Kartikey BHATT Index: fork.c =================================================================== RCS file: /cvsroot/netnice/linux-netnice/kernel/fork.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- fork.c 16 Feb 2006 11:53:08 -0000 1.1.1.1 +++ fork.c 16 Feb 2006 13:11:50 -0000 1.1.1.1.2.1 @@ -43,6 +43,7 @@ #include <linux/rmap.h> #include <linux/acct.h> #include <linux/cn_proc.h> +#include <linux/vif.h> #include <asm/pgtable.h> #include <asm/pgalloc.h> @@ -851,6 +852,55 @@ return current->pid; } +#ifdef CONFIG_NETNICE +int copy_vif(unsigned long clone_flags, struct task_struct *p) +{ + struct pvifnet **p_vif; + struct pvifnet *vif; + struct net_device *dev; + + if (!current->p_vifnet) + p->p_vifnet = NULL; + else { + /* duplicate the interface chain */ + p->p_vifnet = vif_cpvif((struct pvifnet *)current->p_vifnet); + if (!p->p_vifnet) + return -ENOMEM; + } + + /* + * interface maintainance: + * + * The routine bellow is to add unattached virtual interfaces into + * the processes. If this automatic attachment is dangerous, + * set if_protect by sysctl. + */ + if (if_protect) + return 0; + + for (p_vif = (struct pvifnet **) &(p->p_vifnet); + *p_vif; p_vif = &((*p_vif)->next)) + ; + + for (dev = dev_base; dev; dev = dev->next) { + for (vif = (struct pvifnet *)p->p_vifnet; + vif; vif = vif->next) + if (dev == vif->dev) + break; + + if (!vif) { + if (pvif_alloc(&vif, dev, dev2vifnet(dev))) + return -ENOMEM; + + *p_vif = vif; + p_vif = &(vif->next); + } + } + + return 0; +} +#endif + /* * This creates a new process as a copy of the old one, * but does not actually start it yet. @@ -998,6 +1048,10 @@ goto bad_fork_cleanup_mm; if ((retval = copy_namespace(clone_flags, p))) goto bad_fork_cleanup_keys; +#ifdef CONFIG_NETNICE + if ((retval = copy_vif(clone_flags, p))) + goto bad_fork_cleanup_vif; +#endif retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs); if (retval) goto bad_fork_cleanup_namespace; @@ -1152,6 +1206,10 @@ exit_namespace(p); bad_fork_cleanup_keys: exit_keys(p); +#ifdef CONFIG_NETNICE +bad_fork_cleanup_vif: + exit_vif(p); +#endif bad_fork_cleanup_mm: if (p->mm) mmput(p->mm); Index: exit.c =================================================================== RCS file: /cvsroot/netnice/linux-netnice/kernel/exit.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- exit.c 16 Feb 2006 11:53:08 -0000 1.1.1.1 +++ exit.c 16 Feb 2006 13:11:50 -0000 1.1.1.1.2.1 @@ -29,6 +29,7 @@ #include <linux/syscalls.h> #include <linux/signal.h> #include <linux/cn_proc.h> +#include <linux/vif.h> #include <asm/uaccess.h> #include <asm/unistd.h> @@ -409,6 +410,7 @@ return files; } +EXPORT_SYMBOL(get_files_struct); void fastcall put_files_struct(struct files_struct *files) { @@ -530,6 +532,16 @@ mmput(mm); } +#ifdef CONFIG_NETNICE +void exit_vif(struct task_struct *tsk) +{ + /* deallocate the pvifnet */ + pvif_rmall(tsk->p_vifnet); + tsk->p_vifnet = 0; +} +EXPORT_SYMBOL(exit_vif); +#endif + static inline void choose_new_parent(task_t *p, task_t *reaper, task_t *child_reaper) { /* @@ -853,6 +865,9 @@ __exit_fs(tsk); exit_namespace(tsk); exit_thread(); +#ifdef CONFIG_NETNICE + exit_vif(tsk); +#endif cpuset_exit(tsk); exit_keys(tsk); |