kernel_types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Oliver Hahm
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef KERNEL_TYPES_H
22 #define KERNEL_TYPES_H
23 
24 #include <stdint.h>
25 #include <inttypes.h>
26 #include <limits.h>
27 
28 #ifndef NATIVE_INCLUDES
29 # include <stddef.h>
30 # include <sys/types.h>
31 
35 # ifndef SSIZE_MAX
36 # ifdef _POSIX_SSIZE_MAX
37 # define SSIZE_MAX _POSIX_SSIZE_MAX
38 # else
39 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
40 # endif
41 # endif
42 
43 # ifdef MODULE_MSP430_COMMON
44  typedef signed ssize_t;
45 # endif
46 #endif
47 
48 #ifdef __cplusplus
49  extern "C" {
50 #endif
51 
56 #ifndef MAXTHREADS
57 #define MAXTHREADS 32
58 #endif
59 
63 #define KERNEL_PID_UNDEF 0
64 
68 #define KERNEL_PID_FIRST (KERNEL_PID_UNDEF + 1)
69 
73 #define KERNEL_PID_LAST (KERNEL_PID_FIRST + MAXTHREADS - 1)
74 
78 #define PRIkernel_pid PRIi16
79 
83 typedef int16_t kernel_pid_t;
84 
92 static inline int pid_is_valid(kernel_pid_t pid)
93 {
94  return ((KERNEL_PID_FIRST <= pid) && (pid <= KERNEL_PID_LAST));
95 }
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* KERNEL_TYPES_H */
102 
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
#define KERNEL_PID_LAST
The last valid PID (inclusive).
Definition: kernel_types.h:73
signed int ssize_t
Used for a count of bytes or an error indication.
Definition: msp430_types.h:89
Adds include for missing inttype definitions.
static int pid_is_valid(kernel_pid_t pid)
Determine if the given pid is valid.
Definition: kernel_types.h:92
#define KERNEL_PID_FIRST
The first valid PID (inclusive).
Definition: kernel_types.h:68