Skip to content

Commit

Permalink
core: Provide ssize_t in a common place
Browse files Browse the repository at this point in the history
 Now you can include `kernel_types.h` if you need the `ssize_t`, without
 facing problems due to the terrible MSP toolchain.
  • Loading branch information
Kijewski committed Sep 26, 2014
1 parent 866c713 commit 4e50d74
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
18 changes: 18 additions & 0 deletions core/include/kernel_types.h
Expand Up @@ -11,6 +11,24 @@

#include <stdint.h>
#include <inttypes.h>
#include <limits.h>

#ifndef NATIVE_INCLUDES
# include <stddef.h>
# include <sys/types.h>

# ifndef SSIZE_MAX
# ifdef _POSIX_SSIZE_MAX
# define SSIZE_MAX _POSIX_SSIZE_MAX
# else
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
# endif
# endif

# if defined (MODULE_MSP430_COMMON) || defined (MODULE_ATMEGA_COMMON)
typedef signed ssize_t;
# endif
#endif

/**
* @def MAXTHREADS
Expand Down
1 change: 0 additions & 1 deletion cpu/atmega_common/include/sys/types.h
Expand Up @@ -10,4 +10,3 @@
#include <stddef.h>

typedef int16_t suseconds_t;
typedef size_t ssize_t;
6 changes: 3 additions & 3 deletions cpu/msp430-common/include/msp430_types.h
Expand Up @@ -12,6 +12,9 @@
#include <sys/_types.h>
#include <errno.h>

/** defining signed type for size_t */
#include "kernel_types.h"

#ifndef EINVAL
/**
* @brief defines EINVAL if MSP430 toolchain is too old to provide it itself
Expand All @@ -28,9 +31,6 @@
#define EOVERFLOW (65)
#endif

/** defining signed type for size_t */
typedef _ssize_t ssize_t;

typedef unsigned long time_t;

struct timespec {
Expand Down

0 comments on commit 4e50d74

Please sign in to comment.