Added rtems_bsd_thread0_ucred as a single global ucred.

This commit is contained in:
Jennifer Averett 2012-05-01 13:52:03 -05:00
parent c1dd641505
commit 73a8881268
3 changed files with 24 additions and 0 deletions

View File

@ -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) {

View File

@ -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 "

View File

@ -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;