void chldcb_check () { for (;;) { int status; pid_t pid = waitpid (-1, &status, WNOHANG); if (pid == 0 || pid == -1) break; if (child *c = chldcbs[pid]) { chldcbs.remove (c); #ifdef WRAP_DEBUG if (callback_trace & CBTR_CHLD) warn ("CALLBACK_TRACE: %schild pid %d (status %d) %s <- %s\n", timestring (), pid, status, c->cb->dest, c->cb->line); #endif /* WRAP_DEBUG */ STOP_ACHECK_TIMER (); sfs_leave_sel_loop (); (*c->cb) (status); START_ACHECK_TIMER (); delete c; } else if (sfs_core::g_zombie_collect) { zombie_t *z = zombies[pid]; if (z) { z->_status = status; } else { zombies.insert (New zombie_t (pid, status)); } } } }
afsdirentry::afsdirentry (afsdir *dir, const str &name, afsnode *node) : dir (dir), name (name), node (mkref (node)), cookie (gencookie ()) { node->addlink (); cookietab.insert (this); dir->entries.insert (this); }
fhtimer * closesim::fhalloc (const nfs_fh3 &fh) { fhtimer *fht = New fhtimer (this, fh); fht->expire = sfs_get_timenow() + closesim_minlife; fq->minopen--; fq->timeq.insert (fht); fhtab.insert (fht); fq->fhclean (); return fht; }
static inline rpcstats * getstats (int progno, int procno) { str key = strbuf ("%d:%d", progno, procno); rpcstats *stats = rpc_stats_tab[key]; if (!stats) { stats = New rpcstats (key); rpc_stats_tab.insert (stats); } return stats; }
f_node * add_node (const chord_node &n) { f_node *nu = nodes[n.x]; if (!nu) { warn << "added " << n << "\n"; nu = New f_node (n); nodes.insert (nu); char nodess[1024]; sprintf (nodess, "%zd nodes", nodes.size ()); gtk_label_set_text (GTK_LABEL (total_nodes), nodess); } get_queue.push_back (n.x); return nu; }
void chldcb (pid_t pid, cbi::ptr cb) { if (child *c = chldcbs[pid]) { chldcbs.remove (c); delete c; } zombie_t *z; if ((z = zombies[pid])) { int s = z->_status; zombies.remove (z); delete z; if (cb) (*cb) (s); } else if (cb) { chldcbs.insert (New child (pid, cb)); } }
client::client (ref<axprt_crypt> x) : sfsserv (x), fsrv (NULL), generation (nextgen ()) { nfssrv = asrv::alloc (x, ex_nfs_program_3, wrap (mkref (this), &client::nfs3pre_acl_dispatch)); nfscbc = aclnt::alloc (x, ex_nfscb_program_3); char sfs_owner[] = SFSOWNER; struct passwd *pw = getpwnam (sfs_owner); int u_sfs = pw->pw_uid; int g_sfs = pw->pw_gid; int g_sock = pw->pw_gid; //fixme: put something different! int g_fifo = pw->pw_gid; //likewise auth_sfs = authunix_create ("localhost", u_sfs, g_sfs, 0, NULL); auth_sfssock = authunix_create ("localhost", u_sfs, g_sock, 0, NULL); auth_sfsfifo = authunix_create ("localhost", u_sfs, g_fifo, 0, NULL); clienttab.insert (this); }
void mget_state_t::load_batches (const dsdc_hash_ring_t &r) { for (u_int i = 0; i < n; i++) { dsdc_key_t k = (*keys)[i]; dsdc_ring_node_t *n = r.successor (k); (*res)[i].key = k; if (!n) { (*res)[i].res.set_status (DSDC_NONODE); } else { ptr<aclnt_wrap_t> w = n->get_aclnt_wrap (); mget_batch_t *batch; str id = w->remote_peer_id (); if (!(batch = batches[id])) { batch = New mget_batch_t (id, w, mkref (this)); batches.insert (batch); } batch->arg.push_back (k); batch->positions.push_back (i); } } }
inline objref::objref (const void *o, const char *fl, int *fp) : obj (o), refline (fl), flagp (fp) { objreftab.insert (this); }
sfssrv_exec::sfssrv_exec (const vec<str> &av) : argv (av) { assert (!argv.empty ()); exectab.insert (this); }