API Reference¶
This section provides quick lookup pages for common Linux userspace and kernel APIs used in the labs.
The goal is not to replace the Linux man pages or kernel documentation. Instead, this section explains each API in the context of the lab code, common embedded Linux usage, and typical mistakes found during development.
API Groups¶
| Group | Example APIs |
|---|---|
| Synchronization | pthread_mutex_lock, pthread_cond_wait, pthread_rwlock_rdlock, futex, wait_for_completion, complete, blocking_notifier_chain_register, blocking_notifier_call_chain, rcu_read_lock, rcu_dereference, call_rcu |
| C11 Atomics | atomic_load, atomic_store, atomic_fetch_add, atomic_compare_exchange, memory_order_acquire, memory_order_release |
| POSIX I/O | open, read, write, close, fcntl, pipe, dup, errno |
| Process and Signal | fork, sigaction, sigprocmask, kill, waitpid |
| Network Socket | socket, bind, listen, accept, connect, recv, send, setsockopt, inet_ntop |
| Event Loop | epoll_create1, epoll_ctl, epoll_wait, timerfd_create, timerfd_settime, signalfd, eventfd, poll, select |
| IPC | socketpair, sendmsg, recvmsg, SCM_RIGHTS, shm_open, ftruncate, mmap, mq_open, sem_init, sem_wait, sem_post |
| Kernel Driver | bus_register, device_register, driver_register, file_operations, alloc_chrdev_region, cdev_add, device_create, copy_to_user, poll_wait, fasync_helper, devm_gpiod_get |
| Kernel Memory | kmalloc, kzalloc, kcalloc, kfree, vmalloc, kmem_cache_create, kmem_cache_alloc, kmem_cache_free, kmem_cache_destroy |
| Subsystem | devm_iio_device_alloc, iio_push_to_buffers, input_report_key, input_sync, gpiod_to_irq, devm_hwmon_device_register_with_info |
Documentation Style¶
Each API page follows a consistent layout:
- Purpose
- Header
- Prototype
- Parameters
- Return Value
- Minimal Example
- Common Pitfalls
- Related Topics
Build and Platform Driver Helpers¶
Phase 11 adds a small set of kernel driver helper references used by platform-driver and Device Tree workflows: