Initial netbsd support

This commit is contained in:
illiliti 2022-03-04 06:10:27 +03:00 committed by Kenny Levinsen
parent 1990f9b034
commit 4ad48cb305
7 changed files with 84 additions and 4 deletions

View file

@ -6,6 +6,11 @@
#include <sys/sysmacros.h>
#endif
#if defined(__NetBSD__)
#include <stdlib.h>
#include <sys/stat.h>
#endif
#include "drm.h"
// From libdrm
@ -40,6 +45,16 @@ int path_is_drm(const char *path) {
static const int prefixlen = STRLEN(prefix);
return strncmp(prefix, path, prefixlen) == 0;
}
#elif defined(__NetBSD__)
int path_is_drm(const char *path) {
static const char prefix[] = "/dev/dri/";
static const int prefixlen = STRLEN(prefix);
return strncmp(prefix, path, prefixlen) == 0;
}
int dev_is_drm(dev_t device) {
return major(device) == getdevmajor("drm", S_IFCHR);
}
#else
#error Unsupported platform
#endif