device Class Reference

Inherits file.

## Public Member Functions

| device ()
| device (const device &d)
device & | operator= (const device &d)
virtual | ~device ()
Public Member Functions inherited from file
| file ()
| file (const file &f)
file & | operator= (const file &f)
virtual | ~file ()
virtual bool | open (const char *name, int32_t flags)
virtual bool | open (const char *name, int32_t flags, mode_t perms)
virtual bool | create (const char *name, mode_t perms)
virtual char * | getContents ()
virtual ssize_t | getContents (unsigned char *buffer, size_t buffersize)
virtual bool | truncate () const
virtual bool | truncate (off64_t size) const
virtual off64_t | getCurrentPosition () const
virtual off64_t | setPositionRelativeToBeginning (off64_t offset) const
virtual off64_t | setPositionRelativeToCurrent (off64_t offset) const
virtual off64_t | setPositionRelativeToEnd (off64_t offset) const
virtual bool | tryLockFile (int16_t type) const
virtual bool | lockFile (int16_t type) const
virtual bool | checkLockFile (int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | unlockFile () const
virtual bool | tryLockRegion (int16_t type, off64_t start, off64_t len) const
virtual bool | lockRegion (int16_t type, off64_t start, off64_t len) const
virtual bool | checkLockRegion (int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | unlockRegion (off64_t start, off64_t len) const
virtual bool | tryLockFromCurrent (int16_t type, off64_t len) const
virtual bool | tryLockFromCurrent (int16_t type, off64_t start, off64_t len) const
virtual bool | lockFromCurrent (int16_t type, off64_t len) const
virtual bool | lockFromCurrent (int16_t type, off64_t start, off64_t len) const
virtual bool | checkLockFromCurrent (int16_t type, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | checkLockFromCurrent (int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | unlockFromCurrent (off64_t len) const
virtual bool | unlockFromCurrent (off64_t start, off64_t len) const
virtual bool | tryLockFromEnd (int16_t type, off64_t len) const
virtual bool | tryLockFromEnd (int16_t type, off64_t start, off64_t len) const
virtual bool | lockFromEnd (int16_t type, off64_t len) const
virtual bool | lockFromEnd (int16_t type, off64_t start, off64_t len) const
virtual bool | checkLockFromEnd (int16_t type, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | checkLockFromEnd (int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | unlockFromEnd (off64_t len) const
virtual bool | unlockFromEnd (off64_t start, off64_t len) const
virtual bool | tryLockRemainder (int16_t type, off64_t start) const
virtual bool | lockRemainder (int16_t type, off64_t start) const
virtual bool | checkLockRemainder (int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | unlockRemainder (off64_t start) const
virtual bool | tryLockRemainderFromCurrent (int16_t type) const
virtual bool | tryLockRemainderFromCurrent (int16_t type, off64_t start) const
virtual bool | lockRemainderFromCurrent (int16_t type) const
virtual bool | lockRemainderFromCurrent (int16_t type, off64_t start) const
virtual bool | checkLockRemainderFromCurrent (int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | checkLockRemainderFromCurrent (int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | unlockRemainderFromCurrent () const
virtual bool | unlockRemainderFromCurrent (off64_t start) const
virtual bool | tryLockRemainderFromEnd (int16_t type) const
virtual bool | tryLockRemainderFromEnd (int16_t type, off64_t start) const
virtual bool | lockRemainderFromEnd (int16_t type) const
virtual bool | lockRemainderFromEnd (int16_t type, off64_t start) const
virtual bool | checkLockRemainderFromEnd (int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | checkLockRemainderFromEnd (int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
virtual bool | unlockRemainderFromEnd () const
virtual bool | unlockRemainderFromEnd (off64_t start) const
virtual bool | sequentialAccess (off64_t start, size_t len) const
virtual bool | randomAccess (off64_t start, size_t len) const
virtual bool | onlyOnce (off64_t start, size_t len) const
virtual bool | willNeed (off64_t start, size_t len) const
virtual bool | wontNeed (off64_t start, size_t len) const
virtual bool | normalAccess (off64_t start, size_t len) const
virtual bool | reserve (off64_t start, size_t len) const
virtual bool | sync () const
virtual bool | dataSync () const
virtual void | dontGetCurrentPropertiesOnOpen ()
virtual void | getCurrentPropertiesOnOpen ()
virtual bool | getCurrentProperties ()
virtual mode_t | getPermissions () const
virtual uid_t | getOwnerUserId () const
virtual gid_t | getOwnerGroupId () const
virtual off64_t | getSize () const
virtual blksize_t | getBlockSize () const
virtual blkcnt_t | getBlockCount () const
virtual int32_t | isSocket () const
virtual int32_t | isSymbolicLink () const
virtual int32_t | isRegularFile () const
virtual int32_t | isBlockDevice () const
virtual int32_t | isDirectory () const
virtual int32_t | isCharacterDevice () const
virtual int32_t | isFifo () const
virtual time_t | getLastAccessTime () const
virtual time_t | getLastModificationTime () const
virtual time_t | getLastChangeTime () const
virtual dev_t | getDevice () const
virtual dev_t | getDeviceType () const
virtual uint64_t | getInode () const
virtual nlink_t | getNumberOfHardLinks () const
virtual bool | setPermissions (mode_t perms) const
virtual bool | changeOwner (const char *newuser, const char *newgroup) const
virtual bool | changeOwner (uid_t uid, gid_t gid) const
virtual bool | canChangeOwner () const
virtual int64_t | maxLinks () const
virtual void * | getInternalFileStatisticsStructure ()
Public Member Functions inherited from filedescriptor
| filedescriptor ()
| filedescriptor (const filedescriptor &f)
filedescriptor & | operator= (const filedescriptor &f)
virtual | ~filedescriptor ()
virtual bool | close ()
int32_t | getFileDescriptor () const
void | setFileDescriptor (int32_t filedesc)
int32_t | duplicate () const
bool | duplicate (int32_t newfd) const
void | setSecurityContext (securitycontext *ctx)
securitycontext * | getSecurityContext ()
virtual bool | supportsBlockingNonBlockingModes ()
virtual bool | useNonBlockingMode () const
virtual bool | useBlockingMode () const
virtual bool | isUsingNonBlockingMode () const
ssize_t | write (uint16_t number)
ssize_t | write (uint32_t number)
ssize_t | write (uint64_t number)
ssize_t | write (int16_t number)
ssize_t | write (int32_t number)
ssize_t | write (int64_t number)
ssize_t | write (float number)
ssize_t | write (double number)
ssize_t | write (unsigned char character)
ssize_t | write (char character)
ssize_t | write (bool value)
ssize_t | write (const unsigned char *string)
ssize_t | write (const char *string)
ssize_t | write (const unsigned char *string, size_t size)
ssize_t | write (const char *string, size_t length)
ssize_t | write (const void *buffer, size_t size)
ssize_t | write (uint16_t number, int32_t sec, int32_t usec)
ssize_t | write (uint32_t number, int32_t sec, int32_t usec)
ssize_t | write (uint64_t number, int32_t sec, int32_t usec)
ssize_t | write (int16_t number, int32_t sec, int32_t usec)
ssize_t | write (int32_t number, int32_t sec, int32_t usec)
ssize_t | write (int64_t number, int32_t sec, int32_t usec)
ssize_t | write (float number, int32_t sec, int32_t usec)
ssize_t | write (double number, int32_t sec, int32_t usec)
ssize_t | write (unsigned char character, int32_t sec, int32_t usec)
ssize_t | write (char character, int32_t sec, int32_t usec)
ssize_t | write (bool value, int32_t sec, int32_t usec)
ssize_t | write (const unsigned char *string, int32_t sec, int32_t usec)
ssize_t | write (const char *string, int32_t sec, int32_t usec)
ssize_t | write (const unsigned char *string, size_t size, int32_t sec, int32_t usec)
ssize_t | write (const char *string, size_t size, int32_t sec, int32_t usec)
ssize_t | write (const void *buffer, size_t size, int32_t sec, int32_t usec)
size_t | printf (const char *format,...)
size_t | printf (const char *format, va_list *argp)
void | safePrint (unsigned char c)
void | safePrint (const unsigned char *str)
void | safePrint (const unsigned char *str, int32_t length)
void | safePrint (char c)
void | safePrint (const char *str)
void | safePrint (const char *str, int32_t length)
void | printBits (unsigned char value)
void | printBits (uint16_t value)
void | printBits (uint32_t value)
void | printBits (uint64_t value)
void | printBits (char value)
void | printBits (int16_t value)
void | printBits (int32_t value)
void | printBits (int64_t value)
void | printBits (const unsigned char *bits, uint64_t size)
ssize_t | read (uint16_t *buffer)
ssize_t | read (uint32_t *buffer)
ssize_t | read (uint64_t *buffer)
ssize_t | read (int16_t *buffer)
ssize_t | read (int32_t *buffer)
ssize_t | read (int64_t *buffer)
ssize_t | read (float *buffer)
ssize_t | read (double *buffer)
ssize_t | read (unsigned char *buffer)
ssize_t | read (char *buffer)
ssize_t | read (bool *buffer)
ssize_t | read (unsigned char *buffer, size_t size)
ssize_t | read (char *buffer, size_t length)
ssize_t | read (void *buf, size_t size)
ssize_t | read (char **buffer, const char *terminator)
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes)
ssize_t | read (uint16_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (uint32_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (uint64_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (int16_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (int32_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (int64_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (float *buffer, int32_t sec, int32_t usec)
ssize_t | read (double *buffer, int32_t sec, int32_t usec)
ssize_t | read (unsigned char *buffer, int32_t sec, int32_t usec)
ssize_t | read (char *buffer, int32_t sec, int32_t usec)
ssize_t | read (bool *buffer, int32_t sec, int32_t usec)
ssize_t | read (unsigned char *buffer, size_t size, int32_t sec, int32_t usec)
ssize_t | read (char *buffer, size_t size, int32_t sec, int32_t usec)
ssize_t | read (void *buf, size_t size, int32_t sec, int32_t usec)
ssize_t | read (char **buffer, const char *terminator, int32_t sec, int32_t usec)
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec)
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec)
int32_t | waitForNonBlockingRead (int32_t sec, int32_t usec) const
int32_t | waitForNonBlockingWrite (int32_t sec, int32_t usec) const
void | retryInterruptedReads ()
void | dontRetryInterruptedReads ()
bool | getRetryInterruptedReads () const
void | retryInterruptedWrites ()
void | dontRetryInterruptedWrites ()
bool | getRetryInterruptedWrites () const
void | retryInterruptedWaits ()
void | dontRetryInterruptedWaits ()
bool | getRetryInterruptedWaits () const
void | retryInterruptedFcntl ()
void | dontRetryInterruptedFcntl ()
bool | getRetryInterruptedFcntl () const
void | retryInterruptedIoctl ()
void | dontRetryInterruptedIoctl ()
bool | getRetryInterruptedIoctl () const
void | allowShortReads ()
void | dontAllowShortReads ()
void | allowShortWrites ()
void | dontAllowShortWrites ()
virtual bool | passFileDescriptor (int32_t fd)
virtual bool | receiveFileDescriptor (int32_t *fd)
virtual bool | passSocket (int32_t sock)
virtual bool | receiveSocket (int32_t *sock)
void | translateByteOrder ()
void | dontTranslateByteOrder ()
virtual int32_t | fCntl (int32_t command, long arg) const
virtual int32_t | ioCtl (int32_t command, void *arg) const
bool | useNaglesAlgorithm ()
bool | dontUseNaglesAlgorithm ()
bool | setSocketWriteBufferSize (int32_t size)
bool | getSocketWriteBufferSize (int32_t *size)
bool | setSocketReadBufferSize (int32_t size)
bool | getSocketReadBufferSize (int32_t *size)
bool | disableIPv4 ()
bool | enableIPv4 ()
const char * | getType () const
char * | getPeerAddress () const
bool | setWriteBufferSize (ssize_t size) const
bool | flushWriteBuffer (int32_t sec, int32_t usec)
bool | setReadBufferSize (ssize_t size) const
bool | closeOnExec ()
bool | dontCloseOnExec ()
bool | getCloseOnExec ()

## Static Public Member Functions

static bool | createDeviceNode (const char *filename, bool blockdevice, uint16_t major, uint16_t minor, mode_t perms)
Static Public Member Functions inherited from file
static bool | createFile (const char *name, mode_t perms)
static bool | createFifo (const char *filename, mode_t perms)
static int32_t | createTemporaryFile (char *templatefilename)
static int32_t | createTemporaryFile (char *templatefilename, mode_t perms)
static bool | createHardLink (const char *oldpath, const char *newpath)
static bool | createSymbolicLink (const char *oldpath, const char *newpath)
static char * | resolveSymbolicLink (const char *filename)
static bool | rename (const char *oldpath, const char *newpath)
static bool | remove (const char *filename)
static bool | truncate (const char *filename)
static bool | truncate (const char *filename, off64_t size)
static char * | getContents (const char *name)
static ssize_t | getContents (const char *name, unsigned char *buffer, size_t buffersize)
static bool | exists (const char *filename)
static bool | readable (const char *filename)
static bool | writeable (const char *filename)
static bool | executable (const char *filename)
static bool | accessible (const char *filename, int32_t mode)
static bool | getLastChangeTime (const char *filename, time_t *ctime)
static bool | setPermissions (const char *filename, mode_t perms)
static bool | changeOwner (const char *filename, const char *newuser, const char *newgroup)
static bool | changeOwner (const char *filename, uid_t uid, gid_t gid)
static bool | canChangeOwner (const char *filename)
static bool | setLastAccessTime (const char *filename, time_t lastaccesstime)
static bool | setLastModificationTime (const char *filename, time_t lastmodtime)
static bool | setLastAccessAndModificationTimes (const char *filename, time_t lastaccesstime, time_t lastmodtime)
static bool | setLastAccessAndModificationTimes (const char *filename)
static char * | dirname (const char *filename)
static char * | basename (const char *filename)
static char * | basename (const char *filename, const char *ext)
static char * | extension (const char *filename)
static char * | eightDotThree (const char *filename)
static key_t | generateKey (const char *filename, int32_t id)
static int64_t | maxLinks (const char *filename)
Static Public Member Functions inherited from filedescriptor
static bool | createPipe (filedescriptor *readfd, filedescriptor *writefd)
static uint16_t | hostToNet (uint16_t value)
static uint32_t | hostToNet (uint32_t value)
static uint64_t | hostToNet (uint64_t value)
static uint16_t | netToHost (uint16_t value)
static uint32_t | netToHost (uint32_t value)
static uint64_t | netToHost (uint64_t value)
static uint16_t | hostToLittleEndian (uint16_t value)
static uint32_t | hostToLittleEndian (uint32_t value)
static uint64_t | hostToLittleEndian (uint64_t value)
static uint16_t | littleEndianToHost (uint16_t value)
static uint32_t | littleEndianToHost (uint32_t value)
static uint64_t | littleEndianToHost (uint64_t value)

## 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() [1/2]

device::device | ( |  | ) |

Creates an instance of the device class.

## device() [2/2]

device::device | ( | const device & | d | ) |

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

## ~device()

virtual device::~device | ( |  | ) |

virtual

Deletes this instance of the device class.

## Member Function Documentation

## createDeviceNode()

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.

## operator=()

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

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