/src/nspr/pr/src/md/unix/linux.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | | |
6 | | #include "primpl.h" |
7 | | |
8 | | void _MD_EarlyInit(void) |
9 | 1 | { |
10 | 1 | } |
11 | | |
12 | | PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) |
13 | 0 | { |
14 | | #ifndef _PR_PTHREADS |
15 | | if (isCurrent) { |
16 | | (void) setjmp(CONTEXT(t)); |
17 | | } |
18 | | *np = sizeof(CONTEXT(t)) / sizeof(PRWord); |
19 | | return (PRWord *) CONTEXT(t); |
20 | | #else |
21 | 0 | *np = 0; |
22 | 0 | return NULL; |
23 | 0 | #endif |
24 | 0 | } |
25 | | |
26 | | #ifdef _PR_PTHREADS |
27 | | |
28 | | extern void _MD_unix_terminate_waitpid_daemon(void); |
29 | | |
30 | | void _MD_CleanupBeforeExit(void) |
31 | 0 | { |
32 | 0 | _MD_unix_terminate_waitpid_daemon(); |
33 | 0 | } |
34 | | |
35 | | #else /* ! _PR_PTHREADS */ |
36 | | |
37 | | void |
38 | | _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri) |
39 | | { |
40 | | return; |
41 | | } |
42 | | |
43 | | PRStatus |
44 | | _MD_InitializeThread(PRThread *thread) |
45 | | { |
46 | | /* |
47 | | * set the pointers to the stack-pointer and frame-pointer words in the |
48 | | * context structure; this is for debugging use. |
49 | | */ |
50 | | thread->md.sp = _MD_GET_SP_PTR(thread); |
51 | | thread->md.fp = _MD_GET_FP_PTR(thread); |
52 | | return PR_SUCCESS; |
53 | | } |
54 | | |
55 | | PRStatus |
56 | | _MD_WAIT(PRThread *thread, PRIntervalTime ticks) |
57 | | { |
58 | | PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); |
59 | | _PR_MD_SWITCH_CONTEXT(thread); |
60 | | return PR_SUCCESS; |
61 | | } |
62 | | |
63 | | PRStatus |
64 | | _MD_WAKEUP_WAITER(PRThread *thread) |
65 | | { |
66 | | if (thread) { |
67 | | PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); |
68 | | } |
69 | | return PR_SUCCESS; |
70 | | } |
71 | | |
72 | | /* These functions should not be called for Linux */ |
73 | | void |
74 | | _MD_YIELD(void) |
75 | | { |
76 | | PR_NOT_REACHED("_MD_YIELD should not be called for Linux."); |
77 | | } |
78 | | |
79 | | PRStatus |
80 | | _MD_CREATE_THREAD( |
81 | | PRThread *thread, |
82 | | void (*start) (void *), |
83 | | PRThreadPriority priority, |
84 | | PRThreadScope scope, |
85 | | PRThreadState state, |
86 | | PRUint32 stackSize) |
87 | | { |
88 | | PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for Linux."); |
89 | | return PR_FAILURE; |
90 | | } |
91 | | #endif /* ! _PR_PTHREADS */ |