Expand description
ArceOS user program library for C apps.
§Cargo Features
- CPU
smp
: Enable SMP (symmetric multiprocessing) support.fp_simd
: Enable floating point and SIMD support.
- Interrupts:
irq
: Enable interrupt handling support.
- Memory
alloc
: Enable dynamic memory allocation.tls
: Enable thread-local storage.
- Task management
multitask
: Enable multi-threading support.
- Upperlayer stacks
fs
: Enable file system support.net
: Enable networking support.
- Lib C functions
Functions§
- abort⚠
- Abort the current process.
- accept⚠
net
- Accept for connections on a socket
- ax_
fcntl ⚠fd
- Manipulate file descriptor.
- ax_open⚠
fs
- Open a file by
filename
and insert it into the file descriptor table. - bind⚠
net
- Bind a address to a socket.
- clock_
gettime ⚠ - Get clock time since booting
- close⚠
fd
- Close a file by
fd
. - connect⚠
net
- Connects the socket to the address specified.
- dup⚠
fd
- Duplicate a file descriptor.
- dup2⚠
fd
- Duplicate a file descriptor, use file descriptor specified in
new_fd
. - dup3⚠
fd
- Duplicate a file descriptor, the caller can force the close-on-exec flag to
be set for the new file descriptor by specifying
O_CLOEXEC
in flags. - epoll_
create ⚠( select
orepoll
) andepoll
- Creates a new epoll instance.
- epoll_
ctl ⚠( select
orepoll
) andepoll
- Control interface for an epoll file descriptor
- epoll_
wait ⚠( select
orepoll
) andepoll
- Waits for events on the epoll instance referred to by the file descriptor epfd.
- exit⚠
- Exits the current thread.
- free⚠
alloc
- Deallocate memory.
- freeaddrinfo⚠
net
- Free queried
addrinfo
struct - fstat⚠
fs
- Get file metadata by
fd
and write intobuf
. - getaddrinfo⚠
net
- Query addresses for a domain name.
- getcwd⚠
fs
- Get the path of the current directory.
- getpeername⚠
net
- Get peer address to which the socket sockfd is connected.
- getpid⚠
- Get current thread ID.
- getrlimit⚠
- Get resource limitations
- getsockname⚠
net
- Get current address to which the socket sockfd is bound.
- listen⚠
net
- Listen for connections on a socket
- longjmp⚠
longjmp
implementation- lseek⚠
fs
- Set the position of the file indicated by
fd
. - lstat⚠
fs
- Get the metadata of the symbolic link and write into
buf
. - malloc⚠
alloc
- Allocate memory and return the memory address.
- mktime⚠
- Convert broken-down time into time since the Epoch.
- nanosleep⚠
- Sleep some nanoseconds
- pipe⚠
pipe
- Create a pipe
- pthread_
create ⚠multitask
- Create a new thread with the given entry point and argument.
- pthread_
exit ⚠multitask
- Exits the current thread. The value
retval
will be returned to the joiner. - pthread_
join ⚠multitask
- Waits for the given thread to exit, and stores the return value in
retval
. - pthread_
mutex_ ⚠init multitask
- Initialize a mutex.
- pthread_
mutex_ ⚠lock multitask
- Lock the given mutex.
- pthread_
mutex_ ⚠unlock multitask
- Unlock the given mutex.
- pthread_
self ⚠multitask
- Returns the
pthread
struct of current thread. - rand⚠
- Returns a 32-bit unsigned pseudo random interger.
- random⚠
- Returns a 64-bit unsigned pseudo random number.
- read⚠
- Read data from the file indicated by
fd
. - recv⚠
net
- Receive a message on a socket.
- recvfrom⚠
net
- Receive a message on a socket and get its source address.
- rename⚠
fs
- Rename
old
tonew
If new exists, it is first removed. - select⚠
( select
orepoll
) andselect
- Monitor multiple file descriptors, waiting until one or more of the file descriptors become “ready” for some class of I/O operation
- send⚠
net
- Send a message on a socket to the address connected.
- sendto⚠
net
- Send a message on a socket to the address specified.
- setjmp⚠
setjmp
implementation- setrlimit⚠
- Set resource limitations
- shutdown⚠
net
- Shut down a full-duplex connection.
- socket⚠
net
- Create an socket for communication.
- srand⚠
- Sets the seed for the random number generator.
- stat⚠
fs
- Get the file metadata by
path
and write intobuf
. - strerror⚠
- Returns a pointer to the string representation of the given error code.
- strftime⚠
alloc
- Convert date and time to a string.
- strtod⚠
fp_simd
- Convert a string to a double-precision number.
- strtof⚠
fp_simd
- Convert a string to a float number.
- sysconf⚠
- Return system configuration infomation
- write⚠
- Write data to the file indicated by
fd
. - writev⚠
- Write a vector.