Rudiments
Public Member Functions | Static Public Member Functions
device Class Reference

Inherits file.

List of all members.

Public Member Functions

 device ()
 device (const device &d)
deviceoperator= (const device &d)
virtual ~device ()

Static Public Member Functions

static bool createDeviceNode (const char *filename, bool blockdevice, uint16_t major, uint16_t minor, mode_t perms)

Detailed Description

The device class provides methods for interacting with devices.

It is different from the file class only in that it provides a method to create a device node and that by default, the device class does not query the device for parameters (such as size) when it is opened but the file class does. Querying a device node for parameters can have unexpected effects.


Constructor & Destructor Documentation

device::device ( )

Creates an instance of the device class.

device::device ( const device d)

Creates an instance of the device class that is a copy of "d".

virtual device::~device ( ) [virtual]

Deletes this instance of the device class.


Member Function Documentation

static bool device::createDeviceNode ( const char *  filename,
bool  blockdevice,
uint16_t  major,
uint16_t  minor,
mode_t  perms 
) [static]

Creates device node "filename" with major number "major" and minor number "minor". The device node will be created as a block device if "blockdevice" is true, otherwise it will be created as a character device. The device node will be assigned permissions "perms". Returns true on success and false on failure.

device& device::operator= ( const device d)

Makes this instance of the device class identical to "d".