/**@internal * * Initialize a message port. * * @retval 0 when successful * @retval -1 upon an error */ int su_base_port_init(su_port_t *self, su_port_vtable_t const *vtable) { if (self) { self->sup_vtable = vtable; self->sup_tail = &self->sup_head; self->sup_max_defer = 15 * 1000; return su_port_obtain(self); } return -1; }
/** Obtain the root port from other thread. * * @param root pointer to root object * * @retval 0 if successful * @retval -1 upon an error * * @ERRORS * @ERROR EFAULT * @NEW_1_12_7 */ int su_root_obtain(su_root_t *root) { if (root == NULL || root->sur_port == NULL) return (void)(errno = EFAULT), -1; return su_port_obtain(root->sur_port); }