source: rtems/cpukit/include/rtems/inttypes.h @ 438ca2f

5
Last change on this file since 438ca2f was 438ca2f, checked in by Joel Sherrill <joel@…>, on 04/22/17 at 19:15:22

rtems/inttypes.h: Add blksize_t and blkcnt_t

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/**
2 * @file rtems/inttypes.h
3 *
4 * @brief Provide printf() PRIxxx Constante Beyond Standards
5 *
6 * This include file defines PRIxxx constants beyond those in
7 * the C and POSIX standards. These are used to write portable
8 * printf() format strings for POSIX and RTEMS types not in
9 * <inttypes.h>
10 */
11
12/*
13 *  COPYRIGHT (c) 2017 On-Line Applications Research Corporation.
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#ifndef _RTEMS_INTTYPES_H
21#define _RTEMS_INTTYPES_H
22
23#include <inttypes.h>
24#include <rtems/score/cpuopts.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * @defgroup RTEMS inttypes.h Extensions
32 *
33 * This module defines portable PRIxxx constants beyond those
34 * in the C and POSIX standard.
35 */
36
37/** Helper macro to print "modet" in octal */
38#if __RTEMS_SIZEOF_MODE_T__ == 8
39#define PRIomode_t PRIo64
40#elif __RTEMS_SIZEOF_MODE_T__ == 4
41#define PRIomode_t PRIo32
42#else
43#error "PRIomode_t: unsupported size of mode_t"
44#endif
45
46/** Helper macro to print "off_t" in octal */
47#if __RTEMS_SIZEOF_OFF_T__ == 8
48#define PRIooff_t PRIo64
49#elif __RTEMS_SIZEOF_OFF_T__ == 4
50#define PRIooff_t PRIo32
51#else
52#error "PRIooff_t: unsupported size of off_t"
53#endif
54
55/** Helper macro to print "off_t" in decimal */
56#if __RTEMS_SIZEOF_OFF_T__ == 8
57#define PRIdoff_t PRId64
58#elif __RTEMS_SIZEOF_OFF_T__ == 4
59#define PRIdoff_t PRId32
60#else
61#error "PRIdoff_t: unsupported size of off_t"
62#endif
63
64/** Helper macro to print "time_t" in decimal */
65#if __RTEMS_SIZEOF_TIME_T__ == 8
66#define PRIdtime_t PRId64
67#elif __RTEMS_SIZEOF_TIME_T__ == 4
68#define PRIdtime_t PRId32
69#else
70#error "PRIdtime_t: unsupported size of time_t"
71#endif
72
73/** Helper macro to print "blksize_t" in decimal */
74#if __RTEMS_SIZEOF_BLKSIZE_T__ == 8
75#define PRIxblksize_t PRIx64
76#elif __RTEMS_SIZEOF_BLKSIZE_T__ == 4
77#define PRIxblksize_t PRIx32
78#else
79/* Warn and fall back to "long" */
80#warning "unsupported size of blksize_t"
81#define PRIxblksize_t "lx"
82#endif
83
84/** Helper macro to print "blkcnt_t" in decimal */
85#if __RTEMS_SIZEOF_BLKCNT_T__ == 8
86#define PRIxblkcnt_t PRIx64
87#elif __RTEMS_SIZEOF_BLKCNT_T__ == 4
88#define PRIxblkcnt_t PRIx32
89#else
90/* Warn and fall back to "long" */
91#warning "unsupported size of blkcnt_t"
92#define PRIxblkcnt_t "lx"
93#endif
94
95/*
96 * Various inttypes.h-stype macros to assist printing
97 * certain system types on different targets.
98 */
99
100#if defined(RTEMS_USE_16_BIT_OBJECT)
101#define PRIxrtems_id PRIx16
102#else
103#define PRIxrtems_id PRIx32
104#endif
105
106/* c.f. cpukit/score/include/rtems/score/priority.h */
107#define PRIdPriority_Control PRIu64
108#define PRIxPriority_Control PRIx64
109/* rtems_task_priority is a typedef to Priority_Control */
110#define PRIdrtems_task_priority PRIu32
111#define PRIxrtems_task_priority PRIx32
112
113/* c.f. cpukit/score/include/rtems/score/watchdog.h */
114#define PRIdWatchdog_Interval PRIu32
115/* rtems_interval is a typedef to Watchdog_Interval */
116#define PRIdrtems_interval    PRIdWatchdog_Interval
117
118/* c.f. cpukit/score/include/rtems/score/thread.h */
119#define PRIdThread_Entry_numeric_type PRIuPTR
120/* rtems_task_argument is a typedef to Thread_Entry_numeric_type */
121#define PRIdrtems_task_argument PRIdThread_Entry_numeric_type
122
123/* rtems_event_set is a typedef to unit32_t */
124#define PRIxrtems_event_set PRIx32
125
126/* HACK: newlib defines pthread_t as a typedef to __uint32_t */
127/* HACK: There is no portable way to print pthread_t's */
128#define PRIxpthread_t PRIx32
129
130/* rtems_signal_set is a typedef to uint32_t */
131#define PRIxrtems_signal_set PRIx32
132
133/* newlib's ino_t is a typedef to "unsigned long" */
134#define PRIxino_t "lx"
135
136/**@}*/
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif
Note: See TracBrowser for help on using the repository browser.