bsd_init.c: fix build on OpenBSD

isolate NetBSD specific VGAPCVTID ioctl(2) call.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
This commit is contained in:
Matthieu Herrb 2024-02-19 00:40:04 +00:00 committed by Peter Hutterer
parent 584a9715c3
commit 0d4a7ed684

View File

@ -454,7 +454,9 @@ xf86OpenPcvt()
int fd = -1; int fd = -1;
vtmode_t vtmode; vtmode_t vtmode;
char vtname[12], *vtprefix; char vtname[12], *vtprefix;
#ifdef __NetBSD__
struct pcvtid pcvt_version; struct pcvtid pcvt_version;
#endif
#ifndef __OpenBSD__ #ifndef __OpenBSD__
vtprefix = "/dev/ttyv"; vtprefix = "/dev/ttyv";
@ -470,7 +472,9 @@ xf86OpenPcvt()
} }
#endif #endif
if (fd >= 0) { if (fd >= 0) {
#ifdef __NetBSD__
if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) { if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) {
#endif
if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
FatalError("%s: VT_GETMODE failed\n%s%s\n%s", FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
"xf86OpenPcvt", "xf86OpenPcvt",
@ -521,20 +525,28 @@ xf86OpenPcvt()
} }
xf86Info.consType = PCVT; xf86Info.consType = PCVT;
#ifdef WSCONS_SUPPORT #ifdef WSCONS_SUPPORT
#ifdef __NetBSD__
xf86Msg(X_PROBED, xf86Msg(X_PROBED,
"Using wscons driver on %s in pcvt compatibility mode " "Using wscons driver on %s in pcvt compatibility mode "
"(version %d.%d)\n", vtname, "(version %d.%d)\n", vtname,
pcvt_version.rmajor, pcvt_version.rminor); pcvt_version.rmajor, pcvt_version.rminor);
#else
xf86Msg(X_PROBED,
"Using wscons driver on %s in pcvt compatibility mode ",
vtname);
#endif
#else #else
xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n", xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
pcvt_version.rmajor, pcvt_version.rminor); pcvt_version.rmajor, pcvt_version.rminor);
#endif #endif
#ifdef __NetBSD__
} }
else { else {
/* Not pcvt */ /* Not pcvt */
close(fd); close(fd);
fd = -1; fd = -1;
} }
#endif
} }
return fd; return fd;
} }