Home | History | Annotate | Download | only in librumpuser

Lines Matching refs:spc

256 spcresetbuf(struct spclient *spc)
259 spc->spc_buf = NULL;
260 spc->spc_off = 0;
264 spcfreebuf(struct spclient *spc)
267 free(spc->spc_buf);
268 spcresetbuf(spc);
272 sendlockl(struct spclient *spc)
275 while (spc->spc_ostatus != SPCSTATUS_FREE) {
276 spc->spc_ostatus = SPCSTATUS_WANTED;
277 pthread_cond_wait(&spc->spc_cv, &spc->spc_mtx);
279 spc->spc_ostatus = SPCSTATUS_BUSY;
283 sendlock(struct spclient *spc)
286 pthread_mutex_lock(&spc->spc_mtx);
287 sendlockl(spc);
288 pthread_mutex_unlock(&spc->spc_mtx);
292 sendunlockl(struct spclient *spc)
295 if (spc->spc_ostatus == SPCSTATUS_WANTED)
296 pthread_cond_broadcast(&spc->spc_cv);
297 spc->spc_ostatus = SPCSTATUS_FREE;
301 sendunlock(struct spclient *spc)
304 pthread_mutex_lock(&spc->spc_mtx);
305 sendunlockl(spc);
306 pthread_mutex_unlock(&spc->spc_mtx);
310 dosend(struct spclient *spc, struct iovec *iov, size_t iovlen)
315 int fd = spc->spc_fd;
367 doputwait(struct spclient *spc, struct respwait *rw, struct rsp_hdr *rhdr)
374 pthread_mutex_lock(&spc->spc_mtx);
375 rw->rw_reqno = rhdr->rsp_reqno = spc->spc_nextreq++;
376 TAILQ_INSERT_TAIL(&spc->spc_respwait, rw, rw_entries);
380 putwait_locked(struct spclient *spc, struct respwait *rw, struct rsp_hdr *rhdr)
383 doputwait(spc, rw, rhdr);
384 pthread_mutex_unlock(&spc->spc_mtx);
388 putwait(struct spclient *spc, struct respwait *rw, struct rsp_hdr *rhdr)
391 doputwait(spc, rw, rhdr);
392 sendlockl(spc);
393 pthread_mutex_unlock(&spc->spc_mtx);
397 dounputwait(struct spclient *spc, struct respwait *rw)
400 TAILQ_REMOVE(&spc->spc_respwait, rw, rw_entries);
401 pthread_mutex_unlock(&spc->spc_mtx);
407 unputwait_locked(struct spclient *spc, struct respwait *rw)
410 pthread_mutex_lock(&spc->spc_mtx);
411 dounputwait(spc, rw);
415 unputwait(struct spclient *spc, struct respwait *rw)
418 pthread_mutex_lock(&spc->spc_mtx);
419 sendunlockl(spc);
421 dounputwait(spc, rw);
425 kickwaiter(struct spclient *spc)
430 pthread_mutex_lock(&spc->spc_mtx);
431 TAILQ_FOREACH(rw, &spc->spc_respwait, rw_entries) {
432 if (rw->rw_reqno == spc->spc_hdr.rsp_reqno)
437 spc->spc_hdr.rsp_reqno));
438 pthread_mutex_unlock(&spc->spc_mtx);
439 spcfreebuf(spc);
442 DPRINTF(("rump_sp: client %p woke up waiter at %p\n", spc, rw));
443 rw->rw_data = spc->spc_buf;
445 rw->rw_dlen = (size_t)(spc->spc_off - HDRSZ);
446 if (spc->spc_hdr.rsp_class == RUMPSP_ERROR) {
447 error = rw->rw_error = errmap(spc->spc_hdr.rsp_error);
450 pthread_mutex_unlock(&spc->spc_mtx);
453 spcfreebuf(spc);
455 spcresetbuf(spc);
459 kickall(struct spclient *spc)
464 TAILQ_FOREACH(rw, &spc->spc_respwait, rw_entries)
469 readframe(struct spclient *spc)
471 int fd = spc->spc_fd;
477 if (spc->spc_off < HDRSZ) {
479 spc->spc_off));
481 left = HDRSZ - spc->spc_off;
483 n = host_read(fd, (uint8_t*)&spc->spc_hdr + spc->spc_off, left);
493 spc->spc_off += n;
494 if (spc->spc_off < HDRSZ) {
499 framelen = spc->spc_hdr.rsp_len;
508 spc->spc_buf = malloc(framelen - HDRSZ + 1);
509 if (spc->spc_buf == NULL) {
512 memset(spc->spc_buf, 0, framelen - HDRSZ + 1);
517 framelen = spc->spc_hdr.rsp_len;
520 left = framelen - spc->spc_off;
523 spc->spc_off, left));
527 n = host_read(fd, spc->spc_buf + (spc->spc_off - HDRSZ), left);
536 spc->spc_off += n;