Base Framework
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
OperatingSystem Class Reference

Operating system. More...

#include <base/OperatingSystem.h>

Inherits Object.

Public Types

enum  ErrorCode {
  OK, ACCESS_DENIED, BROKEN_STREAM, BUSY,
  CANCELED, DEAD_LOCK, END_OF_FILE, ENTRY_NOT_FOUND,
  FILE_EXISTS, FILE_NOT_FOUND, FILE_TOO_LARGE, FOLDER_EXISTS,
  FOLDER_NOT_EMPTY, INTERRUPTED, INVALID_ADDRESS, INVALID_ARGUMENT,
  INVALID_IOCTL_REQUEST, INVALID_PATH, IO_ERROR, LOCK_VIOLATION,
  NO_SUCH_DEVICE, NOT_A_FOLDER, NOT_A_HANDLE, NOT_PERMITTED,
  NOT_SUPPORTED, OPERATION_IN_PROGRESS, OUT_OF_MEMORY, OUT_OF_SPACE,
  PERMISSION_DENIED, REQUEST_REFUSED, RETRY, SHARING_VIOLATION,
  STACK_OVERFLOW, TIME_OUT, TOO_MANY_LINKS, TOO_MANY_OPEN_FILES,
  UNSPECIFIED_ERROR
}
 
enum  Variable {
  MAX_NUM_OF_ASYNC_IO_OPRS_PER_LIST, MAX_NUM_OF_PENDING_ASYNC_IO_OPRS, MAX_LEN_OF_ARGUMENTS, MAX_NUM_OF_SIMULTANEOUS_PROCESSES_PER_REAL_UID,
  MAX_LEN_OF_HOST_NAME, MAX_NUM_OF_IOVS, MAX_LEN_OF_LOGIN_NAME, MAX_NUM_OF_OPEN_MESSAGE_QUEUES,
  MAX_NUM_OF_OPEN_FILES, PAGE_SIZE, MAX_NUM_OF_THREAD_KEYS, MIN_SIZE_OF_THREAD_STACK,
  MAX_NUM_OF_THREADS, MAX_NUM_OF_SEMAPHORES, MAX_VALUE_OF_SEMAPHORE, MAX_NUM_OF_QUEUED_SIGNALS,
  MAX_NUM_OF_NESTED_SYMBOLIC_LINKS, MAX_NUM_OF_TIMERS, MAX_NUM_OF_SUPPLEMENTARY_GIDS, TICKS_PER_SECOND,
  SUPPORTS_JOB_CONTROL, NUM_OF_CONFIGURED_PROCESSORS, NUM_OF_ONLINE_PROCESSORS, SUPPORTS_ACCESSS_CONTROL_LISTS,
  SUPPORTS_AUDIT, SUPPORTS_ASYNC_IO, SUPPORTS_MAPPED_FILES, SUPPORTS_PROCESS_SHARED_SYNCHRONIZATION
}
 
enum  Resource {
  RESOURCE_CORE, RESOURCE_CPU, RESOURCE_DATA, RESOURCE_FILE_SIZE,
  RESOURCE_OPEN_FILES, RESOURCE_STACK, RESOURCE_ADDRESS_SPACE
}
 
enum  LimitType { HARD_LIMIT, SOFT_LIMIT }
 
typedef void * Handle
 

Static Public Member Functions

static Literal getErrorMessage (unsigned int error) noexcept
 
static unsigned int getErrorCode (unsigned int error) noexcept
 
static long getVariable (Variable variable)
 
static int64 getResourceLimit (Resource resource, LimitType type=SOFT_LIMIT) noexcept
 
static void setResourceLimit (Resource resource, int64 limit, LimitType type=SOFT_LIMIT)
 

Static Public Attributes

static const Handle INVALID_HANDLE
 

Detailed Description

Operating system.

Operating system.

Version
1.2

Member Typedef Documentation

◆ Handle

typedef void* OperatingSystem::Handle

The type of an ordinary resource handle (do NOT assume anything about this type).

Member Enumeration Documentation

◆ ErrorCode

Common error codes.

Enumerator
OK 

No error.

ACCESS_DENIED 

Access denied.

BROKEN_STREAM 

Broken stream.

BUSY 

Busy.

CANCELED 

Operation was canceled.

DEAD_LOCK 

Dead lock detected.

END_OF_FILE 

End of file.

ENTRY_NOT_FOUND 

The path does not specify an existing entry within the filesystem.

FILE_EXISTS 

File (or any entry) already exists.

FILE_NOT_FOUND 

The path does not specify an existing file.

FILE_TOO_LARGE 

File size limit exceeded.

FOLDER_EXISTS 

Path specifies an existing folder.

FOLDER_NOT_EMPTY 

Folder not empty.

INTERRUPTED 

Interrupted by signal.

INVALID_ADDRESS 

Invalid address used in argument.

INVALID_ARGUMENT 

Invalid argument.

INVALID_IOCTL_REQUEST 

Invalid I/O control request.

INVALID_PATH 

Invalid filesystem path.

IO_ERROR 

I/O error.

LOCK_VIOLATION 

Object already locked by other process.

NO_SUCH_DEVICE 

Device does not exist.

NOT_A_FOLDER 

Not a folder.

NOT_A_HANDLE 

Invalid handle to system object.

NOT_PERMITTED 

Operation was not permitted.

NOT_SUPPORTED 

Operation is not supported.

OPERATION_IN_PROGRESS 

Operation already in progress.

OUT_OF_MEMORY 

Out of memory.

OUT_OF_SPACE 

Out of space on device.

PERMISSION_DENIED 

Permission denied.

REQUEST_REFUSED 

Request was refused.

RETRY 

Resource is currently unavailable. Try again later.

SHARING_VIOLATION 

Object in-use by other process.

STACK_OVERFLOW 

Stack overflow.

TIME_OUT 

Operation timed out.

TOO_MANY_LINKS 

Too many levels of symbolic links.

TOO_MANY_OPEN_FILES 

Too many open files (or other objects).

UNSPECIFIED_ERROR 

Unspecified error (used if non of the above errors match the error).

◆ LimitType

The limit type.

Enumerator
HARD_LIMIT 

Hard limit.

SOFT_LIMIT 

Soft limit.

◆ Resource

Enumerator
RESOURCE_CORE 

Core file size.

RESOURCE_CPU 

CPU time.

RESOURCE_DATA 

Data segment size.

RESOURCE_FILE_SIZE 

File size.

RESOURCE_OPEN_FILES 

Number of open files.

RESOURCE_STACK 

Stack size.

RESOURCE_ADDRESS_SPACE 

Address space size.

◆ Variable

Operating system variables.

Member Function Documentation

◆ getErrorCode()

static unsigned int OperatingSystem::getErrorCode ( unsigned int  error)
staticnoexcept

Returns the error code for the specified native error code.

◆ getErrorMessage()

static Literal OperatingSystem::getErrorMessage ( unsigned int  error)
staticnoexcept

Returns a string representation of the specified error code.

◆ getResourceLimit()

static int64 OperatingSystem::getResourceLimit ( Resource  resource,
LimitType  type = SOFT_LIMIT 
)
staticnoexcept

Get resource limit.

Parameters
resourceThe resource limit.
typeSelects between soft and hard limit. The default is SOFT_LIMIT.
Examples
testsuite/Process.cpp.

◆ getVariable()

static long OperatingSystem::getVariable ( Variable  variable)
static

Returns the value of the specified system variable.

◆ setResourceLimit()

static void OperatingSystem::setResourceLimit ( Resource  resource,
int64  limit,
LimitType  type = SOFT_LIMIT 
)
static

Set resource limit.

Parameters
resourceThe resource limit.
limitThe limit.
typeSelects between soft and hard limit. The default is SOFT_LIMIT.

Member Data Documentation

◆ INVALID_HANDLE

const Handle OperatingSystem::INVALID_HANDLE
static

This constants indicates an invalid handle.