+/*
+ * We keep one bit of static storage to make sure only one instance of the oss
+ * writer is running at any given time.
+ */
+static bool sound_device_busy;
+
+static bool sound_device_is_busy(void)
+{
+ return sound_device_busy;
+}
+
+static void set_sound_device_busy(void)
+{
+ assert(!sound_device_busy);
+ sound_device_busy = true;
+}
+
+static void set_sound_device_idle(void)
+{
+ assert(sound_device_busy);
+ sound_device_busy = false;
+}
+
+static int get_oss_format(enum sample_format sf)
+{
+ switch (sf) {
+ case SF_S8: return AFMT_S8;
+ case SF_U8: return AFMT_U8;
+ case SF_S16_LE: return AFMT_S16_LE;
+ case SF_S16_BE: return AFMT_S16_BE;
+ case SF_U16_LE: return AFMT_U16_LE;
+ case SF_U16_BE: return AFMT_U16_BE;
+ default: return AFMT_S16_LE;
+ }
+}
+
+static void oss_pre_select(struct sched *s, void *context)