[rtems-libbsd commit] Added rtems_bsd_thread0_ucred as a single global ucred.
Jennifer Averett
jennifer at rtems.org
Tue May 1 18:48:51 UTC 2012
Module: rtems-libbsd
Branch: master
Commit: 73a88812687f949d24f3a0c66227551cf18940df
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=73a88812687f949d24f3a0c66227551cf18940df
Author: Jennifer Averett <jennifer.averett at oarcorp.com>
Date: Tue May 1 13:52:03 2012 -0500
Added rtems_bsd_thread0_ucred as a single global ucred.
---
freebsd/kern/init_main.c | 9 +++++++++
freebsd/netinet/tcp_syncache.c | 11 +++++++++++
freebsd/sys/proc.h | 4 ++++
3 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/freebsd/kern/init_main.c b/freebsd/kern/init_main.c
index 540e0cb..8ae8a71 100644
--- a/freebsd/kern/init_main.c
+++ b/freebsd/kern/init_main.c
@@ -118,6 +118,8 @@ SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL);
* The sysinit table itself. Items are checked off as the are run.
* If we want to register new sysinit types, add them to newsysinit.
*/
+#else /* __rtems__ */
+struct ucred *rtems_bsd_thread0_ucred;
#endif /* __rtems__ */
SET_DECLARE(sysinit_set, struct sysinit);
#ifndef __rtems__
@@ -191,6 +193,13 @@ mi_startup(void)
#ifndef __rtems__
if (boothowto & RB_VERBOSE)
bootverbose++;
+#else /* __rtems__ */
+ rtems_bsd_thread0_ucred = crget();
+ rtems_bsd_thread0_ucred->cr_ngroups = 1; /* group 0 */
+ rtems_bsd_thread0_ucred->cr_uidinfo = uifind(0);
+ rtems_bsd_thread0_ucred = uifind(0);
+ rtems_bsd_thread0_ucred->cr_prison = &prison0;
+
#endif /* __rtems__ */
if (sysinit == NULL) {
diff --git a/freebsd/netinet/tcp_syncache.c b/freebsd/netinet/tcp_syncache.c
index 17ff3fa..78790cc 100644
--- a/freebsd/netinet/tcp_syncache.c
+++ b/freebsd/netinet/tcp_syncache.c
@@ -730,8 +730,13 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
laddr6 = inp->in6p_laddr;
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
inp->in6p_laddr = sc->sc_inc.inc6_laddr;
+#ifndef __rtems__
if ((error = in6_pcbconnect(inp, (struct sockaddr *)&sin6,
thread0.td_ucred)) != 0) {
+#else /* __rtems__ */
+ if ((error = in6_pcbconnect(inp, (struct sockaddr *)&sin6,
+ rtems_bsd_thread0_ucred)) != 0) {
+#endif /* __rtems__ */
inp->in6p_laddr = laddr6;
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
log(LOG_DEBUG, "%s; %s: in6_pcbconnect failed "
@@ -765,8 +770,14 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
laddr = inp->inp_laddr;
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = sc->sc_inc.inc_laddr;
+#ifndef __rtems__
if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
thread0.td_ucred)) != 0) {
+#else /* __rtems__ */
+ if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
+ rtems_bsd_thread0_ucred)) != 0) {
+#endif /* __rtems__ */
+
inp->inp_laddr = laddr;
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
log(LOG_DEBUG, "%s; %s: in_pcbconnect failed "
diff --git a/freebsd/sys/proc.h b/freebsd/sys/proc.h
index ebbffd7..39ddd78 100644
--- a/freebsd/sys/proc.h
+++ b/freebsd/sys/proc.h
@@ -796,7 +796,11 @@ extern struct sx allproc_lock;
extern struct sx proctree_lock;
extern struct mtx ppeers_lock;
extern struct proc proc0; /* Process slot for swapper. */
+#ifndef __rtems__
extern struct thread thread0; /* Primary thread in proc0. */
+#else /* __rtems__ */
+extern struct ucred *rtems_bsd_thread0_ucred;
+#endif /* __rtems__ */
extern struct vmspace vmspace0; /* VM space for proc0. */
extern int hogticks; /* Limit on kernel cpu hogs. */
extern int lastpid;
More information about the vc
mailing list