int
snd_seq_oss_read(struct seq_oss_devinfo *dp, char __user *buf, int count)
{ struct seq_oss_readq *readq = dp->readq; int result = 0, err = 0; int ev_len; union evrec rec; unsignedlong flags;
if (readq == NULL || ! is_read_mode(dp->file_mode)) return -ENXIO;
while (count >= SHORT_EVENT_SIZE) {
snd_seq_oss_readq_lock(readq, flags);
err = snd_seq_oss_readq_pick(readq, &rec); if (err == -EAGAIN &&
!is_nonblock_mode(dp->file_mode) && result == 0) {
snd_seq_oss_readq_unlock(readq, flags);
snd_seq_oss_readq_wait(readq);
snd_seq_oss_readq_lock(readq, flags); if (signal_pending(current))
err = -ERESTARTSYS; else
err = snd_seq_oss_readq_pick(readq, &rec);
} if (err < 0) {
snd_seq_oss_readq_unlock(readq, flags); break;
}
ev_len = ev_length(&rec); if (ev_len < count) {
snd_seq_oss_readq_unlock(readq, flags); break;
}
snd_seq_oss_readq_free(readq);
snd_seq_oss_readq_unlock(readq, flags); if (copy_to_user(buf, &rec, ev_len)) {
err = -EFAULT; break;
}
result += ev_len;
buf += ev_len;
count -= ev_len;
} return result > 0 ? result : err;
}
/* * write interface
*/
int
snd_seq_oss_write(struct seq_oss_devinfo *dp, constchar __user *buf, int count, struct file *opt)
{ int result = 0, err = 0; int ev_size, fmt; union evrec rec;
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) return -ENXIO;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.