diff --git a/freebsd/sys/pcpu.h b/freebsd/sys/pcpu.h index 8c93f2a8..ce84f15a 100644 --- a/freebsd/sys/pcpu.h +++ b/freebsd/sys/pcpu.h @@ -199,6 +199,11 @@ SLIST_HEAD(cpuhead, pcpu); extern struct cpuhead cpuhead; extern struct pcpu *cpuid_to_pcpu[MAXCPU]; +#ifdef __rtems__ +struct thread *rtems_get_curthread(void); +#define curthread rtems_get_curthread() +#endif + #define curcpu PCPU_GET(cpuid) #define curproc (curthread->td_proc) #ifndef curthread diff --git a/rtemsbsd/src/rtems-bsd-syscalls.c b/rtemsbsd/src/rtems-bsd-syscalls.c index aad2e92d..eb00ef5e 100644 --- a/rtemsbsd/src/rtems-bsd-syscalls.c +++ b/rtemsbsd/src/rtems-bsd-syscalls.c @@ -202,6 +202,10 @@ socket (int domain, int type, int protocol) int fd, error; td = curthread; + if (!td) { + printf("Current thread NULL\n"); + exit(0); + } #ifdef MAC error = mac_socket_check_create(td->td_ucred, domain, type, protocol); if (error == 0 )