Fix virtual_terminal.cpp build on FreeBSD
- need to shuffle some Linux includes behind an ifdef, and some FreeBSD ones as well - FreeBSD has no notion of major device numbers anymore, so the isTty() function can't really tell. Just ignore the check -- I'm assuming the somewhat-standard isatty() doesn't do what is wanted, since otherwise it would be used.
This commit is contained in:
parent
33aff4fcd0
commit
8826c7ff34
1 changed files with 11 additions and 1 deletions
|
@ -26,16 +26,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QDebug>
|
||||
#include <QSocketNotifier>
|
||||
// linux
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <linux/major.h>
|
||||
#include <linux/kd.h>
|
||||
#include <linux/vt.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
#ifdef Q_OS_FREEBSD
|
||||
#include <sys/consio.h>
|
||||
#endif
|
||||
// system
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/signalfd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
// c++
|
||||
#include <csignal>
|
||||
|
||||
|
@ -81,9 +86,14 @@ static bool isTty(int fd)
|
|||
if (fstat(fd, &st) == -1) {
|
||||
return false;
|
||||
}
|
||||
#ifdef Q_OS_LINUX
|
||||
// Not a TTY device or weird vt number, skip it
|
||||
if (major(st.st_rdev) != TTY_MAJOR || minor (st.st_rdev) <= 0 || minor(st.st_rdev) >= 64) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
// FreeBSD doesn't have a notion of major device number, so nothing
|
||||
// to check. isatty() might not do the trick.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue