Types and Constants v0.1.0

Source
Types and constants exported by the Bsd package.

Package: Bsd

Standard File Descriptors

NameTypeValueDescription
StdInint320Standard input.
StdOutint321Standard output.
StdErrint322Standard error.

A process may close or redirect these conventional descriptors.

Syscall Numbers

These numbers are the same on all four supported BSDs:

NameTypeValue
SysExituint641
SysReaduint643
SysWriteuint644
SysCloseuint646
SysBrkuint6417
SysGetPiduint6420
SysMunmapuint6473

SysMmap, SysNanosleep, and SysClockGetTime are also exported, but their values are selected for the active target, since they differ between FreeBSD, OpenBSD, NetBSD, and DragonFly BSD.

Memory Protection

NameTypeValueDescription
ProtectionNoneint320No access.
ProtectionReadint321Pages may be read.
ProtectionWriteint322Pages may be written.
ProtectionExecuteint324Pages may be executed.

Mapping Flags

NameTypeValueDescription
MapSharedint321Create a shared mapping.
MapPrivateint322Create a private copy-on-write mapping.
MapFixedint3216Place the mapping at the exact address.
MapAnonymousint324096Create a mapping not backed by a file.

These values are shared by all four supported BSDs.

Clock IDs

NameTypeValueDescription
ClockRealtimeint320Adjustable wall-clock time.
ClockMonotonicint324/3Monotonic time for interval measurement.

ClockMonotonic is 4 on FreeBSD and DragonFly BSD and 3 on NetBSD and OpenBSD; the package selects the right value for the active target. Use these constants with ClockGetTime.

Timespec

struct Timespec {
    seconds: int64;
    nanoseconds: int64;
}
FieldTypeDescription
secondsint64Whole seconds.
nanosecondsint64Nanoseconds within the second, normally 0–999,999,999.

Used by Nanosleep and ClockGetTime.

See also