summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rwxr-xr-xfreebsd-to-rtems.py1
-rw-r--r--freebsd/sys/contrib/pf/net/pf_ioctl.c8
-rw-r--r--freebsd/sys/net/if_tap.c4
-rw-r--r--freebsd/sys/net/if_tun.c14
-rw-r--r--freebsd/sys/net/rtsock.c4
-rw-r--r--freebsd/sys/sys/proc.h1
-rw-r--r--freebsd/sys/sys/sigio.h31
-rw-r--r--libbsd.txt3
-rw-r--r--rtemsbsd/include/machine/rtems-bsd-config.h.in2
-rw-r--r--rtemsbsd/rtems/rtems-bsd-descrip.c74
-rw-r--r--rtemsbsd/rtems/rtems-bsd-syscalls.c3
-rw-r--r--rtemsbsd/rtems/rtems-bsd-thread.c1
13 files changed, 67 insertions, 80 deletions
diff --git a/Makefile b/Makefile
index 9e8803e3..0f6912f8 100644
--- a/Makefile
+++ b/Makefile
@@ -56,7 +56,6 @@ LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-condvar.c
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-conf.c
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-copyinout.c
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-delay.c
-LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-descrip.c
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-file.c
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-init.c
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-init-with-irq.c
diff --git a/freebsd-to-rtems.py b/freebsd-to-rtems.py
index 30fb68d4..488e5b8f 100755
--- a/freebsd-to-rtems.py
+++ b/freebsd-to-rtems.py
@@ -613,7 +613,6 @@ rtems.addRTEMSSourceFiles(
'rtems/rtems-bsd-conf.c',
'rtems/rtems-bsd-copyinout.c',
'rtems/rtems-bsd-delay.c',
- 'rtems/rtems-bsd-descrip.c',
'rtems/rtems-bsd-get-file.c',
'rtems/rtems-bsd-init.c',
'rtems/rtems-bsd-init-with-irq.c',
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_ */
diff --git a/libbsd.txt b/libbsd.txt
index 503c642e..ee137e62 100644
--- a/libbsd.txt
+++ b/libbsd.txt
@@ -53,6 +53,9 @@ the current Git submodule commit is this
* Multiple routing tables are not supported. Every FIB value is set to zero
(= BSD_DEFAULT_FIB).
+* Process identifiers are not supported. Every PID value is set to zero
+ (= BSD_DEFAULT_PID).
+
* Sebastian Huber and Joel Sherrill discussed the need for a a basic USB
functionality test that is known to work on qemu pc.
diff --git a/rtemsbsd/include/machine/rtems-bsd-config.h.in b/rtemsbsd/include/machine/rtems-bsd-config.h.in
index 1fedcd54..0eeb0e0a 100644
--- a/rtemsbsd/include/machine/rtems-bsd-config.h.in
+++ b/rtemsbsd/include/machine/rtems-bsd-config.h.in
@@ -138,6 +138,8 @@ void rtems_bsd_assert_func(const char *file, int line, const char *func, const c
#define BSD_DEFAULT_FIB 0
+#define BSD_DEFAULT_PID 0
+
extern rtems_chain_control rtems_bsd_lock_chain;
extern rtems_chain_control rtems_bsd_mtx_chain;
diff --git a/rtemsbsd/rtems/rtems-bsd-descrip.c b/rtemsbsd/rtems/rtems-bsd-descrip.c
deleted file mode 100644
index d0d7944e..00000000
--- a/rtemsbsd/rtems/rtems-bsd-descrip.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- *
- * @ingroup rtems_bsd_rtems
- *
- * @brief TODO.
- */
-
-/*
- * Copyright (c) 2012 On-Line Applications Research Corporation (OAR).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <machine/rtems-bsd-config.h>
-
-#include <rtems/bsd/sys/param.h>
-#include <sys/systm.h>
-
-#include <sys/conf.h>
-#include <sys/domain.h>
-#include <sys/fcntl.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/filio.h>
-#include <sys/jail.h>
-#include <sys/kernel.h>
-#include <sys/limits.h>
-#include <rtems/bsd/sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mount.h>
-#include <sys/mutex.h>
-#include <sys/namei.h>
-#include <sys/priv.h>
-#include <sys/proc.h>
-
-/*
- * This routine is not supported in the RTEMS interface
- */
-void
-funsetown(struct sigio **sigiop)
-{
- /* XXX sigiop isn't supported by process for rtems */
-}
-
-/*
- * This routine is not supported in the RTEMS interface
- */
-int
-fsetown(pid_t pgid, struct sigio **sigiop)
-{
- /* XXX sigiop isn't supported by process for rtems */
- return 0;
-}
diff --git a/rtemsbsd/rtems/rtems-bsd-syscalls.c b/rtemsbsd/rtems/rtems-bsd-syscalls.c
index 3aa402f5..db392441 100644
--- a/rtemsbsd/rtems/rtems-bsd-syscalls.c
+++ b/rtemsbsd/rtems/rtems-bsd-syscalls.c
@@ -38,6 +38,7 @@
*/
#include <machine/rtems-bsd-config.h>
+#include <machine/rtems-bsd-thread.h>
#include <rtems/bsd/sys/types.h>
#include <rtems/bsd/sys/param.h>
@@ -662,7 +663,7 @@ kern_sendit(td, s, mp, flags, control, segflg)
/* Generation of SIGPIPE can be controlled per socket */
if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) &&
!(flags & MSG_NOSIGNAL)) {
- killinfo(td->td_proc->p_pid, SIGPIPE, NULL);
+ killinfo(rtems_bsd_get_task_id(td), SIGPIPE, NULL);
}
}
if (error == 0)
diff --git a/rtemsbsd/rtems/rtems-bsd-thread.c b/rtemsbsd/rtems/rtems-bsd-thread.c
index 45e37bbf..545b3244 100644
--- a/rtemsbsd/rtems/rtems-bsd-thread.c
+++ b/rtemsbsd/rtems/rtems-bsd-thread.c
@@ -216,7 +216,6 @@ rtems_bsd_threads_init(void *arg __unused)
FIXME_ucred.cr_ngroups = 1; /* group 0 */
FIXME_proc.p_ucred = crhold(&FIXME_ucred);
- FIXME_proc.p_pid = getpid();
}
SYSINIT(rtems_bsd_threads, SI_SUB_INTRINSIC, SI_ORDER_ANY, rtems_bsd_threads_init, NULL);