source: rtems-docs/shell/shell_old_reference_only.rst @ 8ca13ed

4.115
Last change on this file since 8ca13ed was 8ca13ed, checked in by Amar Takhar <verm@…>, on 01/16/16 at 20:32:09

Split document.

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