sysfs.h revision 4d0d9097df43f55a27ac86bdd587e8c217493e62
/** @defgroup grp_rt_mp RTLinuxSysfs - Linux sysfs * Checks if a sysfs file (or directory, device, symlink, whatever) exists. * @returns true / false, errno is preserved. * @param pszFormat The name format, either absolute or relative to "/sys/". * @param va The format args. * Checks if a sysfs file (or directory, device, symlink, whatever) exists. * @returns true / false, errno is preserved. * @param pszFormat The name format, either absolute or relative to "/sys/". * @param ... The format args. * @returns The file descriptor. -1 and errno on failure. * @param pszFormat The name format, either absolute or relative to "/sys/". * @param va The format args. * @returns The file descriptor. -1 and errno on failure. * @param pszFormat The name format, either absolute or relative to "/sys/". * @param ... The format args. * Closes a file opened with RTLinuxSysFsOpen or RTLinuxSysFsOpenV. * @param fd File descriptor returned by RTLinuxSysFsOpen or * Reads a string from a file opened with RTLinuxSysFsOpen or RTLinuxSysFsOpenV. * @returns The number of bytes read. -1 and errno on failure. * @param fd The file descriptor returned by RTLinuxSysFsOpen or RTLinuxSysFsOpenV. * @param pszBuf Where to store the string. * @param cchBuf The size of the buffer. Must be at least 2 bytes. * Reads a number from a sysfs file. * @returns 64-bit signed value on success, -1 and errno on failure. * @param uBase The number base, 0 for autodetect. * @param pszFormat The filename format, either absolute or relative to "/sys/". * Reads a number from a sysfs file. * @returns 64-bit signed value on success, -1 and errno on failure. * @param uBase The number base, 0 for autodetect. * @param pszFormat The filename format, either absolute or relative to "/sys/". * @param ... Format args. * Reads a device number from a sysfs file. * @returns device number on success, 0 and errno on failure. * @param pszFormat The filename format, either absolute or relative to "/sys/". * Reads a device number from a sysfs file. * @returns device number on success, 0 and errno on failure. * @param pszFormat The filename format, either absolute or relative to "/sys/". * @param ... Format args. * Reads a string from a sysfs file. If the file contains a newline, we only * return the text up until there. * @returns number of characters read on success, -1 and errno on failure. * @param pszBuf Where to store the path element. Must be at least two * characters, but a longer buffer would be advisable. * @param cchBuf The size of the buffer pointed to by @a pszBuf. * @param pszFormat The filename format, either absolute or relative to "/sys/". * Reads a string from a sysfs file. If the file contains a newline, we only * return the text up until there. * @returns number of characters read on success, -1 and errno on failure. * @param pszBuf Where to store the path element. Must be at least two * characters, but a longer buffer would be advisable. * @param cchBuf The size of the buffer pointed to by @a pszBuf. * @param pszFormat The filename format, either absolute or relative to "/sys/". * @param ... Format args. * Reads the last element of the path of the file pointed to by the symbolic * This is needed at least to get the name of the driver associated with a * device, where pszFormat should be the "driver" link in the devices sysfs * @returns The number of characters written on success, -1 and errno on failure. * @param pszBuf Where to store the path element. Must be at least two * characters, but a longer buffer would be advisable. * @param cchBuf The size of the buffer pointed to by @a pszBuf. * @param pszFormat The filename format, either absolute or relative to "/sys/". * Reads the last element of the path of the file pointed to by the symbolic * This is needed at least to get the name of the driver associated with a * device, where pszFormat should be the "driver" link in the devices sysfs * @returns The number of characters written on success, -1 and errno on failure. * @param pszBuf Where to store the path element. Must be at least two * characters, but a longer buffer would be advisable. * @param cchBuf The size of the buffer pointed to by @a pszBuf. * @param pszFormat The filename format, either absolute or relative to "/sys/". * @param ... Format args. * Find the path of a device node under /dev, given then device number. This * function will recursively search under /dev until it finds a device node * matching @a devnum, and store the path into @a pszBuf. The caller may * provide an expected path in pszSuggestion, which will be tried before * searching, but due to the variance in Linux systems it can be hard to always * correctly predict the path. * @returns the number of characters written on success, -1 and errno on * @returns -1 and ENOENT if no matching device node could be found * @param devNum the device number to search for * @param fMode the type of device - only RTFS_TYPE_DEV_CHAR * and RTFS_TYPE_DEV_BLOCK are valid values * @param pszBuf where to store the path * @param cchBuf the size of the buffer * @param pszSuggestion the expected path format of the device node, either * absolute or relative to "/dev" (optional) * Find the path of a device node under /dev, given then device number. This * function will recursively search under /dev until it finds a device node * matching @a devnum, and store the path into @a pszBuf. The caller may * provide an expected path in pszSuggestion, which will be tried before * searching, but due to the variance in Linux systems it can be hard to always * correctly predict the path. * @returns the number of characters written on success, -1 and errno on * @returns -1 and ENOENT if no matching device node could be found * @param devNum the device number to search for * @param fMode the type of device - only RTFS_TYPE_DEV_CHAR * and RTFS_TYPE_DEV_BLOCK are valid values * @param pszBuf where to store the path * @param cchBuf the size of the buffer * @param pszSuggestion the expected path format of the device node, either * absolute or relative to "/dev" (optional) * @param ... Format args.