![]() |
Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
|
#include <pthread.h>#include <stdarg.h>#include <stddef.h>#include <stdint.h>#include <sys/reent.h>#include <sys/types.h>

Go to the source code of this file.
Data Structures | |
| union | FILE |
Macros | |
| #define | SEEK_SET 0 |
| #define | SEEK_CUR 1 |
| #define | SEEK_END 2 |
| #define | EOF (-1) |
| #define | fopen _fopen |
| #define | fclose _fclose |
| #define | fread _fread |
| #define | fwrite _fwrite |
| #define | fseek _fseek |
| #define | ftell _ftell |
| #define | rewind _rewind |
| #define | fileno _fileno |
| #define | freopen _freopen |
| #define | fseeko _fseeko |
| #define | ftello _ftello |
| #define | fputs _fputs |
| #define | fputc _fputc |
| #define | putchar _putchar |
| #define | puts _puts |
| #define | fgetc _fgetc |
| #define | getchar(void) _getchar |
| Read a character from the standard input. More... | |
| #define | fgets _fgets |
| #define | feof _feof |
| #define | ferror _ferror |
| #define | clearerr _clearerr |
| #define | fflush _fflush |
| #define | setvbuf _setvbuf |
| #define | setbuf _setbuf |
| #define | putc(c, stream) fputc(c, stream) |
| #define | getc(stream) fgetc(stream) |
| #define | getc_unlocked(stream) _fgetc(stream) |
| #define | getchar_unlocked() _getchar() |
| #define | putc_unlocked(c, stream) _fputc(c, stream) |
| #define | putchar_unlocked(c) _putchar(c) |
| #define | fputc_unlocked(c, stream) _fputc(c, stream) |
| #define | fgetc_unlocked(stream) _fgetc(stream) |
| #define | fgets_unlocked(s, size, stream) _fgets(s, size, stream) |
| #define | fputs_unlocked(s, stream) _fputs(s, stream) |
| #define | fread_unlocked(p, size, n, stream) _fread(p, size, n, stream) |
| #define | fwrite_unlocked(p, size, n, stream) _fwrite(p, size, n, stream) |
| #define | feof_unlocked(stream) _feof(stream) |
| #define | ferror_unlocked(stream) _ferror(stream) |
| #define | clearerr_unlocked(stream) _clearerr(stream) |
| #define | fflush_unlocked(stream) _fflush(stream) |
| #define | fileno_unlocked(stream) _fileno(stream) |
| #define | flockfile(stream) ((void) (stream)) |
| #define | funlockfile(stream) ((void) (stream)) |
| #define | ftrylockfile(stream) (0) |
| #define | __SIZEOF_FILE sizeof(__FILE) |
| #define | _IOFBF 0 |
| #define | _IOLBF 1 |
| #define | _IONBF 2 |
| #define | BUFSIZ 1024 |
Functions | |
| FILE * | fopen (const char *pathname, const char *mode) |
| Open the file whose name is the string pointed to by pathname and associate a stream with it. More... | |
| FILE * | fdopen (int fd, const char *mode) |
| Put a stream on a descriptor that is already open. More... | |
| FILE * | freopen (const char *pathname, const char *mode, FILE *stream) |
| Point a stream that is already open at another file, which is how a program replaces one of the standard streams. More... | |
| int | fseeko (FILE *stream, off_t offset, int whence) |
| Reposition a stream, with the offset given as an off_t. More... | |
| off_t | ftello (FILE *stream) |
| Report where a stream is, as an off_t. More... | |
| int | fclose (FILE *stream) |
| Close the given file stream. More... | |
| size_t | fread (void *ptr, size_t size, size_t nmemb, FILE *stream) |
| Read nmemb items of data, each size bytes long, from the stream pointed to by stream, storing them at the location given by ptr. More... | |
| size_t | fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream) |
| Write nmemb items of data, each size bytes long, to the stream pointed to by stream, obtaining them from the location given by ptr. More... | |
| int | fseek (FILE *stream, long offset, int whence) |
| Set the file position indicator for the stream pointed to by stream. More... | |
| long | ftell (FILE *stream) |
| Obtain the current value of the file position indicator. More... | |
| void | rewind (FILE *stream) |
| Set the file position indicator to the beginning of the file. More... | |
| int | fileno (FILE *stream) |
| Examine the argument stream and returns the integer file descriptor used to implement this stream. More... | |
| int | rename (const char *oldpath, const char *newpath) |
| Change the name or the location of a file. More... | |
| int | remove (const char *pathname) |
| Delete a file or an empty directory. More... | |
| int | printf (const char *format,...) |
| Format and print data to the standard output. More... | |
| int | fprintf (FILE *stream, const char *format,...) |
| Format and print data to a file. More... | |
| int | dprintf (int fd, const char *format,...) |
| Format and print data to a file. More... | |
| int | sprintf (char *str, const char *format,...) |
| Format and print data to a buffer. More... | |
| int | snprintf (char *str, size_t size, const char *format,...) |
| Format and print data to a buffer with limited buffer size. More... | |
| int | vprintf (const char *format, va_list ap) |
| Format and print data to the standard output with argument list. More... | |
| int | vfprintf (FILE *stream, const char *format, va_list ap) |
| Format and print data to a file with argument list. More... | |
| int | vdprintf (int fd, const char *format, va_list ap) |
| Format and print data to a file with argument list. More... | |
| int | vsprintf (char *str, const char *format, va_list ap) |
| Format and print data to a buffer with argument list. More... | |
| int | vsnprintf (char *str, size_t size, const char *format, va_list ap) |
| Format and print data to a buffer with limited size and argument list. More... | |
| int | sscanf (const char *str, const char *format,...) |
| Read from the string what the format says is in it. Only the string half of scanf is here: the stream half would have to read a FILE of Tenok, which the one the C library brings is not. More... | |
| int | vsscanf (const char *str, const char *format, va_list ap) |
| Read from the string what the format says is in it, taking the places to put it from a variable argument list. More... | |
| int | fputs (const char *s, FILE *stream) |
| Write a string to the stream, without its terminating null byte. More... | |
| int | fputc (int c, FILE *stream) |
| Write a character to the stream. More... | |
| int | putchar (int c) |
| Write a character to the standard output. More... | |
| int | puts (const char *s) |
| Write a string and a newline to the standard output. More... | |
| int | fgetc (FILE *stream) |
| Read a character from the stream. More... | |
| char * | fgets (char *s, int size, FILE *stream) |
| Read a line from the stream, the newline included, and terminate it. More... | |
| int | feof (FILE *stream) |
| Tell whether the end of the stream has been reached. More... | |
| int | ferror (FILE *stream) |
| Tell whether the stream has failed. More... | |
| void | clearerr (FILE *stream) |
| Clear the end of file and the error state of the stream. More... | |
| int | fflush (FILE *stream) |
| Hand over what the stream is holding. Tenok does not buffer, so there is never anything to hand over. More... | |
| int | setvbuf (FILE *stream, char *buf, int mode, size_t size) |
| Ask the stream to buffer what is written to it. Tenok reaches the device on the call that writes, so the only buffering it can be given is the one it already has. More... | |
| void | setbuf (FILE *stream, char *buf) |
| Ask the stream to buffer what is written to it, the way setvbuf() does, without reporting whether it could be done. More... | |
Variables | |
| FILE * | stdin |
| FILE * | stdout |
| FILE * | stderr |
| int getchar | ( | void | ) | _getchar |
Read a character from the standard input.
| int | The character read, and EOF at the end of the file or on error. |
| void clearerr | ( | FILE * | stream | ) |
Clear the end of file and the error state of the stream.
| stream | The file stream to provide. |
| int dprintf | ( | int | fd, |
| const char * | format, | ||
| ... | |||
| ) |
Format and print data to a file.
| str | The pointer to the print buffer. |
| format | Format string. |
| ... | Print arguments. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int fclose | ( | FILE * | stream | ) |
Close the given file stream.
| stream | The file stream to provide. |
| int | 0 on success and nonzero error number on error. |
| FILE* fdopen | ( | int | fd, |
| const char * | mode | ||
| ) |
Put a stream on a descriptor that is already open.
| fd | The file descriptor to provide. |
| mode | Not used, the descriptor carries how it was opened. |
| FILE | *: The stream on success and a null pointer on error, with the reason left in errno. |
| int feof | ( | FILE * | stream | ) |
Tell whether the end of the stream has been reached.
| stream | The file stream to provide. |
| int | Nonzero once the end of the file was reached. |
| int ferror | ( | FILE * | stream | ) |
Tell whether the stream has failed.
| stream | The file stream to provide. |
| int | Nonzero once a call on the stream has failed. |
| int fflush | ( | FILE * | stream | ) |
Hand over what the stream is holding. Tenok does not buffer, so there is never anything to hand over.
| stream | The file stream to provide. |
| int | 0 on success and EOF on error. |
| int fgetc | ( | FILE * | stream | ) |
Read a character from the stream.
| stream | The file stream to provide. |
| int | The character read, and EOF at the end of the file or on error. |
| char* fgets | ( | char * | s, |
| int | size, | ||
| FILE * | stream | ||
| ) |
Read a line from the stream, the newline included, and terminate it.
| s | The buffer to read into. |
| size | The size of the buffer, the null byte included. |
| stream | The file stream to provide. |
| char | *: The buffer on success and a null pointer at the end of the file or on error. |
| int fileno | ( | FILE * | stream | ) |
Examine the argument stream and returns the integer file descriptor used to implement this stream.
| stream | The file stream to provide. |
| int | The file descriptor integer. |
| FILE* fopen | ( | const char * | pathname, |
| const char * | mode | ||
| ) |
Open the file whose name is the string pointed to by pathname and associate a stream with it.
| pathname | The pathname of the file to open. |
| mode | Not used. |
| FILE | *: File stream object. |
| int fprintf | ( | FILE * | stream, |
| const char * | format, | ||
| ... | |||
| ) |
Format and print data to a file.
| stream | The pointer to the file stream. |
| format | Format string. |
| ... | Print arguments. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int fputc | ( | int | c, |
| FILE * | stream | ||
| ) |
Write a character to the stream.
| c | The character to write. |
| stream | The file stream to provide. |
| int | The character written on success and EOF on error. |
| int fputs | ( | const char * | s, |
| FILE * | stream | ||
| ) |
Write a string to the stream, without its terminating null byte.
| s | The string to write. |
| stream | The file stream to provide. |
| int | A nonnegative number on success and EOF on error. |
| size_t fread | ( | void * | ptr, |
| size_t | size, | ||
| size_t | nmemb, | ||
| FILE * | stream | ||
| ) |
Read nmemb items of data, each size bytes long, from the stream pointed to by stream, storing them at the location given by ptr.
| ptr | The memory space for storing the read data. |
| size | The number of nmemb bytes to read. |
| nmemb | The bytes number to read at once. |
| stream | The file stream to provide. |
| size_t | The number of the items that were read, which is smaller than nmemb if the end of the file is reached or an error occurs. |
Point a stream that is already open at another file, which is how a program replaces one of the standard streams.
| pathname | The pathname of the file to open. |
| mode | The mode to open it with. |
| stream | The stream to point at it. |
| FILE | *: The stream on success and a null pointer on error, with the reason left in errno. |
| int fseek | ( | FILE * | stream, |
| long | offset, | ||
| int | whence | ||
| ) |
Set the file position indicator for the stream pointed to by stream.
| stream | The file stream to provide. |
| offset | The new offset to the position specified by whence. |
| whence | The start position of the new offset. |
| int | 0 on success and -1 on error. |
| int fseeko | ( | FILE * | stream, |
| off_t | offset, | ||
| int | whence | ||
| ) |
Reposition a stream, with the offset given as an off_t.
| stream | The file stream to provide. |
| offset | The new offset from the position whence names. |
| whence | SEEK_SET, SEEK_CUR or SEEK_END. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| long ftell | ( | FILE * | stream | ) |
Obtain the current value of the file position indicator.
| stream | The file stream to provide. |
| long | The current file position on success and -1 on error. |
| off_t ftello | ( | FILE * | stream | ) |
Report where a stream is, as an off_t.
| stream | The file stream to provide. |
| off_t | The position on success and -1 on error, with the reason left in errno. |
| size_t fwrite | ( | const void * | ptr, |
| size_t | size, | ||
| size_t | nmemb, | ||
| FILE * | stream | ||
| ) |
Write nmemb items of data, each size bytes long, to the stream pointed to by stream, obtaining them from the location given by ptr.
| ptr | The data to write to the file. |
| size | The number of nmemb bytes to write. |
| nmemb | The byte number to write at once. |
| stream | The file stream to provide. |
| size_t | The number of the items that were written, which is smaller than nmemb if an error occurs. |
| int printf | ( | const char * | format, |
| ... | |||
| ) |
Format and print data to the standard output.
| format | Format string. |
| ... | Print arguments. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int putchar | ( | int | c | ) |
Write a character to the standard output.
| c | The character to write. |
| int | The character written on success and EOF on error. |
| int puts | ( | const char * | s | ) |
Write a string and a newline to the standard output.
| s | The string to write. |
| int | A nonnegative number on success and EOF on error. |
| int remove | ( | const char * | pathname | ) |
Delete a file or an empty directory.
| pathname | The pathname of the file to remove. |
| int | 0 on success and nonzero error number on error. |
| int rename | ( | const char * | oldpath, |
| const char * | newpath | ||
| ) |
Change the name or the location of a file.
| oldpath | The pathname of the file to rename. |
| newpath | The new pathname of the file. |
| int | 0 on success and nonzero error number on error. |
| void rewind | ( | FILE * | stream | ) |
Set the file position indicator to the beginning of the file.
| stream | The file stream to provide. |
| None |
| void setbuf | ( | FILE * | stream, |
| char * | buf | ||
| ) |
Ask the stream to buffer what is written to it, the way setvbuf() does, without reporting whether it could be done.
| stream | The file stream to provide. |
| buf | The buffer to use, or NULL to ask for no buffering. |
| int setvbuf | ( | FILE * | stream, |
| char * | buf, | ||
| int | mode, | ||
| size_t | size | ||
| ) |
Ask the stream to buffer what is written to it. Tenok reaches the device on the call that writes, so the only buffering it can be given is the one it already has.
| stream | The file stream to provide. |
| buf | The buffer to use, which Tenok does not take. |
| mode | One of _IOFBF, _IOLBF and _IONBF. |
| size | The size of the buffer. |
| int | 0 when _IONBF was asked for and nonzero otherwise, with errno set to EINVAL. |
| int snprintf | ( | char * | str, |
| size_t | size, | ||
| const char * | format, | ||
| ... | |||
| ) |
Format and print data to a buffer with limited buffer size.
| str | The pointer to the print buffer. |
| size | The size of the buffer. |
| format | Format string. |
| ... | Print arguments. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int sprintf | ( | char * | str, |
| const char * | format, | ||
| ... | |||
| ) |
Format and print data to a buffer.
| str | The pointer to the print buffer. |
| format | Format string. |
| ... | Print arguments. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int sscanf | ( | const char * | str, |
| const char * | format, | ||
| ... | |||
| ) |
Read from the string what the format says is in it. Only the string half of scanf is here: the stream half would have to read a FILE of Tenok, which the one the C library brings is not.
| str | The string to read from. |
| format | What to look for. |
| int | The number of items read, and EOF if the string ran out first. |
| int vdprintf | ( | int | fd, |
| const char * | format, | ||
| va_list | ap | ||
| ) |
Format and print data to a file with argument list.
| fd: File descriptor number. | |
| format | Format string. |
| ap | Argument list. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int vfprintf | ( | FILE * | stream, |
| const char * | format, | ||
| va_list | ap | ||
| ) |
Format and print data to a file with argument list.
| stream | The pointer to the file stream. |
| format | Format string. |
| ap | Argument list. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int vprintf | ( | const char * | format, |
| va_list | ap | ||
| ) |
Format and print data to the standard output with argument list.
| format | Format string. |
| ap | Argument list. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int vsnprintf | ( | char * | str, |
| size_t | size, | ||
| const char * | format, | ||
| va_list | ap | ||
| ) |
Format and print data to a buffer with limited size and argument list.
| str | The pointer to the print buffer. |
| size | The size of the buffer. |
| format | Format string. |
| ap | Argument list. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int vsprintf | ( | char * | str, |
| const char * | format, | ||
| va_list | ap | ||
| ) |
Format and print data to a buffer with argument list.
| str | The pointer to the print buffer. |
| size | The size of the buffer. |
| format | Format string. |
| ap | Argument list. |
| Upon | successful return, the function returns the number of characters printed; otherwie a negative value is returned. |
| int vsscanf | ( | const char * | str, |
| const char * | format, | ||
| va_list | ap | ||
| ) |
Read from the string what the format says is in it, taking the places to put it from a variable argument list.
| str | The string to read from. |
| format | What to look for. |
| ap | The places to put what was read. |
| int | The number of items read, and EOF if the string ran out first. |