Lines Matching refs:portRef
298 Read(const BReference<Port>& portRef, int32 code, ssize_t result) in Read() argument
300 fID(portRef->id), in Read()
301 fReadCount(portRef->read_count), in Read()
302 fWriteCount(portRef->write_count), in Read()
369 Info(const BReference<Port>& portRef, int32 code, ssize_t result) in Info() argument
371 fID(portRef->id), in Info()
372 fReadCount(portRef->read_count), in Info()
373 fWriteCount(portRef->write_count), in Info()
628 get_locked_port(port_id id) GCC_2_NRV(portRef) in get_locked_port()
631 BReference<Port> portRef; in get_locked_port() local
635 portRef.SetTo(sPorts.Lookup(id)); in get_locked_port()
638 if (portRef != NULL && portRef->state == Port::kActive) { in get_locked_port()
639 if (mutex_lock(&portRef->lock) != B_OK) in get_locked_port()
640 portRef.Unset(); in get_locked_port()
642 portRef.Unset(); in get_locked_port()
644 return portRef; in get_locked_port()
649 get_port(port_id id) GCC_2_NRV(portRef) in get_port()
652 BReference<Port> portRef; in get_port() local
655 portRef.SetTo(sPorts.Lookup(id)); in get_port()
657 return portRef; in get_port()
1070 BReference<Port> portRef = get_locked_port(id); in close_port() local
1071 if (portRef == NULL) { in close_port()
1075 MutexLocker lock(&portRef->lock, true); in close_port()
1079 portRef->capacity = 0; in close_port()
1081 notify_port_select_events(portRef, B_EVENT_INVALID); in close_port()
1082 portRef->select_infos = NULL; in close_port()
1084 portRef->read_condition.NotifyAll(B_BAD_PORT_ID); in close_port()
1085 portRef->write_condition.NotifyAll(B_BAD_PORT_ID); in close_port()
1099 BReference<Port> portRef = get_port(id); in delete_port() local
1101 if (portRef == NULL) { in delete_port()
1106 status_t status = delete_port_logical(portRef); in delete_port()
1116 sPorts.Remove(portRef); in delete_port()
1117 sPortsByName.Remove(portRef); in delete_port()
1119 portRef->ReleaseReference(); in delete_port()
1125 const uint8 lockIndex = portRef->owner % kTeamListLockCount; in delete_port()
1128 list_remove_link(&portRef->team_link); in delete_port()
1129 portRef->ReleaseReference(); in delete_port()
1132 uninit_port(portRef); in delete_port()
1134 T(Delete(portRef)); in delete_port()
1149 BReference<Port> portRef = get_locked_port(id); in select_port() local
1150 if (portRef == NULL) in select_port()
1152 MutexLocker locker(portRef->lock, true); in select_port()
1155 if (is_port_closed(portRef)) in select_port()
1158 if (!kernel && portRef->owner == team_get_kernel_team_id()) { in select_port()
1168 info->next = portRef->select_infos; in select_port()
1169 portRef->select_infos = info; in select_port()
1173 && !portRef->messages.IsEmpty()) { in select_port()
1177 if (portRef->write_count > 0) in select_port()
1197 BReference<Port> portRef = get_locked_port(id); in deselect_port() local
1198 if (portRef == NULL) in deselect_port()
1200 MutexLocker locker(portRef->lock, true); in deselect_port()
1203 select_info** infoLocation = &portRef->select_infos; in deselect_port()
1249 BReference<Port> portRef = get_locked_port(id); in _get_port_info() local
1250 if (portRef == NULL) { in _get_port_info()
1254 MutexLocker locker(portRef->lock, true); in _get_port_info()
1257 fill_port_info(portRef, info, size); in _get_port_info()
1302 BReference<Port> portRef = port; in _get_next_port_info() local
1306 MutexLocker locker(portRef->lock); in _get_next_port_info()
1307 fill_port_info(portRef, info, size); in _get_next_port_info()
1343 BReference<Port> portRef = get_locked_port(id); in _get_port_message_info_etc() local
1344 if (portRef == NULL) in _get_port_message_info_etc()
1346 MutexLocker locker(portRef->lock, true); in _get_port_message_info_etc()
1348 if (is_port_closed(portRef) && portRef->messages.IsEmpty()) { in _get_port_message_info_etc()
1349 T(Info(portRef, 0, B_BAD_PORT_ID)); in _get_port_message_info_etc()
1354 while (portRef->read_count == 0) { in _get_port_message_info_etc()
1360 portRef->read_condition.Add(&entry); in _get_port_message_info_etc()
1368 T(Info(portRef, 0, status)); in _get_port_message_info_etc()
1380 if (newPortRef != portRef in _get_port_message_info_etc()
1381 || (is_port_closed(portRef) && portRef->messages.IsEmpty())) { in _get_port_message_info_etc()
1389 port_message* message = portRef->messages.Head(); in _get_port_message_info_etc()
1391 panic("port %" B_PRId32 ": no messages found\n", portRef->id); in _get_port_message_info_etc()
1400 T(Info(portRef, message->code, B_OK)); in _get_port_message_info_etc()
1403 portRef->read_condition.NotifyOne(); in _get_port_message_info_etc()
1416 BReference<Port> portRef = get_locked_port(id); in port_count() local
1417 if (portRef == NULL) { in port_count()
1421 MutexLocker locker(portRef->lock, true); in port_count()
1424 return portRef->read_count; in port_count()
1452 BReference<Port> portRef = get_locked_port(id); in read_port_etc() local
1453 if (portRef == NULL) in read_port_etc()
1455 MutexLocker locker(portRef->lock, true); in read_port_etc()
1457 if (is_port_closed(portRef) && portRef->messages.IsEmpty()) { in read_port_etc()
1458 T(Read(portRef, 0, B_BAD_PORT_ID)); in read_port_etc()
1463 while (portRef->read_count == 0) { in read_port_etc()
1469 portRef->read_condition.Add(&entry); in read_port_etc()
1484 if (newPortRef != portRef in read_port_etc()
1485 || (is_port_closed(portRef) && portRef->messages.IsEmpty())) { in read_port_etc()
1492 T(Read(portRef, 0, status)); in read_port_etc()
1498 port_message* message = portRef->messages.Head(); in read_port_etc()
1500 panic("port %" B_PRId32 ": no messages found\n", portRef->id); in read_port_etc()
1508 T(Read(portRef, message->code, size)); in read_port_etc()
1510 portRef->read_condition.NotifyOne(); in read_port_etc()
1515 portRef->messages.RemoveHead(); in read_port_etc()
1516 portRef->total_count++; in read_port_etc()
1517 portRef->write_count++; in read_port_etc()
1518 portRef->read_count--; in read_port_etc()
1520 notify_port_select_events(portRef, B_EVENT_WRITE); in read_port_etc()
1521 portRef->write_condition.NotifyOne(); in read_port_etc()
1524 T(Read(portRef, message->code, std::min(bufferSize, message->size))); in read_port_etc()
1581 BReference<Port> portRef = get_locked_port(id); in writev_port_etc() local
1582 if (portRef == NULL) { in writev_port_etc()
1586 MutexLocker locker(portRef->lock, true); in writev_port_etc()
1588 if (is_port_closed(portRef)) { in writev_port_etc()
1593 if (portRef->write_count <= 0) { in writev_port_etc()
1597 portRef->write_count--; in writev_port_etc()
1601 portRef->write_condition.Add(&entry); in writev_port_etc()
1615 if (newPortRef != portRef || is_port_closed(portRef)) { in writev_port_etc()
1624 portRef->write_count--; in writev_port_etc()
1627 &message, *portRef); in writev_port_etc()
1668 portRef->messages.Add(message); in writev_port_etc()
1669 portRef->read_count++; in writev_port_etc()
1671 T(Write(id, portRef->read_count, portRef->write_count, message->code, in writev_port_etc()
1674 notify_port_select_events(portRef, B_EVENT_READ); in writev_port_etc()
1675 portRef->read_condition.NotifyOne(); in writev_port_etc()
1681 T(Write(id, portRef->read_count, portRef->write_count, 0, 0, status)); in writev_port_etc()
1682 portRef->write_count++; in writev_port_etc()
1683 notify_port_select_events(portRef, B_EVENT_WRITE); in writev_port_etc()
1684 portRef->write_condition.NotifyOne(); in writev_port_etc()
1705 BReference<Port> portRef = get_locked_port(id); in set_port_owner() local
1706 if (portRef == NULL) { in set_port_owner()
1710 MutexLocker locker(portRef->lock, true); in set_port_owner()
1713 if (team->id != portRef->owner) { in set_port_owner()
1714 uint8 firstLockIndex = portRef->owner % kTeamListLockCount; in set_port_owner()
1732 if (portRef->state == Port::kActive) { in set_port_owner()
1733 list_remove_link(&portRef->team_link); in set_port_owner()
1734 list_add_item(&team->port_list, portRef.Get()); in set_port_owner()
1735 portRef->owner = team->id; in set_port_owner()
1743 T(OwnerChange(portRef, team->id, B_OK)); in set_port_owner()