Browse Source

make kernel_pid_t comparisons consistent

dev/timer
Oleg Hahm 9 years ago
parent
commit
0ad7b170ed
  1. 2
      drivers/at86rf231/at86rf231_rx.c
  2. 2
      drivers/cc110x_ng/cc110x-rx.c
  3. 2
      drivers/cc2420/cc2420_rx.c
  4. 2
      examples/rpl_udp/helper.c
  5. 6
      sys/net/network_layer/sixlowpan/lowpan.c
  6. 4
      sys/net/transport_layer/destiny/destiny.c
  7. 4
      sys/posix/pthread/pthread.c
  8. 14
      sys/shell/commands/sc_transceiver.c
  9. 2
      sys/transceiver/transceiver.c
  10. 2
      tests/posix_semaphore/main.c

2
drivers/at86rf231/at86rf231_rx.c

@ -61,7 +61,7 @@ void at86rf231_rx_handler(void)
#endif
/* notify transceiver thread if any */
if (transceiver_pid > KERNEL_PID_UNDEF) {
if (transceiver_pid != KERNEL_PID_UNDEF) {
msg_t m;
m.type = (uint16_t) RCV_PKT_AT86RF231;
m.content.value = rx_buffer_next;

2
drivers/cc110x_ng/cc110x-rx.c

@ -86,7 +86,7 @@ void cc110x_rx_handler(void)
#endif
/* notify transceiver thread if any */
if (transceiver_pid > KERNEL_PID_UNDEF) {
if (transceiver_pid != KERNEL_PID_UNDEF) {
msg_t m;
m.type = (uint16_t) RCV_PKT_CC1100;
m.content.value = rx_buffer_next;

2
drivers/cc2420/cc2420_rx.c

@ -78,7 +78,7 @@ void cc2420_rx_handler(void)
#endif
/* notify transceiver thread if any */
if (transceiver_pid > KERNEL_PID_UNDEF) {
if (transceiver_pid != KERNEL_PID_UNDEF) {
msg_t m;
m.type = (uint16_t) RCV_PKT_CC2420;
m.content.value = rx_buffer_next;

2
examples/rpl_udp/helper.c

@ -123,7 +123,7 @@ void rpl_udp_ignore(int argc, char **argv)
{
uint16_t a;
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not runnning.");
return;
}

6
sys/net/network_layer/sixlowpan/lowpan.c

@ -1794,7 +1794,7 @@ int sixlowpan_lowpan_init(void)
ipv6_process, NULL, "ip_process");
}
if (ip_process_pid < 0) {
if (ip_process_pid == KERNEL_PID_UNDEF) {
return 0;
}
@ -1804,7 +1804,7 @@ int sixlowpan_lowpan_init(void)
PRIORITY_MAIN + 1, CREATE_STACKTEST,
lowpan_context_auto_remove, NULL, "lowpan_context_rem");
if (contexts_rem_pid < 0) {
if (contexts_rem_pid == KERNEL_PID_UNDEF) {
return 0;
}
@ -1812,7 +1812,7 @@ int sixlowpan_lowpan_init(void)
PRIORITY_MAIN - 1, CREATE_STACKTEST,
lowpan_transfer, NULL, "lowpan_transfer");
if (transfer_pid < 0) {
if (transfer_pid == KERNEL_PID_UNDEF) {
return 0;
}

4
sys/net/transport_layer/destiny/destiny.c

@ -46,7 +46,7 @@ int destiny_init_transport_layer(void)
PRIORITY_MAIN, CREATE_STACKTEST,
udp_packet_handler, NULL, "udp_packet_handler");
if (udp_thread_pid < 0) {
if (udp_thread_pid == KERNEL_PID_UNDEF) {
return -1;
}
@ -66,7 +66,7 @@ int destiny_init_transport_layer(void)
PRIORITY_MAIN, CREATE_STACKTEST,
tcp_packet_handler, NULL, "tcp_packet_handler");
if (tcp_thread_pid < 0) {
if (tcp_thread_pid == KERNEL_PID_UNDEF) {
return -1;
}

4
sys/posix/pthread/pthread.c

@ -117,7 +117,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
pthread_thread_t *pt = calloc(1, sizeof(pthread_thread_t));
kernel_pid_t pthread_pid = insert(pt);
if (pthread_pid < 0) {
if (pthread_pid == KERNEL_PID_UNDEF) {
free(pt);
return -1;
}
@ -155,7 +155,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
pthread_start_routine,
pt,
"pthread");
if (pt->thread_pid < 0) {
if (pt->thread_pid == KERNEL_PID_UNDEF) {
free(pt->stack);
free(pt);
pthread_sched_threads[pthread_pid-1] = NULL;

14
sys/shell/commands/sc_transceiver.c

@ -68,7 +68,7 @@ void _transceiver_get_set_address_handler(int argc, char **argv)
transceiver_command_t tcmd;
radio_address_t a;
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized");
return;
}
@ -147,7 +147,7 @@ void _transceiver_get_set_long_addr_handler(int argc, char **argv)
transceiver_command_t tcmd;
transceiver_eui64_t a;
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized");
return;
}
@ -183,7 +183,7 @@ void _transceiver_get_set_channel_handler(int argc, char **argv)
transceiver_command_t tcmd;
int32_t c;
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized");
return;
}
@ -212,7 +212,7 @@ void _transceiver_get_set_channel_handler(int argc, char **argv)
void _transceiver_send_handler(int argc, char **argv)
{
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized");
return;
}
@ -264,7 +264,7 @@ void _transceiver_send_handler(int argc, char **argv)
/* checked for type safety */
void _transceiver_monitor_handler(int argc, char **argv)
{
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized");
return;
}
@ -290,7 +290,7 @@ void _transceiver_monitor_handler(int argc, char **argv)
/* checked for type safety */
void _transceiver_get_set_pan_handler(int argc, char **argv)
{
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized");
return;
}
@ -325,7 +325,7 @@ void _transceiver_get_set_pan_handler(int argc, char **argv)
void _transceiver_set_ignore_handler(int argc, char **argv)
{
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not initialized");
return;
}

2
sys/transceiver/transceiver.c

@ -182,7 +182,7 @@ kernel_pid_t transceiver_start(void)
{
transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, PRIORITY_MAIN - 3, CREATE_STACKTEST, run, NULL, "Transceiver");
if (transceiver_pid < 0) {
if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Error creating transceiver thread");
}

2
tests/posix_semaphore/main.c

@ -71,7 +71,7 @@ static void test1(void)
NULL,
"second");
if (pid < 0) {
if (pid == KERNEL_PID_UNDEF) {
puts("first: thread create failed");
}

Loading…
Cancel
Save