Part 1
요약·해설
Zephyr QEMU와 POSIX host build 방법, 1+2+3+4가 10으로 읽히는 출력을 보존합니다.
API
eventfd()
I/O
write · read
Counter
1 + 2 + 3 + 4 = 10
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
원문 SHA-256
10B2F83FA74C612CCCF2D8220C6EAE0AFA4EAEED71BF309544AE5A248C7F3E5E
.. _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
Part 3
한국어 전문 번역
개요
이 sample application은 POSIX eventfd() 함수로 event notification에 사용할 file descriptor를 만드는 방법을 보여 줍니다. 반환된 file descriptor에 write()와 read()를 수행하고, 쓰고 읽은 값을 console에 출력합니다.
빌드 및 실행
이 project는 console에 결과를 출력합니다. QEMU에서 다음과 같이 build하고 실행할 수 있습니다.
west build -b qemu_x86 samples/posix/eventfd
west build -t run
비교를 위해 host OS가 Linux 같은 POSIX 호환 system이면 host에서 직접 build할 수도 있습니다.
cd samples/posix/eventfd
make -f Makefile.host
Make로 만든 output file은 samples/posix/eventfd/build에 저장됩니다.
출력 예
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
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.