1. Adam Hoka
  2. oss4-netbsd

Commits

Hannu Savolainen  committed 233e1ce

Fixes for FreeBSD

  • Participants
  • Parent commits 1a5c537
  • Branches default

Comments (0)

Files changed (1)

File kernel/OS/FreeBSD/os_freebsd.c

View file
 #include "midi_core.h"
 #include <oss_pci.h>
 #include <sys/conf.h>
+#include <sys/module.h>
 #include <sys/proc.h>
 #include <sys/sx.h>
 #include <sys/mman.h>
 
   if (cards[cardnum]->name != NULL)
     strncpy (ci->longname, cards[cardnum]->name, 128);
-  ci->shortname[127] = 0;
+  ci->longname[127] = 0;
 
   if (cards[cardnum]->nick != NULL)
     strncpy (ci->shortname, cards[cardnum]->nick, 16);
 
   if (!(flags & CHDEV_VIRTUAL) && (name != NULL))
     {
+#if __FreeBSD_version >= 900023
+      bsd_cdev =
+	make_dev_credf (MAKEDEV_CHECKNAME, &oss_cdevsw, num, NULL,
+			UID_ROOT, GID_WHEEL, 0666, name, 0);
+      if (bsd_cdev == NULL)
+	{
+	  cmn_err (CE_WARN, "Cannot allocate device node /dev/%s\n", name);
+	  return;
+	}
+#else
       bsd_cdev =
 	make_dev (&oss_cdevsw, num, UID_ROOT, GID_WHEEL, 0666, name, 0);
+#endif
       cdev->info = bsd_cdev;
     }
 }
 {
   oss_device_t *osdev;
 
+  if (module_lookupbyname("sound") != NULL)
+    {
+      cmn_err (CE_WARN, "Open Sound System conflicts with FreeBSD driver\n");
+      cmn_err (CE_CONT, "Please remove sound(4) from kernel or unload it\n");
+      return EBUSY;
+    }
   if ((osdev = PMALLOC (NULL, sizeof (*osdev))) == NULL)
     {
       return ENOSPC;