source: rtems-docs/shell/shell.rst @ 9e27b86

4.115
Last change on this file since 9e27b86 was 9e27b86, checked in by Amar Takhar <verm@…>, on 01/16/16 at 05:09:01

Fix references.

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