Npsrv* np_srv_create(int nwthread, int flags) { Npsrv *srv = NULL; np_uerror (0); if (!(srv = malloc(sizeof(*srv)))) { np_uerror (ENOMEM); goto error; } memset (srv, 0, sizeof (*srv)); pthread_mutex_init(&srv->lock, NULL); pthread_cond_init(&srv->conncountcond, NULL); srv->msize = 8216; srv->flags = flags; srv->netroot = np_net_make_root(); if (srv->netroot == 0) goto error; if (np_usercache_create (srv) < 0) goto error; srv->nwthread = nwthread; if (!(srv->tpool = np_tpool_create (srv, "default"))) goto error; np_tpool_incref (srv->tpool); np_assert_srv = srv; return srv; error: if (srv) np_srv_destroy (srv); return NULL; }
Npsrv* np_srv_create(int nwthread, int flags) { Npsrv *srv = NULL; np_uerror (0); if (!(srv = malloc(sizeof(*srv)))) { np_uerror (ENOMEM); goto error; } memset (srv, 0, sizeof (*srv)); pthread_mutex_init(&srv->lock, NULL); pthread_cond_init(&srv->conncountcond, NULL); srv->msize = 8216; srv->flags = flags; if (np_ctl_initialize (srv) < 0) goto error; if (!np_ctl_addfile (srv->ctlroot, "version", _ctl_get_version, NULL)) goto error; if (!np_ctl_addfile (srv->ctlroot, "connections", _ctl_get_connections, srv)) goto error; if (!np_ctl_addfile (srv->ctlroot, "tpools", _ctl_get_tpools, srv)) goto error; if (!np_ctl_addfile (srv->ctlroot, "requests", _ctl_get_requests, srv)) goto error; if (!np_ctl_addfile_proc (srv->ctlroot, "meminfo")) goto error; if (!np_ctl_addfile_proc (srv->ctlroot, "net.rpc.nfs")) goto error; if (np_usercache_create (srv) < 0) goto error; srv->nwthread = nwthread; if (!(srv->tpool = np_tpool_create (srv, "default"))) goto error; np_tpool_incref_nolock (srv->tpool); return srv; error: if (srv) np_srv_destroy (srv); return NULL; }