amalthea.sys

This file is part of the Amalthea library. Copyright (C) 2018-2024 Eugene 'Vindex' Stulin Distributed under the BSL 1.0 or (at your option) the GNU LGPL 3.0 or later.

The module provides mostly wrappers for low-level system functions, including functions for mounting/unmounting file systems, functions for working with loop devices, functions for getting information about users and groups, functions for mappings, for working with signals, etc.

Public Imports

amalthea.libcore
public import amalthea.libcore;
Undocumented in source.

Members

Aliases

anonMapping
alias anonMapping = createAnonymousMapping
Undocumented in source.
c_sigfn_t
alias c_sigfn_t = void function(int)
Undocumented in source.
create_anonymous_mapping
deprecated alias create_anonymous_mapping = createAnonymousMapping
Undocumented in source.
d_sigfn_int_t
alias d_sigfn_int_t = void function(int)
Undocumented in source.
d_sigfn_t
alias d_sigfn_t = void function(Signal)
Undocumented in source.
free_anonymous_mapping
deprecated alias free_anonymous_mapping = freeAnonymousMapping
Undocumented in source.
getGroupIdWithName
deprecated alias getGroupIdWithName = getGroupIdByName
Undocumented in source.
isTTY
alias isTTY = amalthea.terminal.isTTY
Undocumented in source.
isTerminal
alias isTerminal = amalthea.terminal.isTerminal
Undocumented in source.
loopctl
alias loopctl = LoopDevControl
Undocumented in source.

Classes

LoopDevControl
class LoopDevControl

Set of functions for loop device management. See also: man 4 loop

SysException
class SysException

Exception for functions of this module

Enums

EX_USAGE
anonymousenum EX_USAGE

Exit codes for programs. Codes and descriptions were copied from https://man.openbsd.org/sysexits.3

MapMode
enum MapMode

Enumeration of access modes for mappings.

Signal
enum Signal

UNIX signal enumeration.

Functions

addSignalHandler
void addSignalHandler(S sig, H handler)

The function sets the handler for the signal number.

c_system
int c_system(string cmd)

Common function for calling external programs.

createAnonymousMapping
void* createAnonymousMapping(size_t size)

Allocates memory using anonymous mapping. New memory will contain zeros.

createMapping
void* createMapping(File f, size_t size, MapMode mode)

Creates a new mapping for the specified file.

createPipe
void createPipe(string pipepath, uint mode)

The function creates named pipe.

destroyMapping
void destroyMapping(T* p, size_t size)

Releases the mapping.

freeAnonymousMapping
deprecated void freeAnonymousMapping(void* p, size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
getAppHelpDir
string getAppHelpDir()

Helper function for getting the standard path to the help directory of the current program.

getAppPath
string getAppPath(string app)

Returns file path to the application (searches among system directories).

getAppShareDir
string getAppShareDir()

Helper function for getting the standard path to the share directory of the current program.

getGroupIdByName
uint getGroupIdByName(string groupName)

Returns group numeric identifier, given the known group name.

getGroups
gid_t[] getGroups(gid_t uid)

Returns all system group IDs (if UID isn't specified) or group IDs that the specified user is associated with.

getNameByGID
string getNameByGID(uint gid)

The function returns group name by group ID.

getNameByUID
string getNameByUID(uint uid)

The function returns user name by user ID.

getSignalDescription
string getSignalDescription(Signal signal)

Gets UNIX signal string view.

getSignalDescription
string getSignalDescription(int signum)
Undocumented in source. Be warned that the author may not have intended to support it.
getTimeString (from amalthea.time)
string getTimeString(timestamp_t t) via public import amalthea.time : getTimeString;

Gets a time string by timestamp (only seconds from timestamp is used).

getpagesize
int getpagesize()

Gets memory page size. See: man getpagesize

mount
void mount(string source, string target, string fs, ulong flags, void* data)

Attaches the filesystem specified by source.

readAppHelpText
string readAppHelpText(string app, string lang)

This function returns help text of the current program using standard paths for help file.

setupSignalHandler
deprecated void setupSignalHandler(int sig, c_sigfn_t handler)
Undocumented in source. Be warned that the author may not have intended to support it.
setupSignalHandler
deprecated void setupSignalHandler(int sig, void function(int) handler)
Undocumented in source. Be warned that the author may not have intended to support it.
setupSignalHandler
deprecated void setupSignalHandler(Signal sig, void function(Signal) handler)
Undocumented in source. Be warned that the author may not have intended to support it.
umount
void umount(string target)

Removes the attachment of the filesystem mounted on target.

Manifest constants

MS_ACTIVE
enum MS_ACTIVE;
Undocumented in source.
MS_BIND
enum MS_BIND;
Undocumented in source.
MS_DIRSYNC
enum MS_DIRSYNC;
Undocumented in source.
MS_I_VERSION
enum MS_I_VERSION;
Undocumented in source.
MS_KERNMOUNT
enum MS_KERNMOUNT;
Undocumented in source.
MS_LAZYTIME
enum MS_LAZYTIME;
Undocumented in source.
MS_MANDLOCK
enum MS_MANDLOCK;
Undocumented in source.
MS_MOVE
enum MS_MOVE;
Undocumented in source.
MS_NOATIME
enum MS_NOATIME;
Undocumented in source.
MS_NODEV
enum MS_NODEV;
Undocumented in source.
MS_NODIRATIME
enum MS_NODIRATIME;
Undocumented in source.
MS_NOEXEC
enum MS_NOEXEC;
Undocumented in source.
MS_NOSUID
enum MS_NOSUID;
Undocumented in source.
MS_NOSYMFOLLOW
enum MS_NOSYMFOLLOW;
Undocumented in source.
MS_NOUSER
enum MS_NOUSER;
Undocumented in source.
MS_POSIXACL
enum MS_POSIXACL;
Undocumented in source.
MS_PRIVATE
enum MS_PRIVATE;
Undocumented in source.
MS_RDONLY
enum MS_RDONLY;
Undocumented in source.
MS_REC
enum MS_REC;
Undocumented in source.
MS_RELATIME
enum MS_RELATIME;
Undocumented in source.
MS_REMOUNT
enum MS_REMOUNT;
Undocumented in source.
MS_SHARED
enum MS_SHARED;
Undocumented in source.
MS_SILENT
enum MS_SILENT;
Undocumented in source.
MS_SLAVE
enum MS_SLAVE;
Undocumented in source.
MS_STRICTATIME
enum MS_STRICTATIME;
Undocumented in source.
MS_SYNCHRONOUS
enum MS_SYNCHRONOUS;
Undocumented in source.
MS_UNBINDABLE
enum MS_UNBINDABLE;
Undocumented in source.

Structs

loop_info64
struct loop_info64
Undocumented in source.

Meta