Index: include/termios.h =================================================================== --- include/termios.h +++ include/termios.h @@ -85,6 +85,8 @@ #if __POSIX_VISIBLE >= 200112 pid_t tcgetsid(int); +int tcgetwinsize(int, struct winsize *); +int tcsetwinsize(int, const struct winsize *); #endif #if __BSD_VISIBLE int tcsetsid(int, pid_t); @@ -98,6 +100,5 @@ #endif /* !_TERMIOS_H_ */ #if __BSD_VISIBLE -#include #include #endif Index: lib/libc/gen/Symbol.map =================================================================== --- lib/libc/gen/Symbol.map +++ lib/libc/gen/Symbol.map @@ -428,6 +428,8 @@ sigandset; sigisemptyset; sigorset; + tcgetwinsize; + tcsetwinsize; }; FBSDprivate_1.0 { Index: lib/libc/gen/termios.c =================================================================== --- lib/libc/gen/termios.c +++ lib/libc/gen/termios.c @@ -275,3 +275,17 @@ } /* NOTREACHED */ } + +int +tcgetwinsize(int fd, struct winsize *w) +{ + + return (_ioctl(fd, TIOCGWINSZ, w)); +} + +int +tcsetwinsize(int fd, const struct winsize *w) +{ + + return (_ioctl(fd, TIOCSWINSZ, w)); +} Index: sys/sys/_termios.h =================================================================== --- sys/sys/_termios.h +++ sys/sys/_termios.h @@ -227,4 +227,20 @@ speed_t c_ospeed; /* output speed */ }; +#if __POSIX_VISIBLE >= 200112 +#ifndef _STRUCT_WINSIZE_DEFINED +#define _STRUCT_WINSIZE_DEFINED +/* + * Window/terminal size structure. This information is stored by the kernel + * in order to provide a consistent interface, but is not used by the kernel. + */ +struct winsize { + unsigned short ws_row; /* rows, in characters */ + unsigned short ws_col; /* columns, in characters */ + unsigned short ws_xpixel; /* horizontal size, pixels */ + unsigned short ws_ypixel; /* vertical size, pixels */ +}; +#endif /* !_STRUCT_WINSIZE_DEFINED */ +#endif /* __POSIX_VISIBLE >= 200112 */ + #endif /* !_SYS__TERMIOS_H_ */ Index: sys/sys/ttycom.h =================================================================== --- sys/sys/ttycom.h +++ sys/sys/ttycom.h @@ -47,6 +47,8 @@ * with the old tty driver. */ +#ifndef _STRUCT_WINSIZE_DEFINED +#define _STRUCT_WINSIZE_DEFINED /* * Window/terminal size structure. This information is stored by the kernel * in order to provide a consistent interface, but is not used by the kernel. @@ -57,6 +59,7 @@ unsigned short ws_xpixel; /* horizontal size, pixels */ unsigned short ws_ypixel; /* vertical size, pixels */ }; +#endif /* !_STRUCT_WINSIZE_DEFINED */ /* 0-2 compat */ /* 3-7 unused */