File tree Expand file tree Collapse file tree 6 files changed +61
-3
lines changed
components/libc/compilers/dlib Expand file tree Collapse file tree 6 files changed +61
-3
lines changed Original file line number Diff line number Diff line change 1111#include <LowLevelIOInterface.h>
1212#include <unistd.h>
1313
14+ /*
15+ * The "__close" function should close the file corresponding to
16+ * "handle". It should return 0 on success and nonzero on failure.
17+ */
18+
1419#pragma module_name = "?__close"
20+
1521int __close (int handle )
1622{
1723 if (handle == _LLIO_STDOUT ||
Original file line number Diff line number Diff line change 1111#include <LowLevelIOInterface.h>
1212#include <unistd.h>
1313
14+ /*
15+ * The "__lseek" function makes the next file operation (__read or
16+ * __write) act on a new location. The parameter "whence" specifies
17+ * how the "offset" parameter should be interpreted according to the
18+ * following table:
19+ *
20+ * 0 (=SEEK_SET) - Goto location "offset".
21+ * 1 (=SEEK_CUR) - Go "offset" bytes from the current location.
22+ * 2 (=SEEK_END) - Go to "offset" bytes from the end.
23+ *
24+ * This function should return the current file position, or -1 on
25+ * failure.
26+ */
27+
1428#pragma module_name = "?__lseek"
29+
1530long __lseek (int handle , long offset , int whence )
1631{
1732 if (handle == _LLIO_STDOUT ||
Original file line number Diff line number Diff line change 1212#include <LowLevelIOInterface.h>
1313#include <fcntl.h>
1414
15+ /*
16+ * The "__open" function opens the file named "filename" as specified
17+ * by "mode".
18+ */
19+
1520#pragma module_name = "?__open"
1621
1722int __open (const char * filename , int mode )
Original file line number Diff line number Diff line change 1919#define DBG_LVL DBG_INFO
2020#include <rtdbg.h>
2121
22+ /*
23+ * The "__read" function reads a number of bytes, at most "size" into
24+ * the memory area pointed to by "buffer". It returns the number of
25+ * bytes read, 0 at the end of the file, or _LLIO_ERROR if failure
26+ * occurs.
27+ *
28+ * The template implementation below assumes that the application
29+ * provides the function "MyLowLevelGetchar". It should return a
30+ * character value, or -1 on failure.
31+ */
32+
2233#pragma module_name = "?__read"
34+
2335size_t __read (int handle , unsigned char * buf , size_t len )
2436{
2537#ifdef RT_USING_POSIX
Original file line number Diff line number Diff line change 1111#include <LowLevelIOInterface.h>
1212#include <unistd.h>
1313
14+ /*
15+ * The "remove" function should remove the file named "filename". It
16+ * should return 0 on success and nonzero on failure.
17+ */
18+
1419#pragma module_name = "?remove"
15- int remove (const char * val )
20+
21+ int remove (const char * filename )
1622{
1723#ifdef RT_USING_POSIX
18- return unlink (val );
24+ return unlink (filename );
1925#else
20- return -1 ;
26+ return _LLIO_ERROR ;
2127#endif /* RT_USING_POSIX */
2228}
Original file line number Diff line number Diff line change 1919#define DBG_LVL DBG_INFO
2020#include <rtdbg.h>
2121
22+ /*
23+ * The "__write" function should output "size" number of bytes from
24+ * "buffer" in some application-specific way. It should return the
25+ * number of characters written, or _LLIO_ERROR on failure.
26+ *
27+ * If "buffer" is zero then __write should perform flushing of
28+ * internal buffers, if any. In this case "handle" can be -1 to
29+ * indicate that all handles should be flushed.
30+ *
31+ * The template implementation below assumes that the application
32+ * provides the function "MyLowLevelPutchar". It should return the
33+ * character written, or -1 on failure.
34+ */
35+
2236#pragma module_name = "?__write"
2337
2438size_t __write (int handle , const unsigned char * buf , size_t len )
You can’t perform that action at this time.
0 commit comments