FreeNOS
|
Provides support for the POSIX.1-2008 portable operating system interface for user programs. More...
Data Structures | |
struct | FileSystemMount |
Represents a mounted filesystem. More... | |
struct | dirent |
Represents a directory entry. More... | |
struct | DIR |
A type representing a directory stream. More... | |
struct | FILE |
A structure containing information about a file. More... | |
struct | sockaddr |
Defines a socket address and port pair. More... | |
struct | iovec |
Input/Output vector for multi-packet operations. More... | |
struct | msghdr |
Describes one or more datagrams. More... | |
struct | stat |
The <sys/stat.h> header shall define the stat structure. More... | |
struct | timeval |
Time value information. More... | |
struct | timezone |
Time zone information. More... | |
struct | utsname |
System name structure. More... | |
struct | timespec |
The <time.h> header shall declare the timespec structure. More... | |
Macros | |
#define | assert(exp) |
Insert program diagnostics. More... | |
#define | isdigit(c) Character::isDigit(c) |
Test for a decimal digit. More... | |
#define | islower(c) Character::isLower(c) |
Test for a lowercase letter. More... | |
#define | isupper(c) Character::isUpper(c) |
Test for an uppercase letter. More... | |
#define | isalpha(c) Character::isAlpha(c) |
Test for an alphabetic character. More... | |
#define | isalnum(c) Character::isAlnum(c) |
Test for an alphanumeric character. More... | |
#define | isblank(c) Character::isBlank(c) |
Test for a blank character. More... | |
#define | isspace(c) Character::isSpace(c) |
Test for a white-space character. More... | |
#define | tolower(c) Character::lower(c) |
Converts the letter c to lowercase. More... | |
#define | toupper(c) Character::upper(c) |
Converts the letter c to uppercase. More... | |
#define | DT_UNKNOWN 0 |
The file type is unknown. More... | |
#define | DT_FIFO 1 |
This is a named pipe (FIFO). More... | |
#define | DT_CHR 2 |
This is a character device. More... | |
#define | DT_DIR 4 |
This is a directory. More... | |
#define | DT_BLK 6 |
This is a block device. More... | |
#define | DT_REG 8 |
This is a regular file. More... | |
#define | DT_LNK 10 |
This is a symbolic link. More... | |
#define | DT_SOCK 12 |
This is a Unix domain socket. More... | |
#define | DIRLEN 64 |
Maximum length of a directory entry name. More... | |
#define | CHAR_BIT 8 |
Number of bits in a type char. More... | |
#define | PATH_MAX FileSystemPath::MaximumLength |
Maximum file path length. More... | |
#define | dprintf(fmt, ...) printf("{%s:%d}: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); |
Output a debug message using printf(). More... | |
#define | EXIT_SUCCESS 0 |
Successful termination. More... | |
#define | EXIT_FAILURE 1 |
Unsuccessful termination. More... | |
#define | FILETYPE_BITS 3 |
Number of bits needed to store a FileType. More... | |
#define | FILETYPE_MASK 7 |
Masker value for all FileTypes. More... | |
#define | FILEMODE_BITS 9 |
Number of bits required for all FileModes. More... | |
#define | FILEMODE_MASK 0777 |
Masker value for all FileMode values. More... | |
#define | UTSBUF 128 |
Size of each buffer in the utsname structure fields. More... | |
#define | WEXITSTATUS(st) (st) |
Returns the exit status of the child process. More... | |
#define | _POSIX_VERSION 200809L |
Integer value indicating version of this standard (C-language binding) to which the implementation conforms. More... | |
#define | _POSIX2_VERSION 200809L |
Integer value indicating version of the Shell and Utilities volume of POSIX.1 to which the implementation conforms. More... | |
Typedefs | |
typedef struct FileSystemMount | FileSystemMount |
Represents a mounted filesystem. More... | |
typedef struct DIR | DIR |
A type representing a directory stream. More... | |
typedef Size | socklen_t |
typedef ProcessID | pid_t |
Used for process IDs and process group IDs. More... | |
typedef Size | size_t |
Used for sizes of objects. More... | |
typedef slong | ssize_t |
Used for a count of bytes or an error indication. More... | |
typedef DeviceID | dev_t |
Used for device IDs. More... | |
typedef uint | ino_t |
Used for file serial numbers. More... | |
typedef uint | mode_t |
Used for some file attributes. More... | |
typedef u16 | uid_t |
Used for user IDs. More... | |
typedef u16 | gid_t |
Used for group IDs. More... | |
typedef Size | nlink_t |
Used for link counts. More... | |
typedef sint | off_t |
Used for file sizes. More... | |
typedef sint | blkcnt_t |
Used for file block counts. More... | |
typedef sint | blksize_t |
Used for block sizes. More... | |
typedef u64 | time_t |
Used for time in seconds. More... | |
Functions | |
C DIR * | opendir (const char *dirname) |
Open directory associated with file descriptor. More... | |
C struct dirent * | readdir (DIR *dirp) |
Read a directory. More... | |
C int | closedir (DIR *dirp) |
Close a directory stream. More... | |
C int | open (const char *path, int oflag,...) |
Open file relative to directory file descriptor. More... | |
C char * | basename (char *path) |
Return the last component of a pathname. More... | |
C char * | dirname (char *path) |
Return the directory portion of a pathname. More... | |
C int | abs (int number) |
Compute the absolute value of a number. More... | |
C u32 | sqrt (u32 number) |
Compute the square root of a number. More... | |
C int | snprintf (char *buffer, unsigned int size, const char *fmt,...) |
Write a formatted string into a buffer. More... | |
C int | vsnprintf (char *buffer, unsigned int size, const char *fmt, va_list args) |
Write a formatted string into a buffer. More... | |
C int | printf (const char *format,...) |
Output a formatted string to standard output. More... | |
C int | vprintf (const char *format, va_list args) |
Output a formatted string to standard output, using a variable argument list. More... | |
C void | exit (int status) |
Terminate a process. More... | |
C void | itoa (char *buffer, int divisor, int number) |
Convert a number to a string. More... | |
C int | atoi (const char *nptr) |
Convert a string to an integer. More... | |
C long | strtol (const char *nptr, char **endptr, int base) |
Convert a string to a long integer. More... | |
C void * | malloc (size_t size) |
A memory allocator. More... | |
C void | free (void *ptr) |
Free allocated memory. More... | |
C void | srandom (unsigned int seed) |
Random number generator. More... | |
C long int | random (void) |
Random number generator. More... | |
C int | strcmp (const char *dest, const char *src) |
Compare two strings. More... | |
C int | strncmp (const char *dest, const char *src, size_t count) |
Compare two strings, by only a maximum number of bytes. More... | |
C int | strcasecmp (const char *dest, const char *src) |
Compare two strings, ignoring case considerations. More... | |
C int | strncasecmp (const char *dest, const char *src, size_t count) |
Compare two strings, ignoring case considerations. More... | |
C char * | strdup (const char *str) |
Duplicate a string. More... | |
C char * | strndup (const char *s, size_t size) |
Duplicate a specific number of bytes from a string. More... | |
C void * | memset (void *dest, int ch, size_t count) |
Fill memory with a constant byte. More... | |
C void * | memcpy (void *dest, const void *src, size_t count) |
Copy memory from one place to another. More... | |
C size_t | strlen (const char *str) |
Calculate the length of a string. More... | |
C int | strcpy (char *dest, const char *src) |
Copy a string. More... | |
C int | strncpy (char *dest, const char *src, size_t sz) |
Copy a string, given a maximum number of bytes. More... | |
C size_t | strlcpy (char *dst, const char *src, size_t siz) |
Copy src to string dst of size siz. More... | |
C char * | strcat (char *dest, const char *src) |
Concatenate two strings. More... | |
C char * | strncat (char *dest, const char *src, size_t siz) |
Concatenate a string with part of another. More... | |
C char * | strerror (int errnum) |
The strerror function maps the number in errnum to a message string. More... | |
C char * | strchr (const char *s, int c) |
String scanning operation. More... | |
C char * | strrchr (const char *s, int c) |
String scanning operation. More... | |
C int | connect (int sockfd, struct sockaddr *addr, socklen_t addrlen) |
Connect a socket to an address/port. More... | |
C int | recvfrom (int sockfd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t addrlen) |
Receive a single datagram from a socket. More... | |
C int | sendto (int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t addrlen) |
Send a single datagram to a remote host. More... | |
C int | sendmsg (int sockfd, const struct msghdr *msg, int flags) |
Send multiple datagrams to a remote host. More... | |
C int | stat (const char *path, struct stat *buf) |
Get file status. More... | |
C int | mknod (const char *path, mode_t mode, dev_t dev) |
Make directory, special file, or regular file. More... | |
C int | mkdir (const char *path, mode_t mode) |
Create a new directory. More... | |
C int | creat (const char *path, mode_t mode) |
Create a new file or rewrite an existing one. More... | |
C int | gettimeofday (struct timeval *tv, struct timezone *tz) |
Get current time of day. More... | |
C int | uname (struct utsname *name) |
Get the name of the current system. More... | |
C pid_t | waitpid (pid_t pid, int *stat_loc, int options) |
Wait for a child process to stop or terminate. More... | |
C unsigned long | mktime (const unsigned int year, const unsigned int month, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec) |
Convert given time values to UNIX timestamp (seconds since epoch) More... | |
C pid_t | getpid () |
Get the process ID. More... | |
C pid_t | getppid () |
Get parent process ID. More... | |
C ssize_t | read (int fildes, void *buf, size_t nbyte) |
Read from a file. More... | |
C ssize_t | write (int fildes, const void *buf, size_t nbyte) |
Write on a file. More... | |
C int | close (int fildes) |
Close a file descriptor. More... | |
C off_t | lseek (int fildes, off_t offset, int whence) |
Move the read/write file offset. More... | |
C int | forkexec (const char *path, const char *argv[]) |
Create a new process and execute program. More... | |
C int | spawn (Address program, Size programSize, const char *argv[]) |
Create a new process using in-memory image. More... | |
C int | gethostname (char *name, size_t namelen) |
Get name of current host. More... | |
C char * | getcwd (char *buf, size_t size) |
Get the pathname of the current working directory. More... | |
C int | chdir (const char *path) |
Change working directory. More... | |
C int | unlink (const char *path) |
Remove a file from the filesystem. More... | |
C unsigned int | sleep (unsigned int seconds) |
Sleep for the specified number of seconds. More... | |
Variables | |
C int | errno |
The lvalue errno is used by many functions to return error values. More... | |
C char * | error_map [] |
Contains a array of character strings, representing errno values. More... | |
Error codes | |
Functions that use errno variable can set the errno value to any of these values.
| |
#define | ESUCCESS 0 |
Reports a success operation. More... | |
#define | E2BIG -1 |
Argument list too long. More... | |
#define | EACCES -2 |
Permission denied. More... | |
#define | EADDRINUSE -3 |
Address in use. More... | |
#define | EADDRNOTAVAIL -4 |
Address not available. More... | |
#define | EAFNOSUPPORT -5 |
Address family not supported. More... | |
#define | EAGAIN -6 |
Resource unavailable, try again (may be the same value as [EWOULDBLOCK]). More... | |
#define | EALREADY -7 |
Connection already in progress. More... | |
#define | EBADF -8 |
Bad file descriptor. More... | |
#define | EBADMSG -9 |
Bad message. More... | |
#define | EBUSY -10 |
Device or resource busy. More... | |
#define | ECANCELED -11 |
Operation canceled. More... | |
#define | ECHILD -12 |
No child processes. More... | |
#define | ECONNABORTED -13 |
Connection aborted. More... | |
#define | ECONNREFUSED -14 |
Connection refused. More... | |
#define | ECONNRESET -15 |
Connection reset. More... | |
#define | EDEADLK -16 |
Resource deadlock would occur. More... | |
#define | EDESTADDRREQ -17 |
Destination address required. More... | |
#define | EDOM -18 |
Mathematics argument out of domain of function. More... | |
#define | EDQUOT -19 |
Reserved. More... | |
#define | EEXIST -20 |
File exists. More... | |
#define | EFAULT -21 |
Bad address. More... | |
#define | EFBIG -22 |
File too large. More... | |
#define | EHOSTUNREACH -23 |
Host is unreachable. More... | |
#define | EIDRM -24 |
Identifier removed. More... | |
#define | EILSEQ -25 |
Illegal byte sequence. More... | |
#define | EINPROGRESS -26 |
Operation in progress. More... | |
#define | EINTR -27 |
Interrupted function. More... | |
#define | EINVAL -28 |
Invalid argument. More... | |
#define | EIO -29 |
I/O error. More... | |
#define | EISCONN -30 |
Socket is connected. More... | |
#define | EISDIR -31 |
Is a directory. More... | |
#define | ELOOP -32 |
Too many levels of symbolic links. More... | |
#define | EMFILE -33 |
File descriptor value too large. More... | |
#define | EMLINK -34 |
Too many links. More... | |
#define | EMSGSIZE -35 |
Message too large. More... | |
#define | EMULTIHOP -36 |
Reserved. More... | |
#define | ENAMETOOLONG -37 |
Filename too long. More... | |
#define | ENETDOWN -38 |
Network is down. More... | |
#define | ENETRESET -39 |
Connection aborted by network. More... | |
#define | ENETUNREACH -40 |
Network unreachable. More... | |
#define | ENFILE -41 |
Too many files open in system. More... | |
#define | ENOBUFS -42 |
No buffer space available. More... | |
#define | ENODATA -43 |
No message is available on the STREAM head read queue. More... | |
#define | ENODEV -44 |
No such device. More... | |
#define | ENOENT -45 |
No such file or directory. More... | |
#define | ENOEXEC -46 |
Executable file format error. More... | |
#define | ENOLCK -47 |
No locks available. More... | |
#define | ENOLINK -48 |
Reserved. More... | |
#define | ENOMEM -49 |
Not enough space. More... | |
#define | ENOMSG -50 |
No message of the desired type. More... | |
#define | ENOPROTOOPT -51 |
Protocol not available. More... | |
#define | ENOSPC -52 |
No space left on device. More... | |
#define | ENOSR -53 |
No STREAM resources. More... | |
#define | ENOSTR -54 |
Not a STREAM. More... | |
#define | ENOSYS -55 |
Function not supported. More... | |
#define | ENOTCONN -56 |
The socket is not connected. More... | |
#define | ENOTDIR -57 |
Not a directory. More... | |
#define | ENOTEMPTY -58 |
Directory not empty. More... | |
#define | ENOTRECOVERABLE -59 |
State not recoverable. More... | |
#define | ENOTSOCK -60 |
Not a socket. More... | |
#define | ENOTSUP -61 |
Not supported (may be the same value as [EOPNOTSUPP]). More... | |
#define | ENOTTY -62 |
Inappropriate I/O control operation. More... | |
#define | ENXIO -63 |
No such device or address. More... | |
#define | EOPNOTSUPP -64 |
Operation not supported on socket (may be the same value as [ENOTSUP]). More... | |
#define | EOVERFLOW -65 |
Value too large to be stored in data type. More... | |
#define | EOWNERDEAD -66 |
Previous owner died. More... | |
#define | EPERM -67 |
Operation not permitted. More... | |
#define | EPIPE -68 |
Broken pipe. More... | |
#define | EPROTO -69 |
Protocol error. More... | |
#define | EPROTONOSUPPORT -70 |
Protocol not supported. More... | |
#define | EPROTOTYPE -71 |
Protocol wrong type for socket. More... | |
#define | ERANGE -72 |
Result too large. More... | |
#define | EROFS -73 |
Read-only file system. More... | |
#define | ESPIPE -74 |
Invalid seek. More... | |
#define | ESRCH -75 |
No such process. More... | |
#define | ESTALE -76 |
Reserved. More... | |
#define | ETIME -77 |
Stream ioctl() timeout. More... | |
#define | ETIMEDOUT -78 |
Connection timed out. More... | |
#define | ETXTBSY -79 |
Text file busy. More... | |
#define | EWOULDBLOCK -80 |
Operation would block (may be the same value as [EAGAIN]). More... | |
#define | EXDEV -81 |
Cross-device link. More... | |
#define | ERESTART (1 << 17) |
Triggers a restart of all filesystem requests. More... | |
#define | ELAST ERESTART |
Last defined error value (do not use). More... | |
File Constants | |
#define | O_CREAT (1 << 0) |
Create file if it does not exist. More... | |
#define | O_EXCL (1 << 1) |
Exclusive use flag. More... | |
#define | O_NOCTTY (1 << 2) |
Do not assign controlling terminal. More... | |
#define | O_TRUNC (1 << 3) |
Truncate flag. More... | |
#define | O_TTY_INIT (1 << 4) |
Set the termios structure terminal parameters to a state that provides conforming behavior; see Parameters that Can be Set. More... | |
#define | O_APPEND (1 << 5) |
Set append mode. More... | |
#define | O_DSYNC (1 << 6) |
Write according to synchronized I/O data integrity completion. More... | |
#define | O_NONBLOCK (1 << 7) |
Non-blocking mode. More... | |
#define | O_RSYNC (1 << 8) |
Synchronized read I/O operations. More... | |
#define | O_SYNC (1 << 9) |
Write according to synchronized I/O file integrity completion. More... | |
#define | O_ACCMODE (O_EXEC | O_RDONLY | O_RDWR | O_SEARCH | O_WRONLY) |
Mask for file access modes. More... | |
#define | O_EXEC (1 << 10) |
Open for execute only (non-directory files). More... | |
#define | O_RDONLY (1 << 11) |
Open for reading only. More... | |
#define | O_RDWR (1 << 12) |
Open for reading and writing. More... | |
#define | O_SEARCH (1 << 13) |
Open directory for search only. More... | |
#define | O_WRONLY (1 << 14) |
Open for writing only. More... | |
ISO C99 Signals | |
| |
#define | SIGINT 2 |
Interactive attention signal. More... | |
#define | SIGILL 4 |
Illegal instruction. More... | |
#define | SIGABRT 6 |
Abnormal termination. More... | |
#define | SIGFPE 8 |
Erroneous arithmetic operation. More... | |
#define | SIGSEGV 11 |
Invalid access to storage. More... | |
#define | SIGTERM 15 |
Termination request. More... | |
POSIX.1-2008 Signals | |
| |
#define | SIGHUP 1 |
Hangup. More... | |
#define | SIGQUIT 3 |
Quit. More... | |
#define | SIGTRAP 5 |
Trace/breakpoint trap. More... | |
#define | SIGKILL 9 |
Killed. More... | |
#define | SIGBUS 10 |
Bus error. More... | |
#define | SIGSYS 12 |
Bad system call. More... | |
#define | SIGPIPE 13 |
Broken pipe. More... | |
#define | SIGALRM 14 |
Alarm clock. More... | |
#define | SIGURG 16 |
Urgent data is available at a socket. More... | |
#define | SIGSTOP 17 |
Stop, unblockable. More... | |
#define | SIGTSTP 18 |
Keyboard stop. More... | |
#define | SIGCONT 19 |
Continue. More... | |
#define | SIGCHLD 20 |
Child terminated or stopped. More... | |
#define | SIGTTIN 21 |
Background read from control terminal. More... | |
#define | SIGTTOU 22 |
Background write to control terminal. More... | |
#define | SIGPOLL 23 |
Pollable event occurred (System V). More... | |
#define | SIGXCPU 24 |
CPU time limit exceeded. More... | |
#define | SIGXFSZ 25 |
File size limit exceeded. More... | |
#define | SIGVTALRM 26 |
Virtual timer expired. More... | |
#define | SIGPROF 27 |
Profiling timer expired. More... | |
#define | SIGUSR1 30 |
User-defined signal 1. More... | |
#define | SIGUSR2 31 |
User-defined signal 2. More... | |
Signal Functions | |
C int | kill (pid_t pid, int sig) |
Send a signal to a process or a group of processes. More... | |
File seek operations | |
#define | SEEK_CUR 0 |
Seek relative to current position. More... | |
#define | SEEK_END 1 |
Seek relative to end-of-file. More... | |
#define | SEEK_SET 2 |
Seek relative to start-of-file. More... | |
File streams | |
typedef struct FILE | FILE |
A structure containing information about a file. More... | |
C FILE * | fopen (const char *filename, const char *mode) |
Open a stream. More... | |
C size_t | fread (void *ptr, size_t size, size_t nitems, FILE *stream) |
Binary input. More... | |
C size_t | fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream) |
The fwrite() function shall write, from the array pointed to by ptr, up to nitems elements whose size is specified by size, to the stream pointed to by stream. More... | |
C int | fclose (FILE *stream) |
Close a stream. More... | |
File stat type bits. | |
The <sys/stat.h> header shall define the following symbolic constants for the file types encoded in type mode_t. The values shall be suitable for use in #if preprocessing directives. | |
#define | S_IFMT (FILETYPE_MASK << FILEMODE_BITS) |
Type of file. More... | |
#define | S_IFBLK (FileSystem::BlockDeviceFile << FILEMODE_BITS) |
Block special. More... | |
#define | S_IFCHR (FileSystem::CharacterDeviceFile << FILEMODE_BITS) |
Character special. More... | |
#define | S_IFIFO (FileSystem::FIFOFile << FILEMODE_BITS) |
FIFO special. More... | |
#define | S_IFREG (FileSystem::RegularFile << FILEMODE_BITS) |
Regular. More... | |
#define | S_IFDIR (FileSystem::DirectoryFile << FILEMODE_BITS) |
Directory. More... | |
#define | S_IFLNK (FileSystem::SymlinkFile << FILEMODE_BITS) |
Symbolic link. More... | |
#define | S_IFSOCK (FileSystem::SocketFile << FILEMODE_BITS) |
Socket. More... | |
#define | S_IRWXU FileSystem::OwnerRWX |
File mode bits. More... | |
#define | S_IRUSR FileSystem::OwnerR |
Read permission, owner. More... | |
#define | S_IWUSR FileSystem::OwnerW |
Write permission, owner. More... | |
#define | S_IXUSR FileSystem::OwnerX |
Execute/search permission, owner. More... | |
#define | S_IRWXG FileSystem::GroupRWX |
Read, write, execute/search by group. More... | |
#define | S_IRGRP FileSystem::GroupR |
Read permission, group. More... | |
#define | S_IWGRP FileSystem::GroupW |
Write permission, group. More... | |
#define | S_IXGRP FileSystem::GroupX |
Execute/search permission, group. More... | |
#define | S_IRWXO FileSystem::OtherRWX |
Read, write, execute/search by others. More... | |
#define | S_IROTH FileSystem::OtherR |
Read permission, others. More... | |
#define | S_IWOTH FileSystem::OtherW |
Write permission, others. More... | |
#define | S_IXOTH FileSystem::OtherX |
Execute/search permission, others. More... | |
File type macros. | |
The following macros shall be provided to test whether a file is of the specified type. The value m supplied to the macros is the value of st_mode from a stat structure. The macro shall evaluate to a non-zero value if the test is true; 0 if the test is false. | |
#define | S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask)) |
Test for mode bits. More... | |
#define | S_ISBLK(m) S_ISTYPE(m, S_IFBLK) |
Test for a block special file. More... | |
#define | S_ISCHR(m) S_ISTYPE(m, S_IFCHR) |
Test for a character special file. More... | |
#define | S_ISDIR(m) S_ISTYPE(m, S_IFDIR) |
Test for a directory. More... | |
#define | S_ISFIFO(m) S_ISTYPE(m, S_IFIFO) |
Test for a pipe or FIFO special file. More... | |
#define | S_ISREG(m) S_ISTYPE(m, S_IFREG) |
Test for a regular file. More... | |
#define | S_ISLNK(m) S_ISTYPE(m, S_IFLNK) |
Test for a symbolic link. More... | |
#define | S_ISSOCK(m) S_ISTYPE(m, S_IFSOCK) |
Test for a socket. More... | |
Provides support for the POSIX.1-2008 portable operating system interface for user programs.
#define _POSIX2_VERSION 200809L |
#define _POSIX_VERSION 200809L |
#define assert | ( | exp | ) |
Insert program diagnostics.
The assert() macro shall insert diagnostics into programs; it shall expand to a void expression. When it is executed, if expression (which shall have a scalar type) is false (that is, compares equal to 0), assert() shall write information about the particular call that failed on stderr and shall call abort().
The information written about the call that failed shall include the text of the argument, the name of the source file, the source file line number, and the name of the enclosing function; the latter are, respectively, the values of the preprocessing macros FILE and LINE and of the identifier func.
Forcing a definition of the name NDEBUG, either from the compiler command line or with the preprocessor control statement #define NDEBUG ahead of the #include <assert.h> statement, shall stop assertions from being compiled into the program.
exp | Boolean expression. |
#define dprintf | ( | fmt, | |
... | |||
) | printf("{%s:%d}: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); |
#define EAGAIN -6 |
#define EDOM -18 |
#define ELAST ERESTART |
#define ENODATA -43 |
#define ENOTSUP -61 |
#define EOPNOTSUPP -64 |
#define EOVERFLOW -65 |
#define ERESTART (1 << 17) |
#define EWOULDBLOCK -80 |
#define FILEMODE_BITS 9 |
#define FILEMODE_MASK 0777 |
#define FILETYPE_BITS 3 |
#define isalnum | ( | c | ) | Character::isAlnum(c) |
#define isalpha | ( | c | ) | Character::isAlpha(c) |
#define isblank | ( | c | ) | Character::isBlank(c) |
#define isdigit | ( | c | ) | Character::isDigit(c) |
#define islower | ( | c | ) | Character::isLower(c) |
#define isspace | ( | c | ) | Character::isSpace(c) |
#define isupper | ( | c | ) | Character::isUpper(c) |
#define O_DSYNC (1 << 6) |
#define O_EXEC (1 << 10) |
#define O_NOCTTY (1 << 2) |
#define O_SEARCH (1 << 13) |
#define O_SYNC (1 << 9) |
#define O_TTY_INIT (1 << 4) |
#define PATH_MAX FileSystemPath::MaximumLength |
#define S_IFBLK (FileSystem::BlockDeviceFile << FILEMODE_BITS) |
#define S_IFCHR (FileSystem::CharacterDeviceFile << FILEMODE_BITS) |
#define S_IFDIR (FileSystem::DirectoryFile << FILEMODE_BITS) |
#define S_IFIFO (FileSystem::FIFOFile << FILEMODE_BITS) |
#define S_IFLNK (FileSystem::SymlinkFile << FILEMODE_BITS) |
#define S_IFMT (FILETYPE_MASK << FILEMODE_BITS) |
#define S_IFREG (FileSystem::RegularFile << FILEMODE_BITS) |
#define S_IFSOCK (FileSystem::SocketFile << FILEMODE_BITS) |
#define S_IRGRP FileSystem::GroupR |
#define S_IROTH FileSystem::OtherR |
#define S_IRUSR FileSystem::OwnerR |
#define S_IRWXG FileSystem::GroupRWX |
#define S_IRWXO FileSystem::OtherRWX |
#define S_IRWXU FileSystem::OwnerRWX |
File mode bits.
The <sys/stat.h> header shall define the following symbolic constants for the file mode bits encoded in type mode_t, with the indicated numeric values. These macros shall expand to an expression which has a type that allows them to be used, either singly or OR'ed together, as the third argument to open() without the need for a mode_t cast. The values shall be suitable for use in #if preprocessing directives. Read, write, execute/search by owner.
#define S_ISTYPE | ( | mode, | |
mask | |||
) | (((mode) & S_IFMT) == (mask)) |
#define S_IWGRP FileSystem::GroupW |
#define S_IWOTH FileSystem::OtherW |
#define S_IWUSR FileSystem::OwnerW |
#define S_IXGRP FileSystem::GroupX |
#define S_IXOTH FileSystem::OtherX |
#define S_IXUSR FileSystem::OwnerX |
#define tolower | ( | c | ) | Character::lower(c) |
#define toupper | ( | c | ) | Character::upper(c) |
#define UTSBUF 128 |
#define WEXITSTATUS | ( | st | ) | (st) |
A type representing a directory stream.
typedef struct FileSystemMount FileSystemMount |
Represents a mounted filesystem.
C int abs | ( | int | number | ) |
Compute the absolute value of a number.
The absolute value of a number turns it to positive in case it is negative. Basically it just removes the sign (-) from a number. For example, -3 returns 3, and 8 returns 8.
number | The number to make absolute. |
Definition at line 21 of file abs.cpp.
References CHAR_BIT.
C int atoi | ( | const char * | nptr | ) |
Convert a string to an integer.
The atoi, atol, and atoll functions convert the initial portion of the string pointed to by nptr to int, long int, and long long int representation, respectively.
nptr | String pointer to convert. |
Definition at line 21 of file atoi.cpp.
References String::toLong().
Referenced by MakeNode::exec(), SievePrime::exec(), Sleep::exec(), MpiPrime::exec(), NetCat::initialize(), main(), MpiHost::parseHostsFile(), and vsnprintf().
C char* basename | ( | char * | path | ) |
Return the last component of a pathname.
The basename() function shall take the pathname pointed to by path and return a pointer to the final component of the pathname, deleting any trailing '/' characters.
path | Filesystem path. |
Definition at line 21 of file basename.cpp.
References strrchr().
Referenced by ListFiles::printSingleFile(), StdoutReporter::reportAfter(), StdoutReporter::reportBefore(), StdoutReporter::reportBegin(), StdoutReporter::reportFinish(), and MpiHost::startProcesses().
C int chdir | ( | const char * | path | ) |
Change working directory.
The chdir() function shall cause the directory named by the pathname pointed to by the path argument to become the current working directory; that is, the starting point for path searches for pathnames not beginning with '/' .
path | Path to the directory to use as working directory. |
Definition at line 27 of file chdir.cpp.
References List< T >::append(), ENOTDIR, errno, getcwd(), ListIterator< T >::hasCurrent(), String::length(), memset(), PATH_MAX, List< T >::remove(), S_ISDIR, FileSystemClient::setCurrentDirectory(), snprintf(), FileSystemPath::split(), stat::st_mode, stat(), strcat(), strcpy(), and ZERO.
Referenced by ChangeDirCommand::execute().
C int close | ( | int | fildes | ) |
Close a file descriptor.
fildes | The close() function shall deallocate the file descriptor indicated by fildes. |
Definition at line 22 of file close.cpp.
References FileSystemClient::closeFile(), ENOENT, errno, and FileSystem::Success.
Referenced by Cat::cat(), closedir(), Login::exec(), StdioCommand::execute(), WriteCommand::execute(), fclose(), forkexec(), NetPing::icmpPing(), Terminal::initialize(), LinnCreate::insertFile(), CoreServer::loadKernel(), BufferedFile::read(), NetCtl::showDevice(), BufferedFile::write(), and Terminal::~Terminal().
Close a directory stream.
dirp | The closedir() function shall close the directory stream referred to by the argument dirp. |
Definition at line 22 of file closedir.cpp.
References DIR::buffer, close(), and DIR::fd.
Referenced by LinnCreate::insertDirectory(), opendir(), ListFiles::printFiles(), and DirectoryScanner::scan().
Connect a socket to an address/port.
sockfd | Socket file descriptor |
addr | Pointer to the address and port to connect to. |
addrlen | Length of the address |
Definition at line 23 of file connect.cpp.
References sockaddr::addr, NetworkClient::connectSocket(), EIO, ESUCCESS, NetworkClient::initialize(), and NetworkClient::Success.
Create a new file or rewrite an existing one.
The creat() function is redundant. Its services are also provided by the open() function. It has been included primarily for historical purposes since many existing applications depend on it. It is best considered a part of the C binding rather than a function that should be provided in other languages.
path | Full path to the file to create |
mode | Initial access permissions for the file. |
Definition at line 25 of file creat.cpp.
References FileSystemClient::createFile(), EIO, errno, ESUCCESS, FILEMODE_MASK, FileSystem::RegularFile, and FileSystem::Success.
Referenced by CreateFile::createFile().
C char* dirname | ( | char * | path | ) |
C void exit | ( | int | status | ) |
Terminate a process.
The exit function causes normal program termination to occur. If more than one call to the exit function is executed by a program, the behaviour is undefined.
status | If the value of status is zero or EXIT_SUCCESS, an implementation defined form of the status successful termination is returned. If the value of status is EXIT_FAILURE, an implementation-defined form of the status unsuccesful termination is returned. Otherwise the status is implementation-defined. |
Definition at line 21 of file exit.cpp.
References KillPID, ProcessCtl(), and SELF.
Referenced by LinnCreate::createInode(), ApplicationLauncher::exec(), ExitCommand::execute(), LinnCreate::insertDirectory(), LinnCreate::insertEntry(), LinnCreate::insertFile(), BootImageCreate::readBootSymbols(), NetCat::readLine(), StdioLog::terminate(), and Mount::waitForMount().
Close a stream.
The fclose() function shall cause the stream pointed to by stream to be flushed and the associated file to be closed. Any unwritten buffered data for the stream shall be written to the file; any unread buffered data shall be discarded. Whether or not the call succeeds, the stream shall be disassociated from the file and any buffer set by the setbuf() or setvbuf() function shall be disassociated from the stream. If the associated buffer was automatically allocated, it shall be deallocated.
stream | File stream to close. |
Definition at line 23 of file fclose.cpp.
References close(), errno, FILE::fd, and free().
Referenced by Shell::exec(), BootImageCreate::exec(), main(), MpiHost::parseHostsFile(), BootImageCreate::readBootSymbols(), and LinnCreate::writeImage().
Open a stream.
The fopen() function shall open the file whose pathname is the string pointed to by filename, and associates a stream with it. The mode argument points to a string. If the string is one of the following, the file shall be opened in the indicated mode. Otherwise, the behavior is undefined.
r or rb Open file for reading. w or wb Truncate to zero length or create file for writing. a or ab Append; open or create file for writing at end-of-file. r+ or rb+ or r+b Open file for update (reading and writing). w+ or wb+ or w+b Truncate to zero length or create file for update. a+ or ab+ or a+b Append; open or create file for update, writing at end-of-file.
filename | Path to the file to open. |
mode | Mode describes how to open the file. |
Definition at line 24 of file fopen.cpp.
References ENOTSUP, errno, FILE::fd, malloc(), NULL, open(), and ZERO.
Referenced by Shell::exec(), BootImageCreate::exec(), main(), MpiHost::parseHostsFile(), BootImageCreate::readBootSymbols(), and LinnCreate::writeImage().
C int forkexec | ( | const char * | path, |
const char * | argv[] | ||
) |
Create a new process and execute program.
Definition at line 27 of file forkexec.cpp.
References Memory::Range::access, close(), EFAULT, EIO, errno, Lz4Decompressor::getUncompressedSize(), Lz4Decompressor::initialize(), MapContiguous, O_RDONLY, open(), Memory::Range::phys, read(), Lz4Decompressor::read(), Memory::Readable, Release, SELF, Memory::Range::size, spawn(), stat::st_size, stat(), API::Success, Lz4Decompressor::Success, Memory::User, Memory::Range::virt, VMCtl(), Memory::Writable, and ZERO.
Referenced by Login::exec(), ApplicationLauncher::exec(), and ExternalTest::run().
Binary input.
The fread() function shall read into the array pointed to by ptr up to nitems elements whose size is specified by size in bytes, from the stream pointed to by stream. For each object, size calls shall be made to the fgetc() function and the results stored, in the order read, in an array of unsigned char exactly overlaying the object. The file position indicator for the stream (if defined) shall be advanced by the number of bytes successfully read. If an error occurs, the resulting value of the file position indicator for the stream is unspecified. If a partial element is read, its value is unspecified.
ptr | Output buffer. |
size | Size of each item to read. |
nitems | Number of items to read. |
stream | FILE pointer to read from. |
Definition at line 24 of file fread.cpp.
References FILE::fd, and read().
Referenced by Shell::exec(), main(), MpiHost::parseHostsFile(), and BootImageCreate::readBootSymbols().
C void free | ( | void * | ptr | ) |
Free allocated memory.
The free() function shall cause the space pointed to by ptr to be deallocated; that is, made available for further allocation. If ptr is a null pointer, no action shall occur. Otherwise, if the argument does not match a pointer earlier returned by a function in POSIX.1-2008 that allocates memory as if by malloc(), or if the space has been deallocated by a call to free() or realloc(), the behavior is undefined. Any use of a pointer that refers to freed space results in undefined behavior.
ptr | Previously allocated memory to free. |
Definition at line 22 of file free.cpp.
Referenced by MpiPrime::exec(), and fclose().
The fwrite() function shall write, from the array pointed to by ptr, up to nitems elements whose size is specified by size, to the stream pointed to by stream.
For each object, size calls shall be made to the fputc() function, taking the values (in order) from an array of unsigned char exactly overlaying the object. The file-position indicator for the stream (if defined) shall be advanced by the number of bytes successfully written. If an error occurs, the resulting value of the file-position indicator for the stream is unspecified.
ptr | Input buffer. |
size | Size of each item to write. |
nitems | Number of items to write. |
stream | FILE pointer to write to. |
Definition at line 24 of file fwrite.cpp.
References FILE::fd, and write().
Referenced by BootImageCreate::exec(), and LinnCreate::writeImage().
Get the pathname of the current working directory.
The getcwd() function shall place an absolute pathname of the current working directory in the array pointed to by buf, and return buf. The pathname shall contain no components that are dot or dot-dot, or are symbolic links.
buf | Output buffer, to store the current directory. |
size | Size of the output buffer. |
Definition at line 24 of file getcwd.cpp.
References assert, errno, ESUCCESS, FileSystemClient::getCurrentDirectory(), memcpy(), and NULL.
Referenced by chdir(), ListFiles::exec(), and Shell::prompt().
Get name of current host.
The gethostname() function shall return the standard host name for the current machine. The namelen argument shall specify the size of the array pointed to by the name argument. The returned name shall be null-terminated, except that if namelen is an insufficient length to hold the host name, then the returned name shall be truncated and it is unspecified whether the returned name is null-terminated. Host names are limited to {HOST_NAME_MAX} bytes.
name | Output buffer. |
namelen | Size of the output buffer. |
Definition at line 21 of file gethostname.cpp.
References strlcpy().
Referenced by Hostname::exec(), Shell::prompt(), and uname().
Get the process ID.
The getpid() function shall return the process ID of the calling process.
Definition at line 21 of file getpid.cpp.
References ProcessClient::getProcessID().
Referenced by TestData< T >::seed().
Get parent process ID.
Definition at line 21 of file getppid.cpp.
References ProcessClient::getParentID().
Get current time of day.
tv | Timeval struct object pointer. |
tz | Timezone struct object pointer. |
Definition at line 22 of file gettimeofday.cpp.
References ERANGE, errno, InfoTimer, ProcessCtl(), SELF, timeval::tv_sec, and timeval::tv_usec.
Referenced by SysInfo::exec(), SystemClock::now(), and TestData< T >::seed().
C void itoa | ( | char * | buffer, |
int | divisor, | ||
int | number | ||
) |
Convert a number to a string.
buffer | String buffer to write to. |
divisor | Base of the number, e.g. 16 for hexadecimal. |
number | The number to convert. |
Definition at line 21 of file itoa.cpp.
References Number::Dec, Number::Hex, and String::set().
Referenced by vsnprintf().
Send a signal to a process or a group of processes.
For a process to have permission to send a signal to a process designated by pid, unless the sending process has appropriate privileges, the real or effective user ID of the sending process shall match the real or saved set-user-ID of the receiving process.
If pid is greater than 0, sig shall be sent to the process whose process ID is equal to pid. If pid is 0, sig shall be sent to all processes (excluding an unspecified set of system processes) whose process group ID is equal to the process group ID of the sender, and for which the process has permission to send a signal. If pid is -1, sig shall be sent to all processes (excluding an unspecified set of system processes) for which the process has permission to send that signal. If pid is negative, but not -1, sig shall be sent to all processes (excluding an unspecified set of system processes) whose process group ID is equal to the absolute value of pid, and for which the process has permission to send a signal. If the value of pid causes sig to be generated for the sending process, and if sig is not blocked for the calling thread and if no other thread has sig unblocked or is waiting in a sigwait() function for sig, either sig or at least one pending unblocked signal shall be delivered to the sending thread before kill() returns.
The user ID tests described above shall not be applied when sending SIGCONT to a process that is a member of the same session as the sending process.
pid | The kill() function shall send a signal to a process or a group of processes specified by pid. |
sig | The signal to be sent is specified by sig and is either one from the list given in <signal.h> or 0. If sig is 0 (the null signal), error checking is performed but no signal is actually sent. The null signal can be used to check the validity of pid. |
Definition at line 23 of file kill.cpp.
References EIO, ENOTSUP, errno, EXIT_FAILURE, KillPID, ProcessCtl(), SIGKILL, SIGTERM, and API::Success.
Referenced by ApplicationLauncher::terminate().
Move the read/write file offset.
The lseek() function shall set the file offset for the open file description associated with the file descriptor fildes, as follows:
If whence is SEEK_SET, the file offset shall be set to offset bytes. If whence is SEEK_CUR, the file offset shall be set to its current location plus offset. If whence is SEEK_END, the file offset shall be set to the size of the file plus offset.
fildes | File descriptor. |
offset | New file offset. |
whence | Determines how to modify the file offset pointer. |
Definition at line 22 of file lseek.cpp.
References ENOENT, errno, FileDescriptor::getEntry(), StrictSingleton< FileDescriptor >::instance(), FileDescriptor::Entry::open, and FileDescriptor::Entry::position.
Referenced by Terminal::writeTerminal().
A memory allocator.
The malloc() function shall allocate unused space for an object whose size in bytes is specified by size and whose value is unspecified.
size | Number of bytes to allocate. |
Definition at line 22 of file malloc.cpp.
Referenced by SievePrime::exec(), MpiPrime::exec(), fopen(), strdup(), strndup(), and timeString().
Copy memory from one place to another.
dest | Destination address. |
src | Source address. |
count | Number of bytes to copy. |
Definition at line 20 of file memcpy.cpp.
References sp.
Referenced by copy(), getcwd(), recvfrom(), sendto(), strdup(), and strndup().
Fill memory with a constant byte.
Definition at line 20 of file memset.cpp.
Referenced by Cat::cat(), chdir(), LinnCreate::create(), BootImageCreate::exec(), MpiHost::initialize(), Terminal::initialize(), opendir(), spawn(), teken_subr_tab_clear(), and teken_tab_default().
Create a new directory.
The mkdir() function shall create a new directory with name path. The file permission bits of the new directory shall be initialized from mode. These file permission bits of the mode argument shall be modified by the process' file creation mask.
path | Full path to the directory to create. |
mode | Initial access permissions on the directory. |
Definition at line 25 of file mkdir.cpp.
References FileSystemClient::createFile(), FileSystem::DirectoryFile, EIO, errno, ESUCCESS, FILEMODE_MASK, and FileSystem::Success.
Make directory, special file, or regular file.
path | The mknod() function shall create a new file named by the pathname to which the argument path points. |
mode | The file type for path is OR'ed into the mode argument. |
dev | Device specific identifiers |
Definition at line 25 of file mknod.cpp.
References FileSystemClient::createFile(), EIO, errno, ESUCCESS, FILEMODE_BITS, FILEMODE_MASK, FILETYPE_MASK, and FileSystem::Success.
Referenced by MakeNode::exec().
C unsigned long mktime | ( | const unsigned int | year, |
const unsigned int | month, | ||
const unsigned int | day, | ||
const unsigned int | hour, | ||
const unsigned int | min, | ||
const unsigned int | sec | ||
) |
Convert given time values to UNIX timestamp (seconds since epoch)
year | Year value |
month | Month value |
day | Day value |
hour | Hour value (0-23) |
min | Minute value (0-59) |
sec | Second value (0-59) |
Convert given time values to UNIX timestamp (seconds since epoch)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition at line 20 of file time.cpp.
Referenced by Time::read().
C int open | ( | const char * | path, |
int | oflag, | ||
... | |||
) |
Open file relative to directory file descriptor.
path | The path argument points to a pathname naming the file. |
oflag | Values for oflag are constructed by a bitwise-inclusive OR of flags from the following list, defined in <fcntl.h>. |
Definition at line 26 of file open.cpp.
References ENOENT, errno, ESUCCESS, FileSystemClient::openFile(), and FileSystem::Success.
Referenced by Cat::cat(), Login::exec(), StdioCommand::execute(), WriteCommand::execute(), fopen(), forkexec(), Terminal::initialize(), LinnCreate::insertFile(), CoreServer::loadKernel(), opendir(), FileDescriptor::openEntry(), BufferedFile::read(), NetCtl::showDevice(), and BufferedFile::write().
Open directory associated with file descriptor.
dirname | The opendir() function shall open a directory stream corresponding to the directory named by the dirname argument. |
Definition at line 27 of file opendir.cpp.
References DIR::buffer, closedir(), DIR::count, DIR::current, dirent::d_type, DIRLEN, dirname(), DT_BLK, DT_CHR, DT_DIR, DT_FIFO, DT_LNK, DT_REG, DT_SOCK, DIR::eof, errno, ESUCCESS, DIR::fd, memset(), open(), read(), stat(), strlcpy(), type, and ZERO.
Referenced by LinnCreate::insertDirectory(), ListFiles::printFiles(), and DirectoryScanner::scan().
C int printf | ( | const char * | format, |
... | |||
) |
Output a formatted string to standard output.
format | Formatted string. |
... | Argument list. |
Definition at line 22 of file printf.cpp.
References va_end, va_start, and vprintf().
Referenced by NetPing::arpPing(), Cat::cat(), LinnCreate::createInode(), Hostname::exec(), BenchMark::exec(), Shutdown::exec(), UnixName::exec(), Echo::exec(), Shell::exec(), SysInfo::exec(), MpiPrime::exec(), HelpCommand::execute(), TimeCommand::execute(), Shell::getInput(), Login::getUsername(), NetPing::icmpPing(), Terminal::initialize(), LinnCreate::insertDirectory(), LinnCreate::insertEntry(), LinnCreate::insertFile(), Mount::listMounts(), main(), POSIXApplication::output(), BootImageCreate::output(), SystemClock::printDiff(), NetCat::printLine(), Login::printPrompt(), FileStatus::printStatus(), Shell::prompt(), BootImageCreate::readBootSymbols(), NetCat::readLine(), StdoutReporter::reportAfter(), TAPReporter::reportAfter(), XMLReporter::reportAfter(), StdoutReporter::reportBefore(), XMLReporter::reportBefore(), StdoutReporter::reportBegin(), TAPReporter::reportBegin(), XMLReporter::reportBegin(), StdoutReporter::reportFinish(), TAPReporter::reportFinish(), XMLReporter::reportFinish(), DirectoryScanner::scan(), MpiPrime::searchParallel(), NetCtl::showDevice(), usage(), and LinnCreate::writeImage().
C long int random | ( | void | ) |
Random number generator.
Definition at line 26 of file random.cpp.
References Randomizer::next().
Referenced by TestInt< T >::random(), and TestInt< T >::unique().
Read from a file.
fildes | The read() function shall attempt to read nbyte bytes from the file associated with the open file descriptor, fildes, into the buffer pointed to by buf. |
buf | The read() function shall attempt to read nbyte bytes from the file associated with the open file descriptor, fildes, into the buffer pointed to by buf. |
nbyte | If the value of nbyte is greater than {SSIZE_MAX}, the result is implementation-defined. |
Definition at line 22 of file read.cpp.
References ENOENT, errno, FileSystemClient::readFile(), and FileSystem::Success.
Referenced by NetPing::arpPing(), Cat::cat(), forkexec(), fread(), Shell::getInput(), Login::getUsername(), NetPing::icmpPing(), LinnCreate::insertFile(), CoreServer::loadKernel(), opendir(), NetCat::readLine(), recvfrom(), and NetCtl::showDevice().
Read a directory.
dirp | The readdir() function shall return a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry. |
Definition at line 21 of file readdir.cpp.
References DIR::buffer, DIR::count, DIR::current, and ZERO.
Referenced by LinnCreate::insertDirectory(), ListFiles::printFiles(), and DirectoryScanner::scan().
C int recvfrom | ( | int | sockfd, |
void * | buf, | ||
size_t | len, | ||
int | flags, | ||
struct sockaddr * | addr, | ||
socklen_t | addrlen | ||
) |
Receive a single datagram from a socket.
sockfd | Socket file descriptor |
buf | Destination buffer for receiving the payload |
len | Maximum number of bytes to receive |
flags | Optional flags for the receive operation |
addr | Pointer to the address and port of the sender of the datagram |
addrlen | Length of the address |
Definition at line 25 of file recvfrom.cpp.
References sockaddr::addr, NetworkClient::SocketInfo::address, ERANGE, memcpy(), sockaddr::port, NetworkClient::SocketInfo::port, and read().
Referenced by MpiHost::receivePacket(), NetCat::udpReceive(), MpiProxy::udpReceive(), and DhcpClient::udpReceive().
Send multiple datagrams to a remote host.
sockfd | Socket file descriptor |
msg | Pointer to the messages to send |
flags | Optional flags for the send operation |
Definition at line 24 of file sendmsg.cpp.
References NetworkClient::SocketInfo::action, sockaddr::addr, NetworkClient::SocketInfo::address, NetworkClient::PacketInfo::address, ERANGE, iovec::iov_base, iovec::iov_len, msghdr::msg_iov, msghdr::msg_iovlen, msghdr::msg_name, msghdr::msg_namelen, NetworkClient::SocketInfo::port, NetworkClient::SendMultiple, NetworkClient::PacketInfo::size, and write().
Referenced by NetSend::udpSendMultiple(), and MpiProxy::udpSendMultiple().
C int sendto | ( | int | sockfd, |
const void * | buf, | ||
size_t | len, | ||
int | flags, | ||
const struct sockaddr * | addr, | ||
socklen_t | addrlen | ||
) |
Send a single datagram to a remote host.
sockfd | Socket file descriptor |
buf | Source buffer containing the payload to send |
len | Maximum number of bytes to send. |
flags | Optional flags for the send operation |
addr | Pointer to the destination address and port to send to |
addrlen | Length of the address |
Definition at line 25 of file sendto.cpp.
References NetworkClient::SocketInfo::action, sockaddr::addr, NetworkClient::SocketInfo::address, ERANGE, memcpy(), NetworkClient::SocketInfo::port, NetworkClient::SendSingle, and write().
Referenced by MpiHost::sendPacket(), NetCat::udpSend(), MpiProxy::udpSend(), and DhcpClient::udpSend().
C unsigned int sleep | ( | unsigned int | seconds | ) |
Sleep for the specified number of seconds.
seconds | Number of seconds to sleep |
Definition at line 23 of file sleep.cpp.
References EAGAIN, EIO, errno, InfoTimer, ProcessCtl(), SELF, API::Success, and WaitTimer.
Referenced by Sleep::exec().
C int snprintf | ( | char * | buffer, |
unsigned int | size, | ||
const char * | fmt, | ||
... | |||
) |
Write a formatted string into a buffer.
buffer | String buffer to write to. |
size | Maximum number of bytes to write. |
fmt | Formatted string. |
... | Argument list. |
Definition at line 22 of file snprintf.cpp.
References va_end, va_start, and vsnprintf().
Referenced by chdir(), ProcessList::exec(), Shell::executeInput(), LinnCreate::insertDirectory(), ListFiles::printFiles(), Time::read(), BootImageCreate::readBootSymbols(), DirectoryScanner::scan(), and teken_subr_do_cpr().
Create a new process using in-memory image.
program | In-memory executable to run |
programSize | number of bytes of the executable |
argv | Argument list pointer. |
Definition at line 29 of file spawn.cpp.
References Memory::Range::access, ExecutableFormat::Region::access, ANY, ARGV_SIZE, MemoryBlock::copy(), ExecutableFormat::Region::dataOffset, ExecutableFormat::Region::dataSize, EFAULT, EIO, ENOEXEC, entry, ExecutableFormat::entry(), errno, ExecutableFormat::find(), FileSystemClient::getCurrentDirectory(), StrictSingleton< FileDescriptor >::instance(), KillPID, MapContiguous, ExecutableFormat::Region::memorySize, memset(), PAGESIZE, PATH_MAX, Memory::Range::phys, ProcessCtl(), MemoryMap::range(), Memory::Readable, ExecutableFormat::regions(), Resume, SELF, MemoryBlock::set(), Memory::Range::size, Spawn, strlcpy(), ExecutableFormat::Success, API::Success, UnMap, Memory::User, MemoryMap::UserArgs, Memory::Range::virt, ExecutableFormat::Region::virt, VMCopy(), VMCtl(), Memory::Writable, API::Write, and ZERO.
Referenced by CoreServer::createProcess(), and forkexec().
Compute the square root of a number.
number | The number to use for square root. |
Definition at line 20 of file sqrt.cpp.
Referenced by MpiPrime::collect(), SievePrime::exec(), MpiPrime::exec(), and MpiPrime::searchParallel().
C void srandom | ( | unsigned int | seed | ) |
Random number generator.
The srandom() function sets its argument as the seed for a new sequence of pseudo-random integers to be returned by random(). These sequences are repeatable by calling srandom() with the same seed value. If no seed value is provided, the random() function is automatically seeded with a value of 1.
seed | Initial seed value for the randomizer |
Definition at line 20 of file random.cpp.
References Randomizer::seed().
Referenced by TestData< T >::seed().
Get file status.
path | The path argument points to a pathname naming a file. Read, write, or execute permission of the named file is not required. An implementation that provides additional or alternate file access control mechanisms may, under implementation-defined conditions, cause stat() to fail. In particular, the system may deny the existence of the file specified by path. |
buf | The buf argument is a pointer to a stat structure, as defined in the <sys/stat.h> header, into which information is placed concerning the file. |
Definition at line 25 of file stat.cpp.
References DEBUG, EIO, ENOENT, errno, ESUCCESS, FileSystem::NotFound, FileSystemClient::statFile(), and FileSystem::Success.
Referenced by Cat::cat(), chdir(), BenchMark::exec(), Shell::exec(), ApplicationLauncher::exec(), forkexec(), LinnCreate::insertDirectory(), CoreServer::loadKernel(), opendir(), MpiHost::parseHostsFile(), ListFiles::printFiles(), ListFiles::printSingleFile(), FileStatus::printStatus(), BufferedFile::read(), and BootImageCreate::readBootSymbols().
C int strcasecmp | ( | const char * | dest, |
const char * | src | ||
) |
Compare two strings, ignoring case considerations.
dest | Destination string to compare. |
src | Source string to compare. |
Definition at line 21 of file strcasecmp.cpp.
References tolower.
C char* strcat | ( | char * | dest, |
const char * | src | ||
) |
Concatenate two strings.
The strcat() function shall append a copy of the string pointed to by s2 (including the terminating NUL character) to the end of the string pointed to by s1.
dest | Destination string. |
src | Source string. |
Definition at line 20 of file strcat.cpp.
References strcpy().
Referenced by chdir().
C char* strchr | ( | const char * | s, |
int | c | ||
) |
String scanning operation.
The strchr() function shall locate the first occurrence of c (converted to a char) in the string pointed to by s. The terminating NULL character is considered to be part of the string.
Definition at line 20 of file strchr.cpp.
References NULL.
C int strcmp | ( | const char * | dest, |
const char * | src | ||
) |
Compare two strings.
dest | Destination string to compare. |
src | Source string to compare. |
Definition at line 20 of file strcmp.cpp.
Referenced by main(), NetCat::readLine(), and TestRunner::TestRunner().
C int strcpy | ( | char * | dest, |
const char * | src | ||
) |
Copy a string.
dest | Destination buffer. |
src | Source string. |
Definition at line 20 of file strcpy.cpp.
Referenced by chdir(), strcat(), and teken_subr_do_cpr().
C char* strdup | ( | const char * | str | ) |
Duplicate a string.
str | String to duplicate |
Definition at line 37 of file strdup.cpp.
References copy(), malloc(), memcpy(), NULL, and strlen().
Referenced by timeString().
C char* strerror | ( | int | errnum | ) |
The strerror function maps the number in errnum to a message string.
errnum | Error number to convert. |
Definition at line 20 of file strerror.cpp.
References ELAST, and error_map.
Referenced by NetPing::arpPing(), Cat::cat(), CreateFile::createFile(), MakeNode::exec(), SievePrime::exec(), Remove::exec(), Sleep::exec(), UnixName::exec(), Init::exec(), Login::exec(), Shell::exec(), MpiPrime::exec(), ApplicationLauncher::exec(), BootImageCreate::exec(), ChangeDirCommand::execute(), WriteCommand::execute(), Shell::executeInput(), NetPing::icmpPing(), MpiHost::initialize(), Terminal::initialize(), LinnCreate::insertDirectory(), LinnCreate::insertFile(), main(), MpiHost::parseHostsFile(), ListFiles::printFiles(), ListFiles::printSingleFile(), FileStatus::printStatus(), BufferedFile::read(), BootImageCreate::readBootSymbols(), MpiHost::receivePacket(), DirectoryScanner::scan(), MpiHost::sendPacket(), NetCat::udpReceive(), MpiProxy::udpReceive(), DhcpClient::udpReceive(), NetCat::udpSend(), MpiProxy::udpSend(), DhcpClient::udpSend(), NetSend::udpSendMultiple(), MpiProxy::udpSendMultiple(), BufferedFile::write(), and LinnCreate::writeImage().
Copy src to string dst of size siz.
At most siz-1 characters will be copied. Always NUL terminates (unless siz == 0).
dst | Destination string |
src | Source string |
siz | size_t of dst buffer |
Definition at line 19 of file strlcpy.cpp.
Referenced by dirname(), gethostname(), opendir(), CoreServer::prepareCoreInfo(), spawn(), and uname().
Calculate the length of a string.
str | String to calculate length for. |
Definition at line 21 of file strlen.cpp.
Referenced by Login::exec(), Shell::executeInput(), Terminal::initialize(), BootImageCreate::readBootSymbols(), Shell::runInteractive(), strdup(), strndup(), and StdioLog::write().
Compare two strings, ignoring case considerations.
dest | Destination string to compare. |
src | Source string to compare. |
count | Maximum number of bytes to compare. |
Definition at line 21 of file strncasecmp.cpp.
References tolower.
Concatenate a string with part of another.
The strncat() function shall append not more than n bytes (a NUL character and bytes that follow it are not appended) from the array pointed to by s2 to the end of the string pointed to by s1. The initial byte of s2 overwrites the NUL character at the end of s1. A terminating NUL character is always appended to the result. If copying takes place between objects that overlap, the behavior is undefined.
dest | Destination string. |
src | Source string. |
siz | Number of character to concatenate. |
Definition at line 20 of file strncat.cpp.
References strncpy().
Compare two strings, by only a maximum number of bytes.
dest | Destination string to compare. |
src | Source string to compare. |
count | Maximum number of bytes to compare. |
Definition at line 20 of file strncmp.cpp.
Referenced by NetCtl::exec(), and BootImageCreate::readBootSymbols().
Copy a string, given a maximum number of bytes.
dest | Destination buffer. |
src | Source string. |
sz | Maximum number of bytes to copy. |
Definition at line 20 of file strncpy.cpp.
Referenced by BootImageCreate::exec(), LinnCreate::insertEntry(), BootImageCreate::readBootSymbols(), and strncat().
Duplicate a specific number of bytes from a string.
The strndup() function shall be equivalent to the strdup() function, duplicating the provided s in a new block of memory allocated as if by using malloc(), with the exception being that strndup() copies at most size plus one bytes into the newly allocated memory, terminating the new string with a NUL character. If the length of s is larger than size, only size bytes shall be duplicated. If size is larger than the length of s, all bytes in s shall be copied into the new memory buffer, including the terminating NUL character. The newly created string shall always be properly terminated.
s | String to duplicate. |
size | Maximum number of bytes to copy, excluding the NULL byte. |
Definition at line 22 of file strndup.cpp.
C char* strrchr | ( | const char * | s, |
int | c | ||
) |
String scanning operation.
The strrchr() function shall locate the last occurrence of c (converted to a char) in the string pointed to by s. The terminating NUL character is considered to be part of the string.
Definition at line 20 of file strrchr.cpp.
References NULL.
Referenced by basename(), and dirname().
C long strtol | ( | const char * | nptr, |
char ** | endptr, | ||
int | base | ||
) |
Convert a string to a long integer.
These functions shall convert the initial portion of the string pointed to by str to a type long and long long representation, respectively. First, they decompose the input string into three parts:
nptr | Input string pointer to convert. |
endptr | If the subject sequence is empty or does not have the expected form, no conversion is performed; the value of str is stored in the object pointed to by endptr, provided that endptr is not a null pointer. |
base | Base of the number, e.g. 16 for hexadecimal. |
Definition at line 23 of file strtol.cpp.
References Number::Dec, Number::Hex, Character::isDigit(), and String::toLong().
Get the name of the current system.
name | Used to store information identifying the current system |
Definition at line 23 of file utsname.cpp.
References gethostname(), utsname::machine, utsname::nodename, utsname::release, strlcpy(), utsname::sysname, UTSBUF, and utsname::version.
Referenced by UnixName::exec(), and Login::printPrompt().
C int unlink | ( | const char * | path | ) |
Remove a file from the filesystem.
path | Parh to the file to remove. |
Definition at line 24 of file unlink.cpp.
References FileSystemClient::deleteFile(), EIO, errno, ESUCCESS, and FileSystem::Success.
Referenced by Remove::exec().
Output a formatted string to standard output, using a variable argument list.
format | Formatted string. |
args | Argument list. |
Definition at line 23 of file vprintf.cpp.
References vsnprintf(), and write().
Referenced by printf().
Write a formatted string into a buffer.
buffer | String buffer to write to. |
size | Maximum number of bytes to write. |
fmt | Formatted string. |
args | Argument list. |
Definition at line 23 of file vsnprintf.cpp.
References atoi(), Number::Dec, Number::Hex, itoa(), length, String::setUnsigned(), va_arg, and ZERO.
Referenced by snprintf(), and vprintf().
Wait for a child process to stop or terminate.
The wait() and waitpid() functions shall obtain status information pertaining to one of the caller's child processes. Various options permit status information to be obtained for child processes that have terminated or stopped. If status information is available for two or more child processes, the order in which their status is reported is unspecified.
pid | Process ID of child to wait for. |
stat_loc | Points to an integer for storing the exit status. |
options | Optional flags. |
Definition at line 23 of file waitpid.cpp.
References EIO, errno, ESRCH, API::NotFound, ProcessCtl(), API::Success, and WaitPID.
Referenced by CoreServer::createProcess(), Login::exec(), Init::exec(), Shell::executeInput(), MpiProxy::processTerminate(), ExternalTest::run(), and ApplicationLauncher::wait().
Write on a file.
The write() function shall attempt to write nbyte bytes from the buffer pointed to by buf to the file associated with the open file descriptor, fildes.
fildes | File descriptor. |
buf | Input buffer. |
nbyte | Maximum number of bytes to write. |
Definition at line 22 of file write.cpp.
References ENOENT, errno, FileSystem::Success, and FileSystemClient::writeFile().
Referenced by NetPing::arpPing(), MpiPrime::collect(), ProcessList::exec(), SievePrime::exec(), WriteCommand::execute(), fwrite(), NetPing::icmpPing(), ListFiles::printFiles(), SievePrime::reportResult(), sendmsg(), sendto(), and vprintf().
C int errno |
The lvalue errno is used by many functions to return error values.
Referenced by NetPing::arpPing(), Cat::cat(), chdir(), close(), creat(), CreateFile::createFile(), SievePrime::exec(), Remove::exec(), Sleep::exec(), MakeNode::exec(), UnixName::exec(), Init::exec(), Login::exec(), Shell::exec(), MpiPrime::exec(), ApplicationLauncher::exec(), BootImageCreate::exec(), ChangeDirCommand::execute(), WriteCommand::execute(), Shell::executeInput(), fclose(), fopen(), forkexec(), getcwd(), gettimeofday(), NetPing::icmpPing(), MpiHost::initialize(), Terminal::initialize(), LinnCreate::insertDirectory(), LinnCreate::insertFile(), kill(), lseek(), main(), malloc(), mkdir(), mknod(), open(), opendir(), MpiHost::parseHostsFile(), ListFiles::printFiles(), ListFiles::printSingleFile(), FileStatus::printStatus(), read(), BufferedFile::read(), BootImageCreate::readBootSymbols(), MpiHost::receivePacket(), DirectoryScanner::scan(), MpiHost::sendPacket(), sleep(), spawn(), stat(), NetCat::udpReceive(), MpiProxy::udpReceive(), DhcpClient::udpReceive(), NetCat::udpSend(), MpiProxy::udpSend(), DhcpClient::udpSend(), NetSend::udpSendMultiple(), MpiProxy::udpSendMultiple(), unlink(), ApplicationLauncher::wait(), waitpid(), write(), BufferedFile::write(), and LinnCreate::writeImage().
char * error_map |
Contains a array of character strings, representing errno values.
Definition at line 23 of file errno.c.
Referenced by strerror().