void rpc_destroy_context(struct rpc_context *rpc) { struct rpc_pdu *pdu; while((pdu = rpc->outqueue) != NULL) { pdu->cb(rpc, RPC_STATUS_CANCEL, NULL, pdu->private_data); SLIST_REMOVE(&rpc->outqueue, pdu); rpc_free_pdu(rpc, pdu); } while((pdu = rpc->waitpdu) != NULL) { pdu->cb(rpc, RPC_STATUS_CANCEL, NULL, pdu->private_data); SLIST_REMOVE(&rpc->waitpdu, pdu); rpc_free_pdu(rpc, pdu); } auth_destroy(rpc->auth); rpc->auth =NULL; if (rpc->fd != -1) { close(rpc->fd); } if (rpc->encodebuf != NULL) { free(rpc->encodebuf); rpc->encodebuf = NULL; } if (rpc->error_string != NULL) { free(rpc->error_string); rpc->error_string = NULL; } free(rpc); }
/* * Unregister all hooks and cookies for that module. Note: doesn't disconnect * any hooks! */ void ng_unregister_module(const struct lmodule *mod) { struct msgreg *m, *m1; struct datareg *d, *d1; m = SLIST_FIRST(&msgreg_list); while (m != NULL) { m1 = SLIST_NEXT(m, link); if (m->mod == mod) { SLIST_REMOVE(&msgreg_list, m, msgreg, link); free(m); } m = m1; } d = SLIST_FIRST(&datareg_list); while (d != NULL) { d1 = SLIST_NEXT(d, link); if (d->mod == mod) { SLIST_REMOVE(&datareg_list, d, datareg, link); free(d); } d = d1; } }
void listeners_reload(struct Listener_head *existing_listeners, struct Listener_head *new_listeners, const struct Table_head *tables, struct ev_loop *loop) { struct Listener *iter_existing = SLIST_FIRST(existing_listeners); struct Listener *iter_new = SLIST_FIRST(new_listeners); while (iter_existing != NULL || iter_new != NULL) { int compare_result; char address[ADDRESS_BUFFER_SIZE]; if (iter_existing == NULL) compare_result = 1; else if (iter_new == NULL) compare_result = -1; else compare_result = address_compare(iter_existing->address, iter_new->address); if (compare_result > 0) { struct Listener *new_listener = iter_new; iter_new = SLIST_NEXT(iter_new, entries); notice("Listener %s added.", display_address(new_listener->address, address, sizeof(address))); SLIST_REMOVE(new_listeners, new_listener, Listener, entries); add_listener(existing_listeners, new_listener); init_listener(new_listener, tables, loop); /* -1 for removing from new_listeners */ listener_ref_put(new_listener); } else if (compare_result == 0) { notice ("Listener %s updated.", display_address(iter_existing->address, address, sizeof(address))); listener_update(iter_existing, iter_new, tables); iter_existing = SLIST_NEXT(iter_existing, entries); iter_new = SLIST_NEXT(iter_new, entries); } else { struct Listener *removed_listener = iter_existing; iter_existing = SLIST_NEXT(iter_existing, entries); notice("Listener %s removed.", display_address(removed_listener->address, address, sizeof(address))); SLIST_REMOVE(existing_listeners, removed_listener, Listener, entries); close_listener(loop, removed_listener); /* -1 for removing from existing_listeners */ listener_ref_put(removed_listener); } } }
void rpc_error_all_pdus(struct rpc_context *rpc, char *error) { struct rpc_pdu *pdu; while((pdu = rpc->outqueue) != NULL) { pdu->cb(rpc, RPC_STATUS_ERROR, error, pdu->private_data); SLIST_REMOVE(&rpc->outqueue, pdu); rpc_free_pdu(rpc, pdu); } while((pdu = rpc->waitpdu) != NULL) { pdu->cb(rpc, RPC_STATUS_ERROR, error, pdu->private_data); SLIST_REMOVE(&rpc->waitpdu, pdu); rpc_free_pdu(rpc, pdu); } }
void rpc_destroy_context(struct rpc_context *rpc) { struct rpc_pdu *pdu; assert(rpc->magic == RPC_CONTEXT_MAGIC); while((pdu = rpc->outqueue) != NULL) { pdu->cb(rpc, RPC_STATUS_CANCEL, NULL, pdu->private_data); SLIST_REMOVE(&rpc->outqueue, pdu); rpc_free_pdu(rpc, pdu); } while((pdu = rpc->waitpdu) != NULL) { pdu->cb(rpc, RPC_STATUS_CANCEL, NULL, pdu->private_data); SLIST_REMOVE(&rpc->waitpdu, pdu); rpc_free_pdu(rpc, pdu); } rpc_free_all_fragments(rpc); auth_destroy(rpc->auth); rpc->auth =NULL; if (rpc->fd != -1) { #if defined(WIN32) closesocket(rpc->fd); #else close(rpc->fd); #endif } if (rpc->encodebuf != NULL) { free(rpc->encodebuf); rpc->encodebuf = NULL; } if (rpc->error_string != NULL) { free(rpc->error_string); rpc->error_string = NULL; } if (rpc->udp_dest != NULL) { free(rpc->udp_dest); rpc->udp_dest = NULL; } rpc->magic = 0; free(rpc); }
void pink_easy_process_list_remove(pink_easy_process_list_t *list, const pink_easy_process_t *proc) { assert(list != NULL); SLIST_REMOVE(list, proc, pink_easy_process, entries); }
/* * Get an item from the item free q of the given slab with id. */ static struct item * _slab_get_item_from_freeq(uint8_t id) { struct slabclass *p; /* parent slabclass */ struct item *it; if (!use_freeq) { return NULL; } p = &slabclass[id]; if (p->nfree_itemq == 0) { return NULL; } it = SLIST_FIRST(&p->free_itemq); ASSERT(it->magic == ITEM_MAGIC); ASSERT(it->in_freeq); ASSERT(!(it->is_linked)); it->in_freeq = 0; ASSERT(p->nfree_itemq > 0); p->nfree_itemq--; SLIST_REMOVE(&p->free_itemq, it, item, i_sle); PERSLAB_DECR(id, item_free); log_verb("get free q it %p at offset %"PRIu32" with id %"PRIu8, it, it->offset, it->id); return it; }
/** * \fn order_remove * * \brief order the remove list according to dependency level */ Plisthead * order_remove(Plisthead *deptreehead) { int i, maxlevel = 0; Pkglist *pdp, *next; Plisthead *ordtreehead; /* package removal cannot trust recorded dependencies, reorder */ remove_dep_deepness(deptreehead); SLIST_FOREACH(pdp, deptreehead, next) if (pdp->level > maxlevel) maxlevel = pdp->level; ordtreehead = init_head(); for (i = maxlevel; i >= 0; i--) { pdp = SLIST_FIRST(deptreehead); while (pdp != NULL) { next = SLIST_NEXT(pdp, next); if (pdp->level == i) { SLIST_REMOVE(deptreehead, pdp, Pkglist, next); SLIST_INSERT_HEAD(ordtreehead, pdp, next); } pdp = next; } } return ordtreehead; }
void filt_exdetach(struct knote *kn) { struct vnode *vp = (struct vnode *)kn->kn_hook; SLIST_REMOVE(&vp->v_selectinfo.si_note, kn, knote, kn_selnext); }
void filt_apmrdetach(struct knote *kn) { struct apm_softc *sc = (struct apm_softc *)kn->kn_hook; SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext); }
void vmeintr_disestablish(u_int vec, struct intrhand *ih) { struct intrhand *intr; intrhand_t *list; list = &vmeintr_handlers[vec]; evcount_detach(&ih->ih_count); SLIST_REMOVE(list, ih, intrhand, ih_link); if (!SLIST_EMPTY(list)) return; /* * Walk the interrupts table to check if this level needs * to be disabled. */ for (vec = 0; vec < NVMEINTR; vec++) { intr = SLIST_FIRST(&vmeintr_handlers[vec]); if (intr != NULL && intr->ih_ipl == ih->ih_ipl) break; } if (vec == NVMEINTR) intsrc_disable(INTSRC_VME(ih->ih_ipl)); }
void rc_sect_delkey(struct rcsection *rsp, struct rckey *p) { SLIST_REMOVE(&rsp->rs_keys,p,rckey,rk_next); rc_key_free(p); return; }
static int rpc_write_to_socket(struct rpc_context *rpc) { int32_t count; assert(rpc->magic == RPC_CONTEXT_MAGIC); if (rpc->fd == -1) { rpc_set_error(rpc, "trying to write but not connected"); return -1; } while (rpc->outqueue != NULL) { int64_t total; total = rpc->outqueue->outdata.size; count = send(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written, 0); if (count == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) { return 0; } rpc_set_error(rpc, "Error when writing to socket :%s(%d)", strerror(errno), errno); return -1; } rpc->outqueue->written += count; if (rpc->outqueue->written == total) { struct rpc_pdu *pdu = rpc->outqueue; SLIST_REMOVE(&rpc->outqueue, pdu); SLIST_ADD_END(&rpc->waitpdu, pdu); } } return 0; }
static void filt_uscannerdetach(struct knote *kn) { struct uscanner_softc *sc = kn->kn_hook; SLIST_REMOVE(&sc->sc_selq.sel_klist, kn, knote, kn_selnext); }
void fs_remove_superblock(struct fs * fs, struct fs_superblock * sb) { mtx_t * lock = &fs->fs_giant; mtx_lock(lock); SLIST_REMOVE(&fs->sblist_head, sb, fs_superblock, _sblist); mtx_unlock(lock); }
/* * Unregister a hook function */ void ng_unregister_hook(void *dd) { struct datareg *d = dd; SLIST_REMOVE(&datareg_list, d, datareg, link); free(d); }
/* * Remove a registration. */ void ng_unregister_cookie(void *dd) { struct msgreg *d = dd; SLIST_REMOVE(&msgreg_list, d, msgreg, link); free(d); }
void filt_pipedetach(struct knote *kn) { struct pipe *rpipe = (struct pipe *)kn->kn_fp->f_data; struct pipe *wpipe = rpipe->pipe_peer; switch (kn->kn_filter) { case EVFILT_READ: SLIST_REMOVE(&rpipe->pipe_sel.si_note, kn, knote, kn_selnext); break; case EVFILT_WRITE: if (wpipe == NULL) return; SLIST_REMOVE(&wpipe->pipe_sel.si_note, kn, knote, kn_selnext); break; } }
static void filt_i4brdetach(struct knote *kn) { int s; s = splnet(); SLIST_REMOVE(&select_rd_info.sel_klist, kn, knote, kn_selnext); splx(s); }
/* Set t to NULL to untag c from c->tag */ void tag_client(struct tag *t, struct client *c) { /* Remove client from its previous tag */ if(c->tag && !(c->flags & CLIENT_RULED)) { if(c->tag == t) return; if(!(c->flags & (CLIENT_IGNORE_LAYOUT | CLIENT_FREE))) layout_split_arrange_closed(c); if(!(c->flags & CLIENT_REMOVEALL)) { SLIST_REMOVE(&c->tag->clients, c, client, tnext); if(c->tag->sel == c || W->client == c) client_focus( client_tab_next( client_next(c))); } } c->flags &= ~CLIENT_RULED; /* Client remove */ if(!t) { infobar_elem_screen_update(c->screen, ElemTag); return; } c->prevtag = c->tag; c->tag = t; c->screen = t->screen; client_update_props(c, CPROP_LOC); SLIST_INSERT_HEAD(&t->clients, c, tnext); infobar_elem_screen_update(c->screen, ElemTag); if(c->flags & CLIENT_TABMASTER && c->prevtag) { struct client *cc; SLIST_FOREACH(cc, &c->prevtag->clients, tnext) if(cc->tabmaster == c) { cc->flags |= CLIENT_IGNORE_LAYOUT; tag_client(t, cc); } } layout_client(c); if(t != c->screen->seltag || c->flags & CLIENT_TABBED) client_unmap(c); }
static void filt_cprng_detach(struct knote *kn) { struct cprng_strong *const cprng = kn->kn_hook; mutex_enter(&cprng->cs_lock); SLIST_REMOVE(&cprng->cs_selq.sel_klist, kn, knote, kn_selnext); mutex_exit(&cprng->cs_lock); }
static void filt_aedrdetach(struct knote *kn) { int s; s = splvm(); SLIST_REMOVE(&aed_sc->sc_selinfo.sel_klist, kn, knote, kn_selnext); splx(s); }
static void filt_midiwdetach(struct knote *kn) { struct midi_softc *sc = kn->kn_hook; mutex_enter(sc->lock); SLIST_REMOVE(&sc->wsel.sel_klist, kn, knote, kn_selnext); mutex_exit(sc->lock); }
void filt_midiwdetach(struct knote *kn) { struct midi_softc *sc = (struct midi_softc *)kn->kn_hook; mtx_enter(&audio_lock); SLIST_REMOVE(&sc->wsel.si_note, kn, knote, kn_selnext); mtx_leave(&audio_lock); }
static void filt_evrdetach(struct knote *kn) { struct evvar *ev = kn->kn_hook; mutex_enter(ev->ev_lock); SLIST_REMOVE(&ev->ev_sel.sel_klist, kn, knote, kn_selnext); mutex_exit(ev->ev_lock); }
static void filt_apmrdetach(struct knote *kn) { struct apm_softc *sc = kn->kn_hook; APM_LOCK(sc); SLIST_REMOVE(&sc->sc_rsel.sel_klist, kn, knote, kn_selnext); APM_UNLOCK(sc); }
void filt_apmrdetach(struct knote *kn) { struct apm_softc *sc = (struct apm_softc *)kn->kn_hook; rw_enter_write(&sc->sc_lock); SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext); rw_exit_write(&sc->sc_lock); }
void filt_fifowdetach(struct knote *kn) { struct socket *so = (struct socket *)kn->kn_hook; SLIST_REMOVE(&so->so_snd.sb_sel.si_note, kn, knote, kn_selnext); if (SLIST_EMPTY(&so->so_snd.sb_sel.si_note)) so->so_snd.sb_flags &= ~SB_KNOTE; }
static void filt_udsirwdetach(struct knote *kn) { struct udsir_softc *sc = kn->kn_hook; int s; s = splusb(); SLIST_REMOVE(&sc->sc_wr_sel.sel_klist, kn, knote, kn_selnext); splx(s); }
static void filt_satlinkrdetach(struct knote *kn) { struct satlink_softc *sc = kn->kn_hook; int s; s = splsoftclock(); SLIST_REMOVE(&sc->sc_selq.sel_klist, kn, knote, kn_selnext); splx(s); }