Haiku API Bindings
The Node Monitor
Not logged in

Documentation | StorageKit | The Node Monitor

SYNOPSIS

Perl

use HaikuR1::NodeMonitor qw(watch_node B_WATCH_NAME);

watch_node($node, B_WATCH_NAME, $target);

Python

from HaikuR1.StorageKit import watch_node, B_WATCH_NAME

watch_node(node, B_WATCH_NAME, $target);

DESCRIPTION

Exposes the node monitor function.

For more information on the node monitor, see the Be Book class description and the Haiku Book class description.

FUNCTIONS

Watching

watch_volume

watch_node

stop_watching

watch_node will watch a specific node for certain changes, or for volume mounting and unmounting.

watch_volume will watch all nodes on a volume for certain changes.

stop_watching will stop sending notifications to the given target.

The notification will come in the form of a Message with a what value of B_NODE_MONITOR and a field called opcode, which will be one of the opcode constants.

To watch for mounting and unmounting: Use watch_node with an empty value in place of the node. watch_volume is used to watch all nodes on a volume, not to watch volumes.

(Actually, the node does not have to be empty; you could combine node flags with B_WATCH_MOUNT, and you will get notifications for both the given node and for volume mounting.)

To stop watching a node: Use B_STOP_WATCHING with watch_node. stop_watching stops all notifications to a given target.

Perl

HaikuR1::NodeMonitor::watch_node($node, $flags, $target);
HaikuR1::NodeMonitor::watch_volume($volume, $flags, $target, $looper);
HaikuR1::NodeMonitor::stop_watching($target);

Python

NodeMonitor.watch_node(node, flags, target)
NodeMonitor.watch_volume(volume, flags, target, looper)
NodeMonitor.stop_watching(target)

CONSTANTS

Cause

When the B_ATTR_CHANGED notification is sent, the message will have a cause field, which can either be B_ATTR_CHANGED itself, or one of the following:

Perl

use HaikuR1::NodeMonitor qw(:cause)

Python

Python does not support export tags.

Fields

When the B_STAT_CHANGED notification is sent, the message will have a fields field, which will be an integer combining the following values, representing which part of the stat actually changed.

Perl

use HaikuR1::NodeMonitor qw(:fields)

Python

Python does not support export tags.

Flags

These are the values you pass to watch_node or watch_volume.

Perl

use HaikuR1::NodeMonitor qw(:flags)

Python

Python does not support export tags.

Opcodes

These are sent in the opcode field of the notification message and indicate the type of notification.

Perl

use HaikuR1::NodeMonitor qw(:opcodes)

Python

Python does not support export tags.