Change int into status_t, and other changes for better BeOS type compatiblitly.

This change also introduces a lot of new warnings concerning printf format
anomalies. Please do NOT fix them. Currently, int32 (and also status_t)
is of type int, but it will be of type long (BeOS compatible) soon, and
these warnings will disasappear.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@973 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2002-09-03 02:09:48 +00:00
parent b32c90d52b
commit 75c97114f7
2 changed files with 108 additions and 105 deletions

View File

@ -62,7 +62,7 @@ static int port_spinlock = 0;
#define RELEASE_PORT_LOCK(s) release_spinlock(&(s).lock)
int
status_t
port_init(kernel_args *ka)
{
int i;
@ -98,7 +98,7 @@ dump_port_list(int argc, char **argv)
for (i = 0; i < MAX_PORTS; i++) {
if (ports[i].id >= 0)
dprintf("%p\tid: 0x%x\t\tname: '%s'\n", &ports[i], ports[i].id, ports[i].name);
dprintf("%p\tid: 0x%lx\t\tname: '%s'\n", &ports[i], ports[i].id, ports[i].name);
}
return 0;
}
@ -107,17 +107,17 @@ dump_port_list(int argc, char **argv)
static void
_dump_port_info(struct port_entry *port)
{
int cnt;
int32 cnt;
dprintf("PORT: %p\n", port);
dprintf("name: '%s'\n", port->name);
dprintf("owner: 0x%x\n", port->owner);
dprintf("cap: %d\n", port->capacity);
dprintf("owner: 0x%lx\n", port->owner);
dprintf("cap: %ld\n", port->capacity);
dprintf("head: %d\n", port->head);
dprintf("tail: %d\n", port->tail);
get_sem_count(port->read_sem, &cnt);
dprintf("read_sem: %d\n", cnt);
dprintf("read_sem: %ld\n", cnt);
get_sem_count(port->read_sem, &cnt);
dprintf("write_sem: %d\n", cnt);
dprintf("write_sem: %ld\n", cnt);
}
@ -276,7 +276,7 @@ out:
return retval;
}
int
status_t
close_port(port_id id)
{
int state;
@ -307,7 +307,7 @@ close_port(port_id id)
return B_NO_ERROR;
}
int
status_t
delete_port(port_id id)
{
int slot;
@ -332,7 +332,7 @@ delete_port(port_id id)
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("delete_port: invalid port_id %d\n", id);
dprintf("delete_port: invalid port_id %ld\n", id);
return B_BAD_PORT_ID;
}
@ -399,7 +399,7 @@ find_port(const char *port_name)
return ret_val;
}
int
status_t
_get_port_info(port_id id, port_info *info, size_t size)
{
int slot;
@ -420,7 +420,7 @@ _get_port_info(port_id id, port_info *info, size_t size)
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("get_port_info: invalid port_id %d\n", id);
dprintf("get_port_info: invalid port_id %ld\n", id);
return B_BAD_PORT_ID;
}
@ -439,7 +439,7 @@ _get_port_info(port_id id, port_info *info, size_t size)
return B_NO_ERROR;
}
int
status_t
_get_next_port_info(team_id team, int32 *cookie, struct port_info *info,
size_t size)
{
@ -524,7 +524,7 @@ port_buffer_size_etc(port_id id,
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("get_port_info: invalid port_id %d\n", id);
dprintf("get_port_info: invalid port_id %ld\n", id);
return B_BAD_PORT_ID;
}
RELEASE_PORT_LOCK(ports[slot]);
@ -555,9 +555,9 @@ port_buffer_size_etc(port_id id,
// read data's head length
t = ports[slot].head;
if (t < 0)
panic("port %id: tail < 0", ports[slot].id);
panic("port %ld: tail < 0", ports[slot].id);
if (t > ports[slot].capacity)
panic("port %id: tail > cap %d", ports[slot].id, ports[slot].capacity);
panic("port %ld: tail > cap %ld", ports[slot].id, ports[slot].capacity);
len = ports[slot].msg_queue[t].data_len;
// restore readsem
@ -574,7 +574,7 @@ port_count(port_id id)
{
int slot;
int state;
int count;
int32 count;
if(ports_active == false)
return B_BAD_PORT_ID;
@ -589,7 +589,7 @@ port_count(port_id id)
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("port_count: invalid port_id %d\n", id);
dprintf("port_count: invalid port_id %ld\n", id);
return B_BAD_PORT_ID;
}
@ -605,7 +605,7 @@ port_count(port_id id)
return count;
}
int
status_t
read_port(port_id port,
int32 *msg_code,
void *msg_buffer,
@ -614,7 +614,7 @@ read_port(port_id port,
return read_port_etc(port, msg_code, msg_buffer, buffer_size, 0, 0);
}
int
status_t
read_port_etc(port_id id,
int32 *msg_code,
void *msg_buffer,
@ -653,7 +653,7 @@ read_port_etc(port_id id,
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("read_port_etc: invalid port_id %d\n", id);
dprintf("read_port_etc: invalid port_id %ld\n", id);
return B_BAD_PORT_ID;
}
// store sem_id in local variable
@ -693,9 +693,9 @@ read_port_etc(port_id id,
t = ports[slot].tail;
if (t < 0)
panic("port %id: tail < 0", ports[slot].id);
panic("port %ld: tail < 0", ports[slot].id);
if (t > ports[slot].capacity)
panic("port %id: tail > cap %d", ports[slot].id, ports[slot].capacity);
panic("port %ld: tail > cap %ld", ports[slot].id, ports[slot].capacity);
ports[slot].tail = (ports[slot].tail + 1) % ports[slot].capacity;
@ -735,7 +735,7 @@ read_port_etc(port_id id,
return siz;
}
int
status_t
set_port_owner(port_id id, team_id team)
{
int slot;
@ -754,7 +754,7 @@ set_port_owner(port_id id, team_id team)
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("set_port_owner: invalid port_id %d\n", id);
dprintf("set_port_owner: invalid port_id %ld\n", id);
return B_BAD_PORT_ID;
}
@ -768,7 +768,7 @@ set_port_owner(port_id id, team_id team)
return B_NO_ERROR;
}
int
status_t
write_port(port_id id,
int32 msg_code,
const void *msg_buffer,
@ -777,7 +777,7 @@ write_port(port_id id,
return write_port_etc(id, msg_code, msg_buffer, buffer_size, 0, 0);
}
int
status_t
write_port_etc(port_id id,
int32 msg_code,
const void *msg_buffer,
@ -791,7 +791,7 @@ write_port_etc(port_id id,
sem_id cached_semid;
int h;
cbuf* msg_store;
int c1, c2;
int32 c1, c2;
int err;
if(ports_active == false)
@ -814,14 +814,14 @@ write_port_etc(port_id id,
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("write_port_etc: invalid port_id %d\n", id);
dprintf("write_port_etc: invalid port_id %ld\n", id);
return B_BAD_PORT_ID;
}
if (ports[slot].closed) {
RELEASE_PORT_LOCK(ports[slot]);
restore_interrupts(state);
dprintf("write_port_etc: port %d closed\n", id);
dprintf("write_port_etc: port %ld closed\n", id);
return B_BAD_PORT_ID;
}
@ -880,9 +880,9 @@ write_port_etc(port_id id,
h = ports[slot].head;
if (h < 0)
panic("port %id: head < 0", ports[slot].id);
panic("port %ld: head < 0", ports[slot].id);
if (h >= ports[slot].capacity)
panic("port %id: head > cap %d", ports[slot].id, ports[slot].capacity);
panic("port %ld: head > cap %ld", ports[slot].id, ports[slot].capacity);
ports[slot].msg_queue[h].msg_code = msg_code;
ports[slot].msg_queue[h].data_cbuf = msg_store;
ports[slot].msg_queue[h].data_len = buffer_size;
@ -963,7 +963,7 @@ void port_test()
test_p4 = create_port(1024, "test port #4");
dprintf("porttest: find_port()\n");
dprintf("'test port #1' has id %d (should be %d)\n", find_port("test port #1"), test_p1);
dprintf("'test port #1' has id %ld (should be %ld)\n", find_port("test port #1"), test_p1);
dprintf("porttest: write_port() on 1, 2 and 3\n");
write_port(test_p1, 1, &testdata, sizeof(testdata));
@ -1013,7 +1013,7 @@ void port_test()
int port_test_thread_func(void* arg)
{
int msg_code;
int32 msg_code;
int n;
char buf[6];
buf[5] = '\0';
@ -1021,12 +1021,12 @@ int port_test_thread_func(void* arg)
dprintf("porttest: port_test_thread_func()\n");
n = read_port(test_p1, &msg_code, &buf, 3);
dprintf("read_port #1 code %d len %d buf %s\n", msg_code, n, buf);
dprintf("read_port #1 code %ld len %d buf %s\n", msg_code, n, buf);
n = read_port(test_p1, &msg_code, &buf, 4);
dprintf("read_port #1 code %d len %d buf %s\n", msg_code, n, buf);
dprintf("read_port #1 code %ld len %d buf %s\n", msg_code, n, buf);
buf[4] = 'X';
n = read_port(test_p1, &msg_code, &buf, 5);
dprintf("read_port #1 code %d len %d buf %s\n", msg_code, n, buf);
dprintf("read_port #1 code %ld len %d buf %s\n", msg_code, n, buf);
dprintf("porttest: testing delete p1 from other thread\n");
delete_port(test_p1);
@ -1043,7 +1043,7 @@ port_id user_create_port(int32 queue_length, const char *uname)
{
if(uname != NULL) {
char name[SYS_MAX_OS_NAME_LEN];
int rc;
status_t rc;
if((addr)uname >= KERNEL_BASE && (addr)uname <= KERNEL_TOP)
return ERR_VM_BAD_USER_MEMORY;
@ -1059,12 +1059,12 @@ port_id user_create_port(int32 queue_length, const char *uname)
}
}
int user_close_port(port_id id)
status_t user_close_port(port_id id)
{
return close_port(id);
}
int user_delete_port(port_id id)
status_t user_delete_port(port_id id)
{
return delete_port(id);
}
@ -1073,7 +1073,7 @@ port_id user_find_port(const char *port_name)
{
if(port_name != NULL) {
char name[SYS_MAX_OS_NAME_LEN];
int rc;
status_t rc;
if((addr)port_name >= KERNEL_BASE && (addr)port_name <= KERNEL_TOP)
return ERR_VM_BAD_USER_MEMORY;
@ -1089,11 +1089,11 @@ port_id user_find_port(const char *port_name)
}
}
int user_get_port_info(port_id id, struct port_info *uinfo)
status_t user_get_port_info(port_id id, struct port_info *uinfo)
{
int res;
status_t res;
struct port_info info;
int rc;
status_t rc;
if (uinfo == NULL)
return EINVAL;
@ -1108,14 +1108,14 @@ int user_get_port_info(port_id id, struct port_info *uinfo)
return res;
}
int user_get_next_port_info(team_id uteam,
uint32 *ucookie,
status_t user_get_next_port_info(team_id uteam,
int32 *ucookie,
struct port_info *uinfo)
{
int res;
status_t res;
struct port_info info;
uint32 cookie;
int rc;
int32 cookie;
status_t rc;
if (ucookie == NULL)
return EINVAL;
@ -1127,13 +1127,13 @@ int user_get_next_port_info(team_id uteam,
return ERR_VM_BAD_USER_MEMORY;
// copy from userspace
rc = user_memcpy(&cookie, ucookie, sizeof(uint32));
rc = user_memcpy(&cookie, ucookie, sizeof(int32));
if(rc < 0)
return rc;
res = get_next_port_info(uteam, &cookie, &info);
// copy to userspace
rc = user_memcpy(ucookie, &info, sizeof(uint32));
rc = user_memcpy(ucookie, &info, sizeof(int32));
if(rc < 0)
return rc;
rc = user_memcpy(uinfo, &info, sizeof(struct port_info));
@ -1147,17 +1147,17 @@ ssize_t user_port_buffer_size_etc(port_id port, uint32 flags, bigtime_t timeout)
return port_buffer_size_etc(port, flags | B_CAN_INTERRUPT, timeout);
}
int32 user_port_count(port_id port)
ssize_t user_port_count(port_id port)
{
return port_count(port);
}
ssize_t user_read_port_etc(port_id uport, int32 *umsg_code, void *umsg_buffer,
status_t user_read_port_etc(port_id uport, int32 *umsg_code, void *umsg_buffer,
size_t ubuffer_size, uint32 uflags, bigtime_t utimeout)
{
ssize_t res;
int32 msg_code;
int rc;
ssize_t res;
int32 msg_code;
status_t rc;
if (umsg_code == NULL)
return EINVAL;
@ -1179,12 +1179,12 @@ ssize_t user_read_port_etc(port_id uport, int32 *umsg_code, void *umsg_buffer,
return res;
}
int user_set_port_owner(port_id port, team_id team)
status_t user_set_port_owner(port_id port, team_id team)
{
return set_port_owner(port, team);
}
int user_write_port_etc(port_id uport, int32 umsg_code, void *umsg_buffer,
status_t user_write_port_etc(port_id uport, int32 umsg_code, void *umsg_buffer,
size_t ubuffer_size, uint32 uflags, bigtime_t utimeout)
{
if (umsg_buffer == NULL)

View File

@ -63,7 +63,7 @@ dump_sem_list(int argc, char **argv)
for (i=0; i<MAX_SEMS; i++) {
if (sems[i].id >= 0)
dprintf("%p\tid: 0x%x\t\tname: '%s'\n", &sems[i], sems[i].id, sems[i].name);
dprintf("%p\tid: 0x%lx\t\tname: '%s'\n", &sems[i], sems[i].id, sems[i].name);
}
return 0;
}
@ -74,7 +74,7 @@ _dump_sem_info(struct sem_entry *sem)
{
dprintf("SEM: %p\n", sem);
dprintf("name: '%s'\n", sem->name);
dprintf("owner: 0x%x\n", sem->owner);
dprintf("owner: 0x%lx\n", sem->owner);
dprintf("count: 0x%x\n", sem->count);
dprintf("queue: head %p tail %p\n", sem->q.head, sem->q.tail);
}
@ -122,7 +122,7 @@ dump_sem_info(int argc, char **argv)
}
int
status_t
sem_init(kernel_args *ka)
{
int i;
@ -151,7 +151,7 @@ sem_init(kernel_args *ka)
return 0;
}
sem_id create_sem_etc(int count, const char *name, team_id owner)
sem_id create_sem_etc(int32 count, const char *name, team_id owner)
{
int i;
int state;
@ -209,21 +209,21 @@ out:
return retval;
}
sem_id create_sem(int count, const char *name)
sem_id create_sem(int32 count, const char *name)
{
return create_sem_etc(count, name, team_get_kernel_team_id());
}
int delete_sem(sem_id id)
status_t delete_sem(sem_id id)
{
return delete_sem_etc(id, 0);
}
int delete_sem_etc(sem_id id, int return_code)
status_t delete_sem_etc(sem_id id, status_t return_code)
{
int slot;
int state;
int err = B_NO_ERROR;
status_t err = B_NO_ERROR;
struct thread *t;
int released_threads;
char *old_name;
@ -242,7 +242,7 @@ int delete_sem_etc(sem_id id, int return_code)
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
restore_interrupts(state);
dprintf("delete_sem: invalid sem_id %d\n", id);
dprintf("delete_sem: invalid sem_id %ld\n", id);
return B_BAD_SEM_ID;
}
@ -282,7 +282,7 @@ int delete_sem_etc(sem_id id, int return_code)
}
// Called from a timer handler. Wakes up a semaphore
static int sem_timeout(timer *data)
static int32 sem_timeout(timer *data)
{
struct sem_timeout_args *args = (struct sem_timeout_args *)data->entry.prev;
struct thread *t;
@ -302,7 +302,7 @@ static int sem_timeout(timer *data)
if (sems[slot].id != args->blocked_sem_id) {
// this thread was not waiting on this semaphore
panic("sem_timeout: thid %d was trying to wait on sem %d which doesn't exist!\n",
panic("sem_timeout: thid %ld was trying to wait on sem %ld which doesn't exist!\n",
args->blocked_thread, args->blocked_sem_id);
}
@ -324,21 +324,21 @@ static int sem_timeout(timer *data)
}
int acquire_sem(sem_id id)
status_t acquire_sem(sem_id id)
{
return acquire_sem_etc(id, 1, 0, 0);
}
int acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout)
status_t acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout)
{
int slot = id % MAX_SEMS;
int state;
int err = 0;
status_t err = 0;
if (sems_active == false)
return B_NO_MORE_SEMS;
if (id < 0) {
dprintf("acquire_sem_etc: invalid sem handle %d\n", id);
dprintf("acquire_sem_etc: invalid sem handle %ld\n", id);
return B_BAD_SEM_ID;
}
if (count <= 0)
@ -348,7 +348,7 @@ int acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout)
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
dprintf("acquire_sem_etc: bad sem_id %d\n", id);
dprintf("acquire_sem_etc: bad sem_id %ld\n", id);
err = B_BAD_SEM_ID;
goto err;
}
@ -441,18 +441,18 @@ err:
return err;
}
int release_sem(sem_id id)
status_t release_sem(sem_id id)
{
return release_sem_etc(id, 1, 0);
}
int release_sem_etc(sem_id id, int count, int flags)
status_t release_sem_etc(sem_id id, int32 count, uint32 flags)
{
int slot = id % MAX_SEMS;
int state;
int released_threads = 0;
int err = 0;
status_t err = 0;
struct thread_queue release_queue;
if (sems_active == false)
@ -466,7 +466,7 @@ int release_sem_etc(sem_id id, int count, int flags)
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
dprintf("sem_release_etc: invalid sem_id %d\n", id);
dprintf("sem_release_etc: invalid sem_id %ld\n", id);
err = B_BAD_SEM_ID;
goto err;
}
@ -527,7 +527,7 @@ outnolock:
return err;
}
int get_sem_count(sem_id id, int32* thread_count)
status_t get_sem_count(sem_id id, int32* thread_count)
{
int slot;
int state;
@ -547,7 +547,7 @@ int get_sem_count(sem_id id, int32* thread_count)
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
restore_interrupts(state);
dprintf("sem_get_count: invalid sem_id %d\n", id);
dprintf("sem_get_count: invalid sem_id %ld\n", id);
return B_BAD_SEM_ID;
}
@ -559,7 +559,7 @@ int get_sem_count(sem_id id, int32* thread_count)
return B_NO_ERROR;
}
int _get_sem_info(sem_id id, struct sem_info *info, size_t sz)
status_t _get_sem_info(sem_id id, struct sem_info *info, size_t sz)
{
int state;
int slot;
@ -579,7 +579,7 @@ int _get_sem_info(sem_id id, struct sem_info *info, size_t sz)
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
restore_interrupts(state);
dprintf("get_sem_info: invalid sem_id %d\n", id);
dprintf("get_sem_info: invalid sem_id %ld\n", id);
return B_BAD_SEM_ID;
}
@ -595,7 +595,7 @@ int _get_sem_info(sem_id id, struct sem_info *info, size_t sz)
return B_NO_ERROR;
}
int _get_next_sem_info(team_id team, uint32 *cookie, struct sem_info *info, size_t sz)
status_t _get_next_sem_info(team_id team, int32 *cookie, struct sem_info *info, size_t sz)
{
int state;
int slot;
@ -649,7 +649,7 @@ int _get_next_sem_info(team_id team, uint32 *cookie, struct sem_info *info, size
return B_NO_ERROR;
}
int set_sem_owner(sem_id id, team_id team)
status_t set_sem_owner(sem_id id, team_id team)
{
int state;
int slot;
@ -673,7 +673,7 @@ int set_sem_owner(sem_id id, team_id team)
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
restore_interrupts(state);
dprintf("set_sem_owner: invalid sem_id %d\n", id);
dprintf("set_sem_owner: invalid sem_id %ld\n", id);
return B_BAD_SEM_ID;
}
@ -687,7 +687,7 @@ int set_sem_owner(sem_id id, team_id team)
// Wake up a thread that's blocked on a semaphore
// this function must be entered with interrupts disabled and THREADLOCK held
int sem_interrupt_thread(struct thread *t)
status_t sem_interrupt_thread(struct thread *t)
{
int slot;
struct thread_queue wakeup_queue;
@ -704,12 +704,12 @@ int sem_interrupt_thread(struct thread *t)
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != t->sem_blocking) {
panic("sem_interrupt_thread: thread 0x%x sez it's blocking on sem 0x%x, but that sem doesn't exist!\n", t->id, t->sem_blocking);
panic("sem_interrupt_thread: thread 0x%lx sez it's blocking on sem 0x%lx, but that sem doesn't exist!\n", t->id, t->sem_blocking);
}
wakeup_queue.head = wakeup_queue.tail = NULL;
if (remove_thread_from_sem(t, &sems[slot], &wakeup_queue, EINTR) == ERR_NOT_FOUND)
panic("sem_interrupt_thread: thread 0x%x not found in sem 0x%x's wait queue\n", t->id, t->sem_blocking);
panic("sem_interrupt_thread: thread 0x%lx not found in sem 0x%lx's wait queue\n", t->id, t->sem_blocking);
RELEASE_SEM_LOCK(sems[slot]);
@ -786,7 +786,7 @@ int sem_delete_owned_sems(team_id owner)
return count;
}
sem_id user_create_sem(int count, const char *uname)
sem_id user_create_sem(int32 count, const char *uname)
{
if (uname != NULL) {
char name[SYS_MAX_OS_NAME_LEN];
@ -807,42 +807,43 @@ sem_id user_create_sem(int count, const char *uname)
}
}
int user_delete_sem(sem_id id)
status_t user_delete_sem(sem_id id)
{
return delete_sem(id);
}
int user_delete_sem_etc(sem_id id, int return_code)
status_t user_delete_sem_etc(sem_id id, status_t return_code)
{
return delete_sem_etc(id, return_code);
}
int user_acquire_sem(sem_id id)
status_t user_acquire_sem(sem_id id)
{
return user_acquire_sem_etc(id, 1, 0, 0);
}
int user_acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout)
status_t user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout)
{
flags = flags | B_CAN_INTERRUPT;
return acquire_sem_etc(id, count, flags, timeout);
}
int user_release_sem(sem_id id)
status_t user_release_sem(sem_id id)
{
return release_sem_etc(id, 1, 0);
}
int user_release_sem_etc(sem_id id, int count, int flags)
status_t user_release_sem_etc(sem_id id, int32 count, uint32 flags)
{
return release_sem_etc(id, count, flags);
}
int user_get_sem_count(sem_id uid, int32* uthread_count)
status_t user_get_sem_count(sem_id uid, int32* uthread_count)
{
int32 thread_count;
int rc, rc2;
status_t rc;
int rc2;
rc = get_sem_count(uid, &thread_count);
rc2 = user_memcpy(uthread_count, &thread_count, sizeof(int32));
if (rc2 < 0)
@ -850,10 +851,11 @@ int user_get_sem_count(sem_id uid, int32* uthread_count)
return rc;
}
int user_get_sem_info(sem_id uid, struct sem_info *uinfo, size_t sz)
status_t user_get_sem_info(sem_id uid, struct sem_info *uinfo, size_t sz)
{
struct sem_info info;
int rc, rc2;
status_t rc;
int rc2;
if ((addr)uinfo >= KERNEL_BASE && (addr)uinfo <= KERNEL_TOP)
return ERR_VM_BAD_USER_MEMORY;
@ -865,29 +867,30 @@ int user_get_sem_info(sem_id uid, struct sem_info *uinfo, size_t sz)
return rc;
}
int user_get_next_sem_info(team_id uteam, uint32 *ucookie, struct sem_info *uinfo, size_t sz)
status_t user_get_next_sem_info(team_id uteam, int32 *ucookie, struct sem_info *uinfo, size_t sz)
{
struct sem_info info;
uint32 cookie;
int rc, rc2;
int32 cookie;
status_t rc;
int rc2;
if ((addr)uinfo >= KERNEL_BASE && (addr)uinfo <= KERNEL_TOP)
return ERR_VM_BAD_USER_MEMORY;
rc2 = user_memcpy(&cookie, ucookie, sizeof(uint32));
rc2 = user_memcpy(&cookie, ucookie, sizeof(int32));
if (rc2 < 0)
return rc2;
rc = _get_next_sem_info(uteam, &cookie, &info, sz);
rc2 = user_memcpy(uinfo, &info, sz);
if (rc2 < 0)
return rc2;
rc2 = user_memcpy(ucookie, &cookie, sizeof(uint32));
rc2 = user_memcpy(ucookie, &cookie, sizeof(int32));
if (rc2 < 0)
return rc2;
return rc;
}
int user_set_sem_owner(sem_id uid, team_id uteam)
status_t user_set_sem_owner(sem_id uid, team_id uteam)
{
return set_sem_owner(uid, uteam);
}