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 the current process.
- accept⚠
netAccept for connections on a socket - ax_fcntl⚠
fdManipulate file descriptor. - ax_open⚠
fsOpen a file byfilenameand insert it into the file descriptor table. - bind⚠
netBind a address to a socket. - Get clock time since booting
- close⚠
fdClose a file byfd. - connect⚠
netConnects the socket to the address specified. - dup⚠
fdDuplicate a file descriptor. - dup2⚠
fdDuplicate a file descriptor, use file descriptor specified innew_fd. - dup3⚠
fdDuplicate a file descriptor, the caller can force the close-on-exec flag to be set for the new file descriptor by specifyingO_CLOEXECin flags. - epoll_create⚠(
selectorepoll) andepollCreates a new epoll instance. - epoll_ctl⚠(
selectorepoll) andepollControl interface for an epoll file descriptor - epoll_wait⚠(
selectorepoll) andepollWaits for events on the epoll instance referred to by the file descriptor epfd. - exit⚠Exits the current thread.
- free⚠
allocDeallocate memory. - freeaddrinfo⚠
netFree queriedaddrinfostruct - fstat⚠
fsGet file metadata byfdand write intobuf. - getaddrinfo⚠
netQuery addresses for a domain name. - getcwd⚠
fsGet the path of the current directory. - getpeername⚠
netGet peer address to which the socket sockfd is connected. - Get current thread ID.
- Get resource limitations
- getsockname⚠
netGet current address to which the socket sockfd is bound. - listen⚠
netListen for connections on a socket longjmpimplementation- lseek⚠
fsSet the position of the file indicated byfd. - lstat⚠
fsGet the metadata of the symbolic link and write intobuf. - malloc⚠
allocAllocate memory and return the memory address. - Convert broken-down time into time since the Epoch.
- Sleep some nanoseconds
- pipe⚠
pipeCreate a pipe - pthread_create⚠
multitaskCreate a new thread with the given entry point and argument. - pthread_exit⚠
multitaskExits the current thread. The valueretvalwill be returned to the joiner. - pthread_join⚠
multitaskWaits for the given thread to exit, and stores the return value inretval. - pthread_mutex_init⚠
multitaskInitialize a mutex. - pthread_mutex_lock⚠
multitaskLock the given mutex. - pthread_mutex_unlock⚠
multitaskUnlock the given mutex. - pthread_self⚠
multitaskReturns thepthreadstruct of current thread. - rand⚠Returns a 32-bit unsigned pseudo random interger.
- Returns a 64-bit unsigned pseudo random number.
- read⚠Read data from the file indicated by
fd. - recv⚠
netReceive a message on a socket. - recvfrom⚠
netReceive a message on a socket and get its source address. - rename⚠
fsRenameoldtonewIf new exists, it is first removed. - select⚠(
selectorepoll) andselectMonitor multiple file descriptors, waiting until one or more of the file descriptors become “ready” for some class of I/O operation - send⚠
netSend a message on a socket to the address connected. - sendto⚠
netSend a message on a socket to the address specified. setjmpimplementation- Set resource limitations
- shutdown⚠
netShut down a full-duplex connection. - socket⚠
netCreate an socket for communication. - Sets the seed for the random number generator.
- stat⚠
fsGet the file metadata bypathand write intobuf. - Returns a pointer to the string representation of the given error code.
- strftime⚠
allocConvert date and time to a string. - strtod⚠
fp_simdConvert a string to a double-precision number. - strtof⚠
fp_simdConvert a string to a float number. - Return system configuration infomation
- Write data to the file indicated by
fd. - Write a vector.