cur_t *cur_new(void) { cur_t *cur; int id = id_new(); if(id == -1) return NULL; if((cur = (cur_t*)malloc(sizeof(cur_t))) == NULL) { id_free(id); return NULL; } memset(cur, 0, sizeof(cur_t)); cur->id = id; if(cur_search(cur->id)) { free(cur); id_free(id); return NULL; } //cur->Zzz = LUA_NOREF; cur_insert(cur); return cur; }
/* Set the id of a job. The memory-owner of the id will be the job from * this point on. */ int job_set_id(JOB *job, JOBID *id) { if(job->id) { id_free(id); } job->id = id; return 0; }
void cur_free(cur_t* cur) { if(cur_search(cur->id) == cur) { /* release callback references */ //CALLBACK_UNREF(cur->Zzz); cur_remove(cur); } id_free(cur->id); free(cur); }
/*ARGSUSED*/ static void log_zonefree(zoneid_t zoneid, void *arg) { log_zone_t *lzp = arg; int i; ASSERT(lzp != &log_global && zoneid != GLOBAL_ZONEID); if (lzp == NULL) return; for (i = 0; i < LOG_NUMCLONES; i++) id_free(log_minorspace, lzp->lz_clones[i].log_minor); kmem_free(lzp, sizeof (log_zone_t)); }
/* * task_end() * * Overview * task_end() contains the actions executed once the final member of * a task has released the task, and all actions connected with the task, such * as committing an accounting record to a file, are completed. It is called * by the known last consumer of the task information. Additionally, * task_end() must never refer to any process in the system. * * Return values * None. * * Caller's context * No restrictions on context, beyond that given above. */ void task_end(task_t *tk) { ASSERT(tk->tk_hold_count == 0); project_rele(tk->tk_proj); kmem_free(tk->tk_usage, sizeof (task_usage_t)); kmem_free(tk->tk_inherited, sizeof (task_usage_t)); if (tk->tk_prevusage != NULL) kmem_free(tk->tk_prevusage, sizeof (task_usage_t)); if (tk->tk_zoneusage != NULL) kmem_free(tk->tk_zoneusage, sizeof (task_usage_t)); rctl_set_free(tk->tk_rctls); id_free(taskid_space, tk->tk_tkid); zone_task_rele(tk->tk_zone); kmem_cache_free(task_cache, tk); }
int main(void) { int i; char* str; char** str2; t_list* begin; begin = init(); while (1) { id_print_str("SHELL BLOODEAD SERENIIITY: "); str = id_getline(0); str2 = (char**)id_str_to_word_tab(str); if (check_list(begin,str2) == 0) id_print_error(str2); id_free(str, str2, begin); } free(begin); return (0); }
/*ARGSUSED*/ static int ipmi_close(dev_t dev, int flag, int otyp, cred_t *cred) { ipmi_device_t *dp; struct ipmi_request *req, *next; if ((dp = lookup_ipmidev_by_dev(dev)) == NULL) return (ENODEV); IPMI_LOCK(sc); /* remove any pending requests */ req = TAILQ_FIRST(&sc->ipmi_pending_requests); while (req != NULL) { next = TAILQ_NEXT(req, ir_link); if (req->ir_owner == dp) { TAILQ_REMOVE(&sc->ipmi_pending_requests, req, ir_link); ipmi_free_request(req); } req = next; } dp->ipmi_status |= IPMI_CLOSING; while (dp->ipmi_status & IPMI_BUSY) cv_wait(&dp->ipmi_cv, &sc->ipmi_lock); IPMI_UNLOCK(sc); /* remove any requests in queue of stuff completed */ while ((req = TAILQ_FIRST(&dp->ipmi_completed_requests)) != NULL) { TAILQ_REMOVE(&dp->ipmi_completed_requests, req, ir_link); ipmi_free_request(req); } list_remove(&dev_list, dp); id_free(minor_ids, getminor(dev)); cv_destroy(&dp->ipmi_cv); kmem_free(dp->ipmi_pollhead, sizeof (pollhead_t)); kmem_free(dp, sizeof (ipmi_device_t)); return (0); }
void id_release (Identity_t id) { unsigned h; id_free (id_lookup (id, &h)); }
void log_free(log_t *lp) { id_free(log_minorspace, lp->log_minor); kmem_cache_free(log_cons_cache, lp); }