Get the size of a character device
#include <sys/ioctl.h> #define TIOCGSIZE TIOCGWINSZ #define TIOCGWINSZ _IOR('t', 104, struct winsize)
Argument | Value |
---|---|
fd | A file descriptor that you obtained by opening the device |
request | TIOCGWINSZ |
Additional argument | A pointer to a struct winsize |
This command gets the size of a character device (also known as the window size). It's also implemented as the DCMD_CHR_GETSIZE devctl() command.
None.
The winsize structure is defined in <sys/ioctl.h> as follows:
struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; };