sem.c -> sem.cpp, port.c -> port.cpp
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23585 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -29,10 +29,10 @@ KernelMergeObject kernel_core.o :
|
|||||||
main.c
|
main.c
|
||||||
module.cpp
|
module.cpp
|
||||||
Notifications.cpp
|
Notifications.cpp
|
||||||
port.c
|
port.cpp
|
||||||
real_time_clock.c
|
real_time_clock.c
|
||||||
scheduler.cpp
|
scheduler.cpp
|
||||||
sem.c
|
sem.cpp
|
||||||
shutdown.c
|
shutdown.c
|
||||||
signal.cpp
|
signal.cpp
|
||||||
system_info.c
|
system_info.c
|
||||||
|
|||||||
@@ -840,7 +840,7 @@ port_buffer_size_etc(port_id id, uint32 flags, bigtime_t timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine tail & get the length of the message
|
// determine tail & get the length of the message
|
||||||
msg = list_get_first_item(&sPorts[slot].msg_queue);
|
msg = (port_msg*)list_get_first_item(&sPorts[slot].msg_queue);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
panic("port %ld: no messages found\n", sPorts[slot].id);
|
panic("port %ld: no messages found\n", sPorts[slot].id);
|
||||||
@@ -970,7 +970,7 @@ read_port_etc(port_id id, int32 *_msgCode, void *msgBuffer, size_t bufferSize,
|
|||||||
return B_BAD_PORT_ID;
|
return B_BAD_PORT_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = list_get_first_item(&sPorts[slot].msg_queue);
|
msg = (port_msg*)list_get_first_item(&sPorts[slot].msg_queue);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
panic("port %ld: no messages found", sPorts[slot].id);
|
panic("port %ld: no messages found", sPorts[slot].id);
|
||||||
@@ -993,7 +993,7 @@ read_port_etc(port_id id, int32 *_msgCode, void *msgBuffer, size_t bufferSize,
|
|||||||
restore_interrupts(state);
|
restore_interrupts(state);
|
||||||
|
|
||||||
// check output buffer size
|
// check output buffer size
|
||||||
size = min(bufferSize, msg->size);
|
size = min_c(bufferSize, msg->size);
|
||||||
|
|
||||||
// copy message
|
// copy message
|
||||||
if (_msgCode != NULL)
|
if (_msgCode != NULL)
|
||||||
@@ -1367,7 +1367,7 @@ _user_writev_port_etc(port_id port, int32 messageCode, const iovec *userVecs,
|
|||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
if (userVecs && vecCount != 0) {
|
if (userVecs && vecCount != 0) {
|
||||||
vecs = malloc(sizeof(iovec) * vecCount);
|
vecs = (iovec*)malloc(sizeof(iovec) * vecCount);
|
||||||
if (vecs == NULL)
|
if (vecs == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
@@ -422,7 +422,7 @@ create_sem_etc(int32 count, const char *name, team_id owner)
|
|||||||
name = "unnamed semaphore";
|
name = "unnamed semaphore";
|
||||||
|
|
||||||
nameLength = strlen(name) + 1;
|
nameLength = strlen(name) + 1;
|
||||||
nameLength = min(nameLength, B_OS_NAME_LENGTH);
|
nameLength = min_c(nameLength, B_OS_NAME_LENGTH);
|
||||||
tempName = (char *)malloc(nameLength);
|
tempName = (char *)malloc(nameLength);
|
||||||
if (tempName == NULL)
|
if (tempName == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
@@ -604,7 +604,7 @@ remove_thread_from_sem(struct thread *thread, struct sem_entry *sem,
|
|||||||
// now see if more threads need to be woken up
|
// now see if more threads need to be woken up
|
||||||
while (sem->u.used.count > 0
|
while (sem->u.used.count > 0
|
||||||
&& thread_lookat_queue(&sem->u.used.queue) != NULL) {
|
&& thread_lookat_queue(&sem->u.used.queue) != NULL) {
|
||||||
int32 delta = min(thread->sem.count, sem->u.used.count);
|
int32 delta = min_c(thread->sem.count, sem->u.used.count);
|
||||||
|
|
||||||
thread->sem.count -= delta;
|
thread->sem.count -= delta;
|
||||||
if (thread->sem.count <= 0) {
|
if (thread->sem.count <= 0) {
|
||||||
@@ -863,7 +863,7 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
|
|||||||
thread->sem.flags = flags;
|
thread->sem.flags = flags;
|
||||||
thread->sem.blocking = id;
|
thread->sem.blocking = id;
|
||||||
thread->sem.acquire_count = count;
|
thread->sem.acquire_count = count;
|
||||||
thread->sem.count = min(-sSems[slot].u.used.count, count);
|
thread->sem.count = min_c(-sSems[slot].u.used.count, count);
|
||||||
// store the count we need to restore upon release
|
// store the count we need to restore upon release
|
||||||
thread->sem.acquire_status = B_NO_ERROR;
|
thread->sem.acquire_status = B_NO_ERROR;
|
||||||
thread_enqueue(thread, &sSems[slot].u.used.queue);
|
thread_enqueue(thread, &sSems[slot].u.used.queue);
|
||||||
@@ -1025,7 +1025,7 @@ release_sem_etc(sem_id id, int32 count, uint32 flags)
|
|||||||
if (sSems[slot].u.used.count < 0) {
|
if (sSems[slot].u.used.count < 0) {
|
||||||
struct thread *thread = thread_lookat_queue(&sSems[slot].u.used.queue);
|
struct thread *thread = thread_lookat_queue(&sSems[slot].u.used.queue);
|
||||||
|
|
||||||
delta = min(count, thread->sem.count);
|
delta = min_c(count, thread->sem.count);
|
||||||
thread->sem.count -= delta;
|
thread->sem.count -= delta;
|
||||||
if (thread->sem.count <= 0) {
|
if (thread->sem.count <= 0) {
|
||||||
// release this thread
|
// release this thread
|
||||||
Reference in New Issue
Block a user