diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-10 15:00:20 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-31 13:18:46 +0100 |
commit | cc5f4b27059007c215513df730bdd132e6a979f0 (patch) | |
tree | 501c4c022f8f66fa0adfccd794db8d848b044069 /freebsd | |
parent | Disable alternative routing tables (diff) | |
download | rtems-libbsd-cc5f4b27059007c215513df730bdd132e6a979f0.tar.bz2 |
Use default PID value for all process identifiers
Diffstat (limited to 'freebsd')
-rw-r--r-- | freebsd/sys/contrib/pf/net/pf_ioctl.c | 8 | ||||
-rw-r--r-- | freebsd/sys/net/if_tap.c | 4 | ||||
-rw-r--r-- | freebsd/sys/net/if_tun.c | 14 | ||||
-rw-r--r-- | freebsd/sys/net/rtsock.c | 4 | ||||
-rw-r--r-- | freebsd/sys/sys/proc.h | 1 | ||||
-rw-r--r-- | freebsd/sys/sys/sigio.h | 31 |
6 files changed, 60 insertions, 2 deletions
diff --git a/freebsd/sys/contrib/pf/net/pf_ioctl.c b/freebsd/sys/contrib/pf/net/pf_ioctl.c index 766268cf..e1ef3fac 100644 --- a/freebsd/sys/contrib/pf/net/pf_ioctl.c +++ b/freebsd/sys/contrib/pf/net/pf_ioctl.c @@ -1490,7 +1490,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) bcopy(&pr->rule, rule, sizeof(struct pf_rule)); #ifdef __FreeBSD__ rule->cuid = td->td_ucred->cr_ruid; +#ifndef __rtems__ rule->cpid = td->td_proc ? td->td_proc->p_pid : 0; +#else /* __rtems__ */ + rule->cpid = BSD_DEFAULT_PID; +#endif /* __rtems__ */ #else rule->cuid = p->p_cred->p_ruid; rule->cpid = p->p_pid; @@ -1760,7 +1764,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) bcopy(&pcr->rule, newrule, sizeof(struct pf_rule)); #ifdef __FreeBSD__ newrule->cuid = td->td_ucred->cr_ruid; +#ifndef __rtems__ newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0; +#else /* __rtems__ */ + newrule->cpid = BSD_DEFAULT_PID; +#endif /* __rtems__ */ #else newrule->cuid = p->p_cred->p_ruid; newrule->cpid = p->p_pid; 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)) { diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h index dd8ad315..2c4970e9 100644 --- a/freebsd/sys/sys/proc.h +++ b/freebsd/sys/sys/proc.h @@ -576,7 +576,6 @@ struct proc { struct cv p_pwait; /* (*) wait cv for exit/exec */ #else /* __rtems__ */ struct ucred *p_ucred; /* (c) Process owner's identity. */ - rtems_id p_pid; #endif /* __rtems__ */ }; diff --git a/freebsd/sys/sys/sigio.h b/freebsd/sys/sys/sigio.h index 62ece6d4..1345cd61 100644 --- a/freebsd/sys/sys/sigio.h +++ b/freebsd/sys/sys/sigio.h @@ -59,9 +59,40 @@ struct sigio { SLIST_HEAD(sigiolst, sigio); +#ifndef __rtems__ pid_t fgetown(struct sigio **sigiop); int fsetown(pid_t pgid, struct sigio **sigiop); void funsetown(struct sigio **sigiop); void funsetownlst(struct sigiolst *sigiolst); +#else /* __rtems__ */ +static inline pid_t +fgetown(struct sigio **sigiop) +{ + (void) sigiop; + + return BSD_DEFAULT_PID; +} + +static inline int +fsetown(pid_t pgid, struct sigio **sigiop) +{ + (void) pgid; + (void) sigiop; + + return (0); +} + +static inline void +funsetown(struct sigio **sigiop) +{ + (void) sigiop; +} + +static inline void +funsetownlst(struct sigiolst *sigiolst) +{ + (void) sigiolst; +} +#endif /* __rtems__ */ #endif /* _SYS_SIGIO_H_ */ |