![]() |
Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
|


Go to the source code of this file.
Macros | |
| #define | MQ_PRIO_MAX _MQ_PRIO_MAX |
| #define | STDIN_FILENO 0 /* Standard input file descriptor */ |
| #define | STDOUT_FILENO 1 /* Standard output file descriptor */ |
| #define | STDERR_FILENO 2 /* Standard error file descriptor */ |
| #define | _SC_ARG_MAX 0 |
| #define | _SC_CLK_TCK 2 |
| #define | _SC_OPEN_MAX 4 |
| #define | _SC_PAGESIZE 8 |
| #define | sysconf _sysconf |
| Report a value of the system that is decided when it is built. More... | |
| #define | F_OK 0 /* The file exists */ |
| #define | X_OK 1 /* The file can be executed */ |
| #define | W_OK 2 /* The file can be written */ |
| #define | R_OK 4 /* The file can be read */ |
Functions | |
| unsigned int | sleep (unsigned int seconds) |
| To cause the calling thread to sleep either until the number of real-time seconds specified in seconds have elapsed or until a signal arrives which is not ignored. More... | |
| int | usleep (useconds_t usec) |
| Suspend execution of the calling thread for a given time in microseconds. More... | |
| int | close (int fd) |
| Close a file descriptor, so that it no longer refers to any file and may be reused. More... | |
| int | dup (int oldfd) |
| Create a copy of the file descriptor oldfd, using the lowest-numbered unused file descriptor for the new descriptor. More... | |
| int | dup2 (int oldfd, int newfd) |
| Perform the same task as dup(), but use the file descriptor number specified by newfd. More... | |
| int | pipe (int pipefd[2]) |
| Create a pipe, a stream that is written to through one descriptor and read from through the other. More... | |
| pid_t | vfork (void) |
| Create a child process. Tenok runs every task from the image it booted and has no way to make another, so the call always fails. More... | |
| pid_t | fork (void) |
| Create a child process, the way vfork() does not either. More... | |
| pid_t | setsid (void) |
| Start a session. Tenok has the one console and no sessions to give it out to. More... | |
| int | execve (const char *pathname, char *const argv[], char *const envp[]) |
| Replace the running program with the one the pathname names. No file of Tenok is in a format the system can execute, so the call always fails. More... | |
| int | execvp (const char *file, char *const argv[]) |
| Replace the running program with the one found by searching PATH for the file, the way execve() does. More... | |
| ssize_t | read (int fd, void *buf, size_t count) |
| Attempt to read up to count bytes from file descriptor fd into the buffer starting at buf. More... | |
| ssize_t | write (int fd, const void *buf, size_t count) |
| Write up to count bytes from the buffer starting at buf to the file referred to by the file descriptor fd. More... | |
| off_t | lseek (int fd, long offset, int whence) |
| Reposition the file offset of the open file description associated with the file descriptor fd. More... | |
| pid_t | getpid (void) |
| Return the ID of the calling task. More... | |
| pid_t | getppid (void) |
| Return the ID of the task that started the calling one. Every task of Tenok is started by the one that brings the system up. More... | |
| char * | getcwd (char *buf, size_t size) |
| Get current working directory. More... | |
| int | chdir (const char *path) |
| Change working directory. More... | |
| int | unlink (const char *pathname) |
| Delete a name from the file system. More... | |
| int | rmdir (const char *pathname) |
| Delete a directory, which must be empty. More... | |
| long | sysconf (int name) |
| int | isatty (int fd) |
| Tell whether a descriptor refers to a terminal. More... | |
| int | access (const char *pathname, int mode) |
| Check whether the calling task can reach a file the way it asks. More... | |
| uid_t | getuid (void) |
| Report the user a task runs as, which on Tenok is always root. More... | |
| int | setuid (uid_t uid) |
| Become the user of the given identifier. Tenok runs as the one user it has, so only that one can be become. More... | |
| int | seteuid (uid_t uid) |
| Become the effective user of the given identifier, the way setuid() does. More... | |
| uid_t | geteuid (void) |
| gid_t | getgid (void) |
| Report the group a task runs as, which on Tenok is always root. More... | |
| int | setgid (gid_t gid) |
| Join the group of the given identifier. Tenok has the one group, so only that one can be joined. More... | |
| int | setegid (gid_t gid) |
| Join the effective group of the given identifier, the way setgid() does. More... | |
| gid_t | getegid (void) |
| int | getgroups (int size, gid_t list[]) |
| Report the supplementary groups of the task. Tenok has one group and root is in it, so there is never a supplementary one. More... | |
| int | link (const char *oldpath, const char *newpath) |
| Give a file a second name. Tenok gives a file one name. More... | |
| int | symlink (const char *target, const char *linkpath) |
| Make a name that stands for another. Tenok has no symbolic link. More... | |
| int | readlink (const char *pathname, char *buf, size_t bufsiz) |
| Read what a symbolic link stands for. Nothing a path of Tenok names is one. More... | |
| int | fchdir (int fd) |
| Change the working directory to the one the descriptor names. Tenok keeps no way back from a descriptor to the name it was opened by. More... | |
| int | ttyname_r (int fd, char *buf, size_t buflen) |
| Name the terminal the descriptor is open on. Tenok keeps no way back from a descriptor to the name it was opened by. More... | |
| int | chroot (const char *path) |
| Make the given directory the root. The root of Tenok is the whole of what it mounted, with nothing outside to be shut away from. More... | |
| int | chown (const char *pathname, uid_t owner, gid_t group) |
| Replace the owner of a file. Tenok has one user, so only a request that names it can be granted. More... | |
| int | lchown (const char *pathname, uid_t owner, gid_t group) |
| Replace the owner of a file without following a symbolic link. Tenok has no symbolic link, so this is chown() More... | |
| #define sysconf _sysconf |
Report a value of the system that is decided when it is built.
| name | One of the SC values. |
| long | The value on success and -1 when Tenok has no such value, with the reason left in errno. |
| int access | ( | const char * | pathname, |
| int | mode | ||
| ) |
Check whether the calling task can reach a file the way it asks.
| pathname | The pathname of the file to check. |
| mode | F_OK, or the R_OK, W_OK and X_OK to check for. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int chdir | ( | const char * | path | ) |
Change working directory.
| path | Pathname of the new working directory. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int chown | ( | const char * | pathname, |
| uid_t | owner, | ||
| gid_t | group | ||
| ) |
Replace the owner of a file. Tenok has one user, so only a request that names it can be granted.
| pathname | The pathname of the file. |
| owner | The user to give it to, or -1 to leave it alone. |
| group | The group to give it to, or -1 to leave it alone. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int chroot | ( | const char * | path | ) |
Make the given directory the root. The root of Tenok is the whole of what it mounted, with nothing outside to be shut away from.
| path | The directory to make the root. |
| int | -1 with errno set to ENOSYS. |
| int close | ( | int | fd | ) |
Close a file descriptor, so that it no longer refers to any file and may be reused.
| fd | The file descriptor to provide. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int dup | ( | int | oldfd | ) |
Create a copy of the file descriptor oldfd, using the lowest-numbered unused file descriptor for the new descriptor.
| oldfd | The file descriptor to duplicate. |
| int | The new file descriptor on success and -1 on error, with the reason left in errno. |
| int dup2 | ( | int | oldfd, |
| int | newfd | ||
| ) |
Perform the same task as dup(), but use the file descriptor number specified by newfd.
| oldfd | The file descriptor to duplicate. |
| newfd | The number to specify the new file descriptor. |
| int | The new file descriptor on success and -1 on error, with the reason left in errno. |
| int execve | ( | const char * | pathname, |
| char *const | argv[], | ||
| char *const | envp[] | ||
| ) |
Replace the running program with the one the pathname names. No file of Tenok is in a format the system can execute, so the call always fails.
| pathname | The pathname of the program. |
| argv | The arguments to hand the program. |
| envp | The environment to hand the program. |
| int | -1 with errno set to ENOEXEC. |
| int execvp | ( | const char * | file, |
| char *const | argv[] | ||
| ) |
Replace the running program with the one found by searching PATH for the file, the way execve() does.
| file | The name of the program to search for. |
| argv | The arguments to hand the program. |
| int | -1 with errno set to ENOEXEC. |
| int fchdir | ( | int | fd | ) |
Change the working directory to the one the descriptor names. Tenok keeps no way back from a descriptor to the name it was opened by.
| fd | The descriptor of the directory. |
| int | -1 with errno set to ENOSYS. |
| pid_t fork | ( | void | ) |
Create a child process, the way vfork() does not either.
| pid_t | -1 with errno set to ENOSYS. |
| char* getcwd | ( | char * | buf, |
| size_t | size | ||
| ) |
Get current working directory.
| buf | Buffer space for storing path of the current working space. |
| size | Size of the buffer space. |
| buf | Buffer space for storing path of the current working space, or a null pointer to ask for one that free() takes back. |
| char | *: The buffer on success and a null pointer on error, with the reason left in errno. |
| gid_t getgid | ( | void | ) |
Report the group a task runs as, which on Tenok is always root.
| gid_t | Always 0. |
| int getgroups | ( | int | size, |
| gid_t | list[] | ||
| ) |
Report the supplementary groups of the task. Tenok has one group and root is in it, so there is never a supplementary one.
| size | How many the list holds. |
| list | For returning the groups. |
| int | Always 0. |
| pid_t getpid | ( | void | ) |
Return the ID of the calling task.
| pid_t | The task ID. |
| pid_t getppid | ( | void | ) |
Return the ID of the task that started the calling one. Every task of Tenok is started by the one that brings the system up.
| pid_t | Always 1. |
| uid_t getuid | ( | void | ) |
Report the user a task runs as, which on Tenok is always root.
| uid_t | Always 0. |
| int isatty | ( | int | fd | ) |
Tell whether a descriptor refers to a terminal.
| fd | The file descriptor to provide. |
| int | One when it does, and zero when it does not, with the reason left in errno. |
| int lchown | ( | const char * | pathname, |
| uid_t | owner, | ||
| gid_t | group | ||
| ) |
Replace the owner of a file without following a symbolic link. Tenok has no symbolic link, so this is chown()
| pathname | The pathname of the file. |
| owner | The user to give it to, or -1 to leave it alone. |
| group | The group to give it to, or -1 to leave it alone. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int link | ( | const char * | oldpath, |
| const char * | newpath | ||
| ) |
Give a file a second name. Tenok gives a file one name.
| oldpath | The file to name again. |
| newpath | The name to give it. |
| int | -1 with errno set to ENOSYS. |
| off_t lseek | ( | int | fd, |
| long | offset, | ||
| int | whence | ||
| ) |
Reposition the file offset of the open file description associated with the file descriptor fd.
| fd | The file descriptor to provide. |
| offset | The new offset to the position specified by whence. |
| whence | The start position of the new offset. |
| off_t | The new offset on success and -1 on error, with the reason left in errno. |
| int pipe | ( | int | pipefd[2] | ) |
Create a pipe, a stream that is written to through one descriptor and read from through the other.
| pipefd | Where to store the two descriptors, the read end first and the write end second. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| ssize_t read | ( | int | fd, |
| void * | buf, | ||
| size_t | count | ||
| ) |
Attempt to read up to count bytes from file descriptor fd into the buffer starting at buf.
| fd | The file descriptor to provide. |
| buf | The memory space for storing read data. |
| count | The number of bytes to read. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int readlink | ( | const char * | pathname, |
| char * | buf, | ||
| size_t | bufsiz | ||
| ) |
Read what a symbolic link stands for. Nothing a path of Tenok names is one.
| pathname | The name to read. |
| buf | Where to put what it stands for. |
| bufsiz | The room there is for it. |
| int | -1 with errno set to EINVAL, which is what POSIX says of a name that is not a symbolic link. |
| int rmdir | ( | const char * | pathname | ) |
Delete a directory, which must be empty.
| pathname | The pathname of the directory to remove. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int setegid | ( | gid_t | gid | ) |
Join the effective group of the given identifier, the way setgid() does.
| gid | The group to join. |
| int | 0 for the group Tenok runs as, and -1 with errno set to EPERM for any other. |
| int seteuid | ( | uid_t | uid | ) |
Become the effective user of the given identifier, the way setuid() does.
| uid | The user to become. |
| int | 0 for the user Tenok runs as, and -1 with errno set to EPERM for any other. |
| int setgid | ( | gid_t | gid | ) |
Join the group of the given identifier. Tenok has the one group, so only that one can be joined.
| gid | The group to join. |
| int | 0 for the group Tenok runs as, and -1 with errno set to EPERM for any other. |
| pid_t setsid | ( | void | ) |
Start a session. Tenok has the one console and no sessions to give it out to.
| pid_t | -1 with errno set to ENOSYS. |
| int setuid | ( | uid_t | uid | ) |
Become the user of the given identifier. Tenok runs as the one user it has, so only that one can be become.
| uid | The user to become. |
| int | 0 for the user Tenok runs as, and -1 with errno set to EPERM for any other. |
| unsigned int sleep | ( | unsigned int | seconds | ) |
To cause the calling thread to sleep either until the number of real-time seconds specified in seconds have elapsed or until a signal arrives which is not ignored.
| seconds | The sleep seconds to provide. |
| int | 0 on success and nonzero error number on error. |
| int symlink | ( | const char * | target, |
| const char * | linkpath | ||
| ) |
Make a name that stands for another. Tenok has no symbolic link.
| target | What the name would stand for. |
| linkpath | The name to make. |
| int | -1 with errno set to ENOSYS. |
| int ttyname_r | ( | int | fd, |
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Name the terminal the descriptor is open on. Tenok keeps no way back from a descriptor to the name it was opened by.
| fd | The descriptor. |
| buf | Where to put the name. |
| buflen | The room there is for it. |
| int | ENOSYS. |
| int unlink | ( | const char * | pathname | ) |
Delete a name from the file system.
| pathname | The pathname of the file to remove. |
| int | 0 on success and -1 on error, with the reason left in errno. |
| int usleep | ( | useconds_t | usec | ) |
Suspend execution of the calling thread for a given time in microseconds.
| usec | The sleep microseconds to provide. |
| int | 0 on success and nonzero error number on error. |
| pid_t vfork | ( | void | ) |
Create a child process. Tenok runs every task from the image it booted and has no way to make another, so the call always fails.
| pid_t | -1 with errno set to ENOSYS. |
| ssize_t write | ( | int | fd, |
| const void * | buf, | ||
| size_t | count | ||
| ) |
Write up to count bytes from the buffer starting at buf to the file referred to by the file descriptor fd.
| fd | The file descriptor to provide. |
| buf | The data to write. |
| count | The number of bytes to write. |
| int | 0 on success and -1 on error, with the reason left in errno. |