1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #include <stdarg.h>
12 #include <stddef.h>
13 
14 #include <stdio.h>
15 
16 /***********************************************************************/
17 /* Configuration                                                       */
18 /***********************************************************************/
19 #define L_tmpnam_TFS 14
20 #define TMP_MAX_TFS 10000
21 #define BUFSIZ_TFS 256
22 
23 /***********************************************************************/
24 /* Symbol Definitions                                                  */
25 /***********************************************************************/
26 #ifndef NULL
27 #define NULL 0
28 #endif
29 #define _IOFBF_TFS 0
30 #define _IOLBF_TFS 1
31 #define _IONBF_TFS 2
32 #define EOF_TFS (-1)
33 #define SEEK_CUR_TFS 1
34 #define SEEK_END_TFS 2
35 #define SEEK_SET_TFS 0
36 #define STDIN_OFF 24
37 #define STDOUT_OFF 28
38 #define STDERR_OFF 32
39 #define stdin_TFS (*(FILE_TFS**)((char*)RunningTask + STDIN_OFF))
40 #define stdout_TFS (*(FILE_TFS**)((char*)RunningTask + STDOUT_OFF))
41 #define stderr_TFS (*(FILE_TFS**)((char*)RunningTask + STDERR_OFF))
42 
43 /***********************************************************************/
44 /* Type Definitions                                                    */
45 /***********************************************************************/
46 typedef struct file FILE_TFS;
47 struct file;
48 
49 typedef struct {
50     unsigned int sect_off; // number of file sectors past first sector
51     unsigned int sector;   // absolute sector number
52     unsigned int offset;   // byte offset into absolute sector number
53 } fpos_t_TFS;
54 
55 /***********************************************************************/
56 /* Data Declarations                                                   */
57 /***********************************************************************/
58 extern struct tcb* RunningTask;
59 
60 #ifdef __cplusplus
61 }
62 #endif
63