ReactOS 0.4.16-dev-334-g4d9f67c
sys_arch.c File Reference
#include <debug.h>
#include <lwip/sys.h>
#include "lwip_glue.h"
Include dependency graph for sys_arch.c:

Go to the source code of this file.

Classes

struct  _thread_t
 

Typedefs

typedef struct _thread_tthread_t
 

Functions

u32_t sys_now (void)
 
void sys_arch_protect (sys_prot_t *lev)
 
void sys_arch_unprotect (sys_prot_t lev)
 
err_t sys_sem_new (sys_sem_t *sem, u8_t count)
 
int sys_sem_valid (sys_sem_t *sem)
 
void sys_sem_set_invalid (sys_sem_t *sem)
 
void sys_sem_free (sys_sem_t *sem)
 
void sys_sem_signal (sys_sem_t *sem)
 
u32_t sys_arch_sem_wait (sys_sem_t *sem, u32_t timeout)
 
err_t sys_mbox_new (sys_mbox_t *mbox, int size)
 
int sys_mbox_valid (sys_mbox_t *mbox)
 
void sys_mbox_set_invalid (sys_mbox_t *mbox)
 
void sys_mbox_free (sys_mbox_t *mbox)
 
void sys_mbox_post (sys_mbox_t *mbox, void *msg)
 
u32_t sys_arch_mbox_fetch (sys_mbox_t *mbox, void **msg, u32_t timeout)
 
u32_t sys_arch_mbox_tryfetch (sys_mbox_t *mbox, void **msg)
 
err_t sys_mbox_trypost (sys_mbox_t *mbox, void *msg)
 
VOID NTAPI LwipThreadMain (PVOID Context)
 
sys_thread_t sys_thread_new (const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
 
void sys_init (void)
 
void sys_shutdown (void)
 

Variables

static LIST_ENTRY ThreadListHead
 
static KSPIN_LOCK ThreadListLock
 
KEVENT TerminationEvent
 
NPAGED_LOOKASIDE_LIST MessageLookasideList
 
NPAGED_LOOKASIDE_LIST QueueEntryLookasideList
 
static LARGE_INTEGER StartTime
 

Typedef Documentation

◆ thread_t

Function Documentation

◆ LwipThreadMain()

VOID NTAPI LwipThreadMain ( PVOID  Context)

Definition at line 256 of file sys_arch.c.

257{
258 thread_t Container = (thread_t)Context;
260
262
263 Container->ThreadFunction(Container->ThreadContext);
264
266 RemoveEntryList(&Container->ListEntry);
268
269 ExFreePool(Container);
270
272}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
PLIST_ENTRY NTAPI ExInterlockedInsertHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:114
static LIST_ENTRY ThreadListHead
Definition: sys_arch.c:6
static KSPIN_LOCK ThreadListLock
Definition: sys_arch.c:7
struct _thread_t * thread_t
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1145
#define STATUS_SUCCESS
Definition: shellext.h:65
void(* ThreadFunction)(void *arg)
Definition: sys_arch.c:18
void * ThreadContext
Definition: sys_arch.c:19
LIST_ENTRY ListEntry
Definition: sys_arch.c:20
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by sys_thread_new().

◆ sys_arch_protect()

void sys_arch_protect ( sys_prot_t lev)

Definition at line 33 of file sys_arch.c.

34{
35 /* Preempt the dispatcher */
37}
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ sys_arch_unprotect()

void sys_arch_unprotect ( sys_prot_t  lev)

Definition at line 40 of file sys_arch.c.

41{
42 KeLowerIrql(lev);
43}
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602

◆ sys_shutdown()

void sys_shutdown ( void  )

Definition at line 332 of file sys_arch.c.

333{
334 PLIST_ENTRY CurrentEntry;
335 thread_t Container;
336
337 /* Set the termination event */
339
340 /* Loop through the thread list and wait for each to die */
342 {
343 Container = CONTAINING_RECORD(CurrentEntry, struct _thread_t, ListEntry);
344
345 if (Container->ThreadFunction)
346 {
347 KeWaitForSingleObject(Container->Handle,
348 Executive,
350 FALSE,
351 NULL);
352
353 ZwClose(Container->Handle);
354 }
355 }
356
359}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
PLIST_ENTRY NTAPI ExInterlockedRemoveHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:166
KEVENT TerminationEvent
Definition: sys_arch.c:9
NPAGED_LOOKASIDE_LIST MessageLookasideList
Definition: sys_arch.c:10
NPAGED_LOOKASIDE_LIST QueueEntryLookasideList
Definition: sys_arch.c:11
VOID NTAPI ExDeleteNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside)
Definition: lookas.c:170
#define KernelMode
Definition: asm.h:34
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
Definition: typedefs.h:120
HANDLE Handle
Definition: sys_arch.c:17
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define IO_NO_INCREMENT
Definition: iotypes.h:598
@ Executive
Definition: ketypes.h:415

Referenced by LibIPShutdown().

Variable Documentation

◆ MessageLookasideList

◆ QueueEntryLookasideList

◆ StartTime

◆ TerminationEvent

KEVENT TerminationEvent

◆ ThreadListHead

LIST_ENTRY ThreadListHead
static

Definition at line 6 of file sys_arch.c.

Referenced by LwipThreadMain(), NtQueryInformationThread(), sys_init(), and sys_shutdown().

◆ ThreadListLock

KSPIN_LOCK ThreadListLock
static

Definition at line 7 of file sys_arch.c.

Referenced by LwipThreadMain(), sys_init(), and sys_shutdown().