zephyr/samples/posix/eventfd
Doug Foster 9fe370ef36 samples: doc: Added/Updated README and Makefile for POSIX samples
Added README.rst for eventfd and uname samples. Updated README for
gettimeofday to align with other READMEs.Updated Makefile.host
file for samples to store output file in 'build' directory.

Signed-off-by: Doug Foster <dougwfost@gmail.com>
2024-01-19 10:32:23 +01:00
..
src
CMakeLists.txt include: Prefix includes to use a scope 2022-04-08 19:03:32 +02:00
Makefile.host samples: doc: Added/Updated README and Makefile for POSIX samples 2024-01-19 10:32:23 +01:00
README.rst samples: doc: Added/Updated README and Makefile for POSIX samples 2024-01-19 10:32:23 +01:00
prj.conf samples: Switch from NEWLIB_LIBC to REQUIRES_FULL_LIBC 2023-10-25 08:32:06 +02:00
sample.yaml samples: Switch from NEWLIB_LIBC to REQUIRES_FULL_LIBC 2023-10-25 08:32:06 +02:00

README.rst

.. _posix-eventfd-sample:

POSIX eventfd()
###############

Overview
********

This sample application demonstrates using the POSIX eventfd() function to create a file descriptor,
which can be used for event notification. The returned file descriptor is used with write/read calls
and write/read values are output to the console.

Building and Running
********************

This project outputs to the console. It can be built and executed on QEMU as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/posix/eventfd
   :host-os: unix
   :board: qemu_x86
   :goals: run
   :compact:

For comparison, to build directly for your host OS if it is POSIX compliant (for ex. Linux):

.. code-block:: console

   cd samples/posix/eventfd
   make -f Makefile.host

The make output file will be located in samples/posix/eventfd/build.

Sample Output
=============

.. code-block:: console

    Writing 1 to efd
    Writing 2 to efd
    Writing 3 to efd
    Writing 4 to efd
    Completed write loop
    About to read
    Read 10 (0xa) from efd
    Finished