int NaClSimpleServiceConnectionFactoryWithInstanceData( struct NaClSimpleService *self, struct NaClDesc *conn, void *instance_data, struct NaClSimpleServiceConnection **out) { struct NaClSimpleServiceConnection *server_conn; int status; NaClLog(4, "Entered NaClSimpleServiceConnectionFactory\n"); server_conn = malloc(sizeof *server_conn); if (NULL == server_conn) { status = -NACL_ABI_ENOMEM; goto abort; } NaClLog(4, "NaClSimpleServiceConnectionFactory: self 0x%"NACL_PRIxPTR"\n", (uintptr_t) self); NaClLog(4, "NaClSimpleServiceConnectionFactory: conn 0x%"NACL_PRIxPTR"\n", (uintptr_t) conn); NaClLog(4, "NaClSimpleServiceConnectionFactory: out 0x%"NACL_PRIxPTR"\n", (uintptr_t) out); /* * In the common/degenerate case, factory instance data becomes * connection instance data. */ if (!NaClSimpleServiceConnectionCtor(server_conn, self, conn, instance_data)) { free(server_conn); status = -NACL_ABI_EIO; goto abort; } NaClLog(4, "NaClSimpleServiceConnectionFactory: constructed 0x%"NACL_PRIxPTR"\n", (uintptr_t) server_conn); *out = server_conn; status = 0; abort: NaClLog(4, "Leaving NaClSimpleServiceConnectionFactory: status %d\n", status); return status; }
int NaClManifestProxyConnectionCtor(struct NaClManifestProxyConnection *self, struct NaClManifestProxy *server, struct NaClDesc *conn) { NaClLog(4, "Entered NaClManifestProxyConnectionCtor, self 0x%"NACL_PRIxPTR"\n", (uintptr_t) self); if (!NaClSimpleServiceConnectionCtor( &self->base, (struct NaClSimpleService *) server, conn, (void *) self)) { NaClLog(4, ("NaClManifestProxyConnectionCtor: base class ctor" " NaClSimpleServiceConnectionCtor failed\n")); return 0; } NaClXMutexCtor(&self->mu); NaClXCondVarCtor(&self->cv); self->channel_initialized = 0; NACL_VTBL(NaClRefCount, self) = (struct NaClRefCountVtbl *) &kNaClManifestProxyConnectionVtbl; return 1; }