BRL-CAD
Environment Management

Cross platform API for interacting with the operating system environment. More...

Collaboration diagram for Environment Management:

Files

file  env.h
 

Macros

#define BU_MEM_ALL   0
 
#define BU_MEM_AVAIL   1
 
#define BU_MEM_PAGE_SIZE   2
 

Functions

int bu_setenv (const char *name, const char *value, int overwrite)
 
ssize_t bu_mem (int type, size_t *sz)
 
int bu_interrupt_suspend (void)
 
int bu_interrupt_restore (void)
 

Detailed Description

Cross platform API for interacting with the operating system environment.

Routines for managing signals.

Platform-independent methods for interacting with the parent operating system environment.

These routines provide a common means to temporarily disable and buffer signal processing during critical write operations.

Macro Definition Documentation

◆ BU_MEM_ALL

#define BU_MEM_ALL   0

Definition at line 44 of file env.h.

◆ BU_MEM_AVAIL

#define BU_MEM_AVAIL   1

Definition at line 45 of file env.h.

◆ BU_MEM_PAGE_SIZE

#define BU_MEM_PAGE_SIZE   2

Definition at line 46 of file env.h.

Function Documentation

◆ bu_setenv()

int bu_setenv ( const char *  name,
const char *  value,
int  overwrite 
)

◆ bu_mem()

ssize_t bu_mem ( int  type,
size_t *  sz 
)

Report system memory sizes.

Returns -1 on error and the size of the requested memory type on success. Optionally if sz is non-NULL, the size of the reqeusted memory type will be set to it.

◆ bu_interrupt_suspend()

int bu_interrupt_suspend ( void  )

Defer signal processing and interrupts before critical sections.

Signal processing for a variety of signals that would otherwise disrupt the logic of an application are put on hold until bu_interrupt_restore() is called.

If an interrupt signal is received while suspended, it will be raised when/if interrupts are restored.

Returns 0 on success. Returns non-zero on error (with perror set if signal() failure).

◆ bu_interrupt_restore()

int bu_interrupt_restore ( void  )

Resume signal processing and interrupts after critical sections.

If a signal was raised since bu_interrupt_suspend() was called, the previously installed signal handler will be immediately called albeit only once even if multiple signals were received.

Returns 0 on success. Returns non-zero on error (with perror set if signal() failure).