From cc5f4b27059007c215513df730bdd132e6a979f0 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 10 Oct 2013 15:00:20 +0200 Subject: Use default PID value for all process identifiers --- freebsd/sys/net/if_tap.c | 4 ++++ freebsd/sys/net/if_tun.c | 14 +++++++++++++- freebsd/sys/net/rtsock.c | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'freebsd/sys/net') diff --git a/freebsd/sys/net/if_tap.c b/freebsd/sys/net/if_tap.c index 9e27b809..cd775369 100644 --- a/freebsd/sys/net/if_tap.c +++ b/freebsd/sys/net/if_tap.c @@ -491,7 +491,11 @@ tapopen(struct cdev *dev, int flag, int mode, struct thread *td) } bcopy(IF_LLADDR(tp->tap_ifp), tp->ether_addr, sizeof(tp->ether_addr)); +#ifndef __rtems__ tp->tap_pid = td->td_proc->p_pid; +#else /* __rtems__ */ + tp->tap_pid = BSD_DEFAULT_PID; +#endif /* __rtems__ */ tp->tap_flags |= TAP_OPEN; ifp = tp->tap_ifp; diff --git a/freebsd/sys/net/if_tun.c b/freebsd/sys/net/if_tun.c index a6b86600..b6fa0e5a 100644 --- a/freebsd/sys/net/if_tun.c +++ b/freebsd/sys/net/if_tun.c @@ -421,11 +421,19 @@ tunopen(struct cdev *dev, int flag, int mode, struct thread *td) * with a simple busy flag? */ mtx_lock(&tp->tun_mtx); +#ifndef __rtems__ if (tp->tun_pid != 0 && tp->tun_pid != td->td_proc->p_pid) { +#else /* __rtems__ */ + if (tp->tun_pid != 0 && tp->tun_pid != BSD_DEFAULT_PID) { +#endif /* __rtems__ */ mtx_unlock(&tp->tun_mtx); return (EBUSY); } +#ifndef __rtems__ tp->tun_pid = td->td_proc->p_pid; +#else /* __rtems__ */ + tp->tun_pid = BSD_DEFAULT_PID; +#endif /* __rtems__ */ tp->tun_flags |= TUN_OPEN; ifp = TUN2IFP(tp); @@ -754,7 +762,11 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td break; case TUNSIFPID: mtx_lock(&tp->tun_mtx); - tp->tun_pid = curthread->td_proc->p_pid; +#ifndef __rtems__ + tp->tun_pid = curthread->td_proc->p_pid; +#else /* __rtems__ */ + tp->tun_pid = BSD_DEFAULT_PID; +#endif /* __rtems__ */ mtx_unlock(&tp->tun_mtx); break; case FIONBIO: diff --git a/freebsd/sys/net/rtsock.c b/freebsd/sys/net/rtsock.c index 2e709f79..bfdecf87 100644 --- a/freebsd/sys/net/rtsock.c +++ b/freebsd/sys/net/rtsock.c @@ -544,7 +544,11 @@ route_output(struct mbuf *m, struct socket *so) info.rti_info[RTAX_DST] = NULL; senderr(EPROTONOSUPPORT); } +#ifndef __rtems__ rtm->rtm_pid = curproc->p_pid; +#else /* __rtems__ */ + rtm->rtm_pid = BSD_DEFAULT_PID; +#endif /* __rtems__ */ bzero(&info, sizeof(info)); info.rti_addrs = rtm->rtm_addrs; if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info)) { -- cgit v1.2.3