Coverage Report

Created: 2025-07-01 06:25

/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
0
void _MD_EarlyInit(void) {}
9
10
0
PRWord* _MD_HomeGCRegisters(PRThread* t, int isCurrent, int* np) {
11
#ifndef _PR_PTHREADS
12
  if (isCurrent) {
13
    (void)setjmp(CONTEXT(t));
14
  }
15
  *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
16
  return (PRWord*)CONTEXT(t);
17
#else
18
0
  *np = 0;
19
0
  return NULL;
20
0
#endif
21
0
}
22
23
#ifdef _PR_PTHREADS
24
25
extern void _MD_unix_terminate_waitpid_daemon(void);
26
27
0
void _MD_CleanupBeforeExit(void) { _MD_unix_terminate_waitpid_daemon(); }
28
29
#else  /* ! _PR_PTHREADS */
30
31
void _MD_SET_PRIORITY(_MDThread* thread, PRUintn newPri) { return; }
32
33
PRStatus _MD_InitializeThread(PRThread* thread) {
34
  /*
35
   * set the pointers to the stack-pointer and frame-pointer words in the
36
   * context structure; this is for debugging use.
37
   */
38
  thread->md.sp = _MD_GET_SP_PTR(thread);
39
  thread->md.fp = _MD_GET_FP_PTR(thread);
40
  return PR_SUCCESS;
41
}
42
43
PRStatus _MD_WAIT(PRThread* thread, PRIntervalTime ticks) {
44
  PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
45
  _PR_MD_SWITCH_CONTEXT(thread);
46
  return PR_SUCCESS;
47
}
48
49
PRStatus _MD_WAKEUP_WAITER(PRThread* thread) {
50
  if (thread) {
51
    PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
52
  }
53
  return PR_SUCCESS;
54
}
55
56
/* These functions should not be called for Linux */
57
void _MD_YIELD(void) {
58
  PR_NOT_REACHED("_MD_YIELD should not be called for Linux.");
59
}
60
61
PRStatus _MD_CREATE_THREAD(PRThread* thread, void (*start)(void*),
62
                           PRThreadPriority priority, PRThreadScope scope,
63
                           PRThreadState state, PRUint32 stackSize) {
64
  PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for Linux.");
65
  return PR_FAILURE;
66
}
67
#endif /* ! _PR_PTHREADS */