mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-24 00:59:56 +08:00
Fix curthread so it returns a valid value.
This commit is contained in:
parent
9ee8629924
commit
325120c875
@ -199,6 +199,11 @@ SLIST_HEAD(cpuhead, pcpu);
|
|||||||
extern struct cpuhead cpuhead;
|
extern struct cpuhead cpuhead;
|
||||||
extern struct pcpu *cpuid_to_pcpu[MAXCPU];
|
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 curcpu PCPU_GET(cpuid)
|
||||||
#define curproc (curthread->td_proc)
|
#define curproc (curthread->td_proc)
|
||||||
#ifndef curthread
|
#ifndef curthread
|
||||||
|
@ -202,6 +202,10 @@ socket (int domain, int type, int protocol)
|
|||||||
int fd, error;
|
int fd, error;
|
||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
|
if (!td) {
|
||||||
|
printf("Current thread NULL\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
error = mac_socket_check_create(td->td_ucred, domain, type, protocol);
|
error = mac_socket_check_create(td->td_ucred, domain, type, protocol);
|
||||||
if (error == 0 )
|
if (error == 0 )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user