source: rtems-docs/shell/shell_old_reference_only.rst @ 489740f

4.115
Last change on this file since 489740f was 489740f, checked in by Chris Johns <chrisj@…>, on 05/20/16 at 02:47:09

Set SPDX License Identifier in each source file.

  • Property mode set to 100644
File size: 190.1 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3:orphan:
4
5.. COMMENT: COPYRIGHT (c) 1988-2013.
6.. COMMENT: On-Line Applications Research Corporation (OAR).
7.. COMMENT: All rights reserved.
8.. COMMENT:
9.. COMMENT: Master file for the Shell User's Guide
10.. COMMENT:
11.. COMMENT: COPYRIGHT (c) 1988-2002.
12
13========================
14RTEMS Shell User’s Guide
15========================
16
17COPYRIGHT © 1988 - 2015.
18
19On-Line Applications Research Corporation (OAR).
20
21The authors have used their best efforts in preparing this material.  These
22efforts include the development, research, and testing of the theories and
23programs to determine their effectiveness.  No warranty of any kind, expressed
24or implied, with regard to the software or the material contained in this
25document is provided.  No liability arising out of the application or use of
26any product described in this document is assumed.  The authors reserve the
27right to revise this material and to make changes from time to time in the
28content hereof without obligation to notify anyone of such revision or changes.
29
30The RTEMS Project is hosted at http://www.rtems.org/.  Any inquiries concerning
31RTEMS, its related support components, or its documentation should be directed
32to the Community Project hosted at http://www.rtems.org/.
33
34RTEMS Shell User’s Guide
35########################
36
37Preface
38#######
39
40Real-time embedded systems vary widely based upon their operational and
41maintenance requirements. Some of these systems provide ways for the user or
42developer to interact with them.  This interaction could be used for
43operational, diagnostic, or configuration purposes.  The capabilities described
44in this manual are those provided with RTEMS to provide a command line
45interface for user access.  Some of these commands will be familiar as standard
46POSIX utilities while others are RTEMS specific or helpful in debugging and
47analyzing an embedded system. As a simple example of the powerful and very
48familiar capabilities that the RTEMS Shell provides to an application, consider
49the following example which hints at some of the capabilities available:
50
51.. code-block:: shell
52
53    Welcome to rtems-4.10.99.0(SPARC/w/FPU/sis)
54    COPYRIGHT (c) 1989-2011.
55    On-Line Applications Research Corporation (OAR).
56    Login into RTEMS
57    login: rtems
58    Password:
59    RTEMS SHELL (Ver.1.0-FRC):/dev/console. Feb 28 2008. 'help' to list commands.
60    SHLL [/] $ cat /etc/passwd
61    root:*:0:0:root::/:/bin/sh
62    rtems:*:1:1:RTEMS Application::/:/bin/sh
63    tty:!:2:2:tty owner::/:/bin/false
64    SHLL [/] $ ls /dev
65    -rwxr-xr-x   1  rtems   root           0 Jan 01 00:00 console
66    -rwxr-xr-x   1   root   root           0 Jan 01 00:00 console_b
67    2 files 0 bytes occupied
68    SHLL [/] $ stackuse
69    Stack usage by thread
70    ID      NAME    LOW          HIGH     CURRENT     AVAILABLE     USED
71    0x09010001  IDLE 0x023d89a0 - 0x023d99af 0x023d9760      4096        608
72    0x0a010001  UI1  0x023d9f30 - 0x023daf3f 0x023dad18      4096       1804
73    0x0a010002  SHLL 0x023db4c0 - 0x023df4cf 0x023de9d0     16384       6204
74    0xffffffff  INTR 0x023d2760 - 0x023d375f 0x00000000      4080        316
75    SHLL [/] $ mount -L
76    File systems: msdos
77    SHLL [/] $
78
79In the above example, the user *rtems* logs into a SPARC based RTEMS system.
80The first command is ``cat /etc/passwd``.  This simple command lets us know
81that this application is running the In Memory File System (IMFS) and that the
82infrastructure has provided dummy entries for */etc/passwd* and a few other
83files.  The contents of */etc/passwd* let us know that the user could have
84logged in as ``root``.  In fact, the ``root`` user has more permissions than
85``rtems`` who is not allowed to write into the filesystem.
86
87The second command is ``ls /dev`` which lets us know that RTEMS has POSIX-style
88device nodes which can be accesses through standard I/O function calls.
89
90The third command executed is the RTEMS specific ``stackuse`` which gives a
91report on the stack usage of each thread in the system.  Since stack overflows
92are a common error in deeply embedded systems, this is a surprising simple, yet
93powerful debugging aid.
94
95Finally, the last command, ``mount -L`` hints that RTEMS supports a variety of
96mountable filesystems. With support for MS-DOS FAT on IDE/ATA and Flash devices
97as well as network-based filesystens such as NFS and TFTP, the standard free
98RTEMS provides a robuse infrastructure for embedded applications.
99
100This manual describes the RTEMS Shell and its command set.  In our terminology,
101the Shell is just a loop reading user input and turning that input into
102commands with argument.  The Shell provided with RTEMS is a simple command
103reading loop with limited scripting capabilities.  It can be connected to via a
104standard serial port or connected to the RTEMS ``telnetd`` server for use across
105a network.
106
107Each command in the command set is implemented as a single subroutine which has
108a *main-style* prototype.  The commands interpret their arguments and operate
109upon stdin, stdout, and stderr by default.  This allows each command to be
110invoked independent of the shell.
111
112The described separation of shell from commands from communications mechanism
113was an important design goal.  At one level, the RTEMS Shell is a complete
114shell environment providing access to multiple POSIX compliant filesystems and
115TCP/IP stack.  The subset of capabilities available is easy to configure and
116the standard Shell can be logged into from either a serial port or via telnet.
117But at another level, the Shell is a large set of components which can be
118integrated into the user’s developed command interpreter.  In either case, it
119is trivial to add custom commands to the command set available.
120
121Acknowledgements
122================
123
124.. COMMENT: The RTEMS Project has been granted permission from The Open Group
125.. COMMENT: IEEE to excerpt and use portions of the POSIX standards documents
126.. COMMENT: in the RTEMS POSIX API User's Guide and RTEMS Shell User's Guide.
127.. COMMENT: We have to include a specific acknowledgement paragraph in these
128.. COMMENT: documents (e.g. preface or copyright page) and another slightly
129.. COMMENT: different paragraph for each manual page that excerpts and uses
130.. COMMENT: text from the standards.
131.. COMMENT: This file should help ensure that the paragraphs are consistent
132.. COMMENT: and not duplicated
133
134The Institute of Electrical and Electronics Engineers, Inc and The Open Group,
135have given us permission to reprint portions of their documentation.
136
137.. pull-quote::
138
139    Portions of this text are reprinted and reproduced in electronic form from
140    IEEE Std 1003.1, 2004 Edition, Standard for Information Technology â
141    Operating System Interface (POSIX), The Open Group Base Specifications
142    Issue 6, Copyright © 2001-2004 by the Institute of Electrical and
143    Electronics Engineers, Inc and The Open Group. In the event of any
144    discrepancy between this version and the original IEEE and The Open Group
145    Standard, the original IEEE and The Open Group Standard is the referee
146    document. The original Standard can be obtained online at
147    http://www.opengroup.org/unix/online.html.  This notice shall appear on any
148    product containing this material.
149
150Configuration and Initialization
151################################
152
153Introduction
154============
155
156This chapter provides information on how the application configures and
157initializes the RTEMS shell.
158
159Configuration
160=============
161
162The command set available to the application is user configurable.  It is
163configured using a mechanism similar to the ``confdefs.h`` mechanism used to
164specify application configuration.
165
166In the simplest case, if the user wishes to configure a command set with all
167commands available that are neither filesystem management (e.g. mounting,
168formating, etc.) or network related, then the following is all that is
169required:
170
171.. code-block:: c
172
173    #define CONFIGURE_SHELL_COMMANDS_INIT
174    #define CONFIGURE_SHELL_COMMANDS_ALL
175    #include <rtems/shellconfig.h>
176
177In a slightly more complex example, if the user wishes to include all
178networking commands as well as support for mounting MS-DOS and NFS filesystems,
179then the following is all that is required:
180
181.. code-block:: c
182
183    #define CONFIGURE_SHELL_COMMANDS_INIT
184    #define CONFIGURE_SHELL_COMMANDS_ALL
185    #define CONFIGURE_SHELL_MOUNT_MSDOS
186    #define CONFIGURE_SHELL_MOUNT_NFS
187    #include <rtems/shellconfig.h>
188
189Customizing the Command Set
190---------------------------
191
192The user can configure specific command sets by either building up the set from
193individual commands or starting with a complete set and disabling individual
194commands.  Each command has two configuration macros associated with it.
195
196*CONFIGURE_SHELL_COMMAND_XXX*
197    Each command has a constant of this form which is defined when
198    building a command set by individually enabling specific
199    commands.
200
201*CONFIGURE_SHELL_NO_COMMAND_XXX*
202    In contrast, each command has a similar command which is
203    defined when the application is configuring a command set
204    by disabling specific commands in the set.
205
206Adding Custom Commands
207----------------------
208
209One of the design goals of the RTEMS Shell was to make it easy for a user to
210add custom commands specific to their application.  We believe this design goal
211was accomplished.  In order to add a custom command, the user is required to do
212the following:
213
214- Provide a *main-style* function which implements the command.  If that
215  command function uses a ``getopt`` related function to parse arguments, it
216  *MUST* use the reentrant form.
217
218- Provide a command definition structure of type ``rtems_shell_cmd_t``.
219
220- Configure that command using the ``CONFIGURE_SHELL_USER_COMMANDS`` macro.
221
222Custom aliases are configured similarly but the user only provides an alias
223definition structure of type ``rtems_shell_alias_t`` and configures the alias
224via the ``CONFIGURE_SHELL_USER_ALIASES`` macro.
225
226In the following example, we have implemented a custom command named
227``usercmd`` which simply prints the arguments it was passed. We have also
228provided an alias for ``usercmd`` named ``userecho``.
229
230.. code-block:: c
231
232    #include <rtems/shell.h>
233    int main_usercmd(int argc, char **argv)
234    {
235        int i;
236        printf( "UserCommand: argc=%d\n", argc );
237        for (i=0 ; i<argc ; i++ )
238            printf( "argv[%d]= %s\n", i, argv[i] );
239        return 0;
240    }
241    rtems_shell_cmd_t Shell_USERCMD_Command = {
242        "usercmd",                   /* name */
243        "usercmd n1 \[n2 \[n3...]]", /* usage */
244        "user",                      /* topic */
245        main_usercmd,                /* command */
246        NULL,                        /* alias */
247        NULL                         /* next */
248    };
249    rtems_shell_alias_t Shell_USERECHO_Alias = {
250        "usercmd",                   /* command */
251        "userecho"                   /* alias */
252    };
253    #define CONFIGURE_SHELL_USER_COMMANDS &Shell_USERCMD_Command
254    #define CONFIGURE_SHELL_USER_ALIASES &Shell_USERECHO_Alias
255    #define CONFIGURE_SHELL_COMMANDS_INIT
256    #define CONFIGURE_SHELL_COMMANDS_ALL
257    #define CONFIGURE_SHELL_MOUNT_MSDOS
258    #include <rtems/shellconfig.h>
259
260Notice in the above example, that the user wrote the*main* for their command
261(e.g. ``main_usercmd``) which looks much like any other ``main()``.  They then
262defined a ``rtems_shell_cmd_t`` structure named ``Shell_USERCMD_Command`` which
263describes that command.  This command definition structure is registered into
264the static command set by defining ``CONFIGURE_SHELL_USER_COMMANDS``
265to ``&Shell_USERCMD_Command``.
266
267Similarly, to add the ``userecho`` alias, the user provides the alias
268definition structure named ``Shell_USERECHO_Alias`` and defines
269``CONFIGURE_SHELL_USER_ALIASES`` to configure the alias.
270
271The user can configure any number of commands and aliases in this manner.
272
273Initialization
274==============
275
276The shell may be easily attached to a serial port or to the ``telnetd`` server.
277This section describes how that is accomplished.
278
279Attached to a Serial Port
280-------------------------
281
282Starting the shell attached to the console or a serial port is very simple. The
283user invokes ``rtems_shell_init`` with parameters to indicate the
284characteristics of the task that will be executing the shell including name,
285stack size, and priority.  The user also specifies the device that the shell is
286to be attached to.
287
288This example is taken from the ``fileio`` sample test.  This shell portion of
289this test can be run on any target which provides a console with input and
290output capabilities.  It does not include any commands which cannot be
291supported on all BSPs.  The source code for this test is in
292``testsuites/samples/fileio`` with the shell configuration in the ``init.c``
293file.
294
295.. code-block:: c
296
297    #include <rtems/shell.h>
298    void start_shell(void)
299    {
300        printf(" =========================\n");
301        printf(" starting shell\n");
302        printf(" =========================\n");
303        rtems_shell_init(
304            "SHLL",                       /* task name */
305            RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */
306            100,                          /* task priority */
307            "/dev/console",               /* device name */
308            false,                        /* run forever */
309            true,                         /* wait for shell to terminate */
310            rtems_shell_login_check       /* login check function,
311            use NULL to disable a login check */
312        );
313    }
314
315In the above example, the call to ``rtems_shell_init`` spawns a task to run the
316RTEMS Shell attached to ``/dev/console`` and executing at priority 100.  The
317caller suspends itself and lets the shell take over the console device.  When
318the shell is exited by the user, then control returns to the caller.
319
320Attached to a Socket
321--------------------
322
323TBD
324
325Access Control
326==============
327
328Login Checks
329------------
330
331Login checks are optional for the RTEMS shell and can be configured via a login
332check handler passed to ``rtems_shell_init()``.  One login check handler
333is ``rtems_shell_login_check()``.
334
335Configuration Files
336-------------------
337
338The following files are used by the login check handler
339``rtems_shell_login_check()`` to validate a passphrase for a user and to set up
340the user environment for the shell command execution.
341
342:file:`/etc/passwd`
343    The format for each line is
344
345    .. code:: c
346
347        user_name:password:UID:GID:GECOS:directory:shell
348
349    with colon separated fields.  For more information refer to the Linux
350    PASSWD(5) man page.  Use a ``password`` of ``*`` to disable the login of the
351    user.  An empty password allows login without a password for this user.  In
352    contrast to standard UNIX systems, this file is only readable and writeable
353    for the user with an UID of zero by default.  The ``directory`` is used to
354    perform a filesystem change root operation in ``rtems_shell_login_check()``
355    in contrast to a normal usage as the HOME directory of the user.
356    The *default* content is:
357
358    .. code:: c
359
360        root::0:0::::
361
362    so there is *no password required* for the ``root`` user.
363
364:file:`/etc/group`
365    The format for each line is:
366
367    .. code:: c
368
369        group_name:password:GID:user_list
370
371    with colon separated fields.  The ``user_list`` is comma separated.  For
372    more information refer to the Linux GROUP(5) man page.  In contrast to
373    standard UNIX systems, this file is only readable and writeable for the
374    user with an UID of zero by default.  The default content is
375
376    .. code:: c
377
378        root::0:
379
380Command Visibility and Execution Permission
381-------------------------------------------
382
383Each command has:
384
385- an owner,
386
387- a group, and
388
389- a read permission flag for the owner, the group and all other users, and
390
391- an execution permission flag for the owner, the group and all other
392  users.
393
394The read and write permission flags are stored in the command mode.  The read
395permission flags determine the visibility of the command for the current user.
396The execution permission flags determine the ability to execute a command for
397the current user.  These command properties can be displayed and changed with
398the:
399
400- ``cmdls``,
401
402- ``cmdchown``, and
403
404- ``cmdchmod``
405
406commands.  The access is determined by the effective UID, the effective GID and
407the supplementary group IDs of the current user and follows the standard
408filesystem access procedure.
409
410Add CRYPT(3) Formats
411--------------------
412
413By default the ``crypt_r()`` function used by ``rtems_shell_login_check()``
414supports only plain text passphrases.  Use ``crypt_add_format()`` to add more
415formats.  The following formats are available out of the box:
416
417- ``crypt_md5_format``,
418
419- ``crypt_sha256_format``, and
420
421- ``crypt_sha512_format``.
422
423An example follows:
424
425.. index:: crypt_add_format
426
427.. code:: c
428
429    #include <crypt.h>
430    void add_formats( void )
431    {
432        crypt_add_format( &crypt_md5_format );
433        crypt_add_format( &crypt_sha512_format );
434    }
435
436Functions
437=========
438
439This section describes the Shell related C functions which are publicly
440available related to initialization and configuration.
441
442rtems_shell_init - Initialize the shell
443---------------------------------------
444.. index:: initialization
445
446**CALLING SEQUENCE:**
447
448.. index:: rtems_shell_init
449
450.. code-block:: c
451
452    rtems_status_code rtems_shell_init(
453        const char          *task_name,
454        size_t               task_stacksize,
455        rtems_task_priority  task_priority,
456        const char          *devname,
457        bool                 forever,
458        bool                 wait,
459        rtems_login_check    login_check
460    );
461
462**DIRECTIVE STATUS CODES:**
463
464``RTEMS_SUCCESSFUL`` - Shell task spawned successfully
465
466others - to indicate a failure condition
467
468**DESCRIPTION:**
469
470This service creates a task with the specified characteristics to run the RTEMS
471Shell attached to the specified ``devname``.
472
473.. note::
474
475    This method invokes the ``rtems_task_create`` and ``rtems_task_start``
476    directives and as such may return any status code that those directives may
477    return.
478
479    There is one POSIX key necessary for all shell instances together and one
480    POSIX key value pair per instance. You should make sure that your RTEMS
481    configuration accounts for these resources.
482
483rtems_shell_login_check - Default login check handler
484-----------------------------------------------------
485.. index:: initialization
486
487**CALLING SEQUENCE:**
488
489.. index:: rtems_shell_login_check
490
491.. code:: c
492
493    bool rtems_shell_login_check(
494      const char \*user,
495      const char \*passphrase
496    );
497
498**DIRECTIVE STATUS CODES:**
499
500``true`` - login is allowed, and
501``false`` - otherwise.
502
503**DESCRIPTION:**
504
505This function checks if the specified passphrase is valid for the specified
506user.
507
508.. note::
509
510    As a side-effect if the specified passphrase is valid for the specified
511    user, this function:
512
513    - performs a filesystem change root operation to the directory of the
514      specified user if the directory path is non-empty,
515
516    - changes the owner of the current shell device to the UID of the specified
517      user,
518
519    - sets the real and effective UID of the current user environment to the
520      UID of the specified user,
521
522    - sets the real and effective GID of the current user environment to the
523      GID of the specified user, and
524
525    - sets the supplementary group IDs of the current user environment to the
526      supplementary group IDs of the specified user.
527
528    In case the filesystem change root operation fails, then the environment
529    setup is aborted and ``false`` is returned.
530
531General Commands
532################
533
534Introduction
535============
536
537The RTEMS shell has the following general commands:
538
539- ``help`` - Print command help
540
541- ``alias`` - Add alias for an existing command
542
543- ``cmdls`` - List commands
544
545- ``cmdchown`` - Change user or owner of commands
546
547- ``cmdchmod`` - Change mode of commands
548
549- ``date`` - Print or set current date and time
550
551- ``echo`` - Produce message in a shell script
552
553- ``sleep`` - Delay for a specified amount of time
554
555- ``id`` - show uid gid euid and egid
556
557- ``tty`` - show ttyname
558
559- ``whoami`` - print effective user id
560
561- ``getenv`` - print environment variable
562
563- ``setenv`` - set environment variable
564
565- ``unsetenv`` - unset environment variable
566
567- ``time`` - time command execution
568
569- ``logoff`` - logoff from the system
570
571- ``rtc`` - RTC driver configuration
572
573- ``exit`` - alias for logoff command
574
575Commands
576========
577
578This section details the General Commands available.  A subsection is dedicated
579to each of the commands and describes the behavior and configuration of that
580command as well as providing an example usage.
581
582help - Print command help
583-------------------------
584.. index:: help
585
586**SYNOPSYS:**
587
588.. code:: c
589
590    help misc
591
592**DESCRIPTION:**
593
594This command prints the command help. Help without arguments prints a list of
595topics and help with a topic prints the help for that topic.
596
597**EXIT STATUS:**
598
599This command returns 0.
600
601**NOTES:**
602
603The help print will break the output up based on the environment variable
604SHELL_LINES. If this environment variable is not set the default is 16
605lines. If set the number of lines is set to that the value. If the shell lines
606is set 0 there will be no break.
607
608**EXAMPLES:**
609
610The following is an example of how to use ``alias``:
611
612.. code-block:: shell
613
614    SHLL [/] $ help
615    help: ('r' repeat last cmd - 'e' edit last cmd)
616    TOPIC? The topics are
617    mem, misc, files, help, rtems, network, monitor
618    SHLL [/] $ help misc
619    help: list for the topic 'misc'
620    alias        - alias old new
621    time         - time command [arguments...]
622    joel         - joel [args] SCRIPT
623    date         - date [YYYY-MM-DD HH:MM:SS]
624    echo         - echo [args]
625    sleep        - sleep seconds [nanoseconds]
626    id           - show uid, gid, euid, and egid
627    tty          - show ttyname
628    whoami       - show current user
629    logoff       - logoff from the system
630    setenv       - setenv [var] [string]
631    getenv       - getenv [var]
632    unsetenv     - unsetenv [var]
633    umask        - umask [new_umask]
634    Press any key to continue...
635    rtc          - real time clock read and set
636    SHLL [/] $ setenv SHELL_ENV 0
637    SHLL [/] $ help misc
638    help: list for the topic 'misc'
639    alias        - alias old new
640    time         - time command [arguments...]
641    joel         - joel [args] SCRIPT
642    date         - date [YYYY-MM-DD HH:MM:SS]
643    echo         - echo [args]
644    sleep        - sleep seconds [nanoseconds]
645    id           - show uid, gid, euid, and egid
646    tty          - show ttyname
647    whoami       - show current user
648    logoff       - logoff from the system
649    setenv       - setenv [var] [string]
650    getenv       - getenv [var]
651    unsetenv     - unsetenv [var]
652    umask        - umask [new_umask]
653    rtc          - real time clock read and set
654
655**CONFIGURATION:**
656
657This command has no configuration.
658
659alias - add alias for an existing command
660-----------------------------------------
661.. index:: alias
662
663**SYNOPSYS:**
664
665.. code:: c
666
667    alias oldCommand newCommand
668
669**DESCRIPTION:**
670
671This command adds an alternate name for an existing command to the command set.
672
673**EXIT STATUS:**
674
675This command returns 0 on success and non-zero if an error is encountered.
676
677**NOTES:**
678
679NONE
680
681**EXAMPLES:**
682
683The following is an example of how to use ``alias``:
684.. code:: c
685
686    SHLL \[/] $ me
687    shell:me command not found
688    SHLL \[/] $ alias whoami me
689    SHLL \[/] $ me
690    rtems
691    SHLL \[/] $ whoami
692    rtems
693
694**CONFIGURATION:**
695
696.. index:: CONFIGURE_SHELL_NO_COMMAND_ALIAS
697.. index:: CONFIGURE_SHELL_COMMAND_ALIAS
698
699This command is included in the default shell command set.
700When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ALIAS`` to have this
701command included.
702
703This command can be excluded from the shell command set by
704defining ``CONFIGURE_SHELL_NO_COMMAND_ALIAS`` when all
705shell commands have been configured.
706
707**PROGRAMMING INFORMATION:**
708
709.. index:: rtems_shell_rtems_main_alias
710
711The ``alias`` is implemented by a C language function
712which has the following prototype:
713.. code:: c
714
715    int rtems_shell_rtems_main_alias(
716    int    argc,
717    char \**argv
718    );
719
720The configuration structure for the ``alias`` has the
721following prototype:
722.. code:: c
723
724    extern rtems_shell_cmd_t rtems_shell_ALIAS_Command;
725
726cmdls - List commands
727---------------------
728.. index:: cmdls
729
730**SYNOPSYS:**
731
732.. code:: c
733
734    cmdls COMMAND...
735
736**DESCRIPTION:**
737
738This command lists the visible commands of the command set.
739
740**EXIT STATUS:**
741
742This command returns 0 on success and non-zero if an error is encountered.
743
744**NOTES:**
745
746The current user must have read permission to list a command.
747
748**EXAMPLES:**
749
750The following is an example of how to use ``cmdls``:
751.. code:: c
752
753    SHLL \[/] # cmdls help shutdown
754    r-xr-xr-x     0     0 help
755    r-x------     0     0 shutdown
756
757**CONFIGURATION:**
758
759.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDLS
760.. index:: CONFIGURE_SHELL_COMMAND_CMDLS
761
762This command is included in the default shell command set.
763When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CMDLS`` to have this
764command included.
765
766This command can be excluded from the shell command set by
767defining ``CONFIGURE_SHELL_NO_COMMAND_CMDLS`` when all
768shell commands have been configured.
769
770**PROGRAMMING INFORMATION:**
771
772The configuration structure for the ``cmdls`` has the
773following prototype:
774.. code:: c
775
776    extern rtems_shell_cmd_t rtems_shell_CMDLS_Command;
777
778cmdchown - Change user or owner of commands
779-------------------------------------------
780.. index:: cmdchown
781
782**SYNOPSYS:**
783
784.. code:: c
785
786    cmdchown \[OWNER][:\[GROUP]] COMMAND...
787
788**DESCRIPTION:**
789
790This command changes the user or owner of a command.
791
792**EXIT STATUS:**
793
794This command returns 0 on success and non-zero if an error is encountered.
795
796**NOTES:**
797
798The current user must have an UID of zero or be the command owner to change the
799owner or group.
800
801**EXAMPLES:**
802
803The following is an example of how to use ``cmdchown``:
804.. code:: c
805
806    [/] # cmdls help
807    r-xr-xr-x     0     0 help
808    \[/] # cmdchown 1:1 help
809    \[/] # cmdls help
810    r--r--r--     1     1 help
811
812**CONFIGURATION:**
813
814.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN
815.. index:: CONFIGURE_SHELL_COMMAND_CMDCHOWN
816
817This command is included in the default shell command set.
818When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CMDCHOWN`` to have this
819command included.
820
821This command can be excluded from the shell command set by
822defining ``CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN`` when all
823shell commands have been configured.
824
825**PROGRAMMING INFORMATION:**
826
827The configuration structure for the ``cmdchown`` has the
828following prototype:
829.. code:: c
830
831    extern rtems_shell_cmd_t rtems_shell_CMDCHOWN_Command;
832
833cmdchmod - Change mode of commands
834----------------------------------
835.. index:: cmdchmod
836
837**SYNOPSYS:**
838
839.. code:: c
840
841    cmdchmod OCTAL-MODE COMMAND...
842
843**DESCRIPTION:**
844
845This command changes the mode of a command.
846
847**EXIT STATUS:**
848
849This command returns 0 on success and non-zero if an error is encountered.
850
851**NOTES:**
852
853The current user must have an UID of zero or be the command owner to change the
854mode.
855
856**EXAMPLES:**
857
858The following is an example of how to use ``cmdchmod``:
859.. code:: c
860
861    [/] # cmdls help
862    r-xr-xr-x     0     0 help
863    \[/] # cmdchmod 544 help
864    \[/] # cmdls help
865    r-xr--r--     0     0 help
866
867**CONFIGURATION:**
868
869.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD
870.. index:: CONFIGURE_SHELL_COMMAND_CMDCHMOD
871
872This command is included in the default shell command set.
873When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CMDCHMOD`` to have this
874command included.
875
876This command can be excluded from the shell command set by
877defining ``CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD`` when all
878shell commands have been configured.
879
880**PROGRAMMING INFORMATION:**
881
882The configuration structure for the ``cmdchmod`` has the
883following prototype:
884.. code:: c
885
886    extern rtems_shell_cmd_t rtems_shell_CMDCHMOD_Command;
887
888date - print or set current date and time
889-----------------------------------------
890.. index:: date
891
892**SYNOPSYS:**
893
894.. code:: c
895
896    date
897    date DATE TIME
898
899**DESCRIPTION:**
900
901This command operates one of two modes.  When invoked with no
902arguments, it prints the current date and time.  When invoked
903with both ``date`` and ``time`` arguments, it sets the
904current time.
905
906The ``date`` is specified in ``YYYY-MM-DD`` format.
907The ``time`` is specified in ``HH:MM:SS`` format.
908
909**EXIT STATUS:**
910
911This command returns 0 on success and non-zero if an error is encountered.
912
913**NOTES:**
914
915This comm
916
917**EXAMPLES:**
918
919The following is an example of how to use ``date``:
920.. code:: c
921
922    SHLL \[/] $ date
923    Fri Jan  1 00:00:09 1988
924    SHLL \[/] $ date 2008-02-29 06:45:32
925    SHLL \[/] $ date
926    Fri Feb 29 06:45:35 2008
927
928**CONFIGURATION:**
929
930.. index:: CONFIGURE_SHELL_NO_COMMAND_DATE
931.. index:: CONFIGURE_SHELL_COMMAND_DATE
932
933This command is included in the default shell command set.
934When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DATE`` to have this
935command included.
936
937This command can be excluded from the shell command set by
938defining ``CONFIGURE_SHELL_NO_COMMAND_DATE`` when all
939shell commands have been configured.
940
941**PROGRAMMING INFORMATION:**
942
943.. index:: rtems_shell_rtems_main_date
944
945The ``date`` is implemented by a C language function
946which has the following prototype:
947.. code:: c
948
949    int rtems_shell_rtems_main_date(
950    int    argc,
951    char \**argv
952    );
953
954The configuration structure for the ``date`` has the
955following prototype:
956.. code:: c
957
958    extern rtems_shell_cmd_t rtems_shell_DATE_Command;
959
960echo - produce message in a shell script
961----------------------------------------
962.. index:: echo
963
964**SYNOPSYS:**
965
966.. code:: c
967
968    echo \[-n | -e] args ...
969
970**DESCRIPTION:**
971
972echo prints its arguments on the standard output, separated by spaces.
973Unless the *-n* option is present, a newline is output following the
974arguments.  The *-e* option causes echo to treat the escape sequences
975specially, as described in the following paragraph.  The *-e* option is the
976default, and is provided solely for compatibility with other systems.
977Only one of the options *-n* and *-e* may be given.
978
979If any of the following sequences of characters is encountered during
980output, the sequence is not output.  Instead, the specified action is
981performed:
982
983*\\b*
984    A backspace character is output.
985
986*\\c*
987    Subsequent output is suppressed.  This is normally used at the
988    end of the last argument to suppress the trailing newline that
989    echo would otherwise output.
990
991*\\f*
992    Output a form feed.
993
994*\\n*
995    Output a newline character.
996
997*\\r*
998    Output a carriage return.
999
1000*\\t*
1001    Output a (horizontal) tab character.
1002
1003*\\v*
1004    Output a vertical tab.
1005
1006*\\0digits*
1007    Output the character whose value is given by zero to three digits.
1008    If there are zero digits, a nul character is output.
1009
1010*\\\\*
1011    Output a backslash.
1012
1013**EXIT STATUS:**
1014
1015This command returns 0 on success and non-zero if an error is encountered.
1016
1017**NOTES:**
1018
1019The octal character escape mechanism (\\0digits) differs from the C lan-
1020guage mechanism.
1021
1022There is no way to force ``echo`` to treat its arguments literally, rather
1023than interpreting them as options and escape sequences.
1024
1025**EXAMPLES:**
1026
1027The following is an example of how to use ``echo``:
1028.. code:: c
1029
1030    SHLL \[/] $ echo a b c
1031    a b c
1032    SHLL \[/] $ echo
1033
1034**CONFIGURATION:**
1035
1036.. index:: CONFIGURE_SHELL_NO_COMMAND_ECHO
1037.. index:: CONFIGURE_SHELL_COMMAND_ECHO
1038
1039This command is included in the default shell command set.
1040When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ECHO`` to have this
1041command included.
1042
1043This command can be excluded from the shell command set by
1044defining ``CONFIGURE_SHELL_NO_COMMAND_ECHO`` when all
1045shell commands have been configured.
1046
1047**PROGRAMMING INFORMATION:**
1048
1049.. index:: rtems_shell_rtems_main_echo
1050
1051The ``echo`` is implemented by a C language function
1052which has the following prototype:
1053.. code:: c
1054
1055    int rtems_shell_rtems_main_echo(
1056    int    argc,
1057    char \**argv
1058    );
1059
1060The configuration structure for the ``echo`` has the
1061following prototype:
1062.. code:: c
1063
1064    extern rtems_shell_cmd_t rtems_shell_ECHO_Command;
1065
1066**ORIGIN:**
1067
1068The implementation and portions of the documentation for this
1069command are from NetBSD 4.0.
1070
1071sleep - delay for a specified amount of time
1072--------------------------------------------
1073.. index:: sleep
1074
1075**SYNOPSYS:**
1076
1077.. code:: c
1078
1079    sleep seconds
1080    sleep seconds nanoseconds
1081
1082**DESCRIPTION:**
1083
1084This command causes the task executing the shell to block
1085for the specified number of ``seconds`` and ``nanoseconds``.
1086
1087**EXIT STATUS:**
1088
1089This command returns 0 on success and non-zero if an error is encountered.
1090
1091**NOTES:**
1092
1093This command is implemented using the ``nanosleep()`` method.
1094
1095The command line interface is similar to the ``sleep`` command
1096found on POSIX systems but the addition of the ``nanoseconds``
1097parameter allows fine grained delays in shell scripts without
1098adding another command such as ``usleep``.
1099
1100**EXAMPLES:**
1101
1102The following is an example of how to use ``sleep``:
1103.. code:: c
1104
1105    SHLL \[/] $ sleep 10
1106    SHLL \[/] $ sleep 0 5000000
1107
1108It is not clear from the above but there is a ten second
1109pause after executing the first command before the prompt
1110is printed.  The second command completes very quickly
1111from a human perspective and there is no noticeable
1112delay in the prompt being printed.
1113
1114**CONFIGURATION:**
1115
1116.. index:: CONFIGURE_SHELL_NO_COMMAND_SLEEP
1117.. index:: CONFIGURE_SHELL_COMMAND_SLEEP
1118
1119This command is included in the default shell command set.
1120When building a custom command set, define``CONFIGURE_SHELL_COMMAND_SLEEP`` to have this
1121command included.
1122
1123This command can be excluded from the shell command set by
1124defining ``CONFIGURE_SHELL_NO_COMMAND_SLEEP`` when all
1125shell commands have been configured.
1126
1127**PROGRAMMING INFORMATION:**
1128
1129.. index:: rtems_shell_rtems_main_sleep
1130
1131The ``sleep`` is implemented by a C language function
1132which has the following prototype:
1133.. code:: c
1134
1135    int rtems_shell_rtems_main_sleep(
1136    int    argc,
1137    char \**argv
1138    );
1139
1140The configuration structure for the ``sleep`` has the
1141following prototype:
1142.. code:: c
1143
1144    extern rtems_shell_cmd_t rtems_shell_SLEEP_Command;
1145
1146id - show uid gid euid and egid
1147-------------------------------
1148.. index:: id
1149
1150**SYNOPSYS:**
1151
1152.. code:: c
1153
1154    id
1155
1156**DESCRIPTION:**
1157
1158This command prints the user identity.  This includes the user id
1159(uid), group id (gid), effective user id (euid), and effective
1160group id (egid).
1161
1162**EXIT STATUS:**
1163
1164This command returns 0 on success and non-zero if an error is encountered.
1165
1166**NOTES:**
1167
1168Remember there is only one POSIX process in a single processor RTEMS
1169application. Each thread may have its own user identity and that
1170identity is used by the filesystem to enforce permissions.
1171
1172**EXAMPLES:**
1173
1174The first example of the ``id`` command is from a session logged
1175in as the normal user ``rtems``:
1176.. code:: c
1177
1178    SHLL \[/] # id
1179    uid=1(rtems),gid=1(rtems),euid=1(rtems),egid=1(rtems)
1180
1181The second example of the ``id`` command is from a session logged
1182in as the ``root`` user:
1183.. code:: c
1184
1185    SHLL \[/] # id
1186    uid=0(root),gid=0(root),euid=0(root),egid=0(root)
1187
1188**CONFIGURATION:**
1189
1190.. index:: CONFIGURE_SHELL_NO_COMMAND_ID
1191.. index:: CONFIGURE_SHELL_COMMAND_ID
1192
1193This command is included in the default shell command set.
1194When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ID`` to have this
1195command included.
1196
1197This command can be excluded from the shell command set by
1198defining ``CONFIGURE_SHELL_NO_COMMAND_ID`` when all
1199shell commands have been configured.
1200
1201**PROGRAMMING INFORMATION:**
1202
1203.. index:: rtems_shell_rtems_main_id
1204
1205The ``id`` is implemented by a C language function
1206which has the following prototype:
1207.. code:: c
1208
1209    int rtems_shell_rtems_main_id(
1210    int    argc,
1211    char \**argv
1212    );
1213
1214The configuration structure for the ``id`` has the
1215following prototype:
1216.. code:: c
1217
1218    extern rtems_shell_cmd_t rtems_shell_ID_Command;
1219
1220tty - show ttyname
1221------------------
1222.. index:: tty
1223
1224**SYNOPSYS:**
1225
1226.. code:: c
1227
1228    tty
1229
1230**DESCRIPTION:**
1231
1232This command prints the file name of the device connected
1233to standard input.
1234
1235**EXIT STATUS:**
1236
1237This command returns 0 on success and non-zero if an error is encountered.
1238
1239**NOTES:**
1240
1241NONE
1242
1243**EXAMPLES:**
1244
1245The following is an example of how to use ``tty``:
1246.. code:: c
1247
1248    SHLL \[/] $ tty
1249    /dev/console
1250
1251**CONFIGURATION:**
1252
1253.. index:: CONFIGURE_SHELL_NO_COMMAND_TTY
1254.. index:: CONFIGURE_SHELL_COMMAND_TTY
1255
1256This command is included in the default shell command set.
1257When building a custom command set, define``CONFIGURE_SHELL_COMMAND_TTY`` to have this
1258command included.
1259
1260This command can be excluded from the shell command set by
1261defining ``CONFIGURE_SHELL_NO_COMMAND_TTY`` when all
1262shell commands have been configured.
1263
1264**PROGRAMMING INFORMATION:**
1265
1266.. index:: rtems_shell_rtems_main_tty
1267
1268The ``tty`` is implemented by a C language function
1269which has the following prototype:
1270.. code:: c
1271
1272    int rtems_shell_rtems_main_tty(
1273    int    argc,
1274    char \**argv
1275    );
1276
1277The configuration structure for the ``tty`` has the
1278following prototype:
1279.. code:: c
1280
1281    extern rtems_shell_cmd_t rtems_shell_TTY_Command;
1282
1283whoami - print effective user id
1284--------------------------------
1285.. index:: whoami
1286
1287**SYNOPSYS:**
1288
1289.. code:: c
1290
1291    whoami
1292
1293**DESCRIPTION:**
1294
1295This command displays the user name associated with the current
1296effective user id.
1297
1298**EXIT STATUS:**
1299
1300This command always succeeds.
1301
1302**NOTES:**
1303
1304NONE
1305
1306**EXAMPLES:**
1307
1308The following is an example of how to use ``whoami``:
1309.. code:: c
1310
1311    SHLL \[/] $ whoami
1312    rtems
1313
1314**CONFIGURATION:**
1315
1316.. index:: CONFIGURE_SHELL_NO_COMMAND_WHOAMI
1317.. index:: CONFIGURE_SHELL_COMMAND_WHOAMI
1318
1319This command is included in the default shell command set.
1320When building a custom command set, define``CONFIGURE_SHELL_COMMAND_WHOAMI`` to have this
1321command included.
1322
1323This command can be excluded from the shell command set by
1324defining ``CONFIGURE_SHELL_NO_COMMAND_WHOAMI`` when all
1325shell commands have been configured.
1326
1327**PROGRAMMING INFORMATION:**
1328
1329.. index:: rtems_shell_rtems_main_whoami
1330
1331The ``whoami`` is implemented by a C language function
1332which has the following prototype:
1333.. code:: c
1334
1335    int rtems_shell_rtems_main_whoami(
1336    int    argc,
1337    char \**argv
1338    );
1339
1340The configuration structure for the ``whoami`` has the
1341following prototype:
1342.. code:: c
1343
1344    extern rtems_shell_cmd_t rtems_shell_WHOAMI_Command;
1345
1346getenv - print environment variable
1347-----------------------------------
1348.. index:: getenv
1349
1350**SYNOPSYS:**
1351
1352.. code:: c
1353
1354    getenv variable
1355
1356**DESCRIPTION:**
1357
1358This command is used to display the value of a ``variable`` in the set
1359of environment variables.
1360
1361**EXIT STATUS:**
1362
1363This command will return 1 and print a diagnostic message if
1364a failure occurs.
1365
1366**NOTES:**
1367
1368The entire RTEMS application shares a single set of environment variables.
1369
1370**EXAMPLES:**
1371
1372The following is an example of how to use ``getenv``:
1373.. code:: c
1374
1375    SHLL \[/] $ getenv BASEPATH
1376    /mnt/hda1
1377
1378**CONFIGURATION:**
1379
1380.. index:: CONFIGURE_SHELL_NO_COMMAND_GETENV
1381.. index:: CONFIGURE_SHELL_COMMAND_GETENV
1382
1383This command is included in the default shell command set.
1384When building a custom command set, define``CONFIGURE_SHELL_COMMAND_GETENV`` to have this
1385command included.
1386
1387This command can be excluded from the shell command set by
1388defining ``CONFIGURE_SHELL_NO_COMMAND_GETENV`` when all
1389shell commands have been configured.
1390
1391**PROGRAMMING INFORMATION:**
1392
1393.. index:: rtems_shell_rtems_main_getenv
1394
1395The ``getenv`` is implemented by a C language function
1396which has the following prototype:
1397.. code:: c
1398
1399    int rtems_shell_rtems_main_getenv(
1400    int    argc,
1401    char \**argv
1402    );
1403
1404The configuration structure for the ``getenv`` has the
1405following prototype:
1406.. code:: c
1407
1408    extern rtems_shell_cmd_t rtems_shell_GETENV_Command;
1409
1410setenv - set environment variable
1411---------------------------------
1412.. index:: setenv
1413
1414**SYNOPSYS:**
1415
1416.. code:: c
1417
1418    setenv variable \[value]
1419
1420**DESCRIPTION:**
1421
1422This command is used to add a new ``variable`` to the set of environment
1423variables or to modify the variable of an already existing ``variable``.
1424If the ``value`` is not provided, the ``variable`` will be set to the
1425empty string.
1426
1427**EXIT STATUS:**
1428
1429This command will return 1 and print a diagnostic message if
1430a failure occurs.
1431
1432**NOTES:**
1433
1434The entire RTEMS application shares a single set of environment variables.
1435
1436**EXAMPLES:**
1437
1438The following is an example of how to use ``setenv``:
1439.. code:: c
1440
1441    SHLL \[/] $ setenv BASEPATH /mnt/hda1
1442
1443**CONFIGURATION:**
1444
1445.. index:: CONFIGURE_SHELL_NO_COMMAND_SETENV
1446.. index:: CONFIGURE_SHELL_COMMAND_SETENV
1447
1448This command is included in the default shell command set.
1449When building a custom command set, define``CONFIGURE_SHELL_COMMAND_SETENV`` to have this
1450command included.
1451
1452This command can be excluded from the shell command set by
1453defining ``CONFIGURE_SHELL_NO_COMMAND_SETENV`` when all
1454shell commands have been configured.
1455
1456**PROGRAMMING INFORMATION:**
1457
1458.. index:: rtems_shell_rtems_main_setenv
1459
1460The ``setenv`` is implemented by a C language function
1461which has the following prototype:
1462.. code:: c
1463
1464    int rtems_shell_rtems_main_setenv(
1465    int    argc,
1466    char \**argv
1467    );
1468
1469The configuration structure for the ``setenv`` has the
1470following prototype:
1471.. code:: c
1472
1473    extern rtems_shell_cmd_t rtems_shell_SETENV_Command;
1474
1475unsetenv - unset environment variable
1476-------------------------------------
1477.. index:: unsetenv
1478
1479**SYNOPSYS:**
1480
1481.. code:: c
1482
1483    unsetenv variable
1484
1485**DESCRIPTION:**
1486
1487This command is remove to a ``variable`` from the set of environment
1488variables.
1489
1490**EXIT STATUS:**
1491
1492This command will return 1 and print a diagnostic message if
1493a failure occurs.
1494
1495**NOTES:**
1496
1497The entire RTEMS application shares a single set of environment variables.
1498
1499**EXAMPLES:**
1500
1501The following is an example of how to use ``unsetenv``:
1502.. code:: c
1503
1504    SHLL \[/] $ unsetenv BASEPATH
1505
1506**CONFIGURATION:**
1507
1508.. index:: CONFIGURE_SHELL_NO_COMMAND_UNSETENV
1509.. index:: CONFIGURE_SHELL_COMMAND_UNSETENV
1510
1511This command is included in the default shell command set.
1512When building a custom command set, define``CONFIGURE_SHELL_COMMAND_UNSETENV`` to have this
1513command included.
1514
1515This command can be excluded from the shell command set by
1516defining ``CONFIGURE_SHELL_NO_COMMAND_UNSETENV`` when all
1517shell commands have been configured.
1518
1519**PROGRAMMING INFORMATION:**
1520
1521.. index:: rtems_shell_rtems_main_unsetenv
1522
1523The ``unsetenv`` is implemented by a C language function
1524which has the following prototype:
1525.. code:: c
1526
1527    int rtems_shell_rtems_main_unsetenv(
1528    int    argc,
1529    char \**argv
1530    );
1531
1532The configuration structure for the ``unsetenv`` has the
1533following prototype:
1534.. code:: c
1535
1536    extern rtems_shell_cmd_t rtems_shell_UNSETENV_Command;
1537
1538time - time command execution
1539-----------------------------
1540.. index:: time
1541
1542**SYNOPSYS:**
1543
1544.. code:: c
1545
1546    time command \[argument ...]
1547
1548**DESCRIPTION:**
1549
1550The time command executes and times a command.  After the command
1551finishes, time writes the total time elapsed.  Times are reported in
1552seconds.
1553
1554**EXIT STATUS:**
1555
1556This command returns 0 on success and non-zero if an error is encountered.
1557
1558**NOTES:**
1559
1560None.
1561
1562**EXAMPLES:**
1563
1564The following is an example of how to use ``time``:
1565.. code:: c
1566
1567    SHLL \[/] $ time cp -r /nfs/directory /c
1568
1569**CONFIGURATION:**
1570
1571.. index:: CONFIGURE_SHELL_NO_COMMAND_TIME
1572.. index:: CONFIGURE_SHELL_COMMAND_TIME
1573
1574This command is included in the default shell command set.  When
1575building a custom command set, define``CONFIGURE_SHELL_COMMAND_TIME`` to have this command included.
1576
1577This command can be excluded from the shell command set by
1578defining ``CONFIGURE_SHELL_NO_COMMAND_TIME`` when all
1579shell commands have been configured.
1580
1581**PROGRAMMING INFORMATION:**
1582
1583.. index:: rtems_shell_rtems_main_time
1584
1585The ``time`` is implemented by a C language function
1586which has the following prototype:
1587.. code:: c
1588
1589    int rtems_shell_rtems_main_time(
1590    int    argc,
1591    char \**argv
1592    );
1593
1594The configuration structure for the ``time`` has the
1595following prototype:
1596.. code:: c
1597
1598    extern rtems_shell_cmd_t rtems_shell_TIME_Command;
1599
1600logoff - logoff from the system
1601-------------------------------
1602.. index:: logoff
1603
1604**SYNOPSYS:**
1605
1606.. code:: c
1607
1608    logoff
1609
1610**DESCRIPTION:**
1611
1612This command logs the user out of the shell.
1613
1614**EXIT STATUS:**
1615
1616This command does not return.
1617
1618**NOTES:**
1619
1620The system behavior when the shell is exited depends upon how the
1621shell was initiated.  The typical behavior is that a login prompt
1622will be displayed for the next login attempt or that the connection
1623will be dropped by the RTEMS system.
1624
1625**EXAMPLES:**
1626
1627The following is an example of how to use ``logoff``:
1628.. code:: c
1629
1630    SHLL \[/] $ logoff
1631    logoff from the system...
1632
1633**CONFIGURATION:**
1634
1635.. index:: CONFIGURE_SHELL_NO_COMMAND_LOGOFF
1636.. index:: CONFIGURE_SHELL_COMMAND_LOGOFF
1637
1638This command is included in the default shell command set.
1639When building a custom command set, define``CONFIGURE_SHELL_COMMAND_LOGOFF`` to have this
1640command included.
1641
1642This command can be excluded from the shell command set by
1643defining ``CONFIGURE_SHELL_NO_COMMAND_LOGOFF`` when all
1644shell commands have been configured.
1645
1646**PROGRAMMING INFORMATION:**
1647
1648.. index:: rtems_shell_rtems_main_logoff
1649
1650The ``logoff`` is implemented by a C language function
1651which has the following prototype:
1652.. code:: c
1653
1654    int rtems_shell_rtems_main_logoff(
1655    int    argc,
1656    char \**argv
1657    );
1658
1659The configuration structure for the ``logoff`` has the
1660following prototype:
1661.. code:: c
1662
1663    extern rtems_shell_cmd_t rtems_shell_LOGOFF_Command;
1664
1665rtc - RTC driver configuration
1666------------------------------
1667.. index:: rtc
1668
1669**SYNOPSYS:**
1670
1671.. code:: c
1672
1673    rtc
1674
1675**CONFIGURATION:**
1676
1677.. index:: CONFIGURE_SHELL_NO_COMMAND_RTC
1678.. index:: CONFIGURE_SHELL_COMMAND_RTC
1679
1680This command is included in the default shell command set.
1681When building a custom command set, define``CONFIGURE_SHELL_COMMAND_RTC`` to have this
1682command included.
1683
1684This command can be excluded from the shell command set by
1685defining ``CONFIGURE_SHELL_NO_COMMAND_RTC`` when all
1686shell commands have been configured.
1687
1688exit - exit the shell
1689---------------------
1690.. index:: exit
1691
1692**SYNOPSYS:**
1693
1694.. code:: c
1695
1696    exit
1697
1698**DESCRIPTION:**
1699
1700This command causes the shell interpreter to ``exit``.
1701
1702**EXIT STATUS:**
1703
1704This command does not return.
1705
1706**NOTES:**
1707
1708In contrast to `logoff - logoff from the system`_,
1709this command is built into the shell interpreter loop.
1710
1711**EXAMPLES:**
1712
1713The following is an example of how to use ``exit``:
1714.. code:: c
1715
1716    SHLL \[/] $ exit
1717    Shell exiting
1718
1719**CONFIGURATION:**
1720
1721This command is always present and cannot be disabled.
1722
1723**PROGRAMMING INFORMATION:**
1724
1725The ``exit`` is implemented directly in the shell interpreter.
1726There is no C routine associated with it.
1727
1728.. COMMENT: COPYRIGHT (c) 1988-2008.
1729
1730.. COMMENT: On-Line Applications Research Corporation (OAR).
1731
1732.. COMMENT: All rights reserved.
1733
1734File and Directory Commands
1735###########################
1736
1737Introduction
1738============
1739
1740The RTEMS shell has the following file and directory commands:
1741
1742- ``blksync`` - sync the block driver
1743
1744- ``cat`` - display file contents
1745
1746- ``cd`` - alias for chdir
1747
1748- ``chdir`` - change the current directory
1749
1750- ``chmod`` - change permissions of a file
1751
1752- ``chroot`` - change the root directory
1753
1754- ``cp`` - copy files
1755
1756- ``dd`` - format disks
1757
1758- ``debugrfs`` - debug RFS file system
1759
1760- ``df`` - display file system disk space usage
1761
1762- ``dir`` - alias for ls
1763
1764- ``fdisk`` - format disks
1765
1766- ``hexdump`` - format disks
1767
1768- ``ln`` - make links
1769
1770- ``ls`` - list files in the directory
1771
1772- ``md5`` - display file system disk space usage
1773
1774- ``mkdir`` - create a directory
1775
1776- ``mkdos`` - DOSFS disk format
1777
1778- ``mknod`` - make device special file
1779
1780- ``mkrfs`` - format RFS file system
1781
1782- ``mount`` - mount disk
1783
1784- ``mv`` - move files
1785
1786- ``pwd`` - print work directory
1787
1788- ``rmdir`` - remove empty directories
1789
1790- ``rm`` - remove files
1791
1792- ``umask`` - Set file mode creation mask
1793
1794- ``unmount`` - unmount disk
1795
1796Commands
1797========
1798
1799This section details the File and Directory Commands available.  A
1800subsection is dedicated to each of the commands and
1801describes the behavior and configuration of that
1802command as well as providing an example usage.
1803
1804blksync - sync the block driver
1805-------------------------------
1806.. index:: blksync
1807
1808**SYNOPSYS:**
1809
1810.. code:: c
1811
1812    blksync driver
1813
1814**DESCRIPTION:**
1815
1816This command XXX
1817
1818**EXIT STATUS:**
1819
1820This command returns 0 on success and non-zero if an error is encountered.
1821
1822**NOTES:**
1823
1824NONE
1825
1826**EXAMPLES:**
1827
1828The following is an example of how to use ``blksync``:
1829.. code:: c
1830
1831    EXAMPLE_TBD
1832
1833**CONFIGURATION:**
1834
1835.. index:: CONFIGURE_SHELL_NO_COMMAND_BLKSYNC
1836.. index:: CONFIGURE_SHELL_COMMAND_BLKSYNC
1837
1838This command is included in the default shell command set.
1839When building a custom command set, define``CONFIGURE_SHELL_COMMAND_BLKSYNC`` to have this
1840command included.
1841
1842This command can be excluded from the shell command set by
1843defining ``CONFIGURE_SHELL_NO_COMMAND_BLKSYNC`` when all
1844shell commands have been configured.
1845
1846**PROGRAMMING INFORMATION:**
1847
1848.. index:: rtems_shell_rtems_main_blksync
1849
1850The ``blksync`` is implemented by a C language function
1851which has the following prototype:
1852.. code:: c
1853
1854    int rtems_shell_rtems_main_blksync(
1855    int    argc,
1856    char \**argv
1857    );
1858
1859The configuration structure for the ``blksync`` has the
1860following prototype:
1861.. code:: c
1862
1863    extern rtems_shell_cmd_t rtems_shell_BLKSYNC_Command;
1864
1865cat - display file contents
1866---------------------------
1867.. index:: cat
1868
1869**SYNOPSYS:**
1870
1871.. code:: c
1872
1873    cat file1 \[file2 .. fileN]
1874
1875**DESCRIPTION:**
1876
1877This command displays the contents of the specified files.
1878
1879**EXIT STATUS:**
1880
1881This command returns 0 on success and non-zero if an error is encountered.
1882
1883**NOTES:**
1884
1885It is possible to read the input from a device file using ``cat``.
1886
1887**EXAMPLES:**
1888
1889The following is an example of how to use ``cat``:
1890.. code:: c
1891
1892    SHLL \[/] # cat /etc/passwd
1893    root:\*:0:0:root::/:/bin/sh
1894    rtems:\*:1:1:RTEMS Application::/:/bin/sh
1895    tty:!:2:2:tty owner::/:/bin/false
1896
1897**CONFIGURATION:**
1898
1899.. index:: CONFIGURE_SHELL_NO_COMMAND_CAT
1900.. index:: CONFIGURE_SHELL_COMMAND_CAT
1901
1902This command is included in the default shell command set.
1903When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CAT`` to have this
1904command included.
1905
1906This command can be excluded from the shell command set by
1907defining ``CONFIGURE_SHELL_NO_COMMAND_CAT`` when all
1908shell commands have been configured.
1909
1910**PROGRAMMING INFORMATION:**
1911
1912.. index:: rtems_shell_rtems_main_cat
1913
1914The ``cat`` is implemented by a C language function
1915which has the following prototype:
1916.. code:: c
1917
1918    int rtems_shell_rtems_main_cat(
1919    int    argc,
1920    char \**argv
1921    );
1922
1923The configuration structure for the ``cat`` has the
1924following prototype:
1925.. code:: c
1926
1927    extern rtems_shell_cmd_t rtems_shell_CAT_Command;
1928
1929cd - alias for chdir
1930--------------------
1931.. index:: cd
1932
1933**SYNOPSYS:**
1934
1935.. code:: c
1936
1937    cd directory
1938
1939**DESCRIPTION:**
1940
1941This command is an alias or alternate name for the ``chdir``.
1942See `ls - list files in the directory`_ for more information.
1943
1944**EXIT STATUS:**
1945
1946This command returns 0 on success and non-zero if an error is encountered.
1947
1948**NOTES:**
1949
1950NONE
1951
1952**EXAMPLES:**
1953
1954The following is an example of how to use ``cd``:
1955.. code:: c
1956
1957    SHLL \[/] $ cd etc
1958    SHLL \[/etc] $ cd /
1959    SHLL \[/] $ cd /etc
1960    SHLL \[/etc] $ pwd
1961    /etc
1962    SHLL \[/etc] $ cd /
1963    SHLL \[/] $ pwd
1964    /
1965    SHLL \[/] $ cd etc
1966    SHLL \[/etc] $ cd ..
1967    SHLL \[/] $ pwd
1968    /
1969
1970**CONFIGURATION:**
1971
1972.. index:: CONFIGURE_SHELL_NO_COMMAND_CD
1973.. index:: CONFIGURE_SHELL_COMMAND_CD
1974
1975This command is included in the default shell command set.
1976When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CD`` to have this
1977command included.
1978
1979This command can be excluded from the shell command set by
1980defining ``CONFIGURE_SHELL_NO_COMMAND_CD`` when all
1981shell commands have been configured.
1982
1983**PROGRAMMING INFORMATION:**
1984
1985.. index:: rtems_shell_rtems_main_cd
1986
1987The ``cd`` is implemented by a C language function
1988which has the following prototype:
1989.. code:: c
1990
1991    int rtems_shell_rtems_main_cd(
1992    int    argc,
1993    char \**argv
1994    );
1995
1996The configuration structure for the ``cd`` has the
1997following prototype:
1998.. code:: c
1999
2000    extern rtems_shell_cmd_t rtems_shell_CD_Command;
2001
2002
2003chdir - change the current directory
2004------------------------------------
2005.. index:: chdir
2006
2007**SYNOPSYS:**
2008
2009.. code:: c
2010
2011    chdir \[dir]
2012
2013**DESCRIPTION:**
2014
2015This command is used to change the current working directory to
2016the specified directory.  If no arguments are given, the current
2017working directory will be changed to ``/``.
2018
2019**EXIT STATUS:**
2020
2021This command returns 0 on success and non-zero if an error is encountered.
2022
2023**NOTES:**
2024
2025NONE
2026
2027**EXAMPLES:**
2028
2029The following is an example of how to use ``chdir``:
2030.. code:: c
2031
2032    SHLL \[/] $ pwd
2033    /
2034    SHLL \[/] $ chdir etc
2035    SHLL \[/etc] $ pwd
2036    /etc
2037
2038**CONFIGURATION:**
2039
2040.. index:: CONFIGURE_SHELL_NO_COMMAND_CHDIR
2041.. index:: CONFIGURE_SHELL_COMMAND_CHDIR
2042
2043This command is included in the default shell command set.
2044When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CHDIR`` to have this
2045command included.
2046
2047This command can be excluded from the shell command set by
2048defining ``CONFIGURE_SHELL_NO_COMMAND_CHDIR`` when all
2049shell commands have been configured.
2050
2051**PROGRAMMING INFORMATION:**
2052
2053.. index:: rtems_shell_rtems_main_chdir
2054
2055The ``chdir`` is implemented by a C language function
2056which has the following prototype:
2057.. code:: c
2058
2059    int rtems_shell_rtems_main_chdir(
2060    int    argc,
2061    char \**argv
2062    );
2063
2064The configuration structure for the ``chdir`` has the
2065following prototype:
2066.. code:: c
2067
2068    extern rtems_shell_cmd_t rtems_shell_CHDIR_Command;
2069
2070chmod - change permissions of a file
2071------------------------------------
2072.. index:: chmod
2073
2074**SYNOPSYS:**
2075
2076.. code:: c
2077
2078    chmod permissions file1 \[file2...]
2079
2080**DESCRIPTION:**
2081
2082This command changes the permissions on the files specified to the
2083indicated ``permissions``.  The permission values are POSIX based
2084with owner, group, and world having individual read, write, and
2085executive permission bits.
2086
2087**EXIT STATUS:**
2088
2089This command returns 0 on success and non-zero if an error is encountered.
2090
2091**NOTES:**
2092
2093The ``chmod`` command only takes numeric representations of
2094the permissions.
2095
2096**EXAMPLES:**
2097
2098The following is an example of how to use ``chmod``:
2099.. code:: c
2100
2101    SHLL \[/] # cd etc
2102    SHLL \[/etc] # ls
2103    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
2104    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2105    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2106    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2107    4 files 202 bytes occupied
2108    SHLL \[/etc] # chmod 0777 passwd
2109    SHLL \[/etc] # ls
2110    -rwxrwxrwx   1   root   root         102 Jan 01 00:00 passwd
2111    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2112    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2113    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2114    4 files 202 bytes occupied
2115    SHLL \[/etc] # chmod 0322 passwd
2116    SHLL \[/etc] # ls
2117    --wx-w--w-   1 nouser   root         102 Jan 01 00:00 passwd
2118    -rw-r--r--   1 nouser   root          42 Jan 01 00:00 group
2119    -rw-r--r--   1 nouser   root          30 Jan 01 00:00 issue
2120    -rw-r--r--   1 nouser   root          28 Jan 01 00:00 issue.net
2121    4 files 202 bytes occupied
2122    SHLL \[/etc] # chmod 0644 passwd
2123    SHLL \[/etc] # ls
2124    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
2125    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2126    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2127    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2128    4 files 202 bytes occupied
2129
2130**CONFIGURATION:**
2131
2132.. index:: CONFIGURE_SHELL_NO_COMMAND_CHMOD
2133.. index:: CONFIGURE_SHELL_COMMAND_CHMOD
2134
2135This command is included in the default shell command set.
2136When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CHMOD`` to have this
2137command included.
2138
2139This command can be excluded from the shell command set by
2140defining ``CONFIGURE_SHELL_NO_COMMAND_CHMOD`` when all
2141shell commands have been configured.
2142
2143**PROGRAMMING INFORMATION:**
2144
2145.. index:: rtems_shell_rtems_main_chmod
2146
2147The ``chmod`` is implemented by a C language function
2148which has the following prototype:
2149.. code:: c
2150
2151    int rtems_shell_rtems_main_chmod(
2152    int    argc,
2153    char \**argv
2154    );
2155
2156The configuration structure for the ``chmod`` has the
2157following prototype:
2158.. code:: c
2159
2160    extern rtems_shell_cmd_t rtems_shell_CHMOD_Command;
2161
2162chroot - change the root directory
2163----------------------------------
2164.. index:: chroot
2165
2166**SYNOPSYS:**
2167
2168.. code:: c
2169
2170    chroot \[dir]
2171
2172**DESCRIPTION:**
2173
2174This command changes the root directory to ``dir`` for subsequent
2175commands.
2176
2177**EXIT STATUS:**
2178
2179This command returns 0 on success and non-zero if an error is encountered.
2180
2181The destination directory ``dir`` must exist.
2182
2183**NOTES:**
2184
2185NONE
2186
2187**EXAMPLES:**
2188
2189The following is an example of how to use ``chroot``
2190and the impact it has on the environment for subsequent
2191command invocations:
2192.. code:: c
2193
2194    SHLL \[/] $ cat passwd
2195    cat: passwd: No such file or directory
2196    SHLL \[/] $ chroot etc
2197    SHLL \[/] $ cat passwd
2198    root:\*:0:0:root::/:/bin/sh
2199    rtems:\*:1:1:RTEMS Application::/:/bin/sh
2200    tty:!:2:2:tty owner::/:/bin/false
2201    SHLL \[/] $ cat /etc/passwd
2202    cat: /etc/passwd: No such file or directory
2203
2204**CONFIGURATION:**
2205
2206.. index:: CONFIGURE_SHELL_NO_COMMAND_CHROOT
2207.. index:: CONFIGURE_SHELL_COMMAND_CHROOT
2208
2209This command is included in the default shell command set.
2210When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CHROOT`` to have this
2211command included. Additional to that you have to add one
2212POSIX key value pair for each thread where you want to use
2213the command.
2214
2215This command can be excluded from the shell command set by
2216defining ``CONFIGURE_SHELL_NO_COMMAND_CHROOT`` when all
2217shell commands have been configured.
2218
2219**PROGRAMMING INFORMATION:**
2220
2221.. index:: rtems_shell_rtems_main_chroot
2222
2223The ``chroot`` is implemented by a C language function
2224which has the following prototype:
2225.. code:: c
2226
2227    int rtems_shell_rtems_main_chroot(
2228    int    argc,
2229    char \**argv
2230    );
2231
2232The configuration structure for the ``chroot`` has the
2233following prototype:
2234.. code:: c
2235
2236    extern rtems_shell_cmd_t rtems_shell_CHROOT_Command;
2237
2238cp - copy files
2239---------------
2240.. index:: cp
2241
2242**SYNOPSYS:**
2243
2244.. code:: c
2245
2246    cp \[-R \[-H | -L | -P]] \[-f | -i] \[-pv] src target
2247    cp \[-R \[-H | -L] ] \[-f | -i] \[-NpPv] source_file ... target_directory
2248
2249**DESCRIPTION:**
2250
2251In the first synopsis form, the cp utility copies the contents of the
2252source_file to the target_file. In the second synopsis form, the contents of
2253each named source_file is copied to the destination target_directory. The names
2254of the files themselves are not changed. If cp detects an attempt to copy a
2255file to itself, the copy will fail.
2256
2257The following options are available:
2258
2259*-f*
2260    For each existing destination pathname, attempt to overwrite it. If permissions
2261    do not allow copy to succeed, remove it and create a new file, without
2262    prompting for confirmation. (The -i option is ignored if the -f option is
2263    specified.)
2264
2265*-H*
2266    If the -R option is specified, symbolic links on the command line are followed.
2267    (Symbolic links encountered in the tree traversal are not followed.)
2268
2269*-i*
2270    Causes cp to write a prompt to the standard error output before copying a file
2271    that would overwrite an existing file. If the response from the standard input
2272    begins with the character ’y’, the file copy is attempted.
2273
2274*-L*
2275    If the -R option is specified, all symbolic links are followed.
2276
2277*-N*
2278    When used with -p, do not copy file flags.
2279
2280*-P*
2281    No symbolic links are followed.
2282
2283*-p*
2284    Causes cp to preserve in the copy as many of the modification time, access
2285    time, file flags, file mode, user ID, and group ID as allowed by permissions.
2286    If the user ID and group ID cannot be preserved, no error message is displayed
2287    and the exit value is not altered.
2288    If the source file has its set user ID bit on and the user ID cannot be
2289    preserved, the set user ID bit is not preserved in the copy’s permissions. If
2290    the source file has its set group ID bit on and the group ID cannot be
2291    preserved, the set group ID bit is not preserved in the copy’s permissions. If
2292    the source file has both its set user ID and set group ID bits on, and either
2293    the user ID or group ID cannot be preserved, neither the set user ID or set
2294    group ID bits are preserved in the copy’s permissions.
2295
2296*-R*
2297    If source_file designates a directory, cp copies the directory and the entire
2298    subtree connected at that point. This option also causes symbolic links to be
2299    copied, rather than indirected through, and for cp to create special files
2300    rather than copying them as normal files. Created directories have the same
2301    mode as the corresponding source directory, unmodified by the process’s umask.
2302
2303*-v*
2304    Cause cp to be verbose, showing files as they are copied.
2305
2306For each destination file that already exists, its contents are overwritten if
2307permissions allow, but its mode, user ID, and group ID are unchanged.
2308
2309In the second synopsis form, target_directory must exist unless there is only
2310one named source_file which is a directory and the -R flag is specified.
2311
2312If the destination file does not exist, the mode of the source file is used as
2313modified by the file mode creation mask (umask, see csh(1)). If the source file
2314has its set user ID bit on, that bit is removed unless both the source file and
2315the destination file are owned by the same user. If the source file has its set
2316group ID bit on, that bit is removed unless both the source file and the
2317destination file are in the same group and the user is a member of that group.
2318If both the set user ID and set group ID bits are set, all of the above
2319conditions must be fulfilled or both bits are removed.
2320
2321Appropriate permissions are required for file creation or overwriting.
2322
2323Symbolic links are always followed unless the -R flag is set, in which case
2324symbolic links are not followed, by default. The -H or -L flags (in conjunction
2325with the -R flag), as well as the -P flag cause symbolic links to be followed
2326as described above. The -H and -L options are ignored unless the -R option is
2327specified. In addition, these options override eachsubhedading other and the
2328command’s actions are determined by the last one specified.
2329
2330**EXIT STATUS:**
2331
2332This command returns 0 on success and non-zero if an error is encountered.
2333
2334**NOTES:**
2335
2336NONE
2337
2338**EXAMPLES:**
2339
2340The following is an example of how to use ``cp`` to
2341copy a file to a new name in the current directory:
2342.. code:: c
2343
2344    SHLL \[/] # cat joel
2345    cat: joel: No such file or directory
2346    SHLL \[/] # cp etc/passwd joel
2347    SHLL \[/] # cat joel
2348    root:\*:0:0:root::/:/bin/sh
2349    rtems:\*:1:1:RTEMS Application::/:/bin/sh
2350    tty:!:2:2:tty owner::/:/bin/false
2351    SHLL \[/] # ls
2352    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
2353    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
2354    -rw-r--r--   1   root   root         102 Jan 01 00:00 joel
2355    3 files 1710 bytes occupied
2356
2357The following is an example of how to use ``cp`` to
2358copy one or more files to a destination directory and
2359use the same ``basename`` in the destination directory:
2360.. code:: c
2361
2362    SHLL \[/] # mkdir tmp
2363    SHLL \[/] # ls tmp
2364    0 files 0 bytes occupied
2365    SHLL \[/] # cp /etc/passwd tmp
2366    SHLL \[/] # ls /tmp
2367    -rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
2368    1 files 102 bytes occupied
2369    SHLL \[/] # cp /etc/passwd /etc/group /tmp
2370    SHLL \[/] # ls /tmp
2371    -rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
2372    -rw-r--r--   1   root   root          42 Jan 01 00:01 group
2373    2 files 144 bytes occupied
2374    SHLL \[/] #
2375
2376**CONFIGURATION:**
2377
2378.. index:: CONFIGURE_SHELL_NO_COMMAND_CP
2379.. index:: CONFIGURE_SHELL_COMMAND_CP
2380
2381This command is included in the default shell command set.
2382When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CP`` to have this
2383command included.
2384
2385This command can be excluded from the shell command set by
2386defining ``CONFIGURE_SHELL_NO_COMMAND_CP`` when all
2387shell commands have been configured.
2388
2389**PROGRAMMING INFORMATION:**
2390
2391.. index:: rtems_shell_main_cp
2392
2393The ``cp`` command is implemented by a C language function which
2394has the following prototype:
2395.. code:: c
2396
2397    int rtems_shell_main_cp(
2398    int    argc,
2399    char \**argv
2400    );
2401
2402The configuration structure for the ``cp`` has the
2403following prototype:
2404.. code:: c
2405
2406    extern rtems_shell_cmd_t rtems_shell_CP_Command;
2407
2408**ORIGIN:**
2409
2410The implementation and portions of the documentation for this
2411command are from NetBSD 4.0.
2412
2413dd - convert and copy a file
2414----------------------------
2415.. index:: dd
2416
2417**SYNOPSYS:**
2418
2419.. code:: c
2420
2421    dd \[operands ...]
2422
2423**DESCRIPTION:**
2424
2425The dd utility copies the standard input to the standard output.
2426Input data is read and written in 512-byte blocks.  If input reads are
2427short, input from multiple reads are aggregated to form the output
2428block.  When finished, dd displays the number of complete and partial
2429input and output blocks and truncated input records to the standard
2430error output.
2431
2432The following operands are available:
2433
2434*bs=n*
2435    Set both input and output block size, superseding the ibs and obs
2436    operands.  If no conversion values other than noerror, notrunc or sync
2437    are specified, then each input block is copied to the output as a
2438    single block without any aggregation of short blocks.
2439
2440*cbs=n*
2441    Set the conversion record size to n bytes.  The conversion record size
2442    is required by the record oriented conversion values.
2443
2444*count=n*
2445    Copy only n input blocks.
2446
2447*files=n*
2448    Copy n input files before terminating.  This operand is only
2449    applicable when the input device is a tape.
2450
2451*ibs=n*
2452    Set the input block size to n bytes instead of the default 512.
2453
2454*if=file*
2455    Read input from file instead of the standard input.
2456
2457*obs=n*
2458    Set the output block size to n bytes instead of the default 512.
2459
2460*of=file*
2461    Write output to file instead of the standard output.  Any regular
2462    output file is truncated unless the notrunc conversion value is
2463    specified.  If an initial portion of the output file is skipped (see
2464    the seek operand) the output file is truncated at that point.
2465
2466*seek=n*
2467    Seek n blocks from the beginning of the output before copying.  On
2468    non-tape devices, a *lseek* operation is used.  Otherwise, existing
2469    blocks are read and the data discarded.  If the seek operation is past
2470    the end of file, space from the current end of file to the specified
2471    offset is filled with blocks of NUL bytes.
2472
2473*skip=n*
2474    Skip n blocks from the beginning of the input before copying.  On
2475    input which supports seeks, a *lseek* operation is used.  Otherwise,
2476    input data is read and discarded.  For pipes, the correct number of
2477    bytes is read.  For all other devices, the correct number of blocks is
2478    read without distinguishing between a partial or complete block being
2479    read.
2480
2481*progress=n*
2482    Switch on display of progress if n is set to any non-zero value.  This
2483    will cause a “.” to be printed (to the standard error output) for
2484    every n full or partial blocks written to the output file.
2485
2486*conv=value[,value...]*
2487    Where value is one of the symbols from the following list.
2488
2489    *ascii, oldascii*
2490
2491        The same as the unblock value except that characters are translated
2492        from EBCDIC to ASCII before the records are converted.  (These values
2493        imply unblock if the operand cbs is also specified.)  There are two
2494        conversion maps for ASCII.  The value ascii specifies the recom-
2495        mended one which is compatible with AT&T System V UNIX.  The value
2496        oldascii specifies the one used in historic AT&T and pre 4.3BSD-Reno
2497        systems.
2498
2499    *block*
2500
2501        Treats the input as a sequence of newline or end-of-file terminated
2502        variable length records independent of input and output block
2503        boundaries.  Any trailing newline character is discarded.  Each
2504        input record is converted to a fixed length output record where the
2505        length is specified by the cbs operand.  Input records shorter than
2506        the conversion record size are padded with spaces.  Input records
2507        longer than the conversion record size are truncated.  The number of
2508        truncated input records, if any, are reported to the standard error
2509        output at the completion of the copy.
2510
2511    *ebcdic, ibm, oldebcdic, oldibm*
2512
2513        The same as the block value except that characters are translated from
2514        ASCII to EBCDIC after the records are converted.  (These values imply
2515        block if the operand cbs is also specified.)  There are four
2516        conversion maps for EBCDIC.  The value ebcdic specifies the
2517        recommended one which is compatible with AT&T System V UNIX.  The
2518        value ibm is a slightly different mapping, which is compatible with
2519        the AT&T System V UNIX ibm value.  The values oldebcdic and oldibm are
2520        maps used in historic AT&T and pre 4.3BSD-Reno systems.
2521
2522    *lcase*
2523
2524        Transform uppercase characters into lowercase characters.
2525
2526    *noerror*
2527
2528        Do not stop processing on an input error.  When an input error occurs,
2529        a diagnostic message followed by the current input and output block
2530        counts will be written to the standard error output in the same format
2531        as the standard completion message.  If the sync conversion is also
2532        specified, any missing input data will be replaced with NUL bytes (or
2533        with spaces if a block oriented conversion value was specified) and
2534        processed as a normal input buffer.  If the sync conversion is not
2535        specified, the input block is omitted from the output.  On input files
2536        which are not tapes or pipes, the file offset will be positioned past
2537        the block in which the error occurred using lseek(2).
2538
2539    *notrunc*
2540
2541        Do not truncate the output file.  This will preserve any blocks in the
2542        output file not explicitly written by dd.  The notrunc value is not
2543        supported for tapes.
2544
2545    *osync*
2546
2547        Pad the final output block to the full output block size.  If the
2548        input file is not a multiple of the output block size after
2549        conversion, this conversion forces the final output block to be the
2550        same size as preceding blocks for use on devices that require
2551        regularly sized blocks to be written.  This option is incompatible
2552        with use of the bs=n block size specification.
2553
2554    *sparse*
2555
2556        If one or more non-final output blocks would consist solely of NUL
2557        bytes, try to seek the output file by the required space instead of
2558        filling them with NULs.  This results in a sparse file on some file
2559        systems.
2560
2561    *swab*
2562
2563        Swap every pair of input bytes.  If an input buffer has an odd number
2564        of bytes, the last byte will be ignored during swapping.
2565
2566    *sync*
2567
2568        Pad every input block to the input buffer size.  Spaces are used for
2569        pad bytes if a block oriented conversion value is specified, otherwise
2570        NUL bytes are used.
2571
2572    *ucase*
2573
2574        Transform lowercase characters into uppercase characters.
2575
2576    *unblock*
2577
2578        Treats the input as a sequence of fixed length records independent of
2579        input and output block boundaries.  The length of the input records is
2580        specified by the cbs operand.  Any trailing space characters are
2581        discarded and a newline character is appended.
2582
2583Where sizes are specified, a decimal number of bytes is expected.  Two
2584or more numbers may be separated by an “x” to indicate a product.
2585Each number may have one of the following optional suffixes:
2586
2587*b*
2588    Block; multiply by 512
2589
2590*k*
2591    Kibi; multiply by 1024 (1 KiB)
2592
2593*m*
2594    Mebi; multiply by 1048576 (1 MiB)
2595
2596*g*
2597    Gibi; multiply by 1073741824 (1 GiB)
2598
2599*t*
2600    Tebi; multiply by 1099511627776 (1 TiB)
2601
2602*w*
2603    Word; multiply by the number of bytes in an integer
2604
2605When finished, dd displays the number of complete and partial input
2606and output blocks, truncated input records and odd-length
2607byte-swapping ritten.  Partial output blocks to tape devices are
2608considered fatal errors.  Otherwise, the rest of the block will be
2609written.  Partial output blocks to character devices will produce a
2610warning message.  A truncated input block is one where a variable
2611length record oriented conversion value was specified and the input
2612line was too long to fit in the conversion record or was not newline
2613terminated.
2614
2615Normally, data resulting from input or conversion or both are
2616aggregated into output blocks of the specified size.  After the end of
2617input is reached, any remaining output is written as a block.  This
2618means that the final output block may be shorter than the output block
2619size.
2620
2621**EXIT STATUS:**
2622
2623This command returns 0 on success and non-zero if an error is encountered.
2624
2625**NOTES:**
2626
2627NONE
2628
2629**EXAMPLES:**
2630
2631The following is an example of how to use ``dd``:
2632.. code:: c
2633
2634    SHLL \[/] $ dd if=/nfs/boot-image of=/dev/hda1
2635
2636**CONFIGURATION:**
2637
2638.. index:: CONFIGURE_SHELL_NO_COMMAND_DD
2639.. index:: CONFIGURE_SHELL_COMMAND_DD
2640
2641This command is included in the default shell command set.  When
2642building a custom command set, define``CONFIGURE_SHELL_COMMAND_DD`` to have this command included.
2643
2644This command can be excluded from the shell command set by defining``CONFIGURE_SHELL_NO_COMMAND_DD`` when all shell commands have been
2645configured.
2646
2647**PROGRAMMING INFORMATION:**
2648
2649.. index:: rtems_shell_rtems_main_dd
2650
2651The ``dd`` command is implemented by a C language function which
2652has the following prototype:
2653.. code:: c
2654
2655    int rtems_shell_rtems_main_dd(
2656    int    argc,
2657    char \**argv
2658    );
2659
2660The configuration structure for the ``dd`` has the following
2661prototype:
2662.. code:: c
2663
2664    extern rtems_shell_cmd_t rtems_shell_DD_Command;
2665
2666debugrfs - debug RFS file system
2667--------------------------------
2668.. index:: debugrfs
2669
2670**SYNOPSYS:**
2671
2672.. code:: c
2673
2674    debugrfs \[-hl] path command \[options]
2675
2676**DESCRIPTION:**
2677
2678The command provides debugging information for the RFS file system.
2679
2680The options are:
2681
2682*-h*
2683    Print a help message.
2684
2685*-l*
2686    List the commands.
2687
2688*path*
2689    Path to the mounted RFS file system. The file system has to be mounted
2690    to view to use this command.
2691
2692The commands are:
2693
2694*block start \[end]*
2695    Display the contents of the blocks from start to end.
2696
2697*data*
2698    Display the file system data and configuration.
2699
2700*dir bno*
2701    Process the block as a directory displaying the entries.
2702
2703*group start \[end]*
2704    Display the group data from the start group to the end group.
2705
2706*inode \[-aef] \[start] \[end]*
2707
2708    Display the inodes between start and end. If no start and end is
2709    provides all inodes are displayed.
2710
2711    *-a*
2712
2713        Display all inodes. That is allocated and unallocated inodes.
2714
2715    *-e*
2716
2717        Search and display on inodes that have an error.
2718
2719    *-f*
2720
2721        Force display of inodes, even when in error.
2722
2723**EXIT STATUS:**
2724
2725This command returns 0 on success and non-zero if an error is encountered.
2726
2727**NOTES:**
2728
2729NONE
2730
2731**EXAMPLES:**
2732
2733The following is an example of how to use ``debugrfs``:
2734.. code:: c
2735
2736    SHLL \[/] $ debugrfs /c data
2737
2738**CONFIGURATION:**
2739
2740.. index:: CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS
2741.. index:: CONFIGURE_SHELL_COMMAND_DEBUGRFS
2742
2743This command is included in the default shell command set.
2744When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DEBUGRFS`` to have this
2745command included.
2746
2747This command can be excluded from the shell command set by
2748defining ``CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS`` when all
2749shell commands have been configured.
2750
2751**PROGRAMMING INFORMATION:**
2752
2753.. index:: rtems_shell_rtems_main_debugrfs
2754
2755The ``debugrfs`` command is implemented by a C language function which
2756has the following prototype:
2757.. code:: c
2758
2759    int rtems_shell_rtems_main_debugrfs(
2760    int    argc,
2761    char \**argv
2762    );
2763
2764The configuration structure for ``debugrfs`` has the following
2765prototype:
2766.. code:: c
2767
2768    extern rtems_shell_cmd_t rtems_shell_DEBUGRFS_Command;
2769
2770df - display file system disk space usage
2771-----------------------------------------
2772.. index:: df
2773
2774**SYNOPSYS:**
2775
2776.. code:: c
2777
2778    df \[-h] \[-B block_size]
2779
2780**DESCRIPTION:**
2781
2782This command print disk space usage for mounted file systems.
2783
2784**EXIT STATUS:**
2785
2786This command returns 0 on success and non-zero if an error is encountered.
2787
2788**NOTES:**
2789
2790NONE
2791
2792**EXAMPLES:**
2793
2794The following is an example of how to use ``df``:
2795.. code:: c
2796
2797    SHLL \[/] $ df -B 4K
2798    Filesystem     4K-blocks        Used   Available       Use%     Mounted on
2799    /dev/rda               124         1         124         0%   /mnt/ramdisk
2800    SHLL \[/] $ df
2801    Filesystem     1K-blocks        Used   Available       Use%     Mounted on
2802    /dev/rda               495         1         494         0%   /mnt/ramdisk
2803    SHLL \[/] $ df -h
2804    Filesystem     Size             Used   Available       Use%     Mounted on
2805    /dev/rda              495K        1K        494K         0%   /mnt/ramdisk
2806
2807**CONFIGURATION:**
2808
2809.. index:: CONFIGURE_SHELL_NO_COMMAND_DF
2810.. index:: CONFIGURE_SHELL_COMMAND_DF
2811
2812This command is included in the default shell command set.
2813When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DF`` to have this
2814command included.
2815
2816This command can be excluded from the shell command set by
2817defining ``CONFIGURE_SHELL_NO_COMMAND_DF`` when all
2818shell commands have been configured.
2819
2820**PROGRAMMING INFORMATION:**
2821
2822.. index:: rtems_shell_rtems_main_df
2823
2824The ``df`` is implemented by a C language function
2825which has the following prototype:
2826.. code:: c
2827
2828    int rtems_shell_main_df(
2829    int argc,
2830    char \**argv
2831    );
2832
2833The configuration structure for the ``df`` has the
2834following prototype:
2835.. code:: c
2836
2837    extern rtems_shell_cmd_t rtems_shell_DF_Command;
2838
2839dir - alias for ls
2840------------------
2841.. index:: dir
2842
2843**SYNOPSYS:**
2844
2845.. code:: c
2846
2847    dir \[dir]
2848
2849**DESCRIPTION:**
2850
2851This command is an alias or alternate name for the ``ls``.
2852See `ls - list files in the directory`_
2853for more information.
2854
2855**EXIT STATUS:**
2856
2857This command returns 0 on success and non-zero if an error is encountered.
2858
2859**NOTES:**
2860
2861NONE
2862
2863**EXAMPLES:**
2864
2865The following is an example of how to use ``dir``:
2866.. code:: c
2867
2868    SHLL \[/] $ dir
2869    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
2870    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
2871    2 files 1608 bytes occupied
2872    SHLL \[/] $ dir etc
2873    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
2874    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2875    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2876    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2877    4 files 202 bytes occupied
2878
2879**CONFIGURATION:**
2880
2881.. index:: CONFIGURE_SHELL_NO_COMMAND_DIR
2882.. index:: CONFIGURE_SHELL_COMMAND_DIR
2883
2884This command is included in the default shell command set.
2885When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DIR`` to have this
2886command included.
2887
2888This command can be excluded from the shell command set by
2889defining ``CONFIGURE_SHELL_NO_COMMAND_DIR`` when all
2890shell commands have been configured.
2891
2892**PROGRAMMING INFORMATION:**
2893
2894.. index:: rtems_shell_rtems_main_dir
2895
2896The ``dir`` is implemented by a C language function
2897which has the following prototype:
2898.. code:: c
2899
2900    int rtems_shell_rtems_main_dir(
2901    int    argc,
2902    char \**argv
2903    );
2904
2905The configuration structure for the ``dir`` has the
2906following prototype:
2907.. code:: c
2908
2909    extern rtems_shell_cmd_t rtems_shell_DIR_Command;
2910
2911fdisk - format disk
2912-------------------
2913.. index:: fdisk
2914
2915**SYNOPSYS:**
2916
2917.. code:: c
2918
2919    fdisk
2920
2921**CONFIGURATION:**
2922
2923.. index:: CONFIGURE_SHELL_NO_COMMAND_FDISK
2924.. index:: CONFIGURE_SHELL_COMMAND_FDISK
2925
2926This command is included in the default shell command set.
2927When building a custom command set, define``CONFIGURE_SHELL_COMMAND_FDISK`` to have this
2928command included.
2929
2930This command can be excluded from the shell command set by
2931defining ``CONFIGURE_SHELL_NO_COMMAND_FDISK`` when all
2932shell commands have been configured.
2933
2934hexdump - ascii/dec/hex/octal dump
2935----------------------------------
2936.. index:: hexdump
2937
2938**SYNOPSYS:**
2939
2940.. code:: c
2941
2942    hexdump \[-bcCdovx] \[-e format_string] \[-f format_file] \[-n length]
2943    \[-s skip] file ...
2944
2945**DESCRIPTION:**
2946
2947The hexdump utility is a filter which displays the specified files, or
2948the standard input, if no files are specified, in a user specified
2949format.
2950
2951The options are as follows:
2952
2953*-b*
2954    One-byte octal display.  Display the input offset in hexadecimal,
2955    followed by sixteen space-separated, three column, zero-filled, bytes
2956    of input data, in octal, per line.
2957
2958*-c*
2959    One-byte character display.  Display the input offset in hexadecimal,
2960    followed by sixteen space-separated, three column, space-filled,
2961    characters of input data per line.
2962
2963*-C*
2964    Canonical hex+ASCII display.  Display the input offset in hexadecimal,
2965    followed by sixteen space-separated, two column, hexadecimal bytes,
2966    followed by the same sixteen bytes in %_p format enclosed in “|”
2967    characters.
2968
2969*-d*
2970    Two-byte decimal display.  Display the input offset in hexadecimal,
2971    followed by eight space-separated, five column, zero-filled, two-byte
2972    units of input data, in unsigned decimal, per line.
2973
2974*-e format_string*
2975    Specify a format string to be used for displaying data.
2976
2977*-f format_file*
2978    Specify a file that contains one or more newline separated format
2979    strings.  Empty lines and lines whose first non-blank character is a
2980    hash mark (#) are ignored.
2981
2982*-n length*
2983    Interpret only length bytes of input.
2984
2985*-o*
2986    Two-byte octal display.  Display the input offset in hexadecimal,
2987    followed by eight space-separated, six column, zerofilled, two byte
2988    quantities of input data, in octal, per line.
2989
2990*-s offset*
2991    Skip offset bytes from the beginning of the input.  By default, offset
2992    is interpreted as a decimal number.  With a leading 0x or 0X, offset
2993    is interpreted as a hexadecimal number, otherwise, with a leading 0,
2994    offset is interpreted as an octal number.  Appending the character b,
2995    k, or m to offset causes it to be interpreted as a multiple of 512,
2996    1024, or 1048576, respectively.
2997
2998*-v*
2999    The -v option causes hexdump to display all input data.  Without the
3000    -v option, any number of groups of output lines, which would be
3001    identical to the immediately preceding group of output lines (except
3002    for the input offsets), are replaced with a line containing a single
3003    asterisk.
3004
3005*-x*
3006    Two-byte hexadecimal display.  Display the input offset in
3007    hexadecimal, followed by eight, space separated, four column,
3008    zero-filled, two-byte quantities of input data, in hexadecimal, per
3009    line.
3010
3011For each input file, hexdump sequentially copies the input to standard
3012output, transforming the data according to the format strings
3013specified by the -e and -f options, in the order that they were
3014specified.
3015
3016*Formats*
3017
3018A format string contains any number of format units, separated by
3019whitespace.  A format unit contains up to three items: an iteration
3020count, a byte count, and a format.
3021
3022The iteration count is an optional positive integer, which defaults to
3023one.  Each format is applied iteration count times.
3024
3025The byte count is an optional positive integer.  If specified it
3026defines the number of bytes to be interpreted by each iteration of the
3027format.
3028
3029If an iteration count and/or a byte count is specified, a single slash
3030must be placed after the iteration count and/or before the byte count
3031to disambiguate them.  Any whitespace before or after the slash is
3032ignored.
3033
3034The format is required and must be surrounded by double quote (“ “)
3035marks.  It is interpreted as a fprintf-style format string (see*fprintf*), with the following exceptions:
3036
3037- An asterisk (\*) may not be used as a field width or precision.
3038
3039- A byte count or field precision is required for each “s” con-
3040  version character (unlike the fprintf(3) default which prints the
3041  entire string if the precision is unspecified).
3042
3043- The conversion characters “h”, “l”, “n”, “p” and “q” are not
3044  supported.
3045
3046- The single character escape sequences described in the C standard
3047  are supported:
3048
3049      NUL                  \\0
3050      <alert character>    \\a
3051      <backspace>          \\b
3052      <form-feed>          \\f
3053      <newline>            \\n
3054      <carriage return>    \\r
3055      <tab>                \\t
3056      <vertical tab>       \\v
3057
3058Hexdump also supports the following additional conversion strings:
3059
3060*_a[dox]*
3061    Display the input offset, cumulative across input files, of the next
3062    byte to be displayed.  The appended characters d, o, and x specify the
3063    display base as decimal, octal or hexadecimal respectively.
3064
3065*_A[dox]*
3066    Identical to the _a conversion string except that it is only performed
3067    once, when all of the input data has been processed.
3068
3069*_c*
3070    Output characters in the default character set.  Nonprinting
3071    characters are displayed in three character, zero-padded octal, except
3072    for those representable by standard escape notation (see above), which
3073    are displayed as two character strings.
3074
3075*_p*
3076    Output characters in the default character set.  Nonprinting
3077    characters are displayed as a single “.”.
3078
3079*_u*
3080    Output US ASCII characters, with the exception that control characters
3081    are displayed using the following, lower-case, names.  Characters
3082    greater than 0xff, hexadecimal, are displayed as hexadecimal
3083    strings.
3084    000 nul  001 soh  002 stx  003 etx  004 eot  005 enq
3085    006 ack  007 bel  008 bs   009 ht   00A lf   00B vt
3086    00C ff   00D cr   00E so   00F si   010 dle  011 dc1
3087    012 dc2  013 dc3  014 dc4  015 nak  016 syn  017 etb
3088    018 can  019 em   01A sub  01B esc  01C fs   01D gs
3089    01E rs   01F us   07F del
3090
3091The default and supported byte counts for the conversion characters
3092are as follows:
3093
3094    %_c, %_p, %_u, %c       One byte counts only.
3095    %d, %i, %o, %u, %X, %x  Four byte default, one, two, four
3096    and eight byte counts supported.
3097    %E, %e, %f, %G, %g      Eight byte default, four byte
3098    counts supported.
3099
3100The amount of data interpreted by each format string is the sum of the
3101data required by each format unit, which is the iteration count times
3102the byte count, or the iteration count times the number of bytes
3103required by the format if the byte count is not specified.
3104
3105The input is manipulated in “blocks”, where a block is defined as
3106the largest amount of data specified by any format string.  Format
3107strings interpreting less than an input block’s worth of data, whose
3108last format unit both interprets some number of bytes and does not
3109have a specified iteration count, have the iteration count incremented
3110until the entire input block has been processed or there is not enough
3111data remaining in the block to satisfy the format string.
3112
3113If, either as a result of user specification or hexdump modifying the
3114iteration count as described above, an iteration count is greater than
3115one, no trailing whitespace characters are output during the last
3116iteration.
3117
3118It is an error to specify a byte count as well as multiple conversion
3119characters or strings unless all but one of the conversion characters
3120or strings is _a or _A.
3121
3122If, as a result of the specification of the -n option or end-of-file
3123being reached, input data only partially satisfies a format string,
3124the input block is zero-padded sufficiently to display all available
3125data (i.e. any format units overlapping the end of data will display
3126some num- ber of the zero bytes).
3127
3128Further output by such format strings is replaced by an equivalent
3129number of spaces.  An equivalent number of spaces is defined as the
3130number of spaces output by an s conversion character with the same
3131field width and precision as the original conversion character or
3132conversion string but with any “+”, “ ”, “#” conversion flag
3133characters removed, and ref- erencing a NULL string.
3134
3135If no format strings are specified, the default display is equivalent
3136to specifying the -x option.
3137
3138**EXIT STATUS:**
3139
3140This command returns 0 on success and non-zero if an error is encountered.
3141
3142**NOTES:**
3143
3144NONE
3145
3146**EXAMPLES:**
3147
3148The following is an example of how to use ``hexdump``:
3149.. code:: c
3150
3151    SHLL \[/] $ hexdump -C -n 512 /dev/hda1
3152
3153**CONFIGURATION:**
3154
3155.. index:: CONFIGURE_SHELL_NO_COMMAND_HEXDUMP
3156.. index:: CONFIGURE_SHELL_COMMAND_HEXDUMP
3157
3158This command is included in the default shell command set.  When
3159building a custom command set, define``CONFIGURE_SHELL_COMMAND_HEXDUMP`` to have this command included.
3160
3161This command can be excluded from the shell command set by defining``CONFIGURE_SHELL_NO_COMMAND_HEXDUMP`` when all shell commands have
3162been configured.
3163
3164**PROGRAMMING INFORMATION:**
3165
3166.. index:: rtems_shell_rtems_main_hexdump
3167
3168The ``hexdump`` command is implemented by a C language function
3169which has the following prototype:
3170.. code:: c
3171
3172    int rtems_shell_rtems_main_hexdump(
3173    int    argc,
3174    char \**argv
3175    );
3176
3177The configuration structure for the ``hexdump`` has the following
3178prototype:
3179.. code:: c
3180
3181    extern rtems_shell_cmd_t rtems_shell_HEXDUMP_Command;
3182
3183ln - make links
3184---------------
3185.. index:: ln
3186
3187**SYNOPSYS:**
3188
3189.. code:: c
3190
3191    ln \[-fhinsv] source_file \[target_file]
3192    ln \[-fhinsv] source_file ... target_dir
3193
3194**DESCRIPTION:**
3195
3196The ln utility creates a new directory entry (linked file) which has
3197the same modes as the original file.  It is useful for maintaining
3198multiple copies of a file in many places at once without using up
3199storage for the “copies”; instead, a link “points” to the original
3200copy.  There are two types of links; hard links and symbolic links.
3201How a link “points” to a file is one of the differences between a
3202hard or symbolic link.
3203
3204The options are as follows:
3205
3206*-f*
3207    Unlink any already existing file, permitting the link to occur.
3208
3209*-h*
3210    If the target_file or target_dir is a symbolic link, do not follow it.
3211    This is most useful with the -f option, to replace a symlink which may
3212    point to a directory.
3213
3214*-i*
3215    Cause ln to write a prompt to standard error if the target file
3216    exists.  If the response from the standard input begins with the
3217    character ‘y’ or ‘Y’, then unlink the target file so that the link may
3218    occur.  Otherwise, do not attempt the link.  (The -i option overrides
3219    any previous -f options.)
3220
3221*-n*
3222    Same as -h, for compatibility with other ln implementations.
3223
3224*-s*
3225    Create a symbolic link.
3226
3227*-v*
3228    Cause ln to be verbose, showing files as they are processed.
3229
3230By default ln makes hard links.  A hard link to a file is
3231indistinguishable from the original directory entry; any changes to a
3232file are effective independent of the name used to reference the file.
3233Hard links may not normally refer to directories and may not span file
3234systems.
3235
3236A symbolic link contains the name of the file to which it is linked.
3237The referenced file is used when an *open* operation is performed on
3238the link.  A *stat* on a symbolic link will return the linked-to
3239file; an *lstat* must be done to obtain information about the link.
3240The *readlink* call may be used to read the contents of a symbolic
3241link.  Symbolic links may span file systems and may refer to
3242directories.
3243
3244Given one or two arguments, ln creates a link to an existing file
3245source_file.  If target_file is given, the link has that name;
3246target_file may also be a directory in which to place the link;
3247otherwise it is placed in the current directory.  If only the
3248directory is specified, the link will be made to the last component of
3249source_file.
3250
3251Given more than two arguments, ln makes links in target_dir to all the
3252named source files.  The links made will have the same name as the
3253files being linked to.
3254
3255**EXIT STATUS:**
3256
3257The ``ln`` utility exits 0 on success, and >0 if an error occurs.
3258
3259**NOTES:**
3260
3261NONE
3262
3263**EXAMPLES:**
3264
3265.. code:: c
3266
3267    SHLL \[/] ln -s /dev/console /dev/con1
3268
3269**CONFIGURATION:**
3270
3271.. index:: CONFIGURE_SHELL_NO_COMMAND_LN
3272.. index:: CONFIGURE_SHELL_COMMAND_LN
3273
3274This command is included in the default shell command set.  When
3275building a custom command set, define``CONFIGURE_SHELL_COMMAND_LN`` to have this command included.
3276
3277This command can be excluded from the shell command set by
3278defining ``CONFIGURE_SHELL_NO_COMMAND_LN`` when all
3279shell commands have been configured.
3280
3281**PROGRAMMING INFORMATION:**
3282
3283.. index:: rtems_shell_rtems_main_ln
3284
3285The ``ln`` command is implemented by a C language function which
3286has the following prototype:
3287.. code:: c
3288
3289    int rtems_shell_rtems_main_ln(
3290    int    argc,
3291    char \**argv
3292    );
3293
3294The configuration structure for the ``ln`` has the following
3295prototype:
3296.. code:: c
3297
3298    extern rtems_shell_cmd_t rtems_shell_LN_Command;
3299
3300**ORIGIN:**
3301
3302The implementation and portions of the documentation for this command
3303are from NetBSD 4.0.
3304
3305ls - list files in the directory
3306--------------------------------
3307.. index:: ls
3308
3309**SYNOPSYS:**
3310
3311.. code:: c
3312
3313    ls \[dir]
3314
3315**DESCRIPTION:**
3316
3317This command displays the contents of the specified directory.  If
3318no arguments are given, then it displays the contents of the current
3319working directory.
3320
3321**EXIT STATUS:**
3322
3323This command returns 0 on success and non-zero if an error is encountered.
3324
3325**NOTES:**
3326
3327This command currently does not display information on a set of
3328files like the POSIX ls(1).  It only displays the contents of
3329entire directories.
3330
3331**EXAMPLES:**
3332
3333The following is an example of how to use ``ls``:
3334.. code:: c
3335
3336    SHLL \[/] $ ls
3337    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
3338    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
3339    2 files 1608 bytes occupied
3340    SHLL \[/] $ ls etc
3341    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
3342    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
3343    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
3344    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
3345    4 files 202 bytes occupied
3346    SHLL \[/] $ ls dev etc
3347    -rwxr-xr-x   1  rtems   root           0 Jan 01 00:00 console
3348    -rwxr-xr-x   1   root   root           0 Jan 01 00:00 console_b
3349
3350**CONFIGURATION:**
3351
3352.. index:: CONFIGURE_SHELL_NO_COMMAND_LS
3353.. index:: CONFIGURE_SHELL_COMMAND_LS
3354
3355This command is included in the default shell command set.
3356When building a custom command set, define``CONFIGURE_SHELL_COMMAND_LS`` to have this
3357command included.
3358
3359This command can be excluded from the shell command set by
3360defining ``CONFIGURE_SHELL_NO_COMMAND_LS`` when all
3361shell commands have been configured.
3362
3363**PROGRAMMING INFORMATION:**
3364
3365.. index:: rtems_shell_rtems_main_ls
3366
3367The ``ls`` is implemented by a C language function
3368which has the following prototype:
3369.. code:: c
3370
3371    int rtems_shell_rtems_main_ls(
3372    int    argc,
3373    char \**argv
3374    );
3375
3376The configuration structure for the ``ls`` has the
3377following prototype:
3378.. code:: c
3379
3380    extern rtems_shell_cmd_t rtems_shell_LS_Command;
3381
3382md5 - compute the Md5 hash of a file or list of files
3383-----------------------------------------------------
3384.. index:: md5
3385
3386**SYNOPSYS:**
3387
3388.. code:: c
3389
3390    md5 <files>
3391
3392**DESCRIPTION:**
3393
3394This command prints the MD5 of a file. You can provide one or more
3395files on the command line and a hash for each file is printed in a
3396single line of output.
3397
3398**EXIT STATUS:**
3399
3400This command returns 0 on success and non-zero if an error is encountered.
3401
3402**NOTES:**
3403
3404NONE
3405
3406**EXAMPLES:**
3407
3408The following is an example of how to use ``md5``:
3409.. code:: c
3410
3411    SHLL \[/] $ md5 shell-init
3412    MD5 (shell-init) = 43b4d2e71b47db79eae679a2efeacf31
3413
3414**CONFIGURATION:**
3415
3416.. index:: CONFIGURE_SHELL_NO_COMMAND_MD5
3417.. index:: CONFIGURE_SHELL_COMMAND_MD5
3418
3419This command is included in the default shell command set.
3420When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MD5`` to have this
3421command included.
3422
3423This command can be excluded from the shell command set by
3424defining ``CONFIGURE_SHELL_NO_COMMAND_MD5`` when all
3425shell commands have been configured.
3426
3427**PROGRAMMING INFORMATION:**
3428
3429.. index:: rtems_shell_rtems_main_md5
3430
3431The ``df`` is implemented by a C language function
3432which has the following prototype:
3433.. code:: c
3434
3435    int rtems_shell_main_md5(
3436    int argc,
3437    char \**argv
3438    );
3439
3440The configuration structure for the ``md5`` has the
3441following prototype:
3442.. code:: c
3443
3444    extern rtems_shell_cmd_t rtems_shell_MD5_Command;
3445
3446mkdir - create a directory
3447--------------------------
3448.. index:: mkdir
3449
3450**SYNOPSYS:**
3451
3452.. code:: c
3453
3454    mkdir  dir \[dir1 .. dirN]
3455
3456**DESCRIPTION:**
3457
3458This command creates the set of directories in the order they
3459are specified on the command line.  If an error is encountered
3460making one of the directories, the command will continue to
3461attempt to create the remaining directories on the command line.
3462
3463**EXIT STATUS:**
3464
3465This command returns 0 on success and non-zero if an error is encountered.
3466
3467**NOTES:**
3468
3469If this command is invoked with no arguments, nothing occurs.
3470
3471The user must have sufficient permissions to create the directory.
3472For the ``fileio`` test provided with RTEMS, this means the user
3473must login as ``root`` not ``rtems``.
3474
3475**EXAMPLES:**
3476
3477The following is an example of how to use ``mkdir``:
3478.. code:: c
3479
3480    SHLL \[/] # ls
3481    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
3482    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
3483    2 files 1608 bytes occupied
3484    SHLL \[/] # mkdir joel
3485    SHLL \[/] # ls joel
3486    0 files 0 bytes occupied
3487    SHLL \[/] # cp etc/passwd joel
3488    SHLL \[/] # ls joel
3489    -rw-r--r--   1   root   root         102 Jan 01 00:02 passwd
3490    1 files 102 bytes occupied
3491
3492**CONFIGURATION:**
3493
3494.. index:: CONFIGURE_SHELL_NO_COMMAND_MKDIR
3495.. index:: CONFIGURE_SHELL_COMMAND_MKDIR
3496
3497This command is included in the default shell command set.
3498When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKDIR`` to have this
3499command included.
3500
3501This command can be excluded from the shell command set by
3502defining ``CONFIGURE_SHELL_NO_COMMAND_MKDIR`` when all
3503shell commands have been configured.
3504
3505**PROGRAMMING INFORMATION:**
3506
3507.. index:: rtems_shell_rtems_main_mkdir
3508
3509The ``mkdir`` is implemented by a C language function
3510which has the following prototype:
3511.. code:: c
3512
3513    int rtems_shell_rtems_main_mkdir(
3514    int    argc,
3515    char \**argv
3516    );
3517
3518The configuration structure for the ``mkdir`` has the
3519following prototype:
3520.. code:: c
3521
3522    extern rtems_shell_cmd_t rtems_shell_MKDIR_Command;
3523
3524mldos - DOSFS file system format
3525--------------------------------
3526.. index:: pwd
3527
3528**SYNOPSYS:**
3529
3530.. code:: c
3531
3532    mkdir \[-V label] \[-s sectors/cluster] \[-r size] \[-v] path
3533
3534**DESCRIPTION:**
3535
3536This command formats a block device entry with the DOSFS file system.
3537
3538*-V label*
3539
3540*-s sectors/cluster*
3541
3542*-r size*
3543
3544**EXIT STATUS:**
3545
3546This command returns 0 on success and non-zero if an error is encountered.
3547
3548**NOTES:**
3549
3550NONE
3551
3552**EXAMPLES:**
3553
3554The following is an example of how to use ``mkdos``:
3555.. code:: c
3556
3557    SHLL \[/] $ mkdos /dev/rda1
3558
3559**CONFIGURATION:**
3560
3561.. index:: CONFIGURE_SHELL_NO_COMMAND_MKDOS
3562.. index:: CONFIGURE_SHELL_COMMAND_MKDOS
3563
3564This command is included in the default shell command set.
3565When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKDOS`` to have this
3566command included.
3567
3568This command can be excluded from the shell command set by
3569defining ``CONFIGURE_SHELL_NO_COMMAND_MKDOS`` when all
3570shell commands have been configured.
3571
3572**PROGRAMMING INFORMATION:**
3573
3574.. index:: rtems_shell_rtems_main_mkdos
3575
3576The ``mkdos`` is implemented by a C language function
3577which has the following prototype:
3578.. code:: c
3579
3580    int rtems_shell_rtems_main_mkdos(
3581    int    argc,
3582    char \**argv
3583    );
3584
3585The configuration structure for the ``mkdos`` has the
3586following prototype:
3587.. code:: c
3588
3589    extern rtems_shell_cmd_t rtems_shell_MKDOS_Command;
3590
3591mknod - make device special file
3592--------------------------------
3593.. index:: mknod
3594
3595**SYNOPSYS:**
3596
3597.. code:: c
3598
3599    mknod \[-rR] \[-F fmt] \[-g gid] \[-m mode] \[-u uid] name \[c | b]
3600    \[driver | major] minor
3601    mknod \[-rR] \[-F fmt] \[-g gid] \[-m mode] \[-u uid] name \[c | b]
3602    major unit subunit
3603    mknod \[-rR] \[-g gid] \[-m mode] \[-u uid] name \[c | b] number
3604    mknod \[-rR] \[-g gid] \[-m mode] \[-u uid] name p
3605
3606**DESCRIPTION:**
3607
3608The mknod command creates device special files, or fifos.  Normally
3609the shell script /dev/MAKEDEV is used to create special files for
3610commonly known devices; it executes mknod with the appropriate
3611arguments and can make all the files required for the device.
3612
3613To make nodes manually, the arguments are:
3614
3615*-r*
3616    Replace an existing file if its type is incorrect.
3617
3618*-R*
3619    Replace an existing file if its type is incorrect.  Correct the
3620    mode, user and group.
3621
3622*-g gid*
3623    Specify the group for the device node.  The gid operand may be a
3624    numeric group ID or a group name.  If a group name is also a numeric
3625    group ID, the operand is used as a group name.  Precede a numeric
3626    group ID with a # to stop it being treated as a name.
3627
3628*-m mode*
3629    Specify the mode for the device node.  The mode may be absolute or
3630    symbolic, see *chmod*.
3631
3632*-u uid*
3633    Specify the user for the device node.  The uid operand may be a
3634    numeric user ID or a user name.  If a user name is also a numeric user
3635    ID, the operand is used as a user name.  Precede a numeric user ID
3636    with a # to stop it being treated as a name.
3637
3638*name*
3639    Device name, for example “tty” for a termios serial device or “hd”
3640    for a disk.
3641
3642*b | c | p*
3643    Type of device.  If the device is a block type device such as a tape
3644    or disk drive which needs both cooked and raw special files, the type
3645    is b.  All other devices are character type devices, such as terminal
3646    and pseudo devices, and are type c.  Specifying p creates fifo files.
3647
3648*driver | major*
3649    The major device number is an integer number which tells the kernel
3650    which device driver entry point to use.  If the device driver is
3651    configured into the current kernel it may be specified by driver name
3652    or major number.
3653
3654*minor*
3655    The minor device number tells the kernel which one of several similar
3656    devices the node corresponds to; for example, it may be a specific
3657    serial port or pty.
3658
3659*unit and subunit*
3660    The unit and subunit numbers select a subset of a device; for example,
3661    the unit may specify a particular disk, and the subunit a partition on
3662    that disk.  (Currently this form of specification is only supported
3663    by the bsdos format, for compatibility with the BSD/OS mknod).
3664
3665*number*
3666    A single opaque device number.  Useful for netbooted computers which
3667    require device numbers packed in a format that isn’t supported by
3668    -F.
3669
3670**EXIT STATUS:**
3671
3672The ``mknod`` utility exits 0 on success, and >0 if an error occurs.
3673
3674**NOTES:**
3675
3676NONE
3677
3678**EXAMPLES:**
3679
3680.. code:: c
3681
3682    SHLL \[/] mknod c 3 0 /dev/ttyS10
3683
3684**CONFIGURATION:**
3685
3686.. index:: CONFIGURE_SHELL_NO_COMMAND_MKNOD
3687.. index:: CONFIGURE_SHELL_COMMAND_MKNOD
3688
3689This command is included in the default shell command set.  When
3690building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKNOD`` to have this command included.
3691
3692This command can be excluded from the shell command set by
3693defining ``CONFIGURE_SHELL_NO_COMMAND_MKNOD`` when all
3694shell commands have been configured.
3695
3696**PROGRAMMING INFORMATION:**
3697
3698.. index:: rtems_shell_rtems_main_mknod
3699
3700The ``mknod`` command is implemented by a C language function which
3701has the following prototype:
3702.. code:: c
3703
3704    int rtems_shell_rtems_main_mknod(
3705    int    argc,
3706    char \**argv
3707    );
3708
3709The configuration structure for the ``mknod`` has the following
3710prototype:
3711.. code:: c
3712
3713    extern rtems_shell_cmd_t rtems_shell_MKNOD_Command;
3714
3715**ORIGIN:**
3716
3717The implementation and portions of the documentation for this command
3718are from NetBSD 4.0.
3719
3720mkrfs - format RFS file system
3721------------------------------
3722.. index:: mkrfs
3723
3724**SYNOPSYS:**
3725
3726.. code:: c
3727
3728    mkrfs \[-vsbiIo] device
3729
3730**DESCRIPTION:**
3731
3732Format the block device with the RTEMS File System (RFS). The default
3733configuration with not parameters selects a suitable block size based
3734on the size of the media being formatted.
3735
3736The media is broken up into groups of blocks. The number of blocks in
3737a group is based on the number of bits a block contains. The large a
3738block the more blocks a group contains and the fewer groups in the
3739file system.
3740
3741The following options are provided:
3742
3743*-v*
3744    Display configuration and progress of the format.
3745
3746*-s*
3747    Set the block size in bytes.
3748
3749*-b*
3750    The number of blocks in a group. The block count must be equal or less
3751    than the number of bits in a block.
3752
3753*-i*
3754    Number of inodes in a group. The inode count must be equal or less
3755    than the number of bits in a block.
3756
3757*-I*
3758    Initialise the inodes. The default is not to initialise the inodes and
3759    to rely on the inode being initialised when allocated. Initialising
3760    the inode table helps recovery if a problem appears.
3761
3762*-o*
3763    Integer percentage of the media used by inodes. The default is 1%.
3764
3765*device*
3766    Path of the device to format.
3767
3768**EXIT STATUS:**
3769
3770This command returns 0 on success and non-zero if an error is encountered.
3771
3772**NOTES:**
3773
3774NONE
3775
3776**EXAMPLES:**
3777
3778The following is an example of how to use ``mkrfs``:
3779.. code:: c
3780
3781    SHLL \[/] $ mkrfs /dev/fdda
3782
3783**CONFIGURATION:**
3784
3785.. index:: CONFIGURE_SHELL_NO_COMMAND_MKRFS
3786.. index:: CONFIGURE_SHELL_COMMAND_MKRFS
3787
3788This command is included in the default shell command set.
3789When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKRFS`` to have this
3790command included.
3791
3792This command can be excluded from the shell command set by
3793defining ``CONFIGURE_SHELL_NO_COMMAND_MKRFS`` when all
3794shell commands have been configured.
3795
3796**PROGRAMMING INFORMATION:**
3797
3798.. index:: rtems_shell_rtems_main_mkrfs
3799
3800The ``mkrfs`` command is implemented by a C language function which
3801has the following prototype:
3802.. code:: c
3803
3804    int rtems_shell_rtems_main_mkrfs(
3805    int    argc,
3806    char \**argv
3807    );
3808
3809The configuration structure for ``mkrfs`` has the following
3810prototype:
3811.. code:: c
3812
3813    extern rtems_shell_cmd_t rtems_shell_MKRFS_Command;
3814
3815mount - mount disk
3816------------------
3817.. index:: mount
3818
3819**SYNOPSYS:**
3820
3821.. code:: c
3822
3823    mount \[-t fstype] \[-r] \[-L] device path
3824
3825**DESCRIPTION:**
3826
3827The ``mount`` command will mount a block device to a mount point
3828using the specified file system. The files systems are:
3829
3830- msdos - MSDOS File System
3831
3832- tftp  - TFTP Network File System
3833
3834- ftp   - FTP Network File System
3835
3836- nfs   - Network File System
3837
3838- rfs   - RTEMS File System
3839
3840When the file system type is ’msdos’ or ’rfs’ the driver is a "block
3841device driver" node present in the file system. The driver is ignored
3842with the ’tftp’ and ’ftp’ file systems. For the ’nfs’ file system the
3843driver is the ’host:/path’ string that described NFS host and the
3844exported file system path.
3845
3846**EXIT STATUS:**
3847
3848This command returns 0 on success and non-zero if an error is encountered.
3849
3850**NOTES:**
3851
3852The mount point must exist.
3853
3854The services offered by each file-system vary. For example you cannot list the
3855directory of a TFTP file-system as this server is not provided in the TFTP
3856protocol. You need to check each file-system’s documentation for the services
3857provided.
3858
3859**EXAMPLES:**
3860
3861Mount the Flash Disk driver to the ’/fd’ mount point:
3862.. code:: c
3863
3864    SHLL \[/] $ mount -t msdos /dev/flashdisk0 /fd
3865
3866Mount the NFS file system exported path ’bar’ by host ’foo’:
3867.. code:: c
3868
3869    $ mount -t nfs foo:/bar /nfs
3870
3871Mount the TFTP file system on ’/tftp’:
3872.. code:: c
3873
3874    $ mount -t tftp /tftp
3875
3876To access the TFTP files on server ’10.10.10.10’:
3877.. code:: c
3878
3879    $ cat /tftp/10.10.10.10/test.txt
3880
3881**CONFIGURATION:**
3882
3883.. index:: CONFIGURE_SHELL_NO_COMMAND_MOUNT
3884.. index:: CONFIGURE_SHELL_COMMAND_MOUNT
3885
3886This command is included in the default shell command set.
3887When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MOUNT`` to have this
3888command included.
3889
3890This command can be excluded from the shell command set by
3891defining ``CONFIGURE_SHELL_NO_COMMAND_MOUNT`` when all
3892shell commands have been configured.
3893
3894The mount command includes references to file-system code. If you do not wish
3895to include file-system that you do not use do not define the mount command
3896support for that file-system. The file-system mount command defines are:
3897
3898- msdos - CONFIGURE_SHELL_MOUNT_MSDOS
3899
3900- tftp - CONFIGURE_SHELL_MOUNT_TFTP
3901
3902- ftp - CONFIGURE_SHELL_MOUNT_FTP
3903
3904- nfs - CONFIGURE_SHELL_MOUNT_NFS
3905
3906- rfs - CONFIGURE_SHELL_MOUNT_RFS
3907
3908An example configuration is:
3909.. code:: c
3910
3911    #define CONFIGURE_SHELL_MOUNT_MSDOS
3912    #ifdef RTEMS_NETWORKING
3913    #define CONFIGURE_SHELL_MOUNT_TFTP
3914    #define CONFIGURE_SHELL_MOUNT_FTP
3915    #define CONFIGURE_SHELL_MOUNT_NFS
3916    #define CONFIGURE_SHELL_MOUNT_RFS
3917    #endif
3918
3919**PROGRAMMING INFORMATION:**
3920
3921.. index:: rtems_shell_rtems_main_mount
3922
3923The ``mount`` is implemented by a C language function
3924which has the following prototype:
3925.. code:: c
3926
3927    int rtems_shell_rtems_main_mount(
3928    int    argc,
3929    char \**argv
3930    );
3931
3932The configuration structure for the ``mount`` has the
3933following prototype:
3934.. code:: c
3935
3936    extern rtems_shell_cmd_t rtems_shell_MOUNT_Command;
3937
3938mv - move files
3939---------------
3940.. index:: mv
3941
3942**SYNOPSYS:**
3943
3944.. code:: c
3945
3946    mv \[-fiv] source_file target_file
3947    mv \[-fiv] source_file... target_file
3948
3949**DESCRIPTION:**
3950
3951In its first form, the mv utility renames the file named by the source
3952operand to the destination path named by the target operand.  This
3953form is assumed when the last operand does not name an already
3954existing directory.
3955
3956In its second form, mv moves each file named by a source operand to a
3957destination file in the existing directory named by the directory
3958operand.  The destination path for each operand is the pathname
3959produced by the concatenation of the last operand, a slash, and the
3960final pathname component of the named file.
3961
3962The following options are available:
3963
3964*-f*
3965    Do not prompt for confirmation before overwriting the destination
3966    path.
3967
3968*-i*
3969    Causes mv to write a prompt to standard error before moving a file
3970    that would overwrite an existing file.  If the response from the
3971    standard input begins with the character ’y’, the move is attempted.
3972
3973*-v*
3974    Cause mv to be verbose, showing files as they are processed.
3975
3976The last of any -f or -i options is the one which affects mv’s
3977behavior.
3978
3979It is an error for any of the source operands to specify a nonexistent
3980file or directory.
3981
3982It is an error for the source operand to specify a directory if the
3983target exists and is not a directory.
3984
3985If the destination path does not have a mode which permits writing, mv
3986prompts the user for confirmation as specified for the -i option.
3987
3988Should the *rename* call fail because source and target are on
3989different file systems, ``mv`` will remove the destination file,
3990copy the source file to the destination, and then remove the source.
3991The effect is roughly equivalent to:
3992.. code:: c
3993
3994    rm -f destination_path && \\
3995    cp -PRp source_file destination_path && \\
3996    rm -rf source_file
3997
3998**EXIT STATUS:**
3999
4000The ``mv`` utility exits 0 on success, and >0 if an error occurs.
4001
4002**NOTES:**
4003
4004NONE
4005
4006**EXAMPLES:**
4007
4008.. code:: c
4009
4010    SHLL \[/] mv /dev/console /dev/con1
4011
4012**CONFIGURATION:**
4013
4014.. index:: CONFIGURE_SHELL_NO_COMMAND_MV
4015.. index:: CONFIGURE_SHELL_COMMAND_MV
4016
4017This command is included in the default shell command set.  When
4018building a custom command set, define``CONFIGURE_SHELL_COMMAND_MV`` to have this command included.
4019
4020This command can be excluded from the shell command set by
4021defining ``CONFIGURE_SHELL_NO_COMMAND_MV`` when all
4022shell commands have been configured.
4023
4024**PROGRAMMING INFORMATION:**
4025
4026.. index:: rtems_shell_main_mv
4027
4028The ``mv`` command is implemented by a C language function which
4029has the following prototype:
4030.. code:: c
4031
4032    int rtems_shell_main_mv(
4033    int    argc,
4034    char \**argv
4035    );
4036
4037The configuration structure for the ``mv`` has the
4038following prototype:
4039.. code:: c
4040
4041    extern rtems_shell_cmd_t rtems_shell_MV_Command;
4042
4043**ORIGIN:**
4044
4045The implementation and portions of the documentation for this command
4046are from NetBSD 4.0.
4047
4048pwd - print work directory
4049--------------------------
4050.. index:: pwd
4051
4052**SYNOPSYS:**
4053
4054.. code:: c
4055
4056    pwd
4057
4058**DESCRIPTION:**
4059
4060This command prints the fully qualified filename of the current
4061working directory.
4062
4063**EXIT STATUS:**
4064
4065This command returns 0 on success and non-zero if an error is encountered.
4066
4067**NOTES:**
4068
4069NONE
4070
4071**EXAMPLES:**
4072
4073The following is an example of how to use ``pwd``:
4074.. code:: c
4075
4076    SHLL \[/] $ pwd
4077    /
4078    SHLL \[/] $ cd dev
4079    SHLL \[/dev] $ pwd
4080    /dev
4081
4082**CONFIGURATION:**
4083
4084.. index:: CONFIGURE_SHELL_NO_COMMAND_PWD
4085.. index:: CONFIGURE_SHELL_COMMAND_PWD
4086
4087This command is included in the default shell command set.
4088When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PWD`` to have this
4089command included.
4090
4091This command can be excluded from the shell command set by
4092defining ``CONFIGURE_SHELL_NO_COMMAND_PWD`` when all
4093shell commands have been configured.
4094
4095**PROGRAMMING INFORMATION:**
4096
4097.. index:: rtems_shell_rtems_main_pwd
4098
4099The ``pwd`` is implemented by a C language function
4100which has the following prototype:
4101.. code:: c
4102
4103    int rtems_shell_rtems_main_pwd(
4104    int    argc,
4105    char \**argv
4106    );
4107
4108The configuration structure for the ``pwd`` has the
4109following prototype:
4110.. code:: c
4111
4112    extern rtems_shell_cmd_t rtems_shell_PWD_Command;
4113
4114rmdir - remove empty directories
4115--------------------------------
4116.. index:: rmdir
4117
4118**SYNOPSYS:**
4119
4120.. code:: c
4121
4122    rmdir  \[dir1 .. dirN]
4123
4124**DESCRIPTION:**
4125
4126This command removes the specified set of directories.  If no
4127directories are provided on the command line, no actions are taken.
4128
4129**EXIT STATUS:**
4130
4131This command returns 0 on success and non-zero if an error is encountered.
4132
4133**NOTES:**
4134
4135This command is a implemented using the ``rmdir(2)`` system
4136call and all reasons that call may fail apply to this command.
4137
4138**EXAMPLES:**
4139
4140The following is an example of how to use ``rmdir``:
4141.. code:: c
4142
4143    SHLL \[/] # mkdir joeldir
4144    SHLL \[/] # rmdir joeldir
4145    SHLL \[/] # ls joeldir
4146    joeldir: No such file or directory.
4147
4148**CONFIGURATION:**
4149
4150.. index:: CONFIGURE_SHELL_NO_COMMAND_RMDIR
4151.. index:: CONFIGURE_SHELL_COMMAND_RMDIR
4152
4153This command is included in the default shell command set.
4154When building a custom command set, define``CONFIGURE_SHELL_COMMAND_RMDIR`` to have this
4155command included.
4156
4157This command can be excluded from the shell command set by
4158defining ``CONFIGURE_SHELL_NO_COMMAND_RMDIR`` when all
4159shell commands have been configured.
4160
4161**PROGRAMMING INFORMATION:**
4162
4163.. index:: rtems_shell_rtems_main_rmdir
4164
4165The ``rmdir`` is implemented by a C language function
4166which has the following prototype:
4167.. code:: c
4168
4169    int rtems_shell_rtems_main_rmdir(
4170    int    argc,
4171    char \**argv
4172    );
4173
4174The configuration structure for the ``rmdir`` has the
4175following prototype:
4176.. code:: c
4177
4178    extern rtems_shell_cmd_t rtems_shell_RMDIR_Command;
4179
4180rm - remove files
4181-----------------
4182.. index:: rm
4183
4184**SYNOPSYS:**
4185
4186.. code:: c
4187
4188    rm file1 \[file2 ... fileN]
4189
4190**DESCRIPTION:**
4191
4192This command deletes a name from the filesystem.  If the specified file name
4193was the last link to a file and there are no ``open`` file descriptor
4194references to that file, then it is deleted and the associated space in
4195the file system is made available for subsequent use.
4196
4197If the filename specified was the last link to a file but there
4198are open file descriptor references to it, then the file will
4199remain in existence until the last file descriptor referencing
4200it is closed.
4201
4202**EXIT STATUS:**
4203
4204This command returns 0 on success and non-zero if an error is encountered.
4205
4206**NOTES:**
4207
4208NONE
4209
4210**EXAMPLES:**
4211
4212The following is an example of how to use ``rm``:
4213.. code:: c
4214
4215    SHLL \[/] # cp /etc/passwd tmpfile
4216    SHLL \[/] # cat tmpfile
4217    root:\*:0:0:root::/:/bin/sh
4218    rtems:\*:1:1:RTEMS Application::/:/bin/sh
4219    tty:!:2:2:tty owner::/:/bin/false
4220    SHLL \[/] # rm tmpfile
4221    SHLL \[/] # cat tmpfile
4222    cat: tmpfile: No such file or directory
4223
4224**CONFIGURATION:**
4225
4226.. index:: CONFIGURE_SHELL_NO_COMMAND_RM
4227.. index:: CONFIGURE_SHELL_COMMAND_RM
4228
4229This command is included in the default shell command set.
4230When building a custom command set, define``CONFIGURE_SHELL_COMMAND_RM`` to have this
4231command included.
4232
4233This command can be excluded from the shell command set by
4234defining ``CONFIGURE_SHELL_NO_COMMAND_RM`` when all
4235shell commands have been configured.
4236
4237**PROGRAMMING INFORMATION:**
4238
4239.. index:: rtems_shell_main_rm
4240
4241The ``rm`` is implemented by a C language function
4242which has the following prototype:
4243.. code:: c
4244
4245    int rtems_shell_main_rm(
4246    int    argc,
4247    char \**argv
4248    );
4249
4250The configuration structure for the ``rm`` has the
4251following prototype:
4252.. code:: c
4253
4254    extern rtems_shell_cmd_t rtems_shell_RM_Command;
4255
4256umask - set file mode creation mask
4257-----------------------------------
4258.. index:: umask
4259
4260**SYNOPSYS:**
4261
4262.. code:: c
4263
4264    umask \[new_umask]
4265
4266**DESCRIPTION:**
4267
4268This command sets the user file creation mask to ``new_umask``.  The
4269argument ``new_umask`` may be octal, hexadecimal, or decimal.
4270
4271**EXIT STATUS:**
4272
4273This command returns 0 on success and non-zero if an error is encountered.
4274
4275**NOTES:**
4276
4277This command does not currently support symbolic mode masks.
4278
4279**EXAMPLES:**
4280
4281The following is an example of how to use ``umask``:
4282.. code:: c
4283
4284    SHLL \[/] $ umask
4285    022
4286    SHLL \[/] $ umask 0666
4287    0666
4288    SHLL \[/] $ umask
4289    0666
4290
4291**CONFIGURATION:**
4292
4293.. index:: CONFIGURE_SHELL_NO_COMMAND_UMASK
4294.. index:: CONFIGURE_SHELL_COMMAND_UMASK
4295
4296This command is included in the default shell command set.
4297When building a custom command set, define``CONFIGURE_SHELL_COMMAND_UMASK`` to have this
4298command included.
4299
4300This command can be excluded from the shell command set by
4301defining ``CONFIGURE_SHELL_NO_COMMAND_UMASK`` when all
4302shell commands have been configured.
4303
4304**PROGRAMMING INFORMATION:**
4305
4306.. index:: rtems_shell_rtems_main_umask
4307
4308The ``umask`` is implemented by a C language function
4309which has the following prototype:
4310.. code:: c
4311
4312    int rtems_shell_rtems_main_umask(
4313    int    argc,
4314    char \**argv
4315    );
4316
4317The configuration structure for the ``umask`` has the
4318following prototype:
4319.. code:: c
4320
4321    extern rtems_shell_cmd_t rtems_shell_UMASK_Command;
4322
4323unmount - unmount disk
4324----------------------
4325.. index:: unmount
4326
4327**SYNOPSYS:**
4328
4329.. code:: c
4330
4331    unmount path
4332
4333**DESCRIPTION:**
4334
4335This command unmounts the device at the specified ``path``.
4336
4337**EXIT STATUS:**
4338
4339This command returns 0 on success and non-zero if an error is encountered.
4340
4341**NOTES:**
4342
4343TBD - Surely there must be some warnings to go here.
4344
4345**EXAMPLES:**
4346
4347The following is an example of how to use ``unmount``:
4348.. code:: c
4349
4350    EXAMPLE_TBD
4351
4352**CONFIGURATION:**
4353
4354.. index:: CONFIGURE_SHELL_NO_COMMAND_UNMOUNT
4355.. index:: CONFIGURE_SHELL_COMMAND_UNMOUNT
4356
4357This command is included in the default shell command set.
4358When building a custom command set, define``CONFIGURE_SHELL_COMMAND_UNMOUNT`` to have this
4359command included.
4360
4361This command can be excluded from the shell command set by
4362defining ``CONFIGURE_SHELL_NO_COMMAND_UNMOUNT`` when all
4363shell commands have been configured.
4364
4365**PROGRAMMING INFORMATION:**
4366
4367.. index:: rtems_shell_rtems_main_unmount
4368
4369The ``unmount`` is implemented by a C language function
4370which has the following prototype:
4371.. code:: c
4372
4373    int rtems_shell_rtems_main_unmount(
4374    int    argc,
4375    char \**argv
4376    );
4377
4378The configuration structure for the ``unmount`` has the
4379following prototype:
4380.. code:: c
4381
4382    extern rtems_shell_cmd_t rtems_shell_UNMOUNT_Command;
4383
4384.. COMMENT: COPYRIGHT (c) 1988-2012.
4385
4386.. COMMENT: On-Line Applications Research Corporation (OAR).
4387
4388.. COMMENT: All rights reserved.
4389
4390Memory Commands
4391###############
4392
4393Introduction
4394============
4395
4396The RTEMS shell has the following memory commands:
4397
4398- ``mdump`` - Display contents of memory
4399
4400- ``wdump`` - Display contents of memory (word)
4401
4402- ``ldump`` - Display contents of memory (longword)
4403
4404- ``medit`` - Modify contents of memory
4405
4406- ``mfill`` - File memory with pattern
4407
4408- ``mmove`` - Move contents of memory
4409
4410- ``malloc`` - Obtain information on C Program Heap
4411
4412Commands
4413========
4414
4415This section details the Memory Commands available.  A
4416subsection is dedicated to each of the commands and
4417describes the behavior and configuration of that
4418command as well as providing an example usage.
4419
4420mdump - display contents of memory
4421----------------------------------
4422.. index:: mdump
4423
4424**SYNOPSYS:**
4425
4426.. code:: c
4427
4428    mdump \[address \[length \[size]]]
4429
4430**DESCRIPTION:**
4431
4432This command displays the contents of memory at the ``address``
4433and ``length`` in ``size`` byte units specified on the command line.
4434
4435When ``size`` is not provided, it defaults to ``1`` byte units.
4436Values of ``1``, ``2``, and ``4`` are valid; all others will
4437cause an error to be reported.
4438
4439When ``length`` is not provided, it defaults to ``320`` which
4440is twenty lines of output with sixteen bytes of output per line.
4441
4442When ``address`` is not provided, it defaults to ``0x00000000``.
4443
4444**EXIT STATUS:**
4445
4446This command always returns 0 to indicate success.
4447
4448**NOTES:**
4449
4450Dumping memory from a non-existent address may result in an unrecoverable
4451program fault.
4452
4453**EXAMPLES:**
4454
4455The following is an example of how to use ``mdump``:
4456.. code:: c
4457
4458    SHLL \[/] $ mdump 0x10000 32
4459    0x0001000000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
4460    0x0001001000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
4461    SHLL \[/] $ mdump 0x02000000 32
4462    0x02000000A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
4463    0x02000010A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
4464    SHLL \[/] $ mdump 0x02001000 32
4465    0x0200100003 00 80 00 82 10 60 00-81 98 40 00 83 48 00 00 ......`.....H..
4466    0x0200101084 00 60 01 84 08 A0 07-86 10 20 01 87 28 C0 02 ..`....... ..(..
4467
4468**CONFIGURATION:**
4469
4470.. index:: CONFIGURE_SHELL_NO_COMMAND_MDUMP
4471.. index:: CONFIGURE_SHELL_COMMAND_MDUMP
4472
4473This command is included in the default shell command set.
4474When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MDUMP`` to have this
4475command included.
4476
4477This command can be excluded from the shell command set by
4478defining ``CONFIGURE_SHELL_NO_COMMAND_MDUMP`` when all
4479shell commands have been configured.
4480
4481**PROGRAMMING INFORMATION:**
4482
4483.. index:: rtems_shell_rtems_main_mdump
4484
4485The ``mdump`` is implemented by a C language function
4486which has the following prototype:
4487.. code:: c
4488
4489    int rtems_shell_rtems_main_mdump(
4490    int    argc,
4491    char \**argv
4492    );
4493
4494The configuration structure for the ``mdump`` has the
4495following prototype:
4496.. code:: c
4497
4498    extern rtems_shell_cmd_t rtems_shell_MDUMP_Command;
4499
4500wdump - display contents of memory (word)
4501-----------------------------------------
4502.. index:: wdump
4503
4504**SYNOPSYS:**
4505
4506.. code:: c
4507
4508    wdump \[address \[length]]
4509
4510**DESCRIPTION:**
4511
4512This command displays the contents of memory at the ``address``
4513and ``length`` in bytes specified on the command line.
4514
4515This command is equivalent to ``mdump address length 2``.
4516
4517When ``length`` is not provided, it defaults to ``320`` which
4518is twenty lines of output with eight words of output per line.
4519
4520When ``address`` is not provided, it defaults to ``0x00000000``.
4521
4522**EXIT STATUS:**
4523
4524This command always returns 0 to indicate success.
4525
4526**NOTES:**
4527
4528Dumping memory from a non-existent address may result in an unrecoverable
4529program fault.
4530
4531**EXAMPLES:**
4532
4533The following is an example of how to use ``wdump``:
4534.. code:: c
4535
4536    SHLL \[/] $ wdump 0x02010000 32
4537    0x02010000 0201 08D8 0201 08C0-0201 08AC 0201 0874 ...............t
4538    0x02010010 0201 0894 0201 0718-0201 0640 0201 0798 ...............
4539
4540**CONFIGURATION:**
4541
4542.. index:: CONFIGURE_SHELL_NO_COMMAND_WDUMP
4543.. index:: CONFIGURE_SHELL_COMMAND_WDUMP
4544
4545This command is included in the default shell command set.
4546When building a custom command set, define``CONFIGURE_SHELL_COMMAND_WDUMP`` to have this
4547command included.
4548
4549This command can be excluded from the shell command set by
4550defining ``CONFIGURE_SHELL_NO_COMMAND_WDUMP`` when all
4551shell commands have been configured.
4552
4553**PROGRAMMING INFORMATION:**
4554
4555.. index:: rtems_shell_rtems_main_wdump
4556
4557The ``wdump`` is implemented by a C language function
4558which has the following prototype:
4559.. code:: c
4560
4561    int rtems_shell_rtems_main_wdump(
4562    int    argc,
4563    char \**argv
4564    );
4565
4566The configuration structure for the ``wdump`` has the
4567following prototype:
4568.. code:: c
4569
4570    extern rtems_shell_cmd_t rtems_shell_WDUMP_Command;
4571
4572ldump - display contents of memory (longword)
4573---------------------------------------------
4574.. index:: ldump
4575
4576**SYNOPSYS:**
4577
4578.. code:: c
4579
4580    ldump \[address \[length]]
4581
4582**DESCRIPTION:**
4583
4584This command displays the contents of memory at the ``address``
4585and ``length`` in bytes specified on the command line.
4586
4587This command is equivalent to ``mdump address length 4``.
4588
4589When ``length`` is not provided, it defaults to ``320`` which
4590is twenty lines of output with four longwords of output per line.
4591
4592When ``address`` is not provided, it defaults to ``0x00000000``.
4593
4594**EXIT STATUS:**
4595
4596This command always returns 0 to indicate success.
4597
4598**NOTES:**
4599
4600Dumping memory from a non-existent address may result in an unrecoverable
4601program fault.
4602
4603**EXAMPLES:**
4604
4605The following is an example of how to use ``ldump``:
4606.. code:: c
4607
4608    SHLL \[/] $ ldump 0x02010000 32
4609    0x02010000 020108D8 020108C0-020108AC 02010874 ...............t
4610    0x02010010 020 0894 02010718-02010640 02010798 ...............
4611
4612**CONFIGURATION:**
4613
4614.. index:: CONFIGURE_SHELL_NO_COMMAND_LDUMP
4615.. index:: CONFIGURE_SHELL_COMMAND_LDUMP
4616
4617This command is included in the default shell command set.
4618When building a custom command set, define``CONFIGURE_SHELL_COMMAND_LDUMP`` to have this
4619command included.
4620
4621This command can be excluded from the shell command set by
4622defining ``CONFIGURE_SHELL_NO_COMMAND_LDUMP`` when all
4623shell commands have been configured.
4624
4625**PROGRAMMING INFORMATION:**
4626
4627.. index:: rtems_shell_rtems_main_ldump
4628
4629The ``ldump`` is implemented by a C language function
4630which has the following prototype:
4631.. code:: c
4632
4633    int rtems_shell_rtems_main_ldump(
4634    int    argc,
4635    char \**argv
4636    );
4637
4638The configuration structure for the ``ldump`` has the
4639following prototype:
4640.. code:: c
4641
4642    extern rtems_shell_cmd_t rtems_shell_LDUMP_Command;
4643
4644medit - modify contents of memory
4645---------------------------------
4646.. index:: medit
4647
4648**SYNOPSYS:**
4649
4650.. code:: c
4651
4652    medit address value1 \[value2 ... valueN]
4653
4654**DESCRIPTION:**
4655
4656This command is used to modify the contents of the memory starting
4657at ``address`` using the octets specified by the parameters``value1`` through ``valueN``.
4658
4659**EXIT STATUS:**
4660
4661This command returns 0 on success and non-zero if an error is encountered.
4662
4663**NOTES:**
4664
4665Dumping memory from a non-existent address may result in an unrecoverable
4666program fault.
4667
4668**EXAMPLES:**
4669
4670The following is an example of how to use ``medit``:
4671.. code:: c
4672
4673    SHLL \[/] $ mdump 0x02000000 32
4674    0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
4675    0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
4676    SHLL \[/] $  medit 0x02000000 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09
4677    SHLL \[/] $ mdump 0x02000000 32
4678    0x02000000 01 02 03 04 05 06 07 08-09 00 22 BC A6 10 21 00 .........."...!.
4679    0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
4680
4681**CONFIGURATION:**
4682
4683.. index:: CONFIGURE_SHELL_NO_COMMAND_MEDIT
4684.. index:: CONFIGURE_SHELL_COMMAND_MEDIT
4685
4686This command is included in the default shell command set.
4687When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MEDIT`` to have this
4688command included.
4689
4690This command can be excluded from the shell command set by
4691defining ``CONFIGURE_SHELL_NO_COMMAND_MEDIT`` when all
4692shell commands have been configured.
4693
4694**PROGRAMMING INFORMATION:**
4695
4696.. index:: rtems_shell_rtems_main_medit
4697
4698The ``medit`` is implemented by a C language function
4699which has the following prototype:
4700.. code:: c
4701
4702    int rtems_shell_rtems_main_medit(
4703    int    argc,
4704    char \**argv
4705    );
4706
4707The configuration structure for the ``medit`` has the
4708following prototype:
4709.. code:: c
4710
4711    extern rtems_shell_cmd_t rtems_shell_MEDIT_Command;
4712
4713mfill - file memory with pattern
4714--------------------------------
4715.. index:: mfill
4716
4717**SYNOPSYS:**
4718
4719.. code:: c
4720
4721    mfill address length value
4722
4723**DESCRIPTION:**
4724
4725This command is used to fill the memory starting at ``address``
4726for the specified ``length`` in octets when the specified at``value``.
4727
4728**EXIT STATUS:**
4729
4730This command returns 0 on success and non-zero if an error is encountered.
4731
4732**NOTES:**
4733
4734Filling a non-existent address range may result in an unrecoverable
4735program fault.  Similarly overwriting interrupt vector tables, code
4736space or critical data areas can be fatal as shown in the example.
4737
4738**EXAMPLES:**
4739
4740In this example, the address used (``0x23d89a0``) as the base
4741address of the filled area is the end of the stack for the
4742Idle thread.  This address was determined manually using gdb and
4743is very specific to this application and BSP.  The first command
4744in this example is an ``mdump`` to display the initial contents
4745of this memory.  We see that the first 8 bytes are 0xA5 which is
4746the pattern used as a guard by the Stack Checker.  On
4747the first context switch after the pattern is overwritten
4748by the  ``mfill`` command, the Stack Checker detect the pattern
4749has been corrupted and generates a fatal error.
4750.. code:: c
4751
4752    SHLL \[/] $ mdump 0x23d89a0 16
4753    0x023D89A0 A5 A5 A5 A5 A5 A5 A5 A5-FE ED F0 0D 0B AD 0D 06 ................
4754    SHLL \[/] $ mfill 0x23d89a0 13 0x5a
4755    SHLL \[/] $ BLOWN STACK!!! Offending task(0x23D4418): id=0x09010001; name=0x0203D908
4756    stack covers range 0x23D89A0 - 0x23D99AF (4112 bytes)
4757    Damaged pattern begins at 0x023D89A8 and is 16 bytes long
4758
4759**CONFIGURATION:**
4760
4761.. index:: CONFIGURE_SHELL_NO_COMMAND_MFILL
4762.. index:: CONFIGURE_SHELL_COMMAND_MFILL
4763
4764This command is included in the default shell command set.
4765When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MFILL`` to have this
4766command included.
4767
4768This command can be excluded from the shell command set by
4769defining ``CONFIGURE_SHELL_NO_COMMAND_MFILL`` when all
4770shell commands have been configured.
4771
4772**PROGRAMMING INFORMATION:**
4773
4774.. index:: rtems_shell_rtems_main_mfill
4775
4776The ``mfill`` is implemented by a C language function
4777which has the following prototype:
4778.. code:: c
4779
4780    int rtems_shell_rtems_main_mfill(
4781    int    argc,
4782    char \**argv
4783    );
4784
4785The configuration structure for the ``mfill`` has the
4786following prototype:
4787.. code:: c
4788
4789    extern rtems_shell_cmd_t rtems_shell_MFILL_Command;
4790
4791mmove - move contents of memory
4792-------------------------------
4793.. index:: mmove
4794
4795**SYNOPSYS:**
4796
4797.. code:: c
4798
4799    mmove dst src length
4800
4801**DESCRIPTION:**
4802
4803This command is used to copy the contents of the memory
4804starting at ``src`` to the memory located at ``dst``
4805for the specified ``length`` in octets.
4806
4807**EXIT STATUS:**
4808
4809This command returns 0 on success and non-zero if an error is encountered.
4810
4811**NOTES:**
4812
4813NONE
4814
4815**EXAMPLES:**
4816
4817The following is an example of how to use ``mmove``:
4818.. code:: c
4819
4820    SHLL \[/] $ mdump 0x023d99a0 16
4821    0x023D99A0 A5 A5 A5 A5 A5 A5 A5 A5-A5 A5 A5 A5 A5 A5 A5 A5 ................
4822    SHLL \[/] $ mdump 0x02000000 16
4823    0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
4824    SHLL \[/] $ mmove 0x023d99a0 0x02000000 13
4825    SHLL \[/] $ mdump 0x023d99a0 16
4826    0x023D99A0 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 A5 A5 A5 .H..)..3..".....
4827
4828**CONFIGURATION:**
4829
4830.. index:: CONFIGURE_SHELL_NO_COMMAND_MMOVE
4831.. index:: CONFIGURE_SHELL_COMMAND_MMOVE
4832
4833This command is included in the default shell command set.
4834When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MMOVE`` to have this
4835command included.
4836
4837This command can be excluded from the shell command set by
4838defining ``CONFIGURE_SHELL_NO_COMMAND_MMOVE`` when all
4839shell commands have been configured.
4840
4841**PROGRAMMING INFORMATION:**
4842
4843.. index:: rtems_shell_rtems_main_mmove
4844
4845The ``mmove`` is implemented by a C language function
4846which has the following prototype:
4847.. code:: c
4848
4849    int rtems_shell_rtems_main_mmove(
4850    int    argc,
4851    char \**argv
4852    );
4853
4854The configuration structure for the ``mmove`` has the
4855following prototype:
4856.. code:: c
4857
4858    extern rtems_shell_cmd_t rtems_shell_MMOVE_Command;
4859
4860malloc - obtain information on C program heap
4861---------------------------------------------
4862.. index:: malloc
4863
4864**SYNOPSYS:**
4865
4866.. code:: c
4867
4868    malloc \[walk]
4869
4870**DESCRIPTION:**
4871
4872This command prints information about the current state of the C Program Heap
4873used by the ``malloc()`` family of calls if no or invalid options are passed
4874to the command.  This includes the following information:
4875
4876- Number of free blocks
4877
4878- Largest free block
4879
4880- Total bytes free
4881
4882- Number of used blocks
4883
4884- Largest used block
4885
4886- Total bytes used
4887
4888- Size of the allocatable area in bytes
4889
4890- Minimum free size ever in bytes
4891
4892- Maximum number of free blocks ever
4893
4894- Maximum number of blocks searched ever
4895
4896- Lifetime number of bytes allocated
4897
4898- Lifetime number of bytes freed
4899
4900- Total number of searches
4901
4902- Total number of successful allocations
4903
4904- Total number of failed allocations
4905
4906- Total number of successful frees
4907
4908- Total number of successful resizes
4909
4910When the subcommand ``walk`` is specified, then a heap walk will be
4911performed and information about each block is printed out.
4912
4913**EXIT STATUS:**
4914
4915This command returns 0 on success and non-zero if an error is encountered.
4916
4917**NOTES:**
4918
4919NONE
4920
4921**EXAMPLES:**
4922
4923The following is an example of how to use the ``malloc`` command.
4924.. code:: c
4925
4926    SHLL \[/] $ malloc
4927    C Program Heap and RTEMS Workspace are the same.
4928    Number of free blocks:                               2
4929    Largest free block:                          266207504
4930    Total bytes free:                            266208392
4931    Number of used blocks:                             167
4932    Largest used block:                              16392
4933    Total bytes used:                                83536
4934    Size of the allocatable area in bytes:       266291928
4935    Minimum free size ever in bytes:             266207360
4936    Maximum number of free blocks ever:                  6
4937    Maximum number of blocks searched ever:              5
4938    Lifetime number of bytes allocated:              91760
4939    Lifetime number of bytes freed:                   8224
4940    Total number of searches:                          234
4941    Total number of successful allocations:            186
4942    Total number of failed allocations:                  0
4943    Total number of successful frees:                   19
4944    Total number of successful resizes:                  0
4945    SHLL \[/] $ malloc walk
4946    malloc walk
4947    PASS[0]: page size 8, min block size 48
4948    area begin 0x00210210, area end 0x0FFFC000
4949    first block 0x00210214, last block 0x0FFFBFDC
4950    first free 0x00228084, last free 0x00228354
4951    PASS[0]: block 0x00210214: size 88
4952    ...
4953    PASS[0]: block 0x00220154: size 144
4954    PASS[0]: block 0x002201E4: size 168, prev 0x002205BC, next 0x00228354 (= last free)
4955    PASS[0]: block 0x0022028C: size 168, prev_size 168
4956    ...
4957    PASS[0]: block 0x00226E7C: size 4136
4958    PASS[0]: block 0x00227EA4: size 408, prev 0x00228084 (= first free), next 0x00226CE4
4959    PASS[0]: block 0x0022803C: size 72, prev_size 408
4960    PASS[0]: block 0x00228084: size 648, prev 0x0020F75C (= head), next 0x00227EA4
4961    PASS[0]: block 0x0022830C: size 72, prev_size 648
4962    PASS[0]: block 0x00228354: size 266157192, prev 0x002201E4, next 0x0020F75C (= tail)
4963    PASS[0]: block 0x0FFFBFDC: size 4028711480, prev_size 266157192
4964
4965**CONFIGURATION:**
4966
4967.. index:: CONFIGURE_SHELL_NO_COMMAND_MALLOC
4968.. index:: CONFIGURE_SHELL_COMMAND_MALLOC
4969
4970This command is included in the default shell command set.
4971When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MALLOC`` to have this
4972command included.
4973
4974This command can be excluded from the shell command set by
4975defining ``CONFIGURE_SHELL_NO_COMMAND_MALLOC`` when all
4976shell commands have been configured.
4977
4978**PROGRAMMING INFORMATION:**
4979
4980.. index:: rtems_shell_rtems_main_malloc
4981
4982The ``malloc`` is implemented by a C language function
4983which has the following prototype:
4984.. code:: c
4985
4986    int rtems_shell_rtems_main_malloc(
4987    int    argc,
4988    char \**argv
4989    );
4990
4991The configuration structure for the ``malloc`` has the
4992following prototype:
4993.. code:: c
4994
4995    extern rtems_shell_cmd_t rtems_shell_MALLOC_Command;
4996
4997.. COMMENT: COPYRIGHT (c) 1988-2008.
4998
4999.. COMMENT: On-Line Applications Research Corporation (OAR).
5000
5001.. COMMENT: All rights reserved.
5002
5003RTEMS Specific Commands
5004#######################
5005
5006Introduction
5007============
5008
5009The RTEMS shell has the following rtems commands:
5010
5011- ``shutdown`` - Shutdown the system
5012
5013- ``cpuuse`` - print or reset per thread cpu usage
5014
5015- ``stackuse`` - print per thread stack usage
5016
5017- ``perioduse`` - print or reset per period usage
5018
5019- ``profreport`` - print a profiling report
5020
5021- ``wkspace`` - Display information on Executive Workspace
5022
5023- ``config`` - Show the system configuration.
5024
5025- ``itask`` - List init tasks for the system
5026
5027- ``extension`` - Display information about extensions
5028
5029- ``task`` - Display information about tasks
5030
5031- ``queue`` - Display information about message queues
5032
5033- ``sema`` - display information about semaphores
5034
5035- ``region`` - display information about regions
5036
5037- ``part`` - display information about partitions
5038
5039- ``object`` - Display information about RTEMS objects
5040
5041- ``driver`` - Display the RTEMS device driver table
5042
5043- ``dname`` - Displays information about named drivers
5044
5045- ``pthread`` - Displays information about POSIX threads
5046
5047Commands
5048========
5049
5050This section details the RTEMS Specific Commands available.  A
5051subsection is dedicated to each of the commands and
5052describes the behavior and configuration of that
5053command as well as providing an example usage.
5054
5055shutdown - Shutdown the system
5056------------------------------
5057.. index:: shutdown
5058
5059**SYNOPSYS:**
5060
5061.. code:: c
5062
5063    shutdown
5064
5065**DESCRIPTION:**
5066
5067This command is used to shutdown the RTEMS application.
5068
5069**EXIT STATUS:**
5070
5071This command does not return.
5072
5073**NOTES:**
5074
5075**EXAMPLES:**
5076
5077The following is an example of how to use ``shutdown``:
5078.. code:: c
5079
5080    SHLL \[/] $ shutdown
5081    System shutting down at user request
5082
5083The user will not see another prompt and the system will
5084shutdown.
5085
5086**CONFIGURATION:**
5087
5088.. index:: CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN
5089.. index:: CONFIGURE_SHELL_COMMAND_SHUTDOWN
5090
5091This command is included in the default shell command set.
5092When building a custom command set, define``CONFIGURE_SHELL_COMMAND_SHUTDOWN`` to have this
5093command included.
5094
5095This command can be excluded from the shell command set by
5096defining ``CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN`` when all
5097shell commands have been configured.
5098
5099**PROGRAMMING INFORMATION:**
5100
5101The configuration structure for the ``shutdown`` has the
5102following prototype:
5103.. code:: c
5104
5105    extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;
5106
5107cpuuse - print or reset per thread cpu usage
5108--------------------------------------------
5109.. index:: cpuuse
5110
5111**SYNOPSYS:**
5112
5113.. code:: c
5114
5115    cpuuse \[-r]
5116
5117**DESCRIPTION:**
5118
5119This command may be used to print a report on the per thread
5120cpu usage or to reset the per thread CPU usage statistics. When
5121invoked with the ``-r`` option, the CPU usage statistics
5122are reset.
5123
5124**EXIT STATUS:**
5125
5126This command returns 0 on success and non-zero if an error is encountered.
5127
5128**NOTES:**
5129
5130The granularity of the timing information reported is dependent
5131upon the BSP and the manner in which RTEMS was built.  In the
5132default RTEMS configuration, if the BSP supports nanosecond
5133granularity timestamps, then the information reported will be
5134highly accurate. Otherwise, the accuracy of the information
5135reported is limited by the clock tick quantum.
5136
5137**EXAMPLES:**
5138
5139The following is an example of how to use ``cpuuse``:
5140.. code:: c
5141
5142    SHLL \[/] $ cpuuse
5143    CPU Usage by thread
5144    ID            NAME         SECONDS   PERCENT
5145    0x09010001   IDLE            49.745393   98.953
5146    0x0a010001   UI1              0.000000    0.000
5147    0x0a010002   SHLL             0.525928    1.046
5148    Time since last CPU Usage reset 50.271321 seconds
5149    SHLL \[/] $ cpuuse -r
5150    Resetting CPU Usage information
5151    SHLL \[/] $ cpuuse
5152    CPU Usage by thread
5153    ID            NAME         SECONDS   PERCENT
5154    0x09010001   IDLE             0.000000    0.000
5155    0x0a010001   UI1              0.000000    0.000
5156    0x0a010002   SHLL             0.003092  100.000
5157    Time since last CPU Usage reset 0.003092 seconds
5158
5159In the above example, the system had set idle for nearly
5160a minute when the first report was generated.  The``cpuuse -r`` and ``cpuuse`` commands were pasted
5161from another window so were executed with no gap between.
5162In the second report, only the ``shell`` thread has
5163run since the CPU Usage was reset.  It has consumed
5164approximately 3.092 milliseconds of CPU time processing
5165the two commands and generating the output.
5166
5167**CONFIGURATION:**
5168
5169.. index:: CONFIGURE_SHELL_NO_COMMAND_CPUUSE
5170.. index:: CONFIGURE_SHELL_COMMAND_CPUUSE
5171
5172This command is included in the default shell command set.
5173When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CPUUSE`` to have this
5174command included.
5175
5176This command can be excluded from the shell command set by
5177defining ``CONFIGURE_SHELL_NO_COMMAND_CPUUSE`` when all
5178shell commands have been configured.
5179
5180**PROGRAMMING INFORMATION:**
5181
5182.. index:: rtems_shell_rtems_main_cpuuse
5183
5184The ``cpuuse`` is implemented by a C language function
5185which has the following prototype:
5186.. code:: c
5187
5188    int rtems_shell_rtems_main_cpuuse(
5189    int    argc,
5190    char \**argv
5191    );
5192
5193The configuration structure for the ``cpuuse`` has the
5194following prototype:
5195.. code:: c
5196
5197    extern rtems_shell_cmd_t rtems_shell_CPUUSE_Command;
5198
5199stackuse - print per thread stack usage
5200---------------------------------------
5201.. index:: stackuse
5202
5203**SYNOPSYS:**
5204
5205.. code:: c
5206
5207    stackuse
5208
5209**DESCRIPTION:**
5210
5211This command prints a Stack Usage Report for all of the tasks
5212and threads in the system.  On systems which support it, the
5213usage of the interrupt stack is also included in the report.
5214
5215**EXIT STATUS:**
5216
5217This command always succeeds and returns 0.
5218
5219**NOTES:**
5220
5221The ``CONFIGURE_STACK_CHECKER_ENABLED`` ``confdefs.h`` constant
5222must be defined when the application is configured for this
5223command to have any information to report.
5224
5225**EXAMPLES:**
5226
5227The following is an example of how to use ``stackuse``:
5228.. code:: c
5229
5230    SHLL \[/] $ stackuse
5231    Stack usage by thread
5232    ID      NAME    LOW          HIGH     CURRENT     AVAILABLE     USED
5233    0x09010001  IDLE 0x023d89a0 - 0x023d99af 0x023d9760      4096        608
5234    0x0a010001  UI1  0x023d9f30 - 0x023daf3f 0x023dad18      4096       1804
5235    0x0a010002  SHLL 0x023db4c0 - 0x023df4cf 0x023de9d0     16384       5116
5236    0xffffffff  INTR 0x023d2760 - 0x023d375f 0x00000000      4080        316
5237
5238**CONFIGURATION:**
5239
5240.. index:: CONFIGURE_SHELL_NO_COMMAND_STACKUSE
5241.. index:: CONFIGURE_SHELL_COMMAND_STACKUSE
5242
5243This command is included in the default shell command set.
5244When building a custom command set, define``CONFIGURE_SHELL_COMMAND_STACKUSE`` to have this
5245command included.
5246
5247This command can be excluded from the shell command set by
5248defining ``CONFIGURE_SHELL_NO_COMMAND_STACKUSE`` when all
5249shell commands have been configured.
5250
5251**PROGRAMMING INFORMATION:**
5252
5253.. index:: rtems_shell_rtems_main_stackuse
5254
5255The ``stackuse`` is implemented by a C language function
5256which has the following prototype:
5257.. code:: c
5258
5259    int rtems_shell_rtems_main_stackuse(
5260    int    argc,
5261    char \**argv
5262    );
5263
5264The configuration structure for the ``stackuse`` has the
5265following prototype:
5266.. code:: c
5267
5268    extern rtems_shell_cmd_t rtems_shell_STACKUSE_Command;
5269
5270perioduse - print or reset per period usage
5271-------------------------------------------
5272.. index:: perioduse
5273
5274**SYNOPSYS:**
5275
5276.. code:: c
5277
5278    perioduse \[-r]
5279
5280**DESCRIPTION:**
5281
5282This command may be used to print a statistics report on the rate
5283monotonic periods in the application or to reset the rate monotonic
5284period usage statistics. When invoked with the ``-r`` option, the
5285usage statistics are reset.
5286
5287**EXIT STATUS:**
5288
5289This command returns 0 on success and non-zero if an error is encountered.
5290
5291**NOTES:**
5292
5293The granularity of the timing information reported is dependent
5294upon the BSP and the manner in which RTEMS was built.  In the
5295default RTEMS configuration, if the BSP supports nanosecond
5296granularity timestamps, then the information reported will be
5297highly accurate. Otherwise, the accuracy of the information
5298reported is limited by the clock tick quantum.
5299
5300**EXAMPLES:**
5301
5302The following is an example of how to use ``perioduse``:
5303.. code:: c
5304
5305    SHLL \[/] $ perioduse
5306    Period information by period
5307    --- CPU times are in seconds ---
5308    --- Wall times are in seconds ---
5309    ID     OWNER COUNT MISSED          CPU TIME                  WALL TIME
5310    MIN/MAX/AVG                MIN/MAX/AVG
5311    0x42010001 TA1    502      0 0:000039/0:042650/0:004158 0:000039/0:020118/0:002848
5312    0x42010002 TA2    502      0 0:000041/0:042657/0:004309 0:000041/0:020116/0:002848
5313    0x42010003 TA3    501      0 0:000041/0:041564/0:003653 0:000041/0:020003/0:002814
5314    0x42010004 TA4    501      0 0:000043/0:044075/0:004911 0:000043/0:020004/0:002814
5315    0x42010005 TA5     10      0 0:000065/0:005413/0:002739 0:000065/1:000457/0:041058
5316    MIN/MAX/AVG                MIN/MAX/AVG
5317    SHLL \[/] $ perioduse -r
5318    Resetting Period Usage information
5319    SHLL \[/] $ perioduse
5320    --- CPU times are in seconds ---
5321    --- Wall times are in seconds ---
5322    ID     OWNER COUNT MISSED          CPU TIME                  WALL TIME
5323    MIN/MAX/AVG                MIN/MAX/AVG
5324    0x42010001 TA1      0      0
5325    0x42010002 TA2      0      0
5326    0x42010003 TA3      0      0
5327    0x42010004 TA4      0      0
5328    0x42010005 TA5      0      0
5329
5330**CONFIGURATION:**
5331
5332.. index:: CONFIGURE_SHELL_NO_COMMAND_PERIODUSE
5333.. index:: CONFIGURE_SHELL_COMMAND_PERIODUSE
5334
5335This command is included in the default shell command set.
5336When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PERIODUSE`` to have this
5337command included.
5338
5339This command can be excluded from the shell command set by
5340defining ``CONFIGURE_SHELL_NO_COMMAND_PERIODUSE`` when all
5341shell commands have been configured.
5342
5343**PROGRAMMING INFORMATION:**
5344
5345.. index:: rtems_shell_rtems_main_perioduse
5346
5347The ``perioduse`` is implemented by a C language function
5348which has the following prototype:
5349.. code:: c
5350
5351    int rtems_shell_rtems_main_perioduse(
5352    int    argc,
5353    char \**argv
5354    );
5355
5356The configuration structure for the ``perioduse`` has the
5357following prototype:
5358.. code:: c
5359
5360    extern rtems_shell_cmd_t rtems_shell_PERIODUSE_Command;
5361
5362profreport - print a profiling report
5363-------------------------------------
5364.. index:: profreport
5365
5366**SYNOPSYS:**
5367
5368.. code:: c
5369
5370    profreport
5371
5372**DESCRIPTION:**
5373
5374This command may be used to print a profiling report.
5375
5376**EXIT STATUS:**
5377
5378This command returns 0.
5379
5380**NOTES:**
5381
5382Profiling must be enabled at build configuration time to get profiling
5383information.
5384
5385**EXAMPLES:**
5386
5387The following is an example of how to use ``profreport``:
5388.. code:: c
5389
5390    SHLL \[/] $ profreport
5391    <ProfilingReport name="Shell">
5392    <PerCPUProfilingReport processorIndex="0">
5393    <MaxThreadDispatchDisabledTime unit="ns">10447</MaxThreadDispatchDisabledTime>
5394    <MeanThreadDispatchDisabledTime unit="ns">2</MeanThreadDispatchDisabledTime>
5395    <TotalThreadDispatchDisabledTime unit="ns">195926627</TotalThreadDispatchDisabledTime>
5396    <ThreadDispatchDisabledCount>77908688</ThreadDispatchDisabledCount>
5397    <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
5398    <MaxInterruptTime unit="ns">688</MaxInterruptTime>
5399    <MeanInterruptTime unit="ns">127</MeanInterruptTime>
5400    <TotalInterruptTime unit="ns">282651157</TotalInterruptTime>
5401    <InterruptCount>2215855</InterruptCount>
5402    </PerCPUProfilingReport>
5403    <PerCPUProfilingReport processorIndex="1">
5404    <MaxThreadDispatchDisabledTime unit="ns">9053</MaxThreadDispatchDisabledTime>
5405    <MeanThreadDispatchDisabledTime unit="ns">41</MeanThreadDispatchDisabledTime>
5406    <TotalThreadDispatchDisabledTime unit="ns">3053830335</TotalThreadDispatchDisabledTime>
5407    <ThreadDispatchDisabledCount>73334202</ThreadDispatchDisabledCount>
5408    <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
5409    <MaxInterruptTime unit="ns">57</MaxInterruptTime>
5410    <MeanInterruptTime unit="ns">35</MeanInterruptTime>
5411    <TotalInterruptTime unit="ns">76980203</TotalInterruptTime>
5412    <InterruptCount>2141179</InterruptCount>
5413    </PerCPUProfilingReport>
5414    <SMPLockProfilingReport name="SMP lock stats">
5415    <MaxAcquireTime unit="ns">608</MaxAcquireTime>
5416    <MaxSectionTime unit="ns">1387</MaxSectionTime>
5417    <MeanAcquireTime unit="ns">112</MeanAcquireTime>
5418    <MeanSectionTime unit="ns">338</MeanSectionTime>
5419    <TotalAcquireTime unit="ns">119031</TotalAcquireTime>
5420    <TotalSectionTime unit="ns">357222</TotalSectionTime>
5421    <UsageCount>1055</UsageCount>
5422    <ContentionCount initialQueueLength="0">1055</ContentionCount>
5423    <ContentionCount initialQueueLength="1">0</ContentionCount>
5424    <ContentionCount initialQueueLength="2">0</ContentionCount>
5425    <ContentionCount initialQueueLength="3">0</ContentionCount>
5426    </SMPLockProfilingReport>
5427    <SMPLockProfilingReport name="Giant">
5428    <MaxAcquireTime unit="ns">4186</MaxAcquireTime>
5429    <MaxSectionTime unit="ns">7575</MaxSectionTime>
5430    <MeanAcquireTime unit="ns">160</MeanAcquireTime>
5431    <MeanSectionTime unit="ns">183</MeanSectionTime>
5432    <TotalAcquireTime unit="ns">1772793111</TotalAcquireTime>
5433    <TotalSectionTime unit="ns">2029733879</TotalSectionTime>
5434    <UsageCount>11039140</UsageCount>
5435    <ContentionCount initialQueueLength="0">11037655</ContentionCount>
5436    <ContentionCount initialQueueLength="1">1485</ContentionCount>
5437    <ContentionCount initialQueueLength="2">0</ContentionCount>
5438    <ContentionCount initialQueueLength="3">0</ContentionCount>
5439    </SMPLockProfilingReport>
5440    </ProfilingReport>
5441
5442**CONFIGURATION:**
5443
5444.. index:: CONFIGURE_SHELL_NO_COMMAND_PROFREPORT
5445.. index:: CONFIGURE_SHELL_COMMAND_PROFREPORT
5446
5447When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PROFREPORT`` to have this
5448command included.
5449
5450This command can be excluded from the shell command set by
5451defining ``CONFIGURE_SHELL_NO_COMMAND_PROFREPORT`` when all
5452shell commands have been configured.
5453
5454**PROGRAMMING INFORMATION:**
5455
5456The configuration structure for the ``profreport`` has the
5457following prototype:
5458.. code:: c
5459
5460    extern rtems_shell_cmd_t rtems_shell_PROFREPORT_Command;
5461
5462wkspace - display information on executive workspace
5463----------------------------------------------------
5464.. index:: wkspace
5465
5466**SYNOPSYS:**
5467
5468.. code:: c
5469
5470    wkspace
5471
5472**DESCRIPTION:**
5473
5474This command prints information on the current state of
5475the RTEMS Executive Workspace reported.  This includes the
5476following information:
5477
5478- Number of free blocks
5479
5480- Largest free block
5481
5482- Total bytes free
5483
5484- Number of used blocks
5485
5486- Largest used block
5487
5488- Total bytes used
5489
5490**EXIT STATUS:**
5491
5492This command always succeeds and returns 0.
5493
5494**NOTES:**
5495
5496NONE
5497
5498**EXAMPLES:**
5499
5500The following is an example of how to use ``wkspace``:
5501.. code:: c
5502
5503    SHLL \[/] $ wkspace
5504    Number of free blocks: 1
5505    Largest free block:    132336
5506    Total bytes free:      132336
5507    Number of used blocks: 36
5508    Largest used block:    16408
5509    Total bytes used:      55344
5510
5511**CONFIGURATION:**
5512
5513.. index:: CONFIGURE_SHELL_NO_COMMAND_WKSPACE
5514.. index:: CONFIGURE_SHELL_COMMAND_WKSPACE
5515
5516This command is included in the default shell command set.
5517When building a custom command set, define``CONFIGURE_SHELL_COMMAND_WKSPACE`` to have this
5518command included.
5519
5520This command can be excluded from the shell command set by
5521defining ``CONFIGURE_SHELL_NO_COMMAND_WKSPACE`` when all
5522shell commands have been configured.
5523
5524**PROGRAMMING INFORMATION:**
5525
5526.. index:: rtems_shell_rtems_main_wkspace
5527
5528The ``wkspace`` is implemented by a C language function
5529which has the following prototype:
5530.. code:: c
5531
5532    int rtems_shell_rtems_main_wkspace(
5533    int    argc,
5534    char \**argv
5535    );
5536
5537The configuration structure for the ``wkspace`` has the
5538following prototype:
5539.. code:: c
5540
5541    extern rtems_shell_cmd_t rtems_shell_WKSPACE_Command;
5542
5543config - show the system configuration.
5544---------------------------------------
5545.. index:: config
5546
5547**SYNOPSYS:**
5548
5549.. code:: c
5550
5551    config
5552
5553**DESCRIPTION:**
5554
5555This command display information about the RTEMS Configuration.
5556
5557**EXIT STATUS:**
5558
5559This command always succeeds and returns 0.
5560
5561**NOTES:**
5562
5563At this time, it does not report every configuration parameter.
5564This is an area in which user submissions or sponsorship of
5565a developer would be appreciated.
5566
5567**EXAMPLES:**
5568
5569The following is an example of how to use ``config``:
5570.. code:: c
5571
5572    INITIAL (startup) Configuration Info
5573
5574    WORKSPACE      start: 0x23d22e0;  size: 0x2dd20
5575    TIME           usec/tick: 10000;  tick/timeslice: 50;  tick/sec: 100
5576    MAXIMUMS       tasks: 20;  timers: 0;  sems: 50;  que's: 20;  ext's: 1
5577    partitions: 0;  regions: 0;  ports: 0;  periods: 0
5578
5579**CONFIGURATION:**
5580
5581.. index:: CONFIGURE_SHELL_NO_COMMAND_CONFIG
5582.. index:: CONFIGURE_SHELL_COMMAND_CONFIG
5583
5584This command is included in the default shell command set.
5585When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CONFIG`` to have this
5586command included.
5587
5588This command can be excluded from the shell command set by
5589defining ``CONFIGURE_SHELL_NO_COMMAND_CONFIG`` when all
5590shell commands have been configured.
5591
5592**PROGRAMMING INFORMATION:**
5593
5594.. index:: rtems_shell_rtems_main_config
5595
5596The ``config`` is implemented by a C language function
5597which has the following prototype:
5598.. code:: c
5599
5600    int rtems_shell_rtems_main_config(
5601    int    argc,
5602    char \**argv
5603    );
5604
5605The configuration structure for the ``config`` has the
5606following prototype:
5607.. code:: c
5608
5609    extern rtems_shell_cmd_t rtems_shell_CONFIG_Command;
5610
5611itask - list init tasks for the system
5612--------------------------------------
5613.. index:: itask
5614
5615**SYNOPSYS:**
5616
5617.. code:: c
5618
5619    itask
5620
5621**DESCRIPTION:**
5622
5623This command prints a report on the set of initialization
5624tasks and threads in the system.
5625
5626**EXIT STATUS:**
5627
5628This command always succeeds and returns 0.
5629
5630**NOTES:**
5631
5632At this time, it includes only Classic API Initialization Tasks.
5633This is an area in which user submissions or sponsorship of
5634a developer would be appreciated.
5635
5636**EXAMPLES:**
5637
5638The following is an example of how to use ``itask``:
5639.. code:: c
5640
5641    SHLL \[/] $ itask
5642    #    NAME   ENTRY        ARGUMENT    PRIO   MODES  ATTRIBUTES   STACK SIZE
5643    ------------------------------------------------------------------------------
5644    0   UI1    \[0x2002258] 0 \[0x0]        1    nP      DEFAULT     4096 \[0x1000]
5645
5646**CONFIGURATION:**
5647
5648.. index:: CONFIGURE_SHELL_NO_COMMAND_ITASK
5649.. index:: CONFIGURE_SHELL_COMMAND_ITASK
5650
5651This command is included in the default shell command set.
5652When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ITASK`` to have this
5653command included.
5654
5655This command can be excluded from the shell command set by
5656defining ``CONFIGURE_SHELL_NO_COMMAND_ITASK`` when all
5657shell commands have been configured.
5658
5659**PROGRAMMING INFORMATION:**
5660
5661.. index:: rtems_shell_rtems_main_itask
5662
5663The ``itask`` is implemented by a C language function
5664which has the following prototype:
5665.. code:: c
5666
5667    int rtems_shell_rtems_main_itask(
5668    int    argc,
5669    char \**argv
5670    );
5671
5672The configuration structure for the ``itask`` has the
5673following prototype:
5674.. code:: c
5675
5676    extern rtems_shell_cmd_t rtems_shell_ITASK_Command;
5677
5678extension - display information about extensions
5679------------------------------------------------
5680.. index:: extension
5681
5682**SYNOPSYS:**
5683
5684.. code:: c
5685
5686    extension \[id \[id ...] ]
5687
5688**DESCRIPTION:**
5689
5690When invoked with no arguments, this command prints information on
5691the set of User Extensions currently active in the system.
5692
5693If invoked with a set of ids as arguments, then just
5694those objects are included in the information printed.
5695
5696**EXIT STATUS:**
5697
5698This command returns 0 on success and non-zero if an error is encountered.
5699
5700**NOTES:**
5701
5702NONE
5703
5704**EXAMPLES:**
5705
5706The following is an example of using the ``extension`` command
5707on a system with no user extensions.
5708.. code:: c
5709
5710    SHLL \[/] $ extension
5711    ID       NAME
5712    ------------------------------------------------------------------------------
5713
5714**CONFIGURATION:**
5715
5716.. index:: CONFIGURE_SHELL_NO_COMMAND_EXTENSION
5717.. index:: CONFIGURE_SHELL_COMMAND_EXTENSION
5718
5719This command is included in the default shell command set.
5720When building a custom command set, define``CONFIGURE_SHELL_COMMAND_EXTENSION`` to have this
5721command included.
5722
5723This command can be excluded from the shell command set by
5724defining ``CONFIGURE_SHELL_NO_COMMAND_EXTENSION`` when all
5725shell commands have been configured.
5726
5727**PROGRAMMING INFORMATION:**
5728
5729.. index:: rtems_shell_rtems_main_extension
5730
5731The ``extension`` is implemented by a C language function
5732which has the following prototype:
5733.. code:: c
5734
5735    int rtems_shell_rtems_main_extension(
5736    int    argc,
5737    char \**argv
5738    );
5739
5740The configuration structure for the ``extension`` has the
5741following prototype:
5742.. code:: c
5743
5744    extern rtems_shell_cmd_t rtems_shell_EXTENSION_Command;
5745
5746task - display information about tasks
5747--------------------------------------
5748.. index:: task
5749
5750**SYNOPSYS:**
5751
5752.. code:: c
5753
5754    task \[id \[id ...] ]
5755
5756**DESCRIPTION:**
5757
5758When invoked with no arguments, this command prints information on
5759the set of Classic API Tasks currently active in the system.
5760
5761If invoked with a set of ids as arguments, then just
5762those objects are included in the information printed.
5763
5764**EXIT STATUS:**
5765
5766This command returns 0 on success and non-zero if an error is encountered.
5767
5768**NOTES:**
5769
5770NONE
5771
5772**EXAMPLES:**
5773
5774The following is an example of how to use the ``task`` on an
5775application with just two Classic API tasks:
5776.. code:: c
5777
5778    SHLL \[/] $ task
5779    ID       NAME   PRIO   STAT   MODES  EVENTS   WAITID  WAITARG  NOTES
5780    ------------------------------------------------------------------------------
5781    0a010001   UI1      1   SUSP   P:T:nA  NONE
5782    0a010002   SHLL   100   READY  P:T:nA  NONE
5783
5784**CONFIGURATION:**
5785
5786.. index:: CONFIGURE_SHELL_NO_COMMAND_TASK
5787.. index:: CONFIGURE_SHELL_COMMAND_TASK
5788
5789This command is included in the default shell command set.
5790When building a custom command set, define``CONFIGURE_SHELL_COMMAND_TASK`` to have this
5791command included.
5792
5793This command can be excluded from the shell command set by
5794defining ``CONFIGURE_SHELL_NO_COMMAND_TASK`` when all
5795shell commands have been configured.
5796
5797**PROGRAMMING INFORMATION:**
5798
5799.. index:: rtems_shell_rtems_main_task
5800
5801The ``task`` is implemented by a C language function
5802which has the following prototype:
5803.. code:: c
5804
5805    int rtems_shell_rtems_main_task(
5806    int    argc,
5807    char \**argv
5808    );
5809
5810The configuration structure for the ``task`` has the
5811following prototype:
5812.. code:: c
5813
5814    extern rtems_shell_cmd_t rtems_shell_TASK_Command;
5815
5816queue - display information about message queues
5817------------------------------------------------
5818.. index:: queue
5819
5820**SYNOPSYS:**
5821
5822.. code:: c
5823
5824    queue \[id \[id ... ] ]
5825
5826**DESCRIPTION:**
5827
5828When invoked with no arguments, this command prints information on
5829the set of Classic API Message Queues currently active in the system.
5830
5831If invoked with a set of ids as arguments, then just
5832those objects are included in the information printed.
5833
5834**EXIT STATUS:**
5835
5836This command returns 0 on success and non-zero if an error is encountered.
5837
5838**NOTES:**
5839
5840NONE
5841
5842**EXAMPLES:**
5843
5844The following is an example of using the ``queue`` command
5845on a system with no Classic API Message Queues.
5846.. code:: c
5847
5848    SHLL \[/] $ queue
5849    ID       NAME   ATTRIBUTES   PEND   MAXPEND  MAXSIZE
5850    ------------------------------------------------------------------------------
5851
5852**CONFIGURATION:**
5853
5854.. index:: CONFIGURE_SHELL_NO_COMMAND_QUEUE
5855.. index:: CONFIGURE_SHELL_COMMAND_QUEUE
5856
5857This command is included in the default shell command set.
5858When building a custom command set, define``CONFIGURE_SHELL_COMMAND_QUEUE`` to have this
5859command included.
5860
5861This command can be excluded from the shell command set by
5862defining ``CONFIGURE_SHELL_NO_COMMAND_QUEUE`` when all
5863shell commands have been configured.
5864
5865**PROGRAMMING INFORMATION:**
5866
5867.. index:: rtems_shell_rtems_main_queue
5868
5869The ``queue`` is implemented by a C language function
5870which has the following prototype:
5871.. code:: c
5872
5873    int rtems_shell_rtems_main_queue(
5874    int    argc,
5875    char \**argv
5876    );
5877
5878The configuration structure for the ``queue`` has the
5879following prototype:
5880.. code:: c
5881
5882    extern rtems_shell_cmd_t rtems_shell_QUEUE_Command;
5883
5884sema - display information about semaphores
5885-------------------------------------------
5886.. index:: sema
5887
5888**SYNOPSYS:**
5889
5890.. code:: c
5891
5892    sema \[id \[id ... ] ]
5893
5894**DESCRIPTION:**
5895
5896When invoked with no arguments, this command prints information on
5897the set of Classic API Semaphores currently active in the system.
5898
5899If invoked with a set of objects ids as arguments, then just
5900those objects are included in the information printed.
5901
5902**EXIT STATUS:**
5903
5904This command returns 0 on success and non-zero if an error is encountered.
5905
5906**NOTES:**
5907
5908NONE
5909
5910**EXAMPLES:**
5911
5912The following is an example of how to use ``sema``:
5913.. code:: c
5914
5915    SHLL \[/] $ sema
5916    ID       NAME   ATTR        PRICEIL CURR_CNT HOLDID
5917    ------------------------------------------------------------------------------
5918    1a010001   LBIO   PR:BI:IN      0        1     00000000
5919    1a010002   TRmi   PR:BI:IN      0        1     00000000
5920    1a010003   LBI00  PR:BI:IN      0        1     00000000
5921    1a010004   TRia   PR:BI:IN      0        1     00000000
5922    1a010005   TRoa   PR:BI:IN      0        1     00000000
5923    1a010006   TRxa   <assoc.c: BAD NAME>   0    0 09010001
5924    1a010007   LBI01  PR:BI:IN      0        1     00000000
5925    1a010008   LBI02  PR:BI:IN      0        1     00000000
5926
5927**CONFIGURATION:**
5928
5929.. index:: CONFIGURE_SHELL_NO_COMMAND_SEMA
5930.. index:: CONFIGURE_SHELL_COMMAND_SEMA
5931
5932This command is included in the default shell command set.
5933When building a custom command set, define``CONFIGURE_SHELL_COMMAND_SEMA`` to have this
5934command included.
5935
5936This command can be excluded from the shell command set by
5937defining ``CONFIGURE_SHELL_NO_COMMAND_SEMA`` when all
5938shell commands have been configured.
5939
5940**PROGRAMMING INFORMATION:**
5941
5942.. index:: rtems_shell_rtems_main_sema
5943
5944The ``sema`` is implemented by a C language function
5945which has the following prototype:
5946.. code:: c
5947
5948    int rtems_shell_rtems_main_sema(
5949    int    argc,
5950    char \**argv
5951    );
5952
5953The configuration structure for the ``sema`` has the
5954following prototype:
5955.. code:: c
5956
5957    extern rtems_shell_cmd_t rtems_shell_SEMA_Command;
5958
5959region - display information about regions
5960------------------------------------------
5961.. index:: region
5962
5963**SYNOPSYS:**
5964
5965.. code:: c
5966
5967    region \[id \[id ... ] ]
5968
5969**DESCRIPTION:**
5970
5971When invoked with no arguments, this command prints information on
5972the set of Classic API Regions currently active in the system.
5973
5974If invoked with a set of object ids as arguments, then just
5975those object are included in the information printed.
5976
5977**EXIT STATUS:**
5978
5979This command returns 0 on success and non-zero if an error is encountered.
5980
5981**NOTES:**
5982
5983NONE
5984
5985**EXAMPLES:**
5986
5987The following is an example of using the ``region`` command
5988on a system with no user extensions.
5989.. code:: c
5990
5991    SHLL \[/] $ region
5992    ID       NAME   ATTR        STARTADDR LENGTH    PAGE_SIZE USED_BLOCKS
5993    ------------------------------------------------------------------------------
5994
5995**CONFIGURATION:**
5996
5997.. index:: CONFIGURE_SHELL_NO_COMMAND_REGION
5998.. index:: CONFIGURE_SHELL_COMMAND_REGION
5999
6000This command is included in the default shell command set.
6001When building a custom command set, define``CONFIGURE_SHELL_COMMAND_REGION`` to have this
6002command included.
6003
6004This command can be excluded from the shell command set by
6005defining ``CONFIGURE_SHELL_NO_COMMAND_REGION`` when all
6006shell commands have been configured.
6007
6008**PROGRAMMING INFORMATION:**
6009
6010.. index:: rtems_shell_rtems_main_region
6011
6012The ``region`` is implemented by a C language function
6013which has the following prototype:
6014.. code:: c
6015
6016    int rtems_shell_rtems_main_region(
6017    int    argc,
6018    char \**argv
6019    );
6020
6021The configuration structure for the ``region`` has the
6022following prototype:
6023.. code:: c
6024
6025    extern rtems_shell_cmd_t rtems_shell_REGION_Command;
6026
6027part - display information about partitions
6028-------------------------------------------
6029.. index:: part
6030
6031**SYNOPSYS:**
6032
6033.. code:: c
6034
6035    part \[id \[id ... ] ]
6036
6037**DESCRIPTION:**
6038
6039When invoked with no arguments, this command prints information on
6040the set of Classic API Partitions currently active in the system.
6041
6042If invoked with a set of object ids as arguments, then just
6043those objects are included in the information printed.
6044
6045**EXIT STATUS:**
6046
6047This command returns 0 on success and non-zero if an error is encountered.
6048
6049**NOTES:**
6050
6051NONE
6052
6053**EXAMPLES:**
6054
6055The following is an example of using the ``part`` command
6056on a system with no user extensions.
6057.. code:: c
6058
6059    SHLL \[/] $ part
6060    ID       NAME   ATTR        STARTADDR LENGTH    BUF_SIZE  USED_BLOCKS
6061    ------------------------------------------------------------------------------
6062
6063**CONFIGURATION:**
6064
6065.. index:: CONFIGURE_SHELL_NO_COMMAND_PART
6066.. index:: CONFIGURE_SHELL_COMMAND_PART
6067
6068This command is included in the default shell command set.
6069When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PART`` to have this
6070command included.
6071
6072This command can be excluded from the shell command set by
6073defining ``CONFIGURE_SHELL_NO_COMMAND_PART`` when all
6074shell commands have been configured.
6075
6076**PROGRAMMING INFORMATION:**
6077
6078.. index:: rtems_shell_rtems_main_part
6079
6080The ``part`` is implemented by a C language function
6081which has the following prototype:
6082.. code:: c
6083
6084    int rtems_shell_rtems_main_part(
6085    int    argc,
6086    char \**argv
6087    );
6088
6089The configuration structure for the ``part`` has the
6090following prototype:
6091.. code:: c
6092
6093    extern rtems_shell_cmd_t rtems_shell_PART_Command;
6094
6095object - display information about rtems objects
6096------------------------------------------------
6097.. index:: object
6098
6099**SYNOPSYS:**
6100
6101.. code:: c
6102
6103    object \[id \[id ...] ]
6104
6105**DESCRIPTION:**
6106
6107When invoked with a set of object ids as arguments, then
6108a report on those objects is printed.
6109
6110**EXIT STATUS:**
6111
6112This command returns 0 on success and non-zero if an error is encountered.
6113
6114**NOTES:**
6115
6116NONE
6117
6118**EXAMPLES:**
6119
6120The following is an example of how to use ``object``:
6121.. code:: c
6122
6123    SHLL \[/] $ object 0a010001 1a010002
6124    ID       NAME   PRIO   STAT   MODES  EVENTS   WAITID  WAITARG  NOTES
6125    ------------------------------------------------------------------------------
6126    0a010001   UI1      1   SUSP   P:T:nA  NONE
6127    ID       NAME   ATTR        PRICEIL CURR_CNT HOLDID
6128    ------------------------------------------------------------------------------
6129    1a010002   TRmi   PR:BI:IN      0        1     00000000
6130
6131**CONFIGURATION:**
6132
6133.. index:: CONFIGURE_SHELL_NO_COMMAND_OBJECT
6134.. index:: CONFIGURE_SHELL_COMMAND_OBJECT
6135
6136This command is included in the default shell command set.
6137When building a custom command set, define``CONFIGURE_SHELL_COMMAND_OBJECT`` to have this
6138command included.
6139
6140This command can be excluded from the shell command set by
6141defining ``CONFIGURE_SHELL_NO_COMMAND_OBJECT`` when all
6142shell commands have been configured.
6143
6144**PROGRAMMING INFORMATION:**
6145
6146.. index:: rtems_shell_rtems_main_object
6147
6148The ``object`` is implemented by a C language function
6149which has the following prototype:
6150.. code:: c
6151
6152    int rtems_shell_rtems_main_object(
6153    int    argc,
6154    char \**argv
6155    );
6156
6157The configuration structure for the ``object`` has the
6158following prototype:
6159.. code:: c
6160
6161    extern rtems_shell_cmd_t rtems_shell_OBJECT_Command;
6162
6163driver - display the rtems device driver table
6164----------------------------------------------
6165.. index:: driver
6166
6167**SYNOPSYS:**
6168
6169.. code:: c
6170
6171    driver [ major [ major ... ] ]
6172
6173**DESCRIPTION:**
6174
6175When invoked with no arguments, this command prints information on
6176the set of Device Drivers currently active in the system.
6177
6178If invoked with a set of major numbers as arguments, then just
6179those Device Drivers are included in the information printed.
6180
6181**EXIT STATUS:**
6182
6183This command returns 0 on success and non-zero if an error is encountered.
6184
6185**NOTES:**
6186
6187NONE
6188
6189**EXAMPLES:**
6190
6191The following is an example of how to use ``driver``:
6192.. code:: c
6193
6194    SHLL \[/] $ driver
6195    Major      Entry points
6196    ------------------------------------------------------------------------------
6197    0          init: \[0x200256c];  control: \[0x20024c8]
6198    open: \[0x2002518];  close: \[0x2002504]
6199    read: \[0x20024f0];  write: \[0x20024dc]
6200    1          init: \[0x20023fc];  control: \[0x2002448]
6201    open: \[0x0];  close: \[0x0]
6202    read: \[0x0];  write: \[0x0]
6203    SHLL \[/] $
6204
6205**CONFIGURATION:**
6206
6207.. index:: CONFIGURE_SHELL_NO_COMMAND_DRIVER
6208.. index:: CONFIGURE_SHELL_COMMAND_DRIVER
6209
6210This command is included in the default shell command set.
6211When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DRIVER`` to have this
6212command included.
6213
6214This command can be excluded from the shell command set by
6215defining ``CONFIGURE_SHELL_NO_COMMAND_DRIVER`` when all
6216shell commands have been configured.
6217
6218**PROGRAMMING INFORMATION:**
6219
6220.. index:: rtems_shell_rtems_main_driver
6221
6222The ``driver`` is implemented by a C language function
6223which has the following prototype:
6224.. code:: c
6225
6226    int rtems_shell_rtems_main_driver(
6227    int    argc,
6228    char \**argv
6229    );
6230
6231The configuration structure for the ``driver`` has the
6232following prototype:
6233.. code:: c
6234
6235    extern rtems_shell_cmd_t rtems_shell_DRIVER_Command;
6236
6237dname - displays information about named drivers
6238------------------------------------------------
6239.. index:: dname
6240
6241**SYNOPSYS:**
6242
6243.. code:: c
6244
6245    dname
6246
6247**DESCRIPTION:**
6248
6249This command XXX
6250
6251WARNING! XXX This command does not appear to work as of 27 February 2008.
6252
6253**EXIT STATUS:**
6254
6255This command returns 0 on success and non-zero if an error is encountered.
6256
6257**NOTES:**
6258
6259NONE
6260
6261**EXAMPLES:**
6262
6263The following is an example of how to use ``dname``:
6264.. code:: c
6265
6266    EXAMPLE_TBD
6267
6268**CONFIGURATION:**
6269
6270.. index:: CONFIGURE_SHELL_NO_COMMAND_DNAME
6271.. index:: CONFIGURE_SHELL_COMMAND_DNAME
6272
6273This command is included in the default shell command set.
6274When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DNAME`` to have this
6275command included.
6276
6277This command can be excluded from the shell command set by
6278defining ``CONFIGURE_SHELL_NO_COMMAND_DNAME`` when all
6279shell commands have been configured.
6280
6281**PROGRAMMING INFORMATION:**
6282
6283.. index:: rtems_shell_rtems_main_dname
6284
6285The ``dname`` is implemented by a C language function
6286which has the following prototype:
6287.. code:: c
6288
6289    int rtems_shell_rtems_main_dname(
6290    int    argc,
6291    char \**argv
6292    );
6293
6294The configuration structure for the ``dname`` has the
6295following prototype:
6296.. code:: c
6297
6298    extern rtems_shell_cmd_t rtems_shell_DNAME_Command;
6299
6300pthread - display information about POSIX threads
6301-------------------------------------------------
6302.. index:: pthread
6303
6304**SYNOPSYS:**
6305
6306.. code:: c
6307
6308    pthread \[id \[id ...] ]
6309
6310**DESCRIPTION:**
6311
6312When invoked with no arguments, this command prints information on
6313the set of POSIX API threads currently active in the system.
6314
6315If invoked with a set of ids as arguments, then just
6316those objects are included in the information printed.
6317
6318**EXIT STATUS:**
6319
6320This command returns 0 on success and non-zero if an error is encountered.
6321
6322**NOTES:**
6323
6324This command is only available when the POSIX API is configured.
6325
6326**EXAMPLES:**
6327
6328The following is an example of how to use the ``task`` on an
6329application with four POSIX threads:
6330.. code:: c
6331
6332    SHLL \[/] $ pthread
6333    ID       NAME           PRI  STATE MODES   EVENTS    WAITID  WAITARG  NOTES
6334    ------------------------------------------------------------------------------
6335    0b010002   Main           133 READY  P:T:nA    NONE   43010001 0x7b1148
6336    0b010003   ISR            133 Wcvar  P:T:nA    NONE   43010003 0x7b1148
6337    0b01000c                  133 READY  P:T:nA    NONE   33010002 0x7b1148
6338    0b01000d                  133 Wmutex P:T:nA    NONE   33010002 0x7b1148
6339
6340**CONFIGURATION:**
6341
6342This command is part of the monitor commands which are always
6343available in the shell.
6344
6345**PROGRAMMING INFORMATION:**
6346
6347This command is not directly available for invocation.
6348
6349.. COMMENT: COPYRIGHT (c) 1988-2008.
6350
6351.. COMMENT: On-Line Applications Research Corporation (OAR).
6352
6353.. COMMENT: All rights reserved.
6354
6355Network Commands
6356################
6357
6358Introduction
6359============
6360
6361The RTEMS shell has the following network commands:
6362
6363- ``netstats`` - obtain network statistics
6364
6365- ``ifconfig`` - configure a network interface
6366
6367- ``route`` - show or manipulate the IP routing table
6368
6369- ``ping`` - ping a host or IP address
6370
6371Commands
6372========
6373
6374This section details the Network Commands available.  A
6375subsection is dedicated to each of the commands and
6376describes the behavior and configuration of that
6377command as well as providing an example usage.
6378
6379netstats - obtain network statistics
6380------------------------------------
6381.. index:: netstats
6382
6383**SYNOPSYS:**
6384
6385.. code:: c
6386
6387    netstats \[-Aimfpcut]
6388
6389**DESCRIPTION:**
6390
6391This command is used to display various types of network statistics.  The
6392information displayed can be specified using command line arguments in
6393various combinations.  The arguments are interpreted as follows:
6394
6395*-A*
6396    print All statistics
6397
6398*-i*
6399    print Inet Routes
6400
6401*-m*
6402    print MBUF Statistics
6403
6404*-f*
6405    print IF Statistics
6406
6407*-p*
6408    print IP Statistics
6409
6410*-c*
6411    print ICMP Statistics
6412
6413*-u*
6414    print UDP Statistics
6415
6416*-t*
6417    print TCP Statistics
6418
6419**EXIT STATUS:**
6420
6421This command returns 0 on success and non-zero if an error is encountered.
6422
6423**NOTES:**
6424
6425NONE
6426
6427**EXAMPLES:**
6428
6429The following is an example of how to use ``netstats``:
6430
6431The following is an example of using the ``netstats``
6432command to print the IP routing table:
6433.. code:: c
6434
6435    [/] $ netstats -i
6436    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6437    default         192.168.1.14       UGS         0        0      0 eth1
6438    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6439    192.168.1.14    00:A0:C8:1C:EE:28  UHL         1        0   1219 eth1
6440    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0      840   1202 eth1
6441    192.168.1.151   00:1C:23:B2:0F:BB  UHL         1       23   1219 eth1
6442
6443The following is an example of using the ``netstats``
6444command to print the MBUF statistics:
6445.. code:: c
6446
6447    [/] $ netstats -m
6448    \************ MBUF STATISTICS \************
6449    mbufs:2048    clusters: 128    free:  63
6450    drops:   0       waits:   0  drains:   0
6451    free:1967          data:79          header:2           socket:0
6452    pcb:0           rtable:0           htable:0           atable:0
6453    soname:0           soopts:0           ftable:0           rights:0
6454    ifaddr:0          control:0          oobdata:0
6455
6456The following is an example of using the ``netstats``
6457command to print the print the interface statistics:
6458.. code:: c
6459
6460    [/] $ netstats -f
6461    \************ INTERFACE STATISTICS \************
6462    \***** eth1 \*****
6463    Ethernet Address: 00:04:9F:00:5B:21
6464    Address:192.168.1.244   Broadcast Address:192.168.1.255   Net mask:255.255.255.0
6465    Flags: Up Broadcast Running Active Multicast
6466    Send queue limit:50   length:1    Dropped:0
6467    Rx Interrupts:889            Not First:0               Not Last:0
6468    Giant:0              Non-octet:0
6469    Bad CRC:0                Overrun:0              Collision:0
6470    Tx Interrupts:867             Deferred:0         Late Collision:0
6471    Retransmit Limit:0               Underrun:0             Misaligned:0
6472
6473The following is an example of using the ``netstats``
6474command to print the print IP statistics:
6475.. code:: c
6476
6477    [/] $ netstats -p
6478    \************ IP Statistics \************
6479    total packets received         894
6480    packets rcvd for unreachable dest          13
6481    datagrams delivered to upper level         881
6482    total ip packets generated here         871
6483
6484The following is an example of using the ``netstats``
6485command to print the ICMP statistics:
6486.. code:: c
6487
6488    [/] $ netstats -c
6489    \************ ICMP Statistics \************
6490    Type 0 sent         843
6491    number of responses         843
6492    Type 8 received         843
6493
6494The following is an example of using the ``netstats``
6495command to print the UDP statistics:
6496.. code:: c
6497
6498    [/] $ netstats -u
6499    \************ UDP Statistics \************
6500
6501The following is an example of using the ``netstats``
6502command to print the TCP statistics:
6503.. code:: c
6504
6505    [/] $ netstats -t
6506    \************ TCP Statistics \************
6507    connections accepted           1
6508    connections established           1
6509    segs where we tried to get rtt          34
6510    times we succeeded          35
6511    delayed acks sent           2
6512    total packets sent          37
6513    data packets sent          35
6514    data bytes sent        2618
6515    ack-only packets sent           2
6516    total packets received          47
6517    packets received in sequence          12
6518    bytes received in sequence         307
6519    rcvd ack packets          35
6520    bytes acked by rcvd acks        2590
6521    times hdr predict ok for acks          27
6522    times hdr predict ok for data pkts          10
6523
6524**CONFIGURATION:**
6525
6526.. index:: CONFIGURE_SHELL_NO_COMMAND_NETSTATS
6527.. index:: CONFIGURE_SHELL_COMMAND_NETSTATS
6528
6529This command is included in the default shell command set.
6530When building a custom command set, define``CONFIGURE_SHELL_COMMAND_NETSTATS`` to have this
6531command included.
6532
6533This command can be excluded from the shell command set by
6534defining ``CONFIGURE_SHELL_NO_COMMAND_NETSTATS`` when all
6535shell commands have been configured.
6536
6537**PROGRAMMING INFORMATION:**
6538
6539.. index:: rtems_shell_rtems_main_netstats
6540
6541The ``netstats`` is implemented by a C language function
6542which has the following prototype:
6543.. code:: c
6544
6545    int rtems_shell_rtems_main_netstats(
6546    int    argc,
6547    char \**argv
6548    );
6549
6550The configuration structure for the ``netstats`` has the
6551following prototype:
6552.. code:: c
6553
6554    extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command;
6555
6556ifconfig - configure a network interface
6557----------------------------------------
6558.. index:: ifconfig
6559
6560**SYNOPSYS:**
6561
6562.. code:: c
6563
6564    ifconfig
6565    ifconfig interface
6566    ifconfig interface \[up|down]
6567    ifconfig interface \[netmask|pointtopoint|broadcast] IP
6568
6569**DESCRIPTION:**
6570
6571This command may be used to display information about the
6572network interfaces in the system or configure them.
6573
6574**EXIT STATUS:**
6575
6576This command returns 0 on success and non-zero if an error is encountered.
6577
6578**NOTES:**
6579
6580Just like its counterpart on GNU/Linux and BSD systems, this command
6581is complicated.  More example usages would be a welcome submission.
6582
6583**EXAMPLES:**
6584
6585The following is an example of how to use ``ifconfig``:
6586.. code:: c
6587
6588    ************ INTERFACE STATISTICS \************
6589    \***** eth1 \*****
6590    Ethernet Address: 00:04:9F:00:5B:21
6591    Address:192.168.1.244   Broadcast Address:192.168.1.255   Net mask:255.255.255.0
6592    Flags: Up Broadcast Running Active Multicast
6593    Send queue limit:50   length:1    Dropped:0
6594    Rx Interrupts:5391           Not First:0               Not Last:0
6595    Giant:0              Non-octet:0
6596    Bad CRC:0                Overrun:0              Collision:0
6597    Tx Interrupts:5256            Deferred:0         Late Collision:0
6598    Retransmit Limit:0               Underrun:0             Misaligned:0
6599
6600**CONFIGURATION:**
6601
6602.. index:: CONFIGURE_SHELL_NO_COMMAND_IFCONFIG
6603.. index:: CONFIGURE_SHELL_COMMAND_IFCONFIG
6604
6605This command is included in the default shell command set.
6606When building a custom command set, define``CONFIGURE_SHELL_COMMAND_IFCONFIG`` to have this
6607command included.
6608
6609This command can be excluded from the shell command set by
6610defining ``CONFIGURE_SHELL_NO_COMMAND_IFCONFIG`` when all
6611shell commands have been configured.
6612
6613**PROGRAMMING INFORMATION:**
6614
6615.. index:: rtems_shell_rtems_main_ifconfig
6616
6617The ``ifconfig`` is implemented by a C language function
6618which has the following prototype:
6619.. code:: c
6620
6621    int rtems_shell_rtems_main_ifconfig(
6622    int    argc,
6623    char \**argv
6624    );
6625
6626The configuration structure for the ``ifconfig`` has the
6627following prototype:
6628.. code:: c
6629
6630    extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
6631
6632route - show or manipulate the ip routing table
6633-----------------------------------------------
6634.. index:: route
6635
6636**SYNOPSYS:**
6637
6638.. code:: c
6639
6640    route \[subcommand] \[args]
6641
6642**DESCRIPTION:**
6643
6644This command is used to display and manipulate the routing table.
6645When invoked with no arguments, the current routing information is
6646displayed.  When invoked with the subcommands ``add`` or ``del``,
6647then additional arguments must be provided to describe the route.
6648
6649Command templates include the following:
6650.. code:: c
6651
6652    route \[add|del] -net IP_ADDRESS gw GATEWAY_ADDRESS \[netmask MASK]
6653    route \[add|del] -host IP_ADDRESS gw GATEWAY_ADDRES \[netmask MASK]
6654
6655When not provided the netmask defaults to ``255.255.255.0``
6656
6657**EXIT STATUS:**
6658
6659This command returns 0 on success and non-zero if an error is encountered.
6660
6661**NOTES:**
6662
6663Just like its counterpart on GNU/Linux and BSD systems, this command
6664is complicated.  More example usages would be a welcome submission.
6665
6666**EXAMPLES:**
6667
6668The following is an example of how to use ``route`` to display,
6669add, and delete a new route:
6670.. code:: c
6671
6672    [/] $ route
6673    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6674    default         192.168.1.14       UGS         0        0      0 eth1
6675    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6676    192.168.1.14    00:A0:C8:1C:EE:28  UHL         1        0   1444 eth1
6677    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0    10844   1202 eth1
6678    192.168.1.151   00:1C:23:B2:0F:BB  UHL         2       37   1399 eth1
6679    \[/] $  route add -net 192.168.3.0 gw 192.168.1.14
6680    \[/] $ route
6681    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6682    default         192.168.1.14       UGS         0        0      0 eth1
6683    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6684    192.168.1.14    00:A0:C8:1C:EE:28  UHL         2        0   1498 eth1
6685    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0    14937   1202 eth1
6686    192.168.1.151   00:1C:23:B2:0F:BB  UHL         2       96   1399 eth1
6687    192.168.3.0     192.168.1.14       UGS         0        0      0 eth1
6688    \[/] $ route del -net 192.168.3.0 gw 192.168.1.14
6689    \[/] $ route
6690    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6691    default         192.168.1.14       UGS         0        0      0 eth1
6692    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6693    192.168.1.14    00:A0:C8:1C:EE:28  UHL         1        0   1498 eth1
6694    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0    15945   1202 eth1
6695    192.168.1.151   00:1C:23:B2:0F:BB  UHL         2      117   1399 eth1
6696
6697**CONFIGURATION:**
6698
6699.. index:: CONFIGURE_SHELL_NO_COMMAND_ROUTE
6700.. index:: CONFIGURE_SHELL_COMMAND_ROUTE
6701
6702This command is included in the default shell command set.
6703When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ROUTE`` to have this
6704command included.
6705
6706This command can be excluded from the shell command set by
6707defining ``CONFIGURE_SHELL_NO_COMMAND_ROUTE`` when all
6708shell commands have been configured.
6709
6710**PROGRAMMING INFORMATION:**
6711
6712.. index:: rtems_shell_rtems_main_route
6713
6714The ``route`` is implemented by a C language function
6715which has the following prototype:
6716.. code:: c
6717
6718    int rtems_shell_rtems_main_route(
6719    int    argc,
6720    char \**argv
6721    );
6722
6723The configuration structure for the ``route`` has the
6724following prototype:
6725.. code:: c
6726
6727    extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
6728
6729ping - ping a host or IP address
6730--------------------------------
6731.. index:: ping
6732
6733**SYNOPSYS:**
6734
6735.. code:: c
6736
6737    ping \[-AaDdfnoQqRrv] \[-c count] \[-G sweepmaxsize] \[-g sweepminsize]
6738    \[-h sweepincrsize] \[-i wait] \[-l preload] \[-M mask | time] \[-m ttl]
6739    \[-p pattern] \[-S src_addr] \[-s packetsize] \[-t timeout]
6740    \[-W waittime] \[-z tos] host
6741    ping \[-AaDdfLnoQqRrv] \[-c count] \[-I iface] \[-i wait] \[-l preload]
6742    \[-M mask | time] \[-m ttl] \[-p pattern] \[-S src_addr]
6743    \[-s packetsize] \[-T ttl] \[-t timeout] \[-W waittime]
6744    \[-z tos] mcast-group
6745
6746**DESCRIPTION:**
6747
6748The ping utility uses the ICMP protocol’s mandatory ECHO_REQUEST
6749datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.
6750ECHO_REQUEST datagrams (“pings”) have an IP and ICMP header,
6751followed by a “struct timeval” and then an arbitrary number of
6752“pad” bytes used to fill out the packet.  The options are as
6753follows:
6754
6755*-A*
6756    Audible.  Output a bell (ASCII 0x07) character when no packet is
6757    received before the next packet is transmitted.  To cater for
6758    round-trip times that are longer than the interval between
6759    transmissions, further missing packets cause a bell only if the
6760    maximum number of unreceived packets has increased.
6761
6762*-a*
6763    Audible.  Include a bell (ASCII 0x07) character in the output when any
6764    packet is received.  This option is ignored if other format options
6765    are present.
6766
6767*-c count*
6768    Stop after sending (and receiving) count ECHO_RESPONSE packets.  If
6769    this option is not specified, ping will operate until interrupted.  If
6770    this option is specified in conjunction with ping sweeps, each sweep
6771    will consist of count packets.
6772
6773*-D*
6774    Set the Don’t Fragment bit.
6775
6776*-d*
6777    Set the SO_DEBUG option on the socket being used.
6778
6779*-f*
6780    Flood ping.  Outputs packets as fast as they come back or one
6781    hundred times per second, whichever is more.  For every ECHO_REQUEST
6782    sent a period “.” is printed, while for every ECHO_REPLY received a
6783    backspace is printed.  This provides a rapid display of how many
6784    packets are being dropped.  Only the super-user may use this option.
6785    This can be very hard on a network and should be used with caution.
6786
6787*-G sweepmaxsize*
6788    Specify the maximum size of ICMP payload when sending sweeping pings.
6789    This option is required for ping sweeps.
6790
6791*-g sweepminsize*
6792    Specify the size of ICMP payload to start with when sending sweeping
6793    pings.  The default value is 0.
6794
6795*-h sweepincrsize*
6796    Specify the number of bytes to increment the size of ICMP payload
6797    after each sweep when sending sweeping pings.  The default value is 1.
6798
6799*-I iface*
6800    Source multicast packets with the given interface address.  This flag
6801    only applies if the ping destination is a multicast address.
6802
6803*-i wait*
6804    Wait wait seconds between sending each packet.  The default is to wait
6805    for one second between each packet.  The wait time may be fractional,
6806    but only the super-user may specify values less than 1 second.  This
6807    option is incompatible with the -f option.
6808
6809*-L*
6810    Suppress loopback of multicast packets.  This flag only applies if the
6811    ping destination is a multicast address.
6812
6813*-l preload*
6814    If preload is specified, ping sends that many packets as fast as
6815    possible before falling into its normal mode of behavior.  Only the
6816    super-user may use this option.
6817
6818*-M mask | time*
6819    Use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO.  For mask, print
6820    the netmask of the remote machine.  Set the net.inet.icmp.maskrepl MIB
6821    variable to enable ICMP_MASKREPLY.  For time, print the origination,
6822    reception and transmission timestamps.
6823
6824*-m ttl*
6825    Set the IP Time To Live for outgoing packets.  If not specified, the
6826    kernel uses the value of the net.inet.ip.ttl MIB variable.
6827
6828*-n*
6829    Numeric output only.  No attempt will be made to lookup symbolic names
6830    for host addresses.
6831
6832*-o*
6833    Exit successfully after receiving one reply packet.
6834
6835*-p pattern*
6836    You may specify up to 16 “pad” bytes to fill out the packet you
6837    send.  This is useful for diagnosing data-dependent problems in a
6838    network.  For example, “-p ff” will cause the sent packet to be
6839    filled with all ones.
6840
6841*-Q*
6842    Somewhat quiet output.  Don’t display ICMP error messages that are in
6843    response to our query messages.  Originally, the -v flag was required
6844    to display such errors, but -v displays all ICMP error messages.  On a
6845    busy machine, this output can be overbear- ing.  Without the -Q flag,
6846    ping prints out any ICMP error mes- sages caused by its own
6847    ECHO_REQUEST messages.
6848
6849*-q*
6850    Quiet output.  Nothing is displayed except the summary lines at
6851    startup time and when finished.
6852
6853*-R*
6854    Record route.  Includes the RECORD_ROUTE option in the ECHO_REQUEST
6855    packet and displays the route buffer on returned packets.  Note that
6856    the IP header is only large enough for nine such routes; the
6857    traceroute(8) command is usually better at determining the route
6858    packets take to a particular destination.  If more routes come back
6859    than should, such as due to an illegal spoofed packet, ping will print
6860    the route list and then truncate it at the correct spot.  Many hosts
6861    ignore or discard the RECORD_ROUTE option.
6862
6863*-r*
6864    Bypass the normal routing tables and send directly to a host on an
6865    attached network.  If the host is not on a directly-attached network,
6866    an error is returned.  This option can be used to ping a local host
6867    through an interface that has no route through it (e.g., after the
6868    interface was dropped).
6869
6870*-S src_addr*
6871    Use the following IP address as the source address in outgoing
6872    packets.  On hosts with more than one IP address, this option can be
6873    used to force the source address to be something other than the IP
6874    address of the interface the probe packet is sent on.  If the IP
6875    address is not one of this machine’s interface addresses, an error is
6876    returned and nothing is sent.
6877
6878*-s packetsize*
6879    Specify the number of data bytes to be sent.  The default is 56, which
6880    translates into 64 ICMP data bytes when combined with the 8 bytes of
6881    ICMP header data.  Only the super-user may specify val- ues more than
6882    default.  This option cannot be used with ping sweeps.
6883
6884*-T ttl*
6885    Set the IP Time To Live for multicasted packets.  This flag only
6886    applies if the ping destination is a multicast address.
6887
6888*-t timeout*
6889    Specify a timeout, in seconds, before ping exits regardless of how
6890    many packets have been received.
6891
6892*-v*
6893    Verbose output.  ICMP packets other than ECHO_RESPONSE that are
6894    received are listed.
6895
6896*-W waittime*
6897    Time in milliseconds to wait for a reply for each packet sent.  If a
6898    reply arrives later, the packet is not printed as replied, but
6899    considered as replied when calculating statistics.
6900
6901*-z tos*
6902    Use the specified type of service.
6903
6904**EXIT STATUS:**
6905
6906The ping utility exits with one of the following values:
6907
69080    At least one response was heard from the specified host.
6909
69102    The transmission was successful but no responses were
6911received.
6912
6913any other value an error occurred.  These values are defined in
6914<sysexits.h>.
6915
6916**NOTES:**
6917
6918When using ping for fault isolation, it should first be run on the
6919local host, to verify that the local network interface is up and
6920running.  Then, hosts and gateways further and further away should be
6921“pinged”.  Round-trip times and packet loss statistics are computed.
6922If duplicate packets are received, they are not included in the packet
6923loss calculation, although the round trip time of these packets is
6924used in calculating the round-trip time statistics.  When the
6925specified number of packets have been sent a brief summary is
6926displayed, showing the number of packets sent and received, and the
6927minimum, mean, maximum, and standard deviation of the round-trip
6928times.
6929
6930This program is intended for use in network testing, measurement and
6931management.  Because of the load it can impose on the network, it is
6932unwise to use ping during normal operations or from automated scripts.
6933
6934**EXAMPLES:**
6935
6936The following is an example of how to use ``oing`` to ping:
6937.. code:: c
6938
6939    [/] # ping 10.10.10.1
6940    PING 10.10.10.1 (10.10.10.1): 56 data bytes
6941    64 bytes from 10.10.10.1: icmp_seq=0 ttl=63 time=0.356 ms
6942    64 bytes from 10.10.10.1: icmp_seq=1 ttl=63 time=0.229 ms
6943    64 bytes from 10.10.10.1: icmp_seq=2 ttl=63 time=0.233 ms
6944    64 bytes from 10.10.10.1: icmp_seq=3 ttl=63 time=0.235 ms
6945    64 bytes from 10.10.10.1: icmp_seq=4 ttl=63 time=0.229 ms
6946    --- 10.10.10.1 ping statistics ---
6947    5 packets transmitted, 5 packets received, 0.0% packet loss
6948    round-trip min/avg/max/stddev = 0.229/0.256/0.356/0.050 ms
6949    \[/] # ping -f -c 10000  10.10.10.1
6950    PING 10.10.10.1 (10.10.10.1): 56 data bytes
6951    .
6952    --- 10.10.10.1 ping statistics ---
6953    10000 packets transmitted, 10000 packets received, 0.0% packet loss
6954    round-trip min/avg/max/stddev = 0.154/0.225/0.533/0.027 ms
6955
6956**CONFIGURATION:**
6957
6958.. index:: CONFIGURE_SHELL_NO_COMMAND_PING
6959.. index:: CONFIGURE_SHELL_COMMAND_PING
6960
6961This command is included in the default shell command set.
6962When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PING`` to have this
6963command included.
6964
6965This command can be excluded from the shell command set by
6966defining ``CONFIGURE_SHELL_NO_COMMAND_PING`` when all
6967shell commands have been configured.
6968
6969**PROGRAMMING INFORMATION:**
6970
6971.. index:: rtems_shell_rtems_main_ping
6972
6973The ``ping`` is implemented by a C language function
6974which has the following prototype:
6975.. code:: c
6976
6977    int rtems_shell_rtems_main_ping(
6978    int    argc,
6979    char \**argv
6980    );
6981
6982The configuration structure for the ``ping`` has the
6983following prototype:
6984.. code:: c
6985
6986    extern rtems_shell_cmd_t rtems_shell_PING_Command;
6987
6988Function and Variable Index
6989###########################
6990
6991.. COMMENT: There are currently no Command and Variable Index entries.
6992
6993Concept Index
6994#############
6995
6996Command Index
6997#############
6998
Note: See TracBrowser for help on using the repository browser.