Back to index

plt-scheme  4.2.1
Defines | Functions | Variables
os_dep.c File Reference
#include "private/gc_priv.h"
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>

Go to the source code of this file.

Defines

#define SETJMP(env)   setjmp(env)
#define LONGJMP(env, val)   longjmp(env, val)
#define JMP_BUF   jmp_buf
#define OPT_PROT_EXEC   PROT_EXEC
#define SIGSET_T   sigset_t
#define SIG_DEL(set, signal)   sigdelset(&(set), (signal))
#define SIG_FILL(set)   sigfillset(&set)
#define SIGSETMASK(old, new)   sigprocmask(SIG_SETMASK, &(new), &(old))
#define STACKBOTTOM_ALIGNMENT_M1   ((word)STACK_GRAN - 1)
#define SBRK_ARG_T   int

Functions

void GC_disable_signals ()
void GC_enable_signals ()
void GC_setpagesize ()
ptr_t GC_get_stack_base ()
void GC_register_data_segments ()
ptr_t GC_unix_get_mem (word bytes)
int GC_incremental_protection_needs ()

Variables

static GC_bool mask_initialized = FALSE
static SIGSET_T new_mask
static SIGSET_T old_mask
static SIGSET_T dummy
word GC_page_size
 OS/2.
void(* GC_push_other_roots )()=0
GC_bool GC_dirty_maintained = FALSE

Define Documentation

#define JMP_BUF   jmp_buf

Definition at line 147 of file os_dep.c.

#define LONGJMP (   env,
  val 
)    longjmp(env, val)

Definition at line 146 of file os_dep.c.

#define OPT_PROT_EXEC   PROT_EXEC

Definition at line 168 of file os_dep.c.

#define SBRK_ARG_T   int

Definition at line 1519 of file os_dep.c.

#define SETJMP (   env)    setjmp(env)

Definition at line 145 of file os_dep.c.

#define SIG_DEL (   set,
  signal 
)    sigdelset(&(set), (signal))

Definition at line 516 of file os_dep.c.

#define SIG_FILL (   set)    sigfillset(&set)

Definition at line 517 of file os_dep.c.

#define SIGSET_T   sigset_t

Definition at line 515 of file os_dep.c.

#define SIGSETMASK (   old,
  new 
)    sigprocmask(SIG_SETMASK, &(new), &(old))

Definition at line 518 of file os_dep.c.


Function Documentation

Definition at line 534 of file os_dep.c.

{
    if (!mask_initialized) {
       SIG_FILL(new_mask);

       SIG_DEL(new_mask, SIGSEGV);
       SIG_DEL(new_mask, SIGILL);
       SIG_DEL(new_mask, SIGQUIT);
#      ifdef SIGBUS
           SIG_DEL(new_mask, SIGBUS);
#      endif
#      ifdef SIGIOT
           SIG_DEL(new_mask, SIGIOT);
#      endif
#      ifdef SIGEMT
           SIG_DEL(new_mask, SIGEMT);
#      endif
#      ifdef SIGTRAP
           SIG_DEL(new_mask, SIGTRAP);
#      endif 
       mask_initialized = TRUE;
    }
#   ifdef CHECK_SIGNALS
       if (GC_sig_disabled != 0) ABORT("Nested disables");
       GC_sig_disabled++;
#   endif
    SIGSETMASK(old_mask,new_mask);
}

Definition at line 563 of file os_dep.c.

{
#   ifdef CHECK_SIGNALS
       if (GC_sig_disabled != 1) ABORT("Unmatched enable");
       GC_sig_disabled--;
#   endif
    SIGSETMASK(dummy,old_mask);
}

Definition at line 1019 of file os_dep.c.

{
#   if defined(HEURISTIC1) || defined(HEURISTIC2) || \
       defined(LINUX_STACKBOTTOM) || defined(FREEBSD_STACKBOTTOM)
    word dummy;
    ptr_t result;
#   endif

#   define STACKBOTTOM_ALIGNMENT_M1 ((word)STACK_GRAN - 1)

#   ifdef STACKBOTTOM
       return(STACKBOTTOM);
#   else
#      ifdef HEURISTIC1
#         ifdef STACK_GROWS_DOWN
            result = (ptr_t)((((word)(&dummy))
                            + STACKBOTTOM_ALIGNMENT_M1)
                           & ~STACKBOTTOM_ALIGNMENT_M1);
#         else
            result = (ptr_t)(((word)(&dummy))
                           & ~STACKBOTTOM_ALIGNMENT_M1);
#         endif
#      endif /* HEURISTIC1 */
#      ifdef LINUX_STACKBOTTOM
          result = GC_linux_stack_base();
#      endif
#      ifdef FREEBSD_STACKBOTTOM
          result = GC_freebsd_stack_base();
#      endif
#      ifdef HEURISTIC2
#          ifdef STACK_GROWS_DOWN
              result = GC_find_limit((ptr_t)(&dummy), TRUE);
#             ifdef HEURISTIC2_LIMIT
                  if (result > HEURISTIC2_LIMIT
                      && (ptr_t)(&dummy) < HEURISTIC2_LIMIT) {
                          result = HEURISTIC2_LIMIT;
                  }
#              endif
#          else
              result = GC_find_limit((ptr_t)(&dummy), FALSE);
#             ifdef HEURISTIC2_LIMIT
                  if (result < HEURISTIC2_LIMIT
                      && (ptr_t)(&dummy) > HEURISTIC2_LIMIT) {
                          result = HEURISTIC2_LIMIT;
                  }
#              endif
#          endif

#      endif /* HEURISTIC2 */
#      ifdef STACK_GROWS_DOWN
           if (result == 0) result = (ptr_t)(signed_word)(-sizeof(ptr_t));
#      endif
       return(result);
#   endif /* STACKBOTTOM */
}

Definition at line 3942 of file os_dep.c.

  {
    return GC_PROTECTS_NONE;
  }

Definition at line 1444 of file os_dep.c.

{
#   if !defined(PCR) && !defined(SRC_M3) && !defined(MACOS)
#     if defined(REDIRECT_MALLOC) && defined(GC_SOLARIS_THREADS)
       /* As of Solaris 2.3, the Solaris threads implementation       */
       /* allocates the data structure for the initial thread with    */
       /* sbrk at process startup.  It needs to be scanned, so that   */
       /* we don't lose some malloc allocated data structures         */
       /* hanging from it.  We're on thin ice here ...                */
        extern caddr_t sbrk();

       GC_add_roots_inner(DATASTART, (char *)sbrk(0), FALSE);
#     else
       GC_add_roots_inner(DATASTART, (char *)(DATAEND), FALSE);
#       if defined(DATASTART2)
         GC_add_roots_inner(DATASTART2, (char *)(DATAEND2), FALSE);
#       endif
#     endif
#   endif
#   if defined(MACOS)
    {
#   if defined(THINK_C)
       extern void* GC_MacGetDataStart(void);
       /* globals begin above stack and end at a5. */
       GC_add_roots_inner((ptr_t)GC_MacGetDataStart(),
                        (ptr_t)LMGetCurrentA5(), FALSE);
#   else
#     if defined(__MWERKS__)
#       if !__POWERPC__
         extern void* GC_MacGetDataStart(void);
         /* MATTHEW: Function to handle Far Globals (CW Pro 3) */
#         if __option(far_data)
         extern void* GC_MacGetDataEnd(void);
#         endif
         /* globals begin above stack and end at a5. */
         GC_add_roots_inner((ptr_t)GC_MacGetDataStart(),
                          (ptr_t)LMGetCurrentA5(), FALSE);
         /* MATTHEW: Handle Far Globals */                          
#         if __option(far_data)
      /* Far globals follow he QD globals: */
         GC_add_roots_inner((ptr_t)LMGetCurrentA5(),
                          (ptr_t)GC_MacGetDataEnd(), FALSE);
#         endif
#       else
         extern char __data_start__[], __data_end__[];
         GC_add_roots_inner((ptr_t)&__data_start__,
                          (ptr_t)&__data_end__, FALSE);
#       endif /* __POWERPC__ */
#     endif /* __MWERKS__ */
#   endif /* !THINK_C */
    }
#   endif /* MACOS */

    /* Dynamic libraries are added at every collection, since they may  */
    /* change.                                                        */
}

Here is the call graph for this function:

Definition at line 601 of file os_dep.c.

Here is the caller graph for this function:

Definition at line 1623 of file os_dep.c.

{
  ptr_t result;
# ifdef IRIX5
    /* Bare sbrk isn't thread safe.  Play by malloc rules.     */
    /* The equivalent may be needed on other systems as well.  */
    __LOCK_MALLOC();
# endif
  {
    ptr_t cur_brk = (ptr_t)sbrk(0);
    SBRK_ARG_T lsbs = (word)cur_brk & (GC_page_size-1);
    
    if ((SBRK_ARG_T)bytes < 0) return(0); /* too big */
    if (lsbs != 0) {
        if((ptr_t)sbrk(GC_page_size - lsbs) == (ptr_t)(-1)) return(0);
    }
    result = (ptr_t)sbrk((SBRK_ARG_T)bytes);
    if (result == (ptr_t)(-1)) result = 0;
  }
# ifdef IRIX5
    __UNLOCK_MALLOC();
# endif
  return(result);
}

Variable Documentation

SIGSET_T dummy [static]

Definition at line 527 of file os_dep.c.

Definition at line 2096 of file os_dep.c.

OS/2.

Definition at line 583 of file os_dep.c.

Definition at line 1964 of file os_dep.c.

Definition at line 521 of file os_dep.c.

SIGSET_T new_mask [static]

Definition at line 523 of file os_dep.c.

SIGSET_T old_mask [static]

Definition at line 525 of file os_dep.c.