26. Operation System Specific

26.1. POSIX


Method alarm

int alarm(int seconds)

Description

Set an alarm clock for delivery of a signal.

alarm() arranges for a SIGALRM signal to be delivered to the process in seconds seconds.

If seconds is 0 (zero), no new alarm will be scheduled.

Any previous alarms will in any case be canceled.

Returns

Returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm.

Note

This function is only available on platforms that support signals.

See also

ualarm(), signal(), call_out()


Method fork

object fork()

Description

Fork the process in two.

Fork splits the process in two, and for the parent it returns a pid object for the child. Refer to your Unix manual for further details.

Note

This function can cause endless bugs if used without proper care.

This function is disabled when using threads.

This function is not available on all platforms.

The most common use for fork is to start sub programs, which is better done with Process.create_process().

See also

Process.create_process()


Method exece

int exece(string file, array(string) args)
int exece(string file, array(string) args, mapping(string:string) env)

Description

This function transforms the Pike process into a process running the program specified in the argument file with the arguments args.

If the mapping env is present, it will completely replace all environment variables before the new program is executed.

Returns

This function only returns if something went wrong during exece(2), and in that case it returns 0 (zero).

Note

The Pike driver _dies_ when this function is called. You must either use fork() or Process.create_process() if you wish to execute a program and still run the Pike runtime.

This function is not available on all platforms.

See also

Process.create_process(), fork(), Stdio.File->pipe()

26.2. Apple OS X

Module Apple

Class Apple.Keychain

Description

Support for the Apple Keychain format.

This is used for the files in eg /System/Library/Keychains.

26.3. Microsoft Windows

26.3.1. Registry handling


Method RegGetKeyNames

array(string) RegGetKeyNames(int hkey, string key)

Description

Get a list of value key names from the register.

Parameter hkey

One of the following:

HKEY_CLASSES_ROOT
HKEY_LOCAL_MACHINE
HKEY_CURRENT_USER
HKEY_USERS
Parameter key

A registry key.

Returns

Returns an array of value keys stored at the specified location if any. Returns UNDEFINED on missing key. Throws errors on other failures.

Example

> RegGetKeyNames(HKEY_CURRENT_USER, "Keyboard Layout"); (1) Result: ({ "IMEtoggle", "Preload", "Substitutes", "Toggle" })

Note

This function is only available on Win32 systems.

See also

RegGetValue(), RegGetValues()


Method RegGetValue

string|int|array(string) RegGetValue(int hkey, string key, string index, bool|void no_expand)

Description

Get a single value from the register.

Parameter hkey

One of the following:

HKEY_CLASSES_ROOT
HKEY_LOCAL_MACHINE
HKEY_CURRENT_USER
HKEY_USERS
Parameter key

Registry key.

Parameter index

Value name.

Parameter no_expand

Set this to 1 to not expand variables in REG_EXPAND_SZ-values.

Returns

Returns the value stored at the specified location in the register if any. Returns UNDEFINED on missing keys, throws errors on other failures.

Note

This function is only available on Win32 systems.

Note

Prior to Pike 9.0 REG_EXPAND_SZ-values were always expanded.

See also

RegGetValues(), RegGetKeyNames()


Method RegGetValues

mapping(string:string|int|array(string)) RegGetValues(int hkey, string key, bool|void no_expand)

Description

Get multiple values from the register.

Parameter hkey

One of the following:

HKEY_CLASSES_ROOT
HKEY_LOCAL_MACHINE
HKEY_CURRENT_USER
HKEY_USERS
Parameter key

Registry key.

Parameter no_expand

Set this to 1 to not expand variables in REG_EXPAND_SZ-values.

Returns

Returns a mapping with all the values stored at the specified location in the register if any. Returns UNDEFINED on missing key. Throws errors on other failures.

Example

> RegGetValues(HKEY_CURRENT_USER, "Keyboard Layout\\Preload"); (5) Result: ([ "1":"0000041d" ])

Note

This function is only available on Win32 systems.

Note

Prior to Pike 9.0 REG_EXPAND_SZ-values were always expanded.

See also

RegGetValue(), RegGetKeyNames()