README.rst
1.. zephyr:code-sample:: posix-uname
2 :name: uname()
3
4 Use ``uname()`` to acquire system information and output it to the console.
5
6Overview
7********
8
9In this sample application, the POSIX `uname()`_ function is used to acquire system information and
10it is output to the console. Additionally, uname is added as a shell command and system information
11is displayed according to the option(s) provided for the command.
12
13Building and Running
14********************
15
16This project outputs to the console. It can be built and executed on QEMU as follows:
17
18.. zephyr-app-commands::
19 :zephyr-app: samples/posix/uname
20 :host-os: unix
21 :board: qemu_x86
22 :goals: run
23 :compact:
24
25For comparison, to build directly for your host OS if it is POSIX compliant (for ex. Linux):
26
27.. code-block:: console
28
29 cd samples/posix/uname
30 make -f Makefile.host
31
32The make output file will be located in samples/posix/uname/build.
33
34Sample Output
35=============
36
37.. code-block:: console
38
39 Printing everything in utsname...
40 sysname[7]: Zephyr
41 nodename[7]: zephyr
42 release[13]: 3.5.99
43 version[61]: zephyr-v3.5.0-3515-g10156f5f1d9c Jan 9 2024 22:23:04
44 machine[4]: x86
45
46
47 uart:~$ uname -a
48 Zephyr zephyr 3.5.99 zephyr-v3.5.0-3515-g10156f5f1d9c Jan 9 2024 22:23:04 x86 qemu_x86
49 uart:~$ uname -smi
50 Zephyr x86 qemu_x86
51
52.. _uname(): https://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html
53