1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core: harmonizes the data type for the process ID

Instead of using differing integer types use kernel_pid_t for process
identifier. This type is introduced in a new header file to avoid
circular dependencies.
This commit is contained in:
Oleg Hahm 2014-07-06 22:57:56 +02:00
parent 4546c3f83c
commit 983d056c75
98 changed files with 350 additions and 306 deletions

View File

@ -44,7 +44,7 @@
#include "lpc2387.h"
uint8_t simple_pid;
kernel_pid_t simple_pid;
int16_t simple_buffer[4];
volatile int16_t *ringBuff_X = NULL;

View File

@ -1,6 +1,6 @@
#ifndef __UART0_H
#define __UART0_H
extern int uart0_handler_pid;
extern kernel_pid_t uart0_handler_pid;
#endif /* __UART0_H */

View File

@ -23,6 +23,7 @@
#define KERNEL_H_
#include <stdbool.h>
#include <stdint.h>
#include "attributes.h"
#include "config.h"
@ -66,12 +67,11 @@
#endif
/* ------------------------------------------------------------------------- */
/**
* @def PID_NULL
* @brief Identifier to detect an invalid PID
*/
#define PID_NULL -1
#define KERNEL_PID_NULL -1
/**
* @def PRIORITY_MIN

View File

@ -0,0 +1,18 @@
#ifndef KERNEL_TYPES_H
#define KERNEL_TYPES_H
#include <stdint.h>
#include <inttypes.h>
/**
* Macro for printing formatter
*/
#define PRIkernel_pid PRIi16
/**
* @brief Unique process identifier
*
*/
typedef int16_t kernel_pid_t;
#endif /* KERNEL_TYPES_H */

View File

@ -34,6 +34,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "kernel_types.h"
/**
* @brief Describes a message object which can be sent between threads.
@ -44,7 +45,7 @@
*
*/
typedef struct msg {
uint16_t sender_pid; /**< PID of sending thread. Will be filled in
kernel_pid_t sender_pid; /**< PID of sending thread. Will be filled in
by msg_send. */
uint16_t type; /**< Type field. */
union {
@ -74,7 +75,7 @@ typedef struct msg {
* ``block == 0``
* @return -1, on error (invalid PID)
*/
int msg_send(msg_t *m, unsigned int target_pid, bool block);
int msg_send(msg_t *m, kernel_pid_t target_pid, bool block);
/**
@ -106,7 +107,7 @@ int msg_send_to_self(msg_t *m);
* @return 0, if receiver is not waiting and ``block == 0``
* @return -1, on error (invalid PID)
*/
int msg_send_int(msg_t *m, unsigned int target_pid);
int msg_send_int(msg_t *m, kernel_pid_t target_pid);
/**
@ -150,7 +151,7 @@ int msg_try_receive(msg_t *m);
*
* @return 1, if successful.
*/
int msg_send_receive(msg_t *m, msg_t *reply, unsigned int target_pid);
int msg_send_receive(msg_t *m, msg_t *reply, kernel_pid_t target_pid);
/**
* @brief Replies to a message.

View File

@ -90,7 +90,7 @@ extern volatile int sched_num_threads;
/**
* Process ID of active thread
*/
extern volatile int sched_active_pid;
extern volatile kernel_pid_t sched_active_pid;
/**
* List of runqueues per priority level

View File

@ -59,7 +59,7 @@ typedef struct tcb_t {
char *sp; /**< thread's stack pointer */
uint16_t status; /**< thread's status */
uint16_t pid; /**< thread's process id */
kernel_pid_t pid; /**< thread's process id */
uint16_t priority; /**< thread's priority */
clist_node_t rq_entry; /**< run queue entry */

View File

@ -72,7 +72,7 @@
* @return value ``<0`` on error
* @return pid of newly created task, otherwise
*/
int thread_create(char *stack,
kernel_pid_t thread_create(char *stack,
int stacksize,
char priority,
int flags,
@ -87,7 +87,7 @@ int thread_create(char *stack,
* @return status of the thread
* @return `STATUS_NOT_FOUND` if pid is unknown
*/
int thread_getstatus(int pid);
int thread_getstatus(kernel_pid_t pid);
/**
* @brief Returns the name of a process
@ -97,7 +97,7 @@ int thread_getstatus(int pid);
* @return the threads name
* @return `NULL` if pid is unknown
*/
const char *thread_getname(int pid);
const char *thread_getname(kernel_pid_t pid);
/**
* @brief Puts the current thread into sleep mode. Has to be woken up externally.
@ -120,7 +120,7 @@ void thread_yield(void);
* @return `1` on success
* @return `STATUS_NOT_FOUND` if pid is unknown or not sleeping
*/
int thread_wakeup(int pid);
int thread_wakeup(kernel_pid_t pid);
/**
@ -128,7 +128,7 @@ int thread_wakeup(int pid);
*
* @return obviously you are not a golfer.
*/
int thread_getpid(void);
kernel_pid_t thread_getpid(void);
/**
* @brief Measures the stack usage of a stack

View File

@ -51,13 +51,13 @@ static int queue_msg(tcb_t *target, msg_t *m)
return 0;
}
int msg_send(msg_t *m, unsigned int target_pid, bool block)
int msg_send(msg_t *m, kernel_pid_t target_pid, bool block)
{
if (inISR()) {
return msg_send_int(m, target_pid);
}
if ((unsigned int)sched_active_pid == target_pid) {
if (sched_active_pid == target_pid) {
return msg_send_to_self(m);
}
@ -73,12 +73,12 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block)
return -1;
}
DEBUG("msg_send() %s:%i: Sending from %i to %i. block=%i src->state=%i target->state=%i\n", __FILE__, __LINE__, sched_active_pid, target_pid, block, sched_active_thread->status, target->status);
DEBUG("msg_send() %s:%i: Sending from %" PRIkernel_pid " to %" PRIkernel_pid ". block=%i src->state=%i target->state=%i\n", __FILE__, __LINE__, sched_active_pid, target_pid, block, sched_active_thread->status, target->status);
if (target->status != STATUS_RECEIVE_BLOCKED) {
DEBUG("msg_send() %s:%i: Target %i is not RECEIVE_BLOCKED.\n", __FILE__, __LINE__, target_pid);
DEBUG("msg_send() %s:%i: Target %" PRIkernel_pid " is not RECEIVE_BLOCKED.\n", __FILE__, __LINE__, target_pid);
if (target->msg_array && queue_msg(target, m)) {
DEBUG("msg_send() %s:%i: Target %i has a msg_queue. Queueing message.\n", __FILE__, __LINE__, target_pid);
DEBUG("msg_send() %s:%i: Target %" PRIkernel_pid " has a msg_queue. Queueing message.\n", __FILE__, __LINE__, target_pid);
eINT();
if (sched_active_thread->status == STATUS_REPLY_BLOCKED) {
thread_yield();
@ -117,7 +117,7 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block)
DEBUG("msg_send: %s: Back from send block.\n", sched_active_thread->name);
}
else {
DEBUG("msg_send: %s: Direct msg copy from %i to %i.\n", sched_active_thread->name, thread_getpid(), target_pid);
DEBUG("msg_send: %s: Direct msg copy from %" PRIkernel_pid " to %" PRIkernel_pid ".\n", sched_active_thread->name, thread_getpid(), target_pid);
/* copy msg to target */
msg_t *target_message = (msg_t*) target->wait_data;
*target_message = *m;
@ -141,7 +141,7 @@ int msg_send_to_self(msg_t *m)
return res;
}
int msg_send_int(msg_t *m, unsigned int target_pid)
int msg_send_int(msg_t *m, kernel_pid_t target_pid)
{
tcb_t *target = (tcb_t *) sched_threads[target_pid];
@ -151,7 +151,7 @@ int msg_send_int(msg_t *m, unsigned int target_pid)
}
if (target->status == STATUS_RECEIVE_BLOCKED) {
DEBUG("msg_send_int: Direct msg copy from %i to %i.\n", thread_getpid(), target_pid);
DEBUG("msg_send_int: Direct msg copy from %" PRIkernel_pid " to %" PRIkernel_pid ".\n", thread_getpid(), target_pid);
m->sender_pid = target_pid;
@ -169,7 +169,7 @@ int msg_send_int(msg_t *m, unsigned int target_pid)
}
}
int msg_send_receive(msg_t *m, msg_t *reply, unsigned int target_pid)
int msg_send_receive(msg_t *m, msg_t *reply, kernel_pid_t target_pid)
{
dINT();
tcb_t *me = (tcb_t*) sched_threads[sched_active_pid];
@ -188,7 +188,7 @@ int msg_reply(msg_t *m, msg_t *reply)
tcb_t *target = (tcb_t*) sched_threads[m->sender_pid];
if (!target) {
DEBUG("msg_reply(): %s: Target \"%" PRIu16 "\" not existing...dropping msg!\n", sched_active_thread->name, m->sender_pid);
DEBUG("msg_reply(): %s: Target \"%" PRIkernel_pid "\" not existing...dropping msg!\n", sched_active_thread->name, m->sender_pid);
return -1;
}

View File

@ -84,7 +84,7 @@ static void mutex_wait(struct mutex_t *mutex)
void mutex_unlock(struct mutex_t *mutex)
{
DEBUG("%s: unlocking mutex. val: %u pid: %u\n", sched_active_thread->name, mutex->val, sched_active_pid);
DEBUG("%s: unlocking mutex. val: %u pid: %" PRIkernel_pid "\n", sched_active_thread->name, mutex->val, sched_active_pid);
int irqstate = disableIRQ();
if (mutex->val != 0) {
@ -106,7 +106,7 @@ void mutex_unlock(struct mutex_t *mutex)
void mutex_unlock_and_sleep(struct mutex_t *mutex)
{
DEBUG("%s: unlocking mutex. val: %u pid: %u, and taking a nap\n", sched_active_thread->name, mutex->val, sched_active_pid);
DEBUG("%s: unlocking mutex. val: %u pid: %" PRIkernel_pid ", and taking a nap\n", sched_active_thread->name, mutex->val, sched_active_pid);
int irqstate = disableIRQ();
if (mutex->val != 0) {

View File

@ -43,7 +43,7 @@ volatile unsigned int sched_context_switch_request;
volatile tcb_t *sched_threads[MAXTHREADS];
volatile tcb_t *sched_active_thread;
volatile int sched_active_pid = -1;
volatile kernel_pid_t sched_active_pid = KERNEL_PID_NULL;
clist_node_t *sched_runqueues[SCHED_PRIO_LEVELS];
static uint32_t runqueue_bitcache = 0;
@ -70,7 +70,7 @@ void sched_run(void)
#ifdef SCHED_TEST_STACK
if (*((unsigned int *)my_active_thread->stack_start) != (unsigned int) my_active_thread->stack_start) {
printf("scheduler(): stack overflow detected, task=%s pid=%u\n", my_active_thread->name, my_active_thread->pid);
printf("scheduler(): stack overflow detected, task=%s pid=%" PRIkernel_pid "\n", my_active_thread->name, my_active_thread->pid);
}
#endif
@ -92,7 +92,7 @@ void sched_run(void)
clist_advance(&(sched_runqueues[nextrq]));
my_active_thread = (tcb_t *)next.data;
int my_next_pid = my_active_thread->pid;
kernel_pid_t my_next_pid = my_active_thread->pid;
#if SCHEDSTATISTICS
sched_pidlist[my_next_pid].laststart = time;

View File

@ -32,12 +32,12 @@
#include "hwtimer.h"
#include "sched.h"
inline int thread_getpid(void)
inline kernel_pid_t thread_getpid(void)
{
return sched_active_thread->pid;
}
int thread_getstatus(int pid)
int thread_getstatus(kernel_pid_t pid)
{
if (sched_threads[pid] == NULL) {
return STATUS_NOT_FOUND;
@ -46,7 +46,7 @@ int thread_getstatus(int pid)
return sched_threads[pid]->status;
}
const char *thread_getname(int pid)
const char *thread_getname(kernel_pid_t pid)
{
if (sched_threads[pid] == NULL) {
return NULL;
@ -67,9 +67,9 @@ void thread_sleep(void)
thread_yield();
}
int thread_wakeup(int pid)
int thread_wakeup(kernel_pid_t pid)
{
DEBUG("thread_wakeup: Trying to wakeup PID %i...\n", pid);
DEBUG("thread_wakeup: Trying to wakeup PID %" PRIkernel_pid "...\n", pid);
int old_state = disableIRQ();
@ -106,7 +106,7 @@ int thread_measure_stack_free(char *stack)
return space_free;
}
int thread_create(char *stack, int stacksize, char priority, int flags, void *(*function)(void *arg), void *arg, const char *name)
kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags, void *(*function)(void *arg), void *arg, const char *name)
{
/* allocate our thread control block at the top of our stackspace */
int total_stacksize = stacksize;
@ -150,7 +150,7 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void *(*
dINT();
}
int pid = 0;
kernel_pid_t pid = 0;
while (pid < MAXTHREADS) {
if (sched_threads[pid] == NULL) {
@ -194,7 +194,7 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void *(*
sched_num_threads++;
DEBUG("Created thread %s. PID: %u. Priority: %u.\n", name, cb->pid, priority);
DEBUG("Created thread %s. PID: %" PRIkernel_pid ". Priority: %u.\n", name, cb->pid, priority);
if (flags & CREATE_SLEEPING) {
sched_set_status(cb, STATUS_SLEEPING);

View File

@ -16,6 +16,7 @@
*/
#include <sys/time.h>
#include "kernel_types.h"
#if defined MODULE_RTC
# include "rtc.h"

View File

@ -260,9 +260,9 @@ void _exit(int n)
while (1);
}
/*---------------------------------------------------------------------------*/
int _getpid(void)
pid_t _getpid(void)
{
return sched_active_thread->pid;
return (pid_t) sched_active_thread->pid;
}
/*---------------------------------------------------------------------------*/
int _kill_r(struct _reent *r, int pid, int sig)

View File

@ -26,7 +26,7 @@ directory for more details.
//static volatile time_t epoch;
static struct tm time_to_set;
static int set_time = 0;
int rtc_second_pid = 0;
kernel_pid_t rtc_second_pid = 0;
/*---------------------------------------------------------------------------*/
void rtc_init(void)

View File

@ -107,7 +107,7 @@ void thread_arch_stack_print(void)
int count = 0;
uint32_t *sp = (uint32_t *)sched_active_thread->sp;
printf("printing the current stack of thread %u\n", thread_getpid());
printf("printing the current stack of thread %" PRIkernel_pid "\n", thread_getpid());
printf(" address: data:\n");
do {

View File

@ -219,7 +219,7 @@ void _exit(int n)
while(1);
}
/*---------------------------------------------------------------------------*/
int _getpid(void)
pid_t _getpid(void)
{
return sched_active_thread->pid;
}

View File

@ -24,6 +24,8 @@ directory for more details.
#include <stdint.h>
#include <string.h>
#include "kernel_types.h"
/* cpu */
#include "VIC.h"
#include "lpc2387.h"

View File

@ -36,6 +36,7 @@
#endif
#endif // BSD/Linux
#include "kernel_types.h"
/**
* internal functions

View File

@ -27,6 +27,8 @@
#include <net/ethernet.h>
#include "kernel_types.h"
#define RX_BUF_SIZE (10)
#define TRANSCEIVER_BUFFER_SIZE (3)
@ -46,7 +48,7 @@
*
* @param transceiver_pid the pid of the transceiver thread
*/
void nativenet_init(int transceiver_pid);
void nativenet_init(kernel_pid_t transceiver_pid);
/**
* Shutdown transceiver

View File

@ -53,9 +53,9 @@ uint64_t _native_net_addr_long;
/* nativenet.h **********************************************************/
/************************************************************************/
void nativenet_init(int transceiver_pid)
void nativenet_init(kernel_pid_t transceiver_pid)
{
DEBUG("nativenet_init(transceiver_pid=%d)\n", transceiver_pid);
DEBUG("nativenet_init(transceiver_pid=%" PRIkernel_pid ")\n", transceiver_pid);
rx_buffer_next = 0;
_native_net_pan = 0;
_native_net_chan = 0;

View File

@ -34,6 +34,7 @@
#include <sys/time.h>
#endif
#include "kernel.h"
#include "cpu.h"
#include "irq.h"
#include "vtimer.h"

View File

@ -97,9 +97,9 @@ caddr_t _sbrk_r(struct _reent *r, size_t incr)
*
* @return the process ID of the current thread
*/
int _getpid(void)
pid_t _getpid(void)
{
return sched_active_thread->pid;
return (pid_t) sched_active_thread->pid;
}
/**
@ -111,7 +111,7 @@ int _getpid(void)
*
* @return TODO
*/
int _kill_r(struct _reent *r, int pid, int sig)
int _kill_r(struct _reent *r, pid_t pid, int sig)
{
r->_errno = ESRCH; /* not implemented yet */
return -1;

View File

@ -136,7 +136,7 @@ typedef void (*x86_rtc_callback_t)(uint8_t reg_c);
* @brief Set an RTC alarm.
* @param[in] when Time when the RTC you raise an interrupt. The date part is ignored.
* @param msg_content The value for msg_t::content.value.
* @param target_pid The process which shall receive the message, `-1u` to disable.
* @param target_pid The process which shall receive the message, `KERNEL_PID_NULL` to disable.
* @param allow_replace Whether it is allowed to overwrite an existing alarm.
*
* The value of msg_t::type will be `reg_c | (RTC_REG_B_INT_UPDATE << 8)`,
@ -145,13 +145,13 @@ typedef void (*x86_rtc_callback_t)(uint8_t reg_c);
* You should not call this function directly.
* You should use hwtimer -- or better yet -- vtimer instead.
*/
bool x86_rtc_set_alarm(const x86_rtc_data_t *when, uint32_t msg_content, unsigned int target_pid, bool allow_replace);
bool x86_rtc_set_alarm(const x86_rtc_data_t *when, uint32_t msg_content, kernel_pid_t target_pid, bool allow_replace);
/**
* @brief Set up periodic interrupts
* @param hz How often a second the interrupt should fire, e.g. RTC_REG_A_HZ_8192.
* @param msg_content The value for msg_t::content.value.
* @param target_pid The process which shall receive the message, `-1u` to disable.
* @param target_pid The process which shall receive the message, `KERNEL_PID_NULL` to disable.
* @param allow_replace Whether it is allowed to overwrite an existing alarm.
*
* The value of msg_t::type will be `reg_c | (RTC_REG_B_INT_PERIODIC << 8)`,
@ -160,12 +160,12 @@ bool x86_rtc_set_alarm(const x86_rtc_data_t *when, uint32_t msg_content, unsigne
* You should not call this function directly.
* You should use hwtimer -- or better yet -- vtimer instead.
*/
bool x86_rtc_set_periodic(uint8_t hz, uint32_t msg_content, unsigned int target_pid, bool allow_replace);
bool x86_rtc_set_periodic(uint8_t hz, uint32_t msg_content, kernel_pid_t target_pid, bool allow_replace);
/**
* @brief Set up secondly interrupts.
* @param msg_content The value for msg_t::content.value.
* @param target_pid The process which shall receive the message, `-1u` to disable.
* @param target_pid The process which shall receive the message, `KERNEL_PID_NULL` to disable.
* @param allow_replace Whether it is allowed to overwrite an existing alarm.
*
* The value of msg_t::type will be `reg_c | (RTC_REG_B_INT_UPDATE << 8)`,
@ -174,7 +174,7 @@ bool x86_rtc_set_periodic(uint8_t hz, uint32_t msg_content, unsigned int target_
* You should not call this function directly.
* You should use hwtimer -- or better yet -- vtimer instead.
*/
bool x86_rtc_set_update(uint32_t msg_content, unsigned int target_pid, bool allow_replace);
bool x86_rtc_set_update(uint32_t msg_content, kernel_pid_t target_pid, bool allow_replace);
/**
* @brief Set custom alarm interrupt handler.

View File

@ -58,7 +58,7 @@ int close(int fildes)
pid_t getpid(void)
{
return sched_active_pid;
return (pid_t) sched_active_pid;
}
int fstat(int fildes, struct stat *buf)

View File

@ -113,7 +113,7 @@ static void measure_nop_nop_nops_per_tick(void)
ts_per_nop_nop_nop += counting_end - counting_start;
}
x86_rtc_set_periodic_callback(NULL);
x86_rtc_set_periodic(RTC_REG_A_HZ_OFF, 0, -1, false);
x86_rtc_set_periodic(RTC_REG_A_HZ_OFF, 0, KERNEL_PID_NULL, false);
/* instructions_per_second = nop_nop_nops_per_second * ts_per_nop_nop_nop: */
instructions_per_second = nop_nop_nops_per_tick * TICK_HZ_VAL * ts_per_nop_nop_nop / nop_nop_nops_per_tick / NNN_TICK_ITERATIONS;
@ -150,7 +150,7 @@ static void init_bases(void)
ts_base);
x86_rtc_set_periodic_callback(NULL);
x86_rtc_set_periodic(RTC_REG_A_HZ_OFF, 0, -1, false);
x86_rtc_set_periodic(RTC_REG_A_HZ_OFF, 0, KERNEL_PID_NULL, false);
}
void x86_init_hwtimer(void)
@ -231,17 +231,17 @@ static void stop_alarms(void)
if (rtc_alarm_ie) {
rtc_alarm_ie = 0;
x86_rtc_set_alarm(NULL, 0, -1u, false);
x86_rtc_set_alarm(NULL, 0, KERNEL_PID_NULL, false);
}
if (rtc_update_ie) {
rtc_update_ie = 0;
x86_rtc_set_update(0, -1u, false);
x86_rtc_set_update(0, KERNEL_PID_NULL, false);
}
if (rtc_periodic_ie) {
rtc_periodic_ie = 0;
x86_rtc_set_periodic(RTC_REG_A_HZ_OFF, 0, -1u, false);
x86_rtc_set_periodic(RTC_REG_A_HZ_OFF, 0, KERNEL_PID_NULL, false);
}
}

View File

@ -34,17 +34,19 @@
#include <stdio.h>
#include "kernel.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
static bool valid;
static int32_t alarm_msg_content, periodic_msg_content, update_msg_content;
static unsigned alarm_pid = -1u, periodic_pid = -1u, update_pid = -1u;
static unsigned alarm_pid = KERNEL_PID_NULL, periodic_pid = KERNEL_PID_NULL, update_pid = KERNEL_PID_NULL;
static void alarm_callback_default(uint8_t reg_c)
{
if (alarm_pid != -1u) {
if (alarm_pid != KERNEL_PID_NULL) {
msg_t m;
m.type = reg_c | (RTC_REG_B_INT_ALARM << 8);
m.content.value = alarm_msg_content;
@ -54,7 +56,7 @@ static void alarm_callback_default(uint8_t reg_c)
static void periodic_callback_default(uint8_t reg_c)
{
if (periodic_pid != -1u) {
if (periodic_pid != KERNEL_PID_NULL) {
msg_t m;
m.type = reg_c | (RTC_REG_B_INT_PERIODIC << 8);
m.content.value = periodic_msg_content;
@ -64,7 +66,7 @@ static void periodic_callback_default(uint8_t reg_c)
static void update_callback_default(uint8_t reg_c)
{
if (update_pid != -1u) {
if (update_pid != KERNEL_PID_NULL) {
msg_t m;
m.type = reg_c | (RTC_REG_B_INT_UPDATE << 8);
m.content.value = update_msg_content;
@ -196,7 +198,7 @@ bool x86_rtc_read(x86_rtc_data_t *dest)
return true;
}
bool x86_rtc_set_alarm(const x86_rtc_data_t *when, uint32_t msg_content, unsigned int target_pid, bool allow_replace)
bool x86_rtc_set_alarm(const x86_rtc_data_t *when, uint32_t msg_content, kernel_pid_t target_pid, bool allow_replace)
{
if (!valid) {
return false;
@ -204,15 +206,15 @@ bool x86_rtc_set_alarm(const x86_rtc_data_t *when, uint32_t msg_content, unsigne
unsigned old_status = disableIRQ();
bool result;
if (target_pid == -1u) {
if (target_pid == KERNEL_PID_NULL) {
result = true;
alarm_pid = -1u;
alarm_pid = KERNEL_PID_NULL;
uint8_t b = x86_cmos_read(RTC_REG_B);
x86_cmos_write(RTC_REG_B, b & ~RTC_REG_B_INT_ALARM);
}
else {
result = allow_replace || alarm_pid == -1u;
result = allow_replace || alarm_pid == KERNEL_PID_NULL;
if (result) {
alarm_msg_content = msg_content;
alarm_pid = target_pid;
@ -236,7 +238,7 @@ bool x86_rtc_set_alarm(const x86_rtc_data_t *when, uint32_t msg_content, unsigne
return result;
}
bool x86_rtc_set_periodic(uint8_t hz, uint32_t msg_content, unsigned int target_pid, bool allow_replace)
bool x86_rtc_set_periodic(uint8_t hz, uint32_t msg_content, kernel_pid_t target_pid, bool allow_replace)
{
if (!valid) {
return false;
@ -244,16 +246,16 @@ bool x86_rtc_set_periodic(uint8_t hz, uint32_t msg_content, unsigned int target_
unsigned old_status = disableIRQ();
bool result;
if (target_pid == -1u || hz == RTC_REG_A_HZ_OFF) {
if (target_pid == KERNEL_PID_NULL || hz == RTC_REG_A_HZ_OFF) {
result = true;
periodic_pid = -1u;
periodic_pid = KERNEL_PID_NULL;
uint8_t old_divider = x86_cmos_read(RTC_REG_A) & ~RTC_REG_A_HZ_MASK;
x86_cmos_write(RTC_REG_A, old_divider | RTC_REG_A_HZ_OFF);
x86_cmos_write(RTC_REG_B, x86_cmos_read(RTC_REG_B) & ~RTC_REG_B_INT_PERIODIC);
}
else {
result = allow_replace || periodic_pid == -1u;
result = allow_replace || periodic_pid == KERNEL_PID_NULL;
if (result) {
periodic_msg_content = msg_content;
periodic_pid = target_pid;
@ -268,7 +270,7 @@ bool x86_rtc_set_periodic(uint8_t hz, uint32_t msg_content, unsigned int target_
return result;
}
bool x86_rtc_set_update(uint32_t msg_content, unsigned int target_pid, bool allow_replace)
bool x86_rtc_set_update(uint32_t msg_content, kernel_pid_t target_pid, bool allow_replace)
{
if (!valid) {
return false;
@ -276,14 +278,14 @@ bool x86_rtc_set_update(uint32_t msg_content, unsigned int target_pid, bool allo
unsigned old_status = disableIRQ();
bool result;
if (target_pid == -1u) {
if (target_pid == KERNEL_PID_NULL) {
result = true;
update_pid = -1u;
update_pid = KERNEL_PID_NULL;
x86_cmos_write(RTC_REG_B, x86_cmos_read(RTC_REG_B) & ~RTC_REG_B_INT_UPDATE);
}
else {
result = allow_replace || update_pid == -1u;
result = allow_replace || update_pid == KERNEL_PID_NULL;
if (result) {
update_msg_content = msg_content;
update_pid = target_pid;

View File

@ -51,7 +51,7 @@ static ucontext_t end_context;
bool x86_in_isr = true;
static long fpu_owner = -1;
static kernel_pid_t fpu_owner = KERNEL_PID_NULL;
//static ucontext_t *cur_ctx, *isr_ctx;
@ -188,7 +188,7 @@ static void fpu_used_interrupt(uint8_t intr_num, struct x86_pushad *orig_ctx, un
return;
}
if (fpu_owner != -1) {
if (fpu_owner != KERNEL_PID_NULL) {
ucontext_t *ctx_owner = (ucontext_t *) sched_threads[fpu_owner]->sp;
asm volatile ("fxsave (%0)" :: "r"(&fpu_data));
ctx_owner->__fxsave = fpu_data;
@ -205,7 +205,7 @@ static void x86_thread_exit(void)
{
dINT();
if (fpu_owner == sched_active_pid) {
fpu_owner = -1;
fpu_owner = KERNEL_PID_NULL;
}
sched_task_exit();
}

View File

@ -19,7 +19,7 @@ static uint8_t radio_channel;
static uint16_t radio_address;
static uint64_t radio_address_long;
void at86rf231_init(int tpid)
void at86rf231_init(kernel_pid_t tpid)
{
transceiver_pid = tpid;

View File

@ -82,11 +82,11 @@ static handler_entry_t handlers[MAX_PACKET_HANDLERS];
static const pm_table_t handler_table;
static const char *cc1100_event_handler_name = "cc1100_event_handler";
static mutex_t cc1100_mutex = MUTEX_INIT;
volatile int cc1100_mutex_pid;
volatile kernel_pid_t cc1100_mutex_pid;
static vtimer_t cc1100_watch_dog;
static timex_t cc1100_watch_dog_period;
static uint16_t cc1100_event_handler_pid;
static kernel_pid_t cc1100_event_handler_pid;
static void *cc1100_event_handler_function(void *);
static char event_handler_stack[KERNEL_CONF_STACKSIZE_MAIN];
@ -173,7 +173,7 @@ void cc1100_phy_init(void)
memset(seq_buffer, 0, sizeof(seq_buffer_entry_t) * MAX_SEQ_BUFFER_SIZE);
/* Initialize mutex */
cc1100_mutex_pid = -1;
cc1100_mutex_pid = KERNEL_PID_NULL;
/* Allocate event numbers and start cc1100 event process */
cc1100_event_handler_pid = thread_create(event_handler_stack, sizeof(event_handler_stack), PRIORITY_CC1100, CREATE_STACKTEST,
@ -203,7 +203,7 @@ void cc1100_phy_mutex_lock(void)
void cc1100_phy_mutex_unlock(void)
{
cc1100_mutex_pid = -1;
cc1100_mutex_pid = KERNEL_PID_NULL;
mutex_unlock(&cc1100_mutex);
}

View File

@ -49,10 +49,10 @@ static void write_register(uint8_t r, uint8_t value);
/*---------------------------------------------------------------------------*
* Radio Driver API *
*---------------------------------------------------------------------------*/
void cc110x_init(int tpid)
void cc110x_init(kernel_pid_t tpid)
{
transceiver_pid = tpid;
DEBUG("Transceiver PID: %i\n", transceiver_pid);
DEBUG("Transceiver PID: %" PRIkernel_pid "\n", transceiver_pid);
rx_buffer_next = 0;

View File

@ -74,7 +74,7 @@ void cc2420_initialize(void)
cc2420_switch_to_rx();
}
void cc2420_init(int tpid)
void cc2420_init(kernel_pid_t tpid)
{
transceiver_pid = tpid;
cc2420_initialize();

View File

@ -28,9 +28,9 @@ typedef struct __attribute__((packed))
}
at86rf231_packet_t;
extern int transceiver_pid;
extern kernel_pid_t transceiver_pid;
void at86rf231_init(int tpid);
void at86rf231_init(kernel_pid_t tpid);
//void at86rf231_reset(void);
void at86rf231_rx(void);
void at86rf231_rx_handler(void);

View File

@ -26,6 +26,7 @@
#include "radio/radio.h"
#include "radio/types.h"
#include "cc110x-config.h"
#include "kernel_types.h"
#define CC1100_MAX_DATA_LENGTH (58)
@ -115,9 +116,9 @@ extern volatile uint8_t rx_buffer_next; ///< Next packet in RX queue
extern volatile uint8_t radio_state; ///< Radio state
extern cc110x_statistic_t cc110x_statistic;
extern int transceiver_pid; ///< the transceiver thread pid
extern kernel_pid_t transceiver_pid; ///< the transceiver thread pid
void cc110x_init(int transceiver_pid);
void cc110x_init(kernel_pid_t transceiver_pid);
void cc110x_rx_handler(void);

View File

@ -80,6 +80,7 @@ Frame type value:
#include <stdbool.h>
#include "kernel_types.h"
#include "ieee802154_frame.h"
#include "cc2420_settings.h"
@ -106,8 +107,6 @@ typedef struct __attribute__ ((packed)) {
/* @} */
} cc2420_packet_t;
extern int transceiver_pid;
/**
* @brief Initialize the CC2420 transceiver.
*/
@ -119,7 +118,7 @@ void cc2420_initialize(void);
* @param[in] tpid The PID of the transceiver thread.
*/
void cc2420_init(int tpid);
void cc2420_init(kernel_pid_t tpid);
/**
* @brief Turn CC2420 on.
@ -362,7 +361,7 @@ int16_t cc2420_send(cc2420_packet_t *packet);
/**
* The PID of the transceiver thread.
*/
extern int transceiver_pid;
extern kernel_pid_t transceiver_pid;
/*
* RX Packet Buffer, read from the transceiver, filled by the cc2420_rx_handler.

View File

@ -26,6 +26,7 @@ and Telematics group (http://cst.mi.fu-berlin.de).
#include <time.h>
#include <sys/time.h>
#include "kernel_types.h"
/**
* @brief Initializes the RTC for calendar mode
@ -60,7 +61,7 @@ void rtc_get_localtime(struct tm *localt);
*/
time_t rtc_time(struct timeval *time);
extern int rtc_second_pid;
extern kernel_pid_t rtc_second_pid;
/** @} */
#endif

View File

@ -47,7 +47,7 @@ char relay_stack[KERNEL_CONF_STACKSIZE_MAIN];
#if RIOT_CCN_APPSERVER
char appserver_stack[KERNEL_CONF_STACKSIZE_MAIN];
#endif
int relay_pid, appserver_pid;
kernel_pid_t relay_pid, appserver_pid;
#define SHELL_MSG_BUFFER_SIZE (64)
msg_t msg_buffer_shell[SHELL_MSG_BUFFER_SIZE];
@ -73,7 +73,7 @@ static void riot_ccn_appserver(int argc, char **argv)
appserver_stack, sizeof(appserver_stack),
PRIORITY_MAIN - 1, CREATE_STACKTEST,
ccnl_riot_appserver_start, (void *) relay_pid, "appserver");
DEBUG("ccn-lite appserver on thread_id %d...\n", appserver_pid);
DEBUG("ccn-lite appserver on thread_id %" PRIkernel_pid "...\n", appserver_pid);
}
#endif
@ -183,7 +183,7 @@ static void riot_ccn_relay_start(void)
relay_stack, sizeof(relay_stack),
PRIORITY_MAIN - 2, CREATE_STACKTEST,
ccnl_riot_relay_start, NULL, "relay");
DEBUG("ccn-lite relay on thread_id %d...\n", relay_pid);
DEBUG("ccn-lite relay on thread_id %" PRIkernel_pid "...\n", relay_pid);
riot_ccn_transceiver_start(relay_pid);
}

View File

@ -31,7 +31,7 @@
// ccn
#include "ccn_lite/ccnl-riot.h"
int relay_pid;
kernel_pid_t relay_pid;
char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
@ -47,7 +47,7 @@ void set_address_handler(uint16_t a)
printf("trying to set address %" PRIu16 "\n", a);
mesg.type = SET_ADDRESS;
printf("transceiver_pid=%d\n", transceiver_pid);
printf("transceiver_pid=%" PRIkernel_pid"\n", transceiver_pid);
msg_send_receive(&mesg, &mesg, transceiver_pid);
printf("got address: %" PRIu16 "\n", a);

View File

@ -88,7 +88,7 @@ void *radio(void *arg)
void init_transceiver(void)
{
int radio_pid = thread_create(
kernel_pid_t radio_pid = thread_create(
radio_stack_buffer,
sizeof(radio_stack_buffer),
PRIORITY_MAIN - 2,

View File

@ -28,12 +28,12 @@ void *second_thread(void *arg)
{
(void) arg;
printf("2nd thread started, pid: %i\n", thread_getpid());
printf("2nd thread started, pid: %" PRIkernel_pid "\n", thread_getpid());
msg_t m;
while (1) {
msg_receive(&m);
printf("2nd: Got msg from %i\n", m.sender_pid);
printf("2nd: Got msg from %" PRIkernel_pid "\n", m.sender_pid);
m.content.value++;
msg_reply(&m, &m);
}
@ -46,11 +46,11 @@ char second_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
int main(void)
{
printf("Starting IPC Ping-pong example...\n");
printf("1st thread started, pid: %i\n", thread_getpid());
printf("1st thread started, pid: %" PRIkernel_pid "\n", thread_getpid());
msg_t m;
int pid = thread_create(second_thread_stack, sizeof(second_thread_stack),
kernel_pid_t pid = thread_create(second_thread_stack, sizeof(second_thread_stack),
PRIORITY_MAIN - 1, CREATE_STACKTEST,
second_thread, NULL, "pong");

View File

@ -137,7 +137,7 @@ void rpl_udp_ignore(int argc, char **argv)
if (argc == 2) {
a = atoi(argv[1]);
printf("sending to transceiver (%u): %u\n", transceiver_pid, (*(uint8_t *)tcmd.data));
printf("sending to transceiver (%" PRIkernel_pid "): %u\n", transceiver_pid, (*(uint8_t *)tcmd.data));
msg_send(&mesg, transceiver_pid, 1);
}
else {

View File

@ -87,10 +87,13 @@ void rpl_udp_init(int argc, char **argv)
}
DEBUGF("Start monitor\n");
int monitor_pid = thread_create(
monitor_stack_buffer, sizeof(monitor_stack_buffer),
PRIORITY_MAIN - 2, CREATE_STACKTEST,
rpl_udp_monitor, NULL, "monitor");
kernel_pid_t monitor_pid = thread_create(monitor_stack_buffer,
sizeof(monitor_stack_buffer),
PRIORITY_MAIN - 2,
CREATE_STACKTEST,
rpl_udp_monitor,
NULL,
"monitor");
DEBUGF("Register at transceiver %02X\n", TRANSCEIVER);
transceiver_register(TRANSCEIVER, monitor_pid);
ipv6_register_packet_handler(monitor_pid);

View File

@ -46,11 +46,13 @@ void udp_server(int argc, char **argv)
(void) argc;
(void) argv;
int udp_server_thread_pid = thread_create(
udp_server_stack_buffer, sizeof(udp_server_stack_buffer),
PRIORITY_MAIN, CREATE_STACKTEST,
init_udp_server, NULL, "init_udp_server");
printf("UDP SERVER ON PORT %d (THREAD PID: %d)\n", HTONS(SERVER_PORT), udp_server_thread_pid);
kernel_pid_t udp_server_thread_pid = thread_create(udp_server_stack_buffer,
sizeof(udp_server_stack_buffer),
PRIORITY_MAIN, CREATE_STACKTEST,
init_udp_server,
NULL,
"init_udp_server");
printf("UDP SERVER ON PORT %d (THREAD PID: %" PRIkernel_pid ")\n", HTONS(SERVER_PORT), udp_server_thread_pid);
}
static void *init_udp_server(void *arg)

View File

@ -45,9 +45,9 @@ void chardev_loop(ringbuffer_t *rb)
{
msg_t m;
int pid = thread_getpid();
kernel_pid_t pid = thread_getpid();
int reader_pid = -1;
kernel_pid_t reader_pid = KERNEL_PID_NULL;
struct posix_iop_t *r = NULL;
puts("UART0 thread started.");
@ -61,7 +61,7 @@ void chardev_loop(ringbuffer_t *rb)
switch(m.type) {
case OPEN:
DEBUG("OPEN\n");
if (reader_pid == -1) {
if (reader_pid == KERNEL_PID_NULL) {
reader_pid = m.sender_pid;
/* no error */
m.content.value = 0;
@ -89,8 +89,8 @@ void chardev_loop(ringbuffer_t *rb)
case CLOSE:
DEBUG("CLOSE\n");
if (m.sender_pid == reader_pid) {
DEBUG("uart0_thread: closing file from %i\n", reader_pid);
reader_pid = -1;
DEBUG("uart0_thread: closing file from %" PRIkernel_pid "\n", reader_pid);
reader_pid = KERNEL_PID_NULL;
r = NULL;
m.content.value = 0;
}
@ -112,7 +112,7 @@ void chardev_loop(ringbuffer_t *rb)
DEBUG("Data is available\n");
int state = disableIRQ();
int nbytes = min(r->nbytes, rb->avail);
DEBUG("uart0_thread [%i]: sending %i bytes received from %i to pid %i\n", pid, nbytes, m.sender_pid, reader_pid);
DEBUG("uart0_thread [%i]: sending %i bytes received from %" PRIkernel_pid " to pid %" PRIkernel_pid "\n", pid, nbytes, m.sender_pid, reader_pid);
ringbuffer_get(rb, r->buffer, nbytes);
r->nbytes = nbytes;

View File

@ -12,9 +12,10 @@
#ifndef __BOARD_UART0_H
#define __BOARD_UART0_H
#include "kernel_types.h"
#include "cpu-conf.h" /* To give user access to UART0_BUFSIZE */
extern int uart0_handler_pid;
extern kernel_pid_t uart0_handler_pid;
void board_uart0_init(void);
void uart0_handle_incoming(int c);

View File

@ -22,6 +22,7 @@
#define FD_H
#include <stdlib.h>
#include <sys/types.h>
#include "kernel_types.h"
#include "cpu.h"
/**
@ -32,7 +33,7 @@ typedef struct {
int __active;
/** the internal filedescriptor */
int fd;
kernel_pid_t fd;
/**
* Read *n* into *buf* from *fd*. Return the
@ -44,7 +45,7 @@ typedef struct {
ssize_t (*write)(int fd, const void *buf, size_t n);
/** Close the file descriptor *fd*. */
int (*close)(int fd);
int (*close)(kernel_pid_t fd);
} fd_t;
/**
@ -66,7 +67,7 @@ int fd_init(void);
*/
int fd_new(int internal_fd, ssize_t (*internal_read)(int, void *, size_t),
ssize_t (*internal_write)(int, const void *, size_t),
int (*internal_close)(int));
int (*internal_close)(kernel_pid_t));
/**
* @brief Gets the file descriptor table entry associated with file

View File

@ -20,6 +20,8 @@
#ifndef __READ_H
#define __READ_H
#include "kernel_types.h"
#define OPEN 0
#define CLOSE 1
#define READ 2
@ -30,10 +32,10 @@ struct posix_iop_t {
char *buffer;
};
int posix_open(int pid, int flags);
int posix_close(int pid);
int posix_read(int pid, char *buffer, int bufsize);
int posix_write(int pid, char *buffer, int bufsize);
int posix_open(kernel_pid_t pid, int flags);
int posix_close(kernel_pid_t pid);
int posix_read(kernel_pid_t pid, char *buffer, int bufsize);
int posix_write(kernel_pid_t pid, char *buffer, int bufsize);
/** @} */
#endif /* __READ_H */

View File

@ -11,6 +11,7 @@
#ifndef TRANSCEIVER_H
#define TRANSCEIVER_H
#include "kernel_types.h"
#include "radio/types.h"
/* supported transceivers *
@ -190,7 +191,7 @@ enum transceiver_msg_type_t {
*/
typedef struct {
transceiver_type_t transceivers; ///< the tranceivers the thread is registered for
int pid; ///< the thread's pid
kernel_pid_t pid; ///< the thread's pid
} registered_t;
typedef struct {
@ -199,7 +200,7 @@ typedef struct {
} transceiver_command_t;
/* The transceiver thread's pid */
extern int transceiver_pid;
extern kernel_pid_t transceiver_pid;
/** An array of ignored link layer addresses */
extern radio_address_t transceiver_ignored_addr[TRANSCEIVER_MAX_IGNORED_ADDR];
@ -216,7 +217,7 @@ void transceiver_init(transceiver_type_t transceivers);
*
* @return The transceiver thread's pid
*/
int transceiver_start(void);
kernel_pid_t transceiver_start(void);
/**
* @brief register a thread for events from certain transceivers
@ -226,7 +227,7 @@ int transceiver_start(void);
*
* @return 1 on success, 0 otherwise
*/
uint8_t transceiver_register(transceiver_type_t transceivers, int pid);
uint8_t transceiver_register(transceiver_type_t transceivers, kernel_pid_t pid);
/**
* @brief unregister a thread for events from certain transceivers
@ -236,7 +237,7 @@ uint8_t transceiver_register(transceiver_type_t transceivers, int pid);
*
* @return 1 on success, 0 otherwise
*/
uint8_t transceiver_unregister(transceiver_type_t transceivers, int pid);
uint8_t transceiver_unregister(transceiver_type_t transceivers, kernel_pid_t pid);
#endif /* TRANSCEIVER_H */
/** @} */

View File

@ -39,7 +39,7 @@ typedef struct vtimer_t {
timex_t absolute;
void (*action)(struct vtimer_t *timer);
void *arg;
unsigned int pid;
kernel_pid_t pid;
} vtimer_t;
/**
@ -89,7 +89,7 @@ int vtimer_sleep(timex_t time);
* @param[in] ptr message value
* @return 0 on success, < 0 on error
*/
int vtimer_set_msg(vtimer_t *t, timex_t interval, unsigned int pid, void *ptr);
int vtimer_set_msg(vtimer_t *t, timex_t interval, kernel_pid_t pid, void *ptr);
/**
* @brief set a vtimer with wakeup event
@ -97,7 +97,7 @@ int vtimer_set_msg(vtimer_t *t, timex_t interval, unsigned int pid, void *ptr);
* @param[in] pid process id
* @return 0 on success, < 0 on error
*/
int vtimer_set_wakeup(vtimer_t *t, timex_t interval, int pid);
int vtimer_set_wakeup(vtimer_t *t, timex_t interval, kernel_pid_t pid);
/**
* @brief remove a vtimer

View File

@ -340,7 +340,7 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
case (CCNL_RIOT_HALT):
/* cmd to stop the relay */
DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid);
DEBUGMSG(1, "\tSrc:\t%" PRIkernel_pid "\n", in.sender_pid);
DEBUGMSG(1, "\tNumb:\t%" PRIu32 "\n", in.content.value);
ccnl->halt_flag = 1;
@ -349,7 +349,7 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
#if RIOT_CCNL_POPULATE
case (CCNL_RIOT_POPULATE):
/* cmd to polulate the cache */
DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid);
DEBUGMSG(1, "\tSrc:\t%" PRIkernel_pid "\n", in.sender_pid);
DEBUGMSG(1, "\tNumb:\t%" PRIu32 "\n", in.content.value);
handle_populate_cache(ccnl);
@ -372,7 +372,7 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
break;
default:
DEBUGMSG(1, "%s Packet waiting\n", riot_ccnl_event_to_string(in.type));
DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid);
DEBUGMSG(1, "\tSrc:\t%" PRIkernel_pid "\n", in.sender_pid);
DEBUGMSG(1, "\tdropping it...\n");
break;
}

View File

@ -104,8 +104,8 @@ struct ccnl_relay_s {
void *aux;
int fib_threshold_prefix; /* how may name components should be considdered as dynamic */
int fib_threshold_aggregate;
int riot_pid;
int riot_helper_pid;
kernel_pid_t riot_pid;
kernel_pid_t riot_helper_pid;
mutex_t global_lock;
mutex_t stop_lock;
};

View File

@ -37,10 +37,10 @@
/** message buffer */
msg_t msg_buffer_appserver[APPSERVER_MSG_BUFFER_SIZE];
int relay_pid;
kernel_pid_t relay_pid;
char prefix[] = "/riot/appserver/";
static int appserver_sent_content(uint8_t *buf, int len, uint16_t from)
static int appserver_sent_content(uint8_t *buf, int len, kernel_pid_t from)
{
static riot_ccnl_msg_t rmsg;
rmsg.payload = buf;
@ -50,8 +50,8 @@ static int appserver_sent_content(uint8_t *buf, int len, uint16_t from)
msg_t m;
m.type = CCNL_RIOT_MSG;
m.content.ptr = (char *) &rmsg;
uint16_t dest_pid = from;
DEBUGMSG(1, "sending msg to pid=%u\n", dest_pid);
kernel_pid_t dest_pid = from;
DEBUGMSG(1, "sending msg to pid=%" PRIkernel_pid "\n", dest_pid);
int ret = msg_send(&m, dest_pid, 1);
DEBUGMSG(1, "msg_reply returned: %d\n", ret);
return ret;
@ -132,7 +132,7 @@ static void riot_ccnl_appserver_ioloop(void)
switch (in.type) {
case (CCNL_RIOT_MSG):
m = (riot_ccnl_msg_t *) in.content.ptr;
DEBUGMSG(1, "new msg: size=%" PRIu16 " sender_pid=%" PRIu16 "\n",
DEBUGMSG(1, "new msg: size=%" PRIu16 " sender_pid=%" PRIkernel_pid "\n",
m->size, in.sender_pid);
appserver_handle_interest(m->payload, m->size, in.sender_pid);
@ -151,7 +151,7 @@ static void riot_ccnl_appserver_ioloop(void)
static void riot_ccnl_appserver_register(void)
{
char faceid[10];
snprintf(faceid, sizeof(faceid), "%d", thread_getpid());
snprintf(faceid, sizeof(faceid), "%" PRIkernel_pid, thread_getpid());
char *type = "newMSGface";
unsigned char *mgnt_pkg = malloc(256);
@ -168,7 +168,7 @@ static void riot_ccnl_appserver_register(void)
void *ccnl_riot_appserver_start(void *arg)
{
int _relay_pid = (int) arg;
kernel_pid_t _relay_pid = (kernel_pid_t) arg;
relay_pid = _relay_pid;
riot_ccnl_appserver_register();
riot_ccnl_appserver_ioloop();

View File

@ -79,7 +79,7 @@ int riot_send_msg(uint8_t *buf, uint16_t size, uint16_t to)
msg_t m;
m.type = CCNL_RIOT_MSG;
m.content.ptr = (char *) rmsg;
DEBUGMSG(1, "sending msg to pid=%u\n", to);
DEBUGMSG(1, "sending msg to pid=%" PRIkernel_pid "\n", to);
msg_send(&m, to, 1);
return size;
@ -89,7 +89,7 @@ void riot_send_nack(uint16_t to)
{
msg_t m;
m.type = CCNL_RIOT_NACK;
DEBUGMSG(1, "sending NACK msg to pid=%u\n", to);
DEBUGMSG(1, "sending NACK msg to pid=%" PRIkernel_pid"\n", to);
msg_send(&m, to, 0);
}

View File

@ -32,7 +32,7 @@
msg_t mesg, rep;
int ccnl_riot_client_get(unsigned int relay_pid, char *name, char *reply_buf)
int ccnl_riot_client_get(kernel_pid_t relay_pid, char *name, char *reply_buf)
{
char *prefix[CCNL_MAX_NAME_COMP];
char *cp = strtok(name, "/");
@ -60,7 +60,7 @@ int ccnl_riot_client_get(unsigned int relay_pid, char *name, char *reply_buf)
}
unsigned int interest_nonce = genrand_uint32();
int interest_len = mkInterest(prefix, &interest_nonce, interest_pkg);
DEBUGMSG(1, "relay_pid=%u interest_len=%d\n", relay_pid, interest_len);
DEBUGMSG(1, "relay_pid=%" PRIkernel_pid " interest_len=%d\n", relay_pid, interest_len);
riot_ccnl_msg_t rmsg;
rmsg.payload = interest_pkg;
@ -85,7 +85,7 @@ int ccnl_riot_client_get(unsigned int relay_pid, char *name, char *reply_buf)
unsigned char *data = rmsg_reply->payload;
int datalen = (int) rmsg_reply->size;
DEBUGMSG(1, "%d bytes left; msg from=%u\n", datalen, rep.sender_pid);
DEBUGMSG(1, "%d bytes left; msg from=%" PRIkernel_pid "\n", datalen, rep.sender_pid);
int scope = 3, aok = 3, minsfx = 0, maxsfx = CCNL_MAX_NAME_COMP,
contlen = 0;
@ -119,7 +119,7 @@ int ccnl_riot_client_get(unsigned int relay_pid, char *name, char *reply_buf)
return content_len;
}
int ccnl_riot_client_new_face(unsigned int relay_pid, char *type, char *faceid,
int ccnl_riot_client_new_face(kernel_pid_t relay_pid, char *type, char *faceid,
unsigned char *reply_buf)
{
DEBUGMSG(1, "riot_new_face: mkNewFaceRquest\n");
@ -148,7 +148,7 @@ int ccnl_riot_client_new_face(unsigned int relay_pid, char *type, char *faceid,
return size;
}
int ccnl_riot_client_register_prefix(unsigned int relay_pid, char *prefix, char *faceid,
int ccnl_riot_client_register_prefix(kernel_pid_t relay_pid, char *prefix, char *faceid,
unsigned char *reply_buf)
{
DEBUGMSG(1, "riot_register_prefix: mkPrefixregRequest\n");
@ -178,7 +178,7 @@ int ccnl_riot_client_register_prefix(unsigned int relay_pid, char *prefix, char
return size;
}
int ccnl_riot_client_publish(unsigned int relay_pid, char *prefix, char *faceid, char *type, unsigned char *reply_buf)
int ccnl_riot_client_publish(kernel_pid_t relay_pid, char *prefix, char *faceid, char *type, unsigned char *reply_buf)
{
ccnl_riot_client_new_face(relay_pid, type, faceid, reply_buf);
int content_len = ccnl_riot_client_register_prefix(relay_pid, prefix, faceid, reply_buf);

View File

@ -38,7 +38,7 @@
*
* @return the length of the reply message stored in reply_buf
*/
int ccnl_riot_client_get(unsigned int relay_pid, char *name, char *reply_buf);
int ccnl_riot_client_get(kernel_pid_t relay_pid, char *name, char *reply_buf);
/**
* @brief high level function to publish a name, e.g. "/riot/test"
@ -62,7 +62,7 @@ int ccnl_riot_client_get(unsigned int relay_pid, char *name, char *reply_buf);
*
* @return the length of the reply message stored in reply_buf
*/
int ccnl_riot_client_publish(unsigned int relay_pid, char *prefix, char *faceid,
int ccnl_riot_client_publish(kernel_pid_t relay_pid, char *prefix, char *faceid,
char *type, unsigned char *reply_buf);
/**
@ -81,7 +81,7 @@ int ccnl_riot_client_publish(unsigned int relay_pid, char *prefix, char *faceid,
*
* @return the length of the reply message stored in reply_buf
*/
int ccnl_riot_client_new_face(unsigned int relay_pid, char *type, char *faceid,
int ccnl_riot_client_new_face(kernel_pid_t relay_pid, char *type, char *faceid,
unsigned char *reply_buf);
/**
@ -100,7 +100,7 @@ int ccnl_riot_client_new_face(unsigned int relay_pid, char *type, char *faceid,
*
* @return the length of the reply message stored in reply_buf
*/
int ccnl_riot_client_register_prefix(unsigned int relay_pid, char *prefix,
int ccnl_riot_client_register_prefix(kernel_pid_t relay_pid, char *prefix,
char *faceid, unsigned char *reply_buf);
/**

View File

@ -369,7 +369,7 @@ int net_if_send_packet_broadcast(net_if_trans_addr_m_t preferred_dest_mode,
*
* @return 1 on success, 0 otherwise
*/
int net_if_register(int if_id, int pid);
int net_if_register(int if_id, kernel_pid_t pid);
/**
* Returns the EUI-64 of the transeivers attached to this interface. This can

View File

@ -153,7 +153,7 @@ uint8_t ipv6_get_default_hop_limit(void);
* @return 0 on success, ENOMEN if maximum number of registrable
* threads is exceeded.
*/
uint8_t ipv6_register_packet_handler(int pid);
uint8_t ipv6_register_packet_handler(kernel_pid_t pid);
/**
* @brief Registers a handler thread for L4 protocol.
@ -161,14 +161,14 @@ uint8_t ipv6_register_packet_handler(int pid);
* @param[in] next_header Next header ID of the L4 protocol.
* @param[in] pid PID of the handler thread
*/
void ipv6_register_next_header_handler(uint8_t next_header, int pid);
void ipv6_register_next_header_handler(uint8_t next_header, kernel_pid_t pid);
/**
* @brief Registers a handler thread for RPL options
*
* @param[in] pid PID of the handler thread.
*/
void ipv6_register_rpl_handler(int pid);
void ipv6_register_rpl_handler(kernel_pid_t pid);
/**
* @brief Sets the first 64 bit of *ipv6_addr* to link local prefix.

View File

@ -279,7 +279,7 @@ void sixlowpan_lowpan_bootstrapping(void);
* @return 1 on success, ENOMEM if maximum number of registrable
* threads is exceeded.
*/
uint8_t sixlowpan_lowpan_register(int pid);
uint8_t sixlowpan_lowpan_register(kernel_pid_t pid);
#if ENABLE_DEBUG
/**

View File

@ -56,7 +56,7 @@ int sixlowpan_mac_send_ieee802154_frame(int if_id, const void *dest,
*
* @return PID of the MAC receiver thread.
*/
int sixlowpan_mac_init(void);
kernel_pid_t sixlowpan_mac_init(void);
/** @} */
#endif /* SIXLOWPAN_MAC_H */

View File

@ -394,7 +394,7 @@ int net_if_send_packet_long(int if_id, net_if_eui64_t *target,
return (response > payload_len) ? (int)payload_len : (int)response;
}
int net_if_register(int if_id, int pid)
int net_if_register(int if_id, kernel_pid_t pid)
{
if (if_id < 0 || if_id > NET_IF_MAX || !interfaces[if_id].initialized) {
DEBUG("Register thread: No interface initialized with ID %d.\n", if_id);

View File

@ -44,7 +44,7 @@
#define READER_STACK_SIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
char serial_reader_stack[READER_STACK_SIZE];
uint16_t serial_reader_pid;
kernel_pid_t serial_reader_pid;
uint8_t serial_out_buf[BORDER_BUFFER_SIZE];
uint8_t serial_in_buf[BORDER_BUFFER_SIZE];
@ -69,14 +69,14 @@ uint8_t *get_serial_in_buffer(int offset)
return &(serial_in_buf[offset]);
}
uint16_t border_get_serial_reader()
kernel_pid_t border_get_serial_reader()
{
return serial_reader_pid;
}
void serial_reader_f(void)
{
int main_pid = 0;
kernel_pid_t main_pid = KERNEL_PID_NULL;
int bytes;
msg_t m;
border_packet_t *uart_buf;

View File

@ -32,7 +32,7 @@ static int set_timeout(vtimer_t *timeout, timex_t val, void *args);
static void sending_slot(void);
char sending_slot_stack[SENDING_SLOT_STACK_SIZE];
unsigned int sending_slot_pid;
kernel_pid_t sending_slot_pid;
flowcontrol_stat_t slwin_stat;
sem_t connection_established;

View File

@ -44,7 +44,7 @@ enum option_types_t {
OPT_DAC,
};
extern int nd_nbr_cache_rem_pid;
extern kernel_pid_t nd_nbr_cache_rem_pid;
void recv_echo_req(void);

View File

@ -52,9 +52,9 @@ ipv6_hdr_t *ipv6_buf;
icmpv6_hdr_t *icmp_buf;
uint8_t *nextheader;
int udp_packet_handler_pid = 0;
int tcp_packet_handler_pid = 0;
int rpl_process_pid = 0;
kernel_pid_t udp_packet_handler_pid = KERNEL_PID_NULL;
kernel_pid_t tcp_packet_handler_pid = KERNEL_PID_NULL;
kernel_pid_t rpl_process_pid = KERNEL_PID_NULL;
ipv6_addr_t *(*ip_get_next_hop)(ipv6_addr_t *) = 0;
static ipv6_net_if_ext_t ipv6_net_if_ext[NET_IF_MAX];
@ -193,7 +193,7 @@ uint8_t ipv6_get_default_hop_limit(void)
}
/* Register an upper layer thread */
uint8_t ipv6_register_packet_handler(int pid)
uint8_t ipv6_register_packet_handler(kernel_pid_t pid)
{
uint8_t i;
@ -259,7 +259,7 @@ int icmpv6_demultiplex(const icmpv6_hdr_t *hdr)
case (ICMPV6_TYPE_RPL_CONTROL): {
DEBUG("INFO: packet type: RPL message\n");
if (rpl_process_pid != 0) {
if (rpl_process_pid != KERNEL_PID_NULL) {
msg_t m_send;
m_send.content.ptr = (char *) &hdr->code;
msg_send(&m_send, rpl_process_pid, 1);
@ -379,7 +379,7 @@ void *ipv6_process(void *arg)
}
case (IPV6_PROTO_NUM_TCP): {
if (tcp_packet_handler_pid != 0) {
if (tcp_packet_handler_pid != KERNEL_PID_NULL) {
m_send.content.ptr = (char *) ipv6_buf;
msg_send_receive(&m_send, &m_recv, tcp_packet_handler_pid);
}
@ -391,7 +391,7 @@ void *ipv6_process(void *arg)
}
case (IPV6_PROTO_NUM_UDP): {
if (udp_packet_handler_pid != 0) {
if (udp_packet_handler_pid != KERNEL_PID_NULL) {
m_send.content.ptr = (char *) ipv6_buf;
msg_send_receive(&m_send, &m_recv, udp_packet_handler_pid);
}
@ -752,17 +752,17 @@ uint8_t ipv6_is_router(void)
return 0;
}
void set_tcp_packet_handler_pid(int pid)
void set_tcp_packet_handler_pid(kernel_pid_t pid)
{
tcp_packet_handler_pid = pid;
}
void set_udp_packet_handler_pid(int pid)
void set_udp_packet_handler_pid(kernel_pid_t pid)
{
udp_packet_handler_pid = pid;
}
void ipv6_register_next_header_handler(uint8_t next_header, int pid)
void ipv6_register_next_header_handler(uint8_t next_header, kernel_pid_t pid)
{
switch (next_header) {
case (IPV6_PROTO_NUM_TCP):
@ -785,7 +785,7 @@ void ipv6_iface_set_routing_provider(ipv6_addr_t *(*next_hop)(ipv6_addr_t *dest)
ip_get_next_hop = next_hop;
}
void ipv6_register_rpl_handler(int pid)
void ipv6_register_rpl_handler(kernel_pid_t pid)
{
rpl_process_pid = pid;
}

View File

@ -45,7 +45,7 @@
/* extern variables */
extern uint8_t ipv6_ext_hdr_len;
extern int ip_process_pid;
extern kernel_pid_t ip_process_pid;
/* base header lengths */
#define LL_HDR_LEN (0x4)

View File

@ -123,10 +123,10 @@ uint8_t comp_buf[512];
uint8_t first_frag = 0;
mutex_t fifo_mutex = MUTEX_INIT;
int ip_process_pid = 0;
int nd_nbr_cache_rem_pid = 0;
int contexts_rem_pid = 0;
int transfer_pid = 0;
kernel_pid_t ip_process_pid = KERNEL_PID_NULL;
kernel_pid_t nd_nbr_cache_rem_pid = KERNEL_PID_NULL;
kernel_pid_t contexts_rem_pid = KERNEL_PID_NULL;
kernel_pid_t transfer_pid = KERNEL_PID_NULL;
mutex_t lowpan_context_mutex = MUTEX_INIT;
@ -763,7 +763,7 @@ void add_fifo_packet(lowpan_reas_buf_t *current_packet)
}
/* Register an upper layer thread */
uint8_t sixlowpan_lowpan_register(int pid)
uint8_t sixlowpan_lowpan_register(kernel_pid_t pid)
{
uint8_t i;

View File

@ -319,10 +319,11 @@ int sixlowpan_mac_send_ieee802154_frame(int if_id,
}
}
int sixlowpan_mac_init(void)
kernel_pid_t sixlowpan_mac_init(void)
{
int recv_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE,
PRIORITY_MAIN - 2, CREATE_STACKTEST, recv_ieee802154_frame, NULL, "radio");
kernel_pid_t recv_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE,
PRIORITY_MAIN - 2, CREATE_STACKTEST,
recv_ieee802154_frame, NULL, "radio");
int if_id = -1;
while ((if_id = net_if_iter_interfaces(if_id)) >= 0) {

View File

@ -60,9 +60,9 @@ static uint8_t etx_send_buf[ETX_BUF_SIZE];
static uint8_t etx_rec_buf[ETX_BUF_SIZE];
//PIDs
int etx_beacon_pid = 0;
int etx_radio_pid = 0;
int etx_clock_pid = 0;
kernel_pid_t etx_beacon_pid = KERNEL_PID_NULL;
kernel_pid_t etx_radio_pid = KERNEL_PID_NULL;
kernel_pid_t etx_clock_pid = KERNEL_PID_NULL;
//Message queue for radio
static msg_t msg_que[ETX_RCV_QUEUE_SIZE];

View File

@ -49,7 +49,7 @@ char addr_str[IPV6_MAX_ADDR_STR_LEN];
/* global variables */
rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS];
rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES];
unsigned int rpl_process_pid;
kernel_pid_t rpl_process_pid;
mutex_t rpl_recv_mutex = MUTEX_INIT;
mutex_t rpl_send_mutex = MUTEX_INIT;
msg_t rpl_msg_queue[RPL_PKT_RECV_BUF_SIZE];

View File

@ -44,7 +44,7 @@
/* global variables */
extern rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS];
extern rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES];
extern unsigned int rpl_process_pid;
extern kernel_pid_t rpl_process_pid;
/* needed for receiving messages with ICMP-code 155. Received via IPC from ipv6.c */
extern mutex_t rpl_recv_mutex;

View File

@ -33,10 +33,10 @@ static char interval_over_buf[TRICKLE_INTERVAL_STACKSIZE];
static char dao_delay_over_buf[DAO_DELAY_STACKSIZE];
static char routing_table_buf[RT_STACKSIZE];
int timer_over_pid;
int interval_over_pid;
int dao_delay_over_pid;
int rt_timer_over_pid;
kernel_pid_t timer_over_pid;
kernel_pid_t interval_over_pid;
kernel_pid_t dao_delay_over_pid;
kernel_pid_t rt_timer_over_pid;
bool ack_received;
uint8_t dao_counter;

View File

@ -42,7 +42,7 @@ int destiny_init_transport_layer(void)
memset(sockets, 0, MAX_SOCKETS * sizeof(socket_internal_t));
/* UDP */
int udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE,
kernel_pid_t udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE,
PRIORITY_MAIN, CREATE_STACKTEST,
udp_packet_handler, NULL, "udp_packet_handler");
@ -62,7 +62,7 @@ int destiny_init_transport_layer(void)
#endif
global_sequence_counter = rand();
int tcp_thread_pid = thread_create(tcp_stack_buffer, TCP_STACK_SIZE,
kernel_pid_t tcp_thread_pid = thread_create(tcp_stack_buffer, TCP_STACK_SIZE,
PRIORITY_MAIN, CREATE_STACKTEST,
tcp_packet_handler, NULL, "tcp_packet_handler");

View File

@ -42,13 +42,13 @@ int net_msg_reply(msg_t *m, msg_t *reply, uint16_t message)
return msg_reply(m, reply);
}
int net_msg_send(msg_t *m, unsigned int pid, bool block, uint16_t message)
int net_msg_send(msg_t *m, kernel_pid_t pid, bool block, uint16_t message)
{
m->type = message;
return msg_send(m, pid, block);
}
int net_msg_send_recv(msg_t *m, msg_t *reply, unsigned int pid, uint16_t message)
int net_msg_send_recv(msg_t *m, msg_t *reply, kernel_pid_t pid, uint16_t message)
{
m->type = message;
return msg_send_receive(m, reply, pid);;

View File

@ -37,8 +37,8 @@
void block_continue_thread(void);
int net_msg_receive(msg_t *m);
int net_msg_reply(msg_t *m, msg_t *reply, uint16_t message);
int net_msg_send(msg_t *m, unsigned int pid, bool block, uint16_t message);
int net_msg_send_recv(msg_t *m, msg_t *reply, unsigned int pid, uint16_t message);
int net_msg_send(msg_t *m, kernel_pid_t pid, bool block, uint16_t message);
int net_msg_send_recv(msg_t *m, msg_t *reply, kernel_pid_t pid, uint16_t message);
#endif /* MSG_HELP_H_ */
/**

View File

@ -236,7 +236,7 @@ bool is_tcp_socket(int s)
}
}
int bind_udp_socket(int s, sockaddr6_t *name, int namelen, uint8_t pid)
int bind_udp_socket(int s, sockaddr6_t *name, int namelen, kernel_pid_t pid)
{
int i;
@ -256,7 +256,7 @@ int bind_udp_socket(int s, sockaddr6_t *name, int namelen, uint8_t pid)
return 0;
}
int bind_tcp_socket(int s, sockaddr6_t *name, int namelen, uint8_t pid)
int bind_tcp_socket(int s, sockaddr6_t *name, int namelen, kernel_pid_t pid)
{
int i;
@ -676,7 +676,7 @@ int destiny_socket_connect(int socket, sockaddr6_t *addr, uint32_t addrlen)
current_tcp_socket->tcp_control.state = TCP_ESTABLISHED;
current_int_tcp_socket->recv_pid = 255;
current_int_tcp_socket->recv_pid = KERNEL_PID_NULL;
destiny_socket_print_sockets();
return 0;
@ -1217,7 +1217,7 @@ socket_internal_t *get_waiting_connection_socket(int socket,
}
int handle_new_tcp_connection(socket_internal_t *current_queued_int_socket,
socket_internal_t *server_socket, uint8_t pid)
socket_internal_t *server_socket, kernel_pid_t pid)
{
(void) pid;
@ -1293,8 +1293,8 @@ int handle_new_tcp_connection(socket_internal_t *current_queued_int_socket,
* the TCP ACK packet */
msg_reply(&msg_recv_client_ack, &msg_send_client_ack);
/* Reset PID to an unlikely value */
current_queued_int_socket->recv_pid = 255;
/* Reset PID to an invalid value */
current_queued_int_socket->recv_pid = KERNEL_PID_NULL;
/* Waiting for Clients ACK waiting period to time out */
vtimer_usleep(TCP_SYN_INITIAL_TIMEOUT / 2);

View File

@ -122,7 +122,7 @@ void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
socket_internal_t *tcp_socket)
{
msg_t m_recv_tcp, m_send_tcp;
uint8_t target_pid;
kernel_pid_t target_pid;
if (tcp_socket->socket_values.tcp_control.state == TCP_LAST_ACK) {
target_pid = tcp_socket->recv_pid;

View File

@ -67,7 +67,7 @@ static int fd_get_next_free(void)
int fd_new(int internal_fd, ssize_t (*internal_read)(int, void *, size_t),
ssize_t (*internal_write)(int, const void *, size_t),
int (*internal_close)(int))
int (*internal_close)(kernel_pid_t))
{
int fd = fd_get_next_free();

View File

@ -21,7 +21,7 @@
#include "posix_io.h"
static int _posix_fileop(int pid, int op, int flags)
static int _posix_fileop(kernel_pid_t pid, int op, int flags)
{
msg_t m;
m.type = op;
@ -30,7 +30,7 @@ static int _posix_fileop(int pid, int op, int flags)
return m.content.value;
}
static int _posix_fileop_data(int pid, int op, char *buffer, int nbytes)
static int _posix_fileop_data(kernel_pid_t pid, int op, char *buffer, int nbytes)
{
struct posix_iop_t r;
r.nbytes = nbytes;
@ -45,22 +45,22 @@ static int _posix_fileop_data(int pid, int op, char *buffer, int nbytes)
return r.nbytes;
}
int posix_open(int pid, int flags)
int posix_open(kernel_pid_t pid, int flags)
{
return _posix_fileop(pid, OPEN, flags);
}
int posix_close(int pid)
int posix_close(kernel_pid_t pid)
{
return _posix_fileop(pid, CLOSE, 0);
}
int posix_read(int pid, char *buffer, int bufsize)
int posix_read(kernel_pid_t pid, char *buffer, int bufsize)
{
return _posix_fileop_data(pid, READ, buffer, bufsize);
}
int posix_write(int pid, char *buffer, int bufsize)
int posix_write(kernel_pid_t pid, char *buffer, int bufsize)
{
return _posix_fileop_data(pid, WRITE, buffer, bufsize);
}

View File

@ -32,7 +32,7 @@
typedef struct pthread_barrier_waiting_node
{
struct pthread_barrier_waiting_node *next; /**< The next waiting thread. */
int pid; /**< The current thread to wake up. */
kernel_pid_t pid; /**< The current thread to wake up. */
volatile int cont; /**< 0 = spurious wake up, 1 = wake up */
} pthread_barrier_waiting_node_t;

View File

@ -54,7 +54,7 @@ enum pthread_thread_status {
};
typedef struct pthread_thread {
int thread_pid;
kernel_pid_t thread_pid;
enum pthread_thread_status status;
int joining_thread;
@ -72,7 +72,7 @@ typedef struct pthread_thread {
static pthread_thread_t *volatile pthread_sched_threads[MAXTHREADS];
static struct mutex_t pthread_mutex;
static volatile int pthread_reaper_pid = -1;
static volatile int pthread_reaper_pid = KERNEL_PID_NULL;
static char pthread_reaper_stack[PTHREAD_REAPER_STACKSIZE];
@ -116,7 +116,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
{
pthread_thread_t *pt = calloc(1, sizeof(pthread_thread_t));
int pthread_pid = insert(pt);
kernel_pid_t pthread_pid = insert(pt);
if (pthread_pid < 0) {
free(pt);
return -1;
@ -136,7 +136,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
mutex_lock(&pthread_mutex);
if (pthread_reaper_pid < 0) {
/* volatile pid to overcome problems with double checking */
volatile int pid = thread_create(pthread_reaper_stack,
volatile kernel_pid_t pid = thread_create(pthread_reaper_stack,
PTHREAD_REAPER_STACKSIZE,
0,
CREATE_STACKTEST,
@ -184,7 +184,7 @@ void pthread_exit(void *retval)
ct->__routine(ct->__arg);
}
self->thread_pid = -1;
self->thread_pid = KERNEL_PID_NULL;
DEBUG("pthread_exit(%p), self == %p\n", retval, (void *) self);
if (self->status != PTS_DETACHED) {
self->returnval = retval;
@ -269,7 +269,7 @@ pthread_t pthread_self(void)
{
pthread_t result = 0;
mutex_lock(&pthread_mutex);
int pid = sched_active_pid; /* sched_active_pid is volatile */
kernel_pid_t pid = sched_active_pid; /* sched_active_pid is volatile */
for (int i = 0; i < MAXTHREADS; i++) {
if (pthread_sched_threads[i] && pthread_sched_threads[i]->thread_pid == pid) {
result = i+1;

View File

@ -47,13 +47,13 @@ int pthread_barrier_wait(pthread_barrier_t *barrier)
* to be woken up. Once the value reaches zero, everyone gets woken up. */
mutex_lock(&barrier->mutex);
DEBUG("%s: hit a synchronization barrier. pid=%u\n",
DEBUG("%s: hit a synchronization barrier. pid=%" PRIkernel_pid"\n",
sched_active_thread->name, sched_active_thread->pid);
if (--barrier->count > 0) {
/* need to wait for further threads */
DEBUG("%s: waiting for %u threads. pid=%u\n",
DEBUG("%s: waiting for %u threads. pid=%" PRIkernel_pid "\n",
sched_active_thread->name, barrier->count, sched_active_thread->pid);
pthread_barrier_waiting_node_t node;
@ -79,7 +79,7 @@ int pthread_barrier_wait(pthread_barrier_t *barrier)
else {
/* all threads have arrived, wake everybody up */
DEBUG("%s: waking every other thread up. pid=%u\n",
DEBUG("%s: waking every other thread up. pid=%" PRIkernel_pid "\n",
sched_active_thread->name, sched_active_thread->pid);
int count = 1; /* Count number of woken up threads.

View File

@ -43,7 +43,7 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *at
(void) attr;
if (rwlock == NULL) {
DEBUG("Thread %u: pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "init");
DEBUG("Thread %" PRIkernel_pid " pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "init");
return EINVAL;
}
@ -54,7 +54,7 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *at
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL) {
DEBUG("Thread %u: pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "destroy");
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "destroy");
return EINVAL;
}
@ -104,19 +104,19 @@ static int pthread_rwlock_lock(pthread_rwlock_t *rwlock,
bool allow_spurious)
{
if (rwlock == NULL) {
DEBUG("Thread %u: pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
DEBUG("Thread %" PRIkernel_pid": pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
thread_pid, "lock", is_writer, allow_spurious, "rwlock=NULL");
return EINVAL;
}
mutex_lock(&rwlock->mutex);
if (!is_blocked(rwlock)) {
DEBUG("Thread %u: pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
thread_pid, "lock", is_writer, allow_spurious, "is open");
rwlock->readers += incr_when_held;
}
else {
DEBUG("Thread %u: pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
thread_pid, "lock", is_writer, allow_spurious, "is locked");
/* queue for the lock */
@ -139,12 +139,12 @@ static int pthread_rwlock_lock(pthread_rwlock_t *rwlock,
mutex_lock(&rwlock->mutex);
if (waiting_node.continue_) {
/* pthread_rwlock_unlock() already set rwlock->readers */
DEBUG("Thread %u: pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
thread_pid, "lock", is_writer, allow_spurious, "continued");
break;
}
else if (allow_spurious) {
DEBUG("Thread %u: pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): is_writer=%u, allow_spurious=%u %s\n",
thread_pid, "lock", is_writer, allow_spurious, "is timed out");
queue_remove(&rwlock->queue, &waiting_node.qnode);
mutex_unlock(&rwlock->mutex);
@ -162,7 +162,7 @@ static int pthread_rwlock_trylock(pthread_rwlock_t *rwlock,
int incr_when_held)
{
if (rwlock == NULL) {
DEBUG("Thread %u: pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "trylock");
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "trylock");
return EINVAL;
}
else if (mutex_trylock(&rwlock->mutex) == 0) {
@ -243,30 +243,30 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL) {
DEBUG("Thread %u: pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "unlock");
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): rwlock=NULL supplied\n", thread_pid, "unlock");
return EINVAL;
}
mutex_lock(&rwlock->mutex);
if (rwlock->readers == 0) {
/* the lock is open */
DEBUG("Thread %u: pthread_rwlock_%s(): lock is open\n", thread_pid, "unlock");
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): lock is open\n", thread_pid, "unlock");
mutex_unlock(&rwlock->mutex);
return EPERM;
}
if (rwlock->readers > 0) {
DEBUG("Thread %u: pthread_rwlock_%s(): release %s lock\n", thread_pid, "unlock", "read");
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): release %s lock\n", thread_pid, "unlock", "read");
--rwlock->readers;
}
else {
DEBUG("Thread %u: pthread_rwlock_%s(): release %s lock\n", thread_pid, "unlock", "write");
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): release %s lock\n", thread_pid, "unlock", "write");
rwlock->readers = 0;
}
if (rwlock->readers != 0 || rwlock->queue.first == NULL) {
/* this thread was not the last reader, or no one is waiting to aquire the lock */
DEBUG("Thread %u: pthread_rwlock_%s(): no one is waiting\n", thread_pid, "unlock");
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): no one is waiting\n", thread_pid, "unlock");
mutex_unlock(&rwlock->mutex);
return 0;
}
@ -279,12 +279,12 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
sched_set_status(waiting_node->thread, STATUS_PENDING);
if (waiting_node->is_writer) {
DEBUG("Thread %u: pthread_rwlock_%s(): continue %s %u\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): continue %s %" PRIkernel_pid "\n",
thread_pid, "unlock", "writer", waiting_node->thread->pid);
--rwlock->readers;
}
else {
DEBUG("Thread %u: pthread_rwlock_%s(): continue %s %u\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): continue %s %" PRIkernel_pid "\n",
thread_pid, "unlock", "reader", waiting_node->thread->pid);
++rwlock->readers;
@ -293,12 +293,12 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
waiting_node = (__pthread_rwlock_waiter_node_t *) rwlock->queue.first->data;
if (waiting_node->is_writer) {
/* Not to be unfair to writers, we don't try to wake up readers that came after the first writer. */
DEBUG("Thread %u: pthread_rwlock_%s(): continuing readers blocked by writer %u\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): continuing readers blocked by writer %" PRIkernel_pid "\n",
thread_pid, "unlock", waiting_node->thread->pid);
break;
}
waiting_node->continue_ = true;
DEBUG("Thread %u: pthread_rwlock_%s(): continue %s %u\n",
DEBUG("Thread %" PRIkernel_pid ": pthread_rwlock_%s(): continue %s %" PRIkernel_pid "\n",
thread_pid, "unlock", "reader", waiting_node->thread->pid);
/* wake up this reader */

View File

@ -64,7 +64,7 @@ void thread_print_all(void)
#endif
overall_stacksz += stacksz;
stacksz -= thread_measure_stack_free(p->stack_start);
printf("\t%3u | %-21s| %-8s %.1s | %3i | %5i (%5i) %p"
printf("\t%3" PRIkernel_pid " | %-21s| %-8s %.1s | %3i | %5i (%5i) %p"
#if SCHEDSTATISTICS
" | %4d/1k | %8d"
#endif

View File

@ -88,7 +88,7 @@ msg_t msg_buffer[TRANSCEIVER_MSG_BUFFER_SIZE];
uint32_t response; ///< response bytes for messages to upper layer threads
int transceiver_pid = -1; ///< the transceiver thread's pid
kernel_pid_t transceiver_pid = KERNEL_PID_NULL; ///< the transceiver thread's pid
static volatile uint8_t rx_buffer_pos = 0;
static volatile uint8_t transceiver_buffer_pos = 0;
@ -165,7 +165,7 @@ void transceiver_init(transceiver_type_t t)
for (i = 0; i < TRANSCEIVER_MAX_REGISTERED; i++) {
reg[i].transceivers = TRANSCEIVER_NONE;
reg[i].pid = 0;
reg[i].pid = KERNEL_PID_NULL;
}
/* check if a non defined bit is set */
@ -178,7 +178,7 @@ void transceiver_init(transceiver_type_t t)
}
/* Start the transceiver thread */
int transceiver_start(void)
kernel_pid_t transceiver_start(void)
{
transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, PRIORITY_MAIN - 3, CREATE_STACKTEST, run, NULL, "Transceiver");
@ -231,7 +231,7 @@ int transceiver_start(void)
}
/* Register an upper layer thread */
uint8_t transceiver_register(transceiver_type_t t, int pid)
uint8_t transceiver_register(transceiver_type_t t, kernel_pid_t pid)
{
int result = 0;
int state = disableIRQ();
@ -250,7 +250,7 @@ uint8_t transceiver_register(transceiver_type_t t, int pid)
}
/* Unregister an upper layer thread */
uint8_t transceiver_unregister(transceiver_type_t t, int pid)
uint8_t transceiver_unregister(transceiver_type_t t, kernel_pid_t pid)
{
int result = 0;
int state = disableIRQ();
@ -499,7 +499,7 @@ static void receive_packet(uint16_t type, uint8_t pos)
while (reg[i].transceivers != TRANSCEIVER_NONE) {
if (reg[i].transceivers & t) {
m.content.ptr = (char *) &(transceiver_buffer[transceiver_buffer_pos]);
DEBUG("transceiver: Notify thread %i\n", reg[i].pid);
DEBUG("transceiver: Notify thread %" PRIkernel_pid "\n", reg[i].pid);
if (msg_send(&m, reg[i].pid, false) && (m.type != ENOBUFFER)) {
transceiver_buffer[transceiver_buffer_pos].processing++;

View File

@ -39,7 +39,7 @@
#define UART0_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
ringbuffer_t uart0_ringbuffer;
int uart0_handler_pid;
kernel_pid_t uart0_handler_pid;
static char buffer[UART0_BUFSIZE];
@ -48,7 +48,7 @@ static char uart0_thread_stack[UART0_STACKSIZE];
void board_uart0_init(void)
{
ringbuffer_init(&uart0_ringbuffer, buffer, UART0_BUFSIZE);
int pid = thread_create(
kernel_pid_t pid = thread_create(
uart0_thread_stack,
sizeof(uart0_thread_stack),
PRIORITY_MAIN - 1,

View File

@ -311,7 +311,7 @@ int vtimer_init(void)
return 0;
}
int vtimer_set_wakeup(vtimer_t *t, timex_t interval, int pid)
int vtimer_set_wakeup(vtimer_t *t, timex_t interval, kernel_pid_t pid)
{
t->action = vtimer_callback_wakeup;
t->arg = NULL;
@ -368,7 +368,7 @@ int vtimer_remove(vtimer_t *t)
return 0;
}
int vtimer_set_msg(vtimer_t *t, timex_t interval, unsigned int pid, void *ptr)
int vtimer_set_msg(vtimer_t *t, timex_t interval, kernel_pid_t pid, void *ptr)
{
t->action = vtimer_callback_msg;
t->arg = ptr;
@ -411,7 +411,7 @@ void vtimer_print(vtimer_t *t)
printf("Seconds: %" PRIu32 " - Microseconds: %" PRIu32 "\n \
action: %p\n \
arg: %p\n \
pid: %u\n",
pid: %" PRIkernel_pid "\n",
t->absolute.seconds, t->absolute.microseconds,
t->action,
t->arg,

View File

@ -30,7 +30,7 @@
#define LIMIT 1000
static char stacks[3][KERNEL_CONF_STACKSIZE_MAIN];
static int pids[3];
static kernel_pid_t pids[3];
static void *first_thread(void *arg)
{
@ -61,7 +61,7 @@ static void *second_thread(void *arg)
while (1) {
msg_t m1;
msg_receive(&m1);
DEBUG("2nd: got msg from %i: %i\n", m1.sender_pid, m1.content.value);
DEBUG("2nd: got msg from %" PRIkernel_pid ": %i\n", m1.sender_pid, m1.content.value);
msg_t m2;
m2.content.value = m1.content.value + 1;
@ -90,7 +90,7 @@ static void *third_thread(void *arg)
while (1) {
msg_t m;
msg_receive(&m);
DEBUG("3rd: got msg from %i: %i\n", m.sender_pid, m.content.value);
DEBUG("3rd: got msg from %" PRIkernel_pid ": %i\n", m.sender_pid, m.content.value);
--m.content.value;
msg_reply(&m, &m);

View File

@ -130,7 +130,7 @@ void sender(void)
int main(void)
{
#ifndef SENDER
int radio_pid;
kernel_pid_t radio_pid;
#endif
int16_t a;
msg_t mesg;

View File

@ -63,9 +63,13 @@ static void test1(void)
}
puts("first: thread create");
int pid = thread_create(test1_thread_stack, sizeof(test1_thread_stack),
PRIORITY_MAIN - 1, CREATE_STACKTEST | CREATE_WOUT_YIELD,
test1_second_thread, NULL, "second");
kernel_pid_t pid = thread_create(test1_thread_stack,
sizeof(test1_thread_stack),
PRIORITY_MAIN - 1,
CREATE_STACKTEST | CREATE_WOUT_YIELD,
test1_second_thread,
NULL,
"second");
if (pid < 0) {
puts("first: thread create failed");
@ -137,9 +141,13 @@ void test2(void)
snprintf(names[i], sizeof(names[i]), "priority %d", priority);
printf("first: thread create: %d\n", priority);
int pid = thread_create(test2_thread_stack[i],
sizeof(test2_thread_stack[i]), priority, CREATE_STACKTEST,
priority_sema_thread, NULL, names[i]);
kernel_pid_t pid = thread_create(test2_thread_stack[i],
sizeof(test2_thread_stack[i]),
priority,
CREATE_STACKTEST,
priority_sema_thread,
NULL,
names[i]);
if (pid < 0) {
puts("first: thread create failed");

View File

@ -57,13 +57,9 @@ int main(void)
expected_value = 1000*1000;
pthread_cond_init(&cv, NULL);
int pid = thread_create(stack,
sizeof(stack),
PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST,
second_thread,
NULL,
"second_thread");
kernel_pid_t pid = thread_create(stack,sizeof(stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST,
second_thread, NULL, "second_thread");
while (1) {
mutex_lock(&mutex);

View File

@ -54,7 +54,7 @@ static pthread_rwlock_t rwlock;
static volatile unsigned counter;
#define PRINTF(FMT, ...) \
printf("%c%u (prio=%u): " FMT "\n", sched_active_thread->name[0], sched_active_pid, sched_active_thread->priority, __VA_ARGS__)
printf("%c%" PRIkernel_pid " (prio=%u): " FMT "\n", sched_active_thread->name[0], sched_active_pid, sched_active_thread->priority, __VA_ARGS__)
static void do_sleep(int factor)
{

View File

@ -28,10 +28,10 @@
#define NUM_ITERATIONS (10)
static char stacks[NUM_CHILDREN][STACK_SIZE];
static int pids[NUM_CHILDREN];
static kernel_pid_t pids[NUM_CHILDREN];
static char names[NUM_CHILDREN][8];
static int parent_pid;
static kernel_pid_t parent_pid;
static void *child_fun(void *arg)
{

View File

@ -29,15 +29,15 @@
mutex_t mtx = MUTEX_INIT;
volatile int storage = 1;
int main_id;
int ths[PROBLEM];
kernel_pid_t main_id;
kernel_pid_t ths[PROBLEM];
char stacks[PROBLEM][KERNEL_CONF_STACKSIZE_MAIN];
void *run(void *arg)
{
(void) arg;
int me = thread_getpid();
kernel_pid_t me = thread_getpid();
printf("I am alive (%d)\n", me);
msg_t m;
msg_receive(&m);

View File

@ -27,13 +27,13 @@
char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
uint16_t p1, p_main;
kernel_pid_t p1, p_main;
void *thread1(void *arg)
{
(void) arg;
printf("THREAD %u start\n", p1);
printf("THREAD %" PRIkernel_pid " start\n", p1);
msg_t msg, reply;
memset(&msg, 1, sizeof(msg_t));
@ -43,10 +43,10 @@ void *thread1(void *arg)
/* step 2: send message, turning its status into STATUS_REPLY_BLOCKED */
msg_send_receive(&msg, &reply, p_main);
printf("received: %u, %u \n", reply.sender_pid, reply.type);
printf("received: %" PRIkernel_pid ", %u \n", reply.sender_pid, reply.type);
printf("pointer: %s\n", reply.content.ptr);
printf("THREAD %u SHOULD BE BLOCKING :(\n", p1);
printf("THREAD %" PRIkernel_pid " SHOULD BE BLOCKING :(\n", p1);
return NULL;
}
@ -66,6 +66,6 @@ int main(void)
/* step 3: receive a msg */
msg_receive(&msg);
printf("MAIN THREAD %u ALIVE!\n", p_main);
printf("MAIN THREAD %" PRIkernel_pid " ALIVE!\n", p_main);
return 0;
}

View File

@ -27,7 +27,7 @@
char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
uint16_t p1, p_main;
kernel_pid_t p1, p_main;
void *thread1(void *arg)
{
@ -43,10 +43,10 @@ void *thread1(void *arg)
/* step 2: send message, turning its status into STATUS_REPLY_BLOCKED */
msg_send_receive(&msg, &reply, p_main);
printf("received: %u, %u \n", reply.sender_pid, reply.type);
printf("received: %" PRIkernel_pid ", %u \n", reply.sender_pid, reply.type);
printf("pointer: %s\n", reply.content.ptr);
printf("THREAD %u SHOULD BE BLOCKING :(\n", p1);
printf("THREAD %" PRIkernel_pid " SHOULD BE BLOCKING :(\n", p1);
return NULL;
}
@ -63,6 +63,6 @@ int main(void)
/* step 3: receive a msg */
msg_receive(&msg);
printf("MAIN THREAD %u ALIVE!\n", p_main);
printf("MAIN THREAD %" PRIkernel_pid " ALIVE!\n", p_main);
return 0;
}

View File

@ -29,14 +29,14 @@ char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
char t3_stack[KERNEL_CONF_STACKSIZE_MAIN];
uint16_t p1, p2, p3;
kernel_pid_t p1, p2, p3;
void *sub_thread(void *arg)
{
(void) arg;
int pid = thread_getpid();
printf("THREAD %s (pid:%i) start\n", thread_getname(pid), pid);
kernel_pid_t pid = thread_getpid();
printf("THREAD %s (pid:%" PRIkernel_pid ") start\n", thread_getname(pid), pid);
msg_t msg;
@ -44,7 +44,7 @@ void *sub_thread(void *arg)
msg_send(&msg, 1, 1);
printf("THREAD %s (pid:%i) end.\n", thread_getname(pid), pid);
printf("THREAD %s (pid:%" PRIkernel_pid ") end.\n", thread_getname(pid), pid);
return NULL;
}
@ -67,7 +67,7 @@ int main(void)
puts("THREADS CREATED\n");
for(int i = 0; i < 3; i++) {
msg_receive(&msg);
printf("Got msg from pid %i: \"%s\"\n", msg.sender_pid, msg.content.ptr);
printf("Got msg from pid %" PRIkernel_pid ": \"%s\"\n", msg.sender_pid, msg.content.ptr);
}
return 0;

View File

@ -44,7 +44,7 @@ void *timer_thread(void *arg)
{
(void) arg;
printf("This is thread %d\n", thread_getpid());
printf("This is thread %" PRIkernel_pid "\n", thread_getpid());
/* we need a queue if the second message arrives while the first is still processed */
/* without a queue, the message would get lost */
@ -77,7 +77,7 @@ void *timer_thread_local(void *arg)
{
(void) arg;
printf("This is thread %d\n", thread_getpid());
printf("This is thread %" PRIkernel_pid "\n", thread_getpid());
while (1) {
msg_t m;
@ -92,7 +92,7 @@ void *timer_thread_local(void *arg)
int main(void)
{
msg_t m;
int pid = thread_create(
kernel_pid_t pid = thread_create(
timer_stack,
sizeof(timer_stack),
PRIORITY_MAIN - 1,
@ -109,7 +109,7 @@ int main(void)
m.content.ptr = (char *) &msg_b;
msg_send(&m, pid, false);
int pid2 = thread_create(
kernel_pid_t pid2 = thread_create(
timer_stack_local,
sizeof(timer_stack_local),
PRIORITY_MAIN - 1,

View File

@ -54,7 +54,7 @@ struct timer_msg timer_msgs[] = { { .interval = { .seconds = 0, .microseconds =
void *timer_thread(void *arg)
{
(void) arg;
printf("This is thread %d\n", thread_getpid());
printf("This is thread %" PRIkernel_pid "\n", thread_getpid());
msg_t msgq[16];
msg_init_queue(msgq, sizeof(msgq));
@ -103,7 +103,7 @@ void *timer_thread(void *arg)
int main(void)
{
msg_t m;
int pid = thread_create(
kernel_pid_t pid = thread_create(
timer_stack,
sizeof(timer_stack),
PRIORITY_MAIN - 1,