source: rtems-docs/shell/shell.rst @ 7b8e24e

4.115
Last change on this file since 7b8e24e was 7b8e24e, checked in by Amar Takhar <verm@…>, on 01/16/16 at 05:00:29

Fix broken markup.

  • Property mode set to 100644
File size: 192.2 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
1699.. _General-Commands-logoff-_002d-logoff-from-the-system:
1700
1701logoff - logoff from the system
1702-------------------------------
1703.. index:: logoff
1704
1705**SYNOPSYS:**
1706
1707.. code:: c
1708
1709    logoff
1710
1711**DESCRIPTION:**
1712
1713This command logs the user out of the shell.
1714
1715**EXIT STATUS:**
1716
1717This command does not return.
1718
1719**NOTES:**
1720
1721The system behavior when the shell is exited depends upon how the
1722shell was initiated.  The typical behavior is that a login prompt
1723will be displayed for the next login attempt or that the connection
1724will be dropped by the RTEMS system.
1725
1726**EXAMPLES:**
1727
1728The following is an example of how to use ``logoff``:
1729.. code:: c
1730
1731    SHLL \[/] $ logoff
1732    logoff from the system...
1733
1734**CONFIGURATION:**
1735
1736.. index:: CONFIGURE_SHELL_NO_COMMAND_LOGOFF
1737.. index:: CONFIGURE_SHELL_COMMAND_LOGOFF
1738
1739This command is included in the default shell command set.
1740When building a custom command set, define``CONFIGURE_SHELL_COMMAND_LOGOFF`` to have this
1741command included.
1742
1743This command can be excluded from the shell command set by
1744defining ``CONFIGURE_SHELL_NO_COMMAND_LOGOFF`` when all
1745shell commands have been configured.
1746
1747**PROGRAMMING INFORMATION:**
1748
1749.. index:: rtems_shell_rtems_main_logoff
1750
1751The ``logoff`` is implemented by a C language function
1752which has the following prototype:
1753.. code:: c
1754
1755    int rtems_shell_rtems_main_logoff(
1756    int    argc,
1757    char \**argv
1758    );
1759
1760The configuration structure for the ``logoff`` has the
1761following prototype:
1762.. code:: c
1763
1764    extern rtems_shell_cmd_t rtems_shell_LOGOFF_Command;
1765
1766rtc - RTC driver configuration
1767------------------------------
1768.. index:: rtc
1769
1770**SYNOPSYS:**
1771
1772.. code:: c
1773
1774    rtc
1775
1776**CONFIGURATION:**
1777
1778.. index:: CONFIGURE_SHELL_NO_COMMAND_RTC
1779.. index:: CONFIGURE_SHELL_COMMAND_RTC
1780
1781This command is included in the default shell command set.
1782When building a custom command set, define``CONFIGURE_SHELL_COMMAND_RTC`` to have this
1783command included.
1784
1785This command can be excluded from the shell command set by
1786defining ``CONFIGURE_SHELL_NO_COMMAND_RTC`` when all
1787shell commands have been configured.
1788
1789exit - exit the shell
1790---------------------
1791.. index:: exit
1792
1793**SYNOPSYS:**
1794
1795.. code:: c
1796
1797    exit
1798
1799**DESCRIPTION:**
1800
1801This command causes the shell interpreter to ``exit``.
1802
1803**EXIT STATUS:**
1804
1805This command does not return.
1806
1807**NOTES:**
1808
1809In contrast to :ref:`logoff <General-Commands-logoff-_002d-logoff-from-the-system>`,
1810this command is built into the shell interpreter loop.
1811
1812**EXAMPLES:**
1813
1814The following is an example of how to use ``exit``:
1815.. code:: c
1816
1817    SHLL \[/] $ exit
1818    Shell exiting
1819
1820**CONFIGURATION:**
1821
1822This command is always present and cannot be disabled.
1823
1824**PROGRAMMING INFORMATION:**
1825
1826The ``exit`` is implemented directly in the shell interpreter.
1827There is no C routine associated with it.
1828
1829.. COMMENT: COPYRIGHT (c) 1988-2008.
1830
1831.. COMMENT: On-Line Applications Research Corporation (OAR).
1832
1833.. COMMENT: All rights reserved.
1834
1835File and Directory Commands
1836###########################
1837
1838Introduction
1839============
1840
1841The RTEMS shell has the following file and directory commands:
1842
1843- ``blksync`` - sync the block driver
1844
1845- ``cat`` - display file contents
1846
1847- ``cd`` - alias for chdir
1848
1849- ``chdir`` - change the current directory
1850
1851- ``chmod`` - change permissions of a file
1852
1853- ``chroot`` - change the root directory
1854
1855- ``cp`` - copy files
1856
1857- ``dd`` - format disks
1858
1859- ``debugrfs`` - debug RFS file system
1860
1861- ``df`` - display file system disk space usage
1862
1863- ``dir`` - alias for ls
1864
1865- ``fdisk`` - format disks
1866
1867- ``hexdump`` - format disks
1868
1869- ``ln`` - make links
1870
1871- ``ls`` - list files in the directory
1872
1873- ``md5`` - display file system disk space usage
1874
1875- ``mkdir`` - create a directory
1876
1877- ``mkdos`` - DOSFS disk format
1878
1879- ``mknod`` - make device special file
1880
1881- ``mkrfs`` - format RFS file system
1882
1883- ``mount`` - mount disk
1884
1885- ``mv`` - move files
1886
1887- ``pwd`` - print work directory
1888
1889- ``rmdir`` - remove empty directories
1890
1891- ``rm`` - remove files
1892
1893- ``umask`` - Set file mode creation mask
1894
1895- ``unmount`` - unmount disk
1896
1897Commands
1898========
1899
1900This section details the File and Directory Commands available.  A
1901subsection is dedicated to each of the commands and
1902describes the behavior and configuration of that
1903command as well as providing an example usage.
1904
1905blksync - sync the block driver
1906-------------------------------
1907.. index:: blksync
1908
1909**SYNOPSYS:**
1910
1911.. code:: c
1912
1913    blksync driver
1914
1915**DESCRIPTION:**
1916
1917This command XXX
1918
1919**EXIT STATUS:**
1920
1921This command returns 0 on success and non-zero if an error is encountered.
1922
1923**NOTES:**
1924
1925NONE
1926
1927**EXAMPLES:**
1928
1929The following is an example of how to use ``blksync``:
1930.. code:: c
1931
1932    EXAMPLE_TBD
1933
1934**CONFIGURATION:**
1935
1936.. index:: CONFIGURE_SHELL_NO_COMMAND_BLKSYNC
1937.. index:: CONFIGURE_SHELL_COMMAND_BLKSYNC
1938
1939This command is included in the default shell command set.
1940When building a custom command set, define``CONFIGURE_SHELL_COMMAND_BLKSYNC`` to have this
1941command included.
1942
1943This command can be excluded from the shell command set by
1944defining ``CONFIGURE_SHELL_NO_COMMAND_BLKSYNC`` when all
1945shell commands have been configured.
1946
1947**PROGRAMMING INFORMATION:**
1948
1949.. index:: rtems_shell_rtems_main_blksync
1950
1951The ``blksync`` is implemented by a C language function
1952which has the following prototype:
1953.. code:: c
1954
1955    int rtems_shell_rtems_main_blksync(
1956    int    argc,
1957    char \**argv
1958    );
1959
1960The configuration structure for the ``blksync`` has the
1961following prototype:
1962.. code:: c
1963
1964    extern rtems_shell_cmd_t rtems_shell_BLKSYNC_Command;
1965
1966cat - display file contents
1967---------------------------
1968.. index:: cat
1969
1970**SYNOPSYS:**
1971
1972.. code:: c
1973
1974    cat file1 \[file2 .. fileN]
1975
1976**DESCRIPTION:**
1977
1978This command displays the contents of the specified files.
1979
1980**EXIT STATUS:**
1981
1982This command returns 0 on success and non-zero if an error is encountered.
1983
1984**NOTES:**
1985
1986It is possible to read the input from a device file using ``cat``.
1987
1988**EXAMPLES:**
1989
1990The following is an example of how to use ``cat``:
1991.. code:: c
1992
1993    SHLL \[/] # cat /etc/passwd
1994    root:\*:0:0:root::/:/bin/sh
1995    rtems:\*:1:1:RTEMS Application::/:/bin/sh
1996    tty:!:2:2:tty owner::/:/bin/false
1997
1998**CONFIGURATION:**
1999
2000.. index:: CONFIGURE_SHELL_NO_COMMAND_CAT
2001.. index:: CONFIGURE_SHELL_COMMAND_CAT
2002
2003This command is included in the default shell command set.
2004When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CAT`` to have this
2005command included.
2006
2007This command can be excluded from the shell command set by
2008defining ``CONFIGURE_SHELL_NO_COMMAND_CAT`` when all
2009shell commands have been configured.
2010
2011**PROGRAMMING INFORMATION:**
2012
2013.. index:: rtems_shell_rtems_main_cat
2014
2015The ``cat`` is implemented by a C language function
2016which has the following prototype:
2017.. code:: c
2018
2019    int rtems_shell_rtems_main_cat(
2020    int    argc,
2021    char \**argv
2022    );
2023
2024The configuration structure for the ``cat`` has the
2025following prototype:
2026.. code:: c
2027
2028    extern rtems_shell_cmd_t rtems_shell_CAT_Command;
2029
2030cd - alias for chdir
2031--------------------
2032.. index:: cd
2033
2034**SYNOPSYS:**
2035
2036.. code:: c
2037
2038    cd directory
2039
2040**DESCRIPTION:**
2041
2042This command is an alias or alternate name for the ``chdir``.
2043See :ref:`cd <File-and-Directory-Commands-chdir-_002d-change-the-current-directory>`
2044for more information.
2045
2046**EXIT STATUS:**
2047
2048This command returns 0 on success and non-zero if an error is encountered.
2049
2050**NOTES:**
2051
2052NONE
2053
2054**EXAMPLES:**
2055
2056The following is an example of how to use ``cd``:
2057.. code:: c
2058
2059    SHLL \[/] $ cd etc
2060    SHLL \[/etc] $ cd /
2061    SHLL \[/] $ cd /etc
2062    SHLL \[/etc] $ pwd
2063    /etc
2064    SHLL \[/etc] $ cd /
2065    SHLL \[/] $ pwd
2066    /
2067    SHLL \[/] $ cd etc
2068    SHLL \[/etc] $ cd ..
2069    SHLL \[/] $ pwd
2070    /
2071
2072**CONFIGURATION:**
2073
2074.. index:: CONFIGURE_SHELL_NO_COMMAND_CD
2075.. index:: CONFIGURE_SHELL_COMMAND_CD
2076
2077This command is included in the default shell command set.
2078When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CD`` to have this
2079command included.
2080
2081This command can be excluded from the shell command set by
2082defining ``CONFIGURE_SHELL_NO_COMMAND_CD`` when all
2083shell commands have been configured.
2084
2085**PROGRAMMING INFORMATION:**
2086
2087.. index:: rtems_shell_rtems_main_cd
2088
2089The ``cd`` is implemented by a C language function
2090which has the following prototype:
2091.. code:: c
2092
2093    int rtems_shell_rtems_main_cd(
2094    int    argc,
2095    char \**argv
2096    );
2097
2098The configuration structure for the ``cd`` has the
2099following prototype:
2100.. code:: c
2101
2102    extern rtems_shell_cmd_t rtems_shell_CD_Command;
2103
2104.. _File-and-Directory-Commands-chdir-_002d-change-the-current-directory:
2105
2106chdir - change the current directory
2107------------------------------------
2108.. index:: chdir
2109
2110**SYNOPSYS:**
2111
2112.. code:: c
2113
2114    chdir \[dir]
2115
2116**DESCRIPTION:**
2117
2118This command is used to change the current working directory to
2119the specified directory.  If no arguments are given, the current
2120working directory will be changed to ``/``.
2121
2122**EXIT STATUS:**
2123
2124This command returns 0 on success and non-zero if an error is encountered.
2125
2126**NOTES:**
2127
2128NONE
2129
2130**EXAMPLES:**
2131
2132The following is an example of how to use ``chdir``:
2133.. code:: c
2134
2135    SHLL \[/] $ pwd
2136    /
2137    SHLL \[/] $ chdir etc
2138    SHLL \[/etc] $ pwd
2139    /etc
2140
2141**CONFIGURATION:**
2142
2143.. index:: CONFIGURE_SHELL_NO_COMMAND_CHDIR
2144.. index:: CONFIGURE_SHELL_COMMAND_CHDIR
2145
2146This command is included in the default shell command set.
2147When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CHDIR`` to have this
2148command included.
2149
2150This command can be excluded from the shell command set by
2151defining ``CONFIGURE_SHELL_NO_COMMAND_CHDIR`` when all
2152shell commands have been configured.
2153
2154**PROGRAMMING INFORMATION:**
2155
2156.. index:: rtems_shell_rtems_main_chdir
2157
2158The ``chdir`` is implemented by a C language function
2159which has the following prototype:
2160.. code:: c
2161
2162    int rtems_shell_rtems_main_chdir(
2163    int    argc,
2164    char \**argv
2165    );
2166
2167The configuration structure for the ``chdir`` has the
2168following prototype:
2169.. code:: c
2170
2171    extern rtems_shell_cmd_t rtems_shell_CHDIR_Command;
2172
2173chmod - change permissions of a file
2174------------------------------------
2175.. index:: chmod
2176
2177**SYNOPSYS:**
2178
2179.. code:: c
2180
2181    chmod permissions file1 \[file2...]
2182
2183**DESCRIPTION:**
2184
2185This command changes the permissions on the files specified to the
2186indicated ``permissions``.  The permission values are POSIX based
2187with owner, group, and world having individual read, write, and
2188executive permission bits.
2189
2190**EXIT STATUS:**
2191
2192This command returns 0 on success and non-zero if an error is encountered.
2193
2194**NOTES:**
2195
2196The ``chmod`` command only takes numeric representations of
2197the permissions.
2198
2199**EXAMPLES:**
2200
2201The following is an example of how to use ``chmod``:
2202.. code:: c
2203
2204    SHLL \[/] # cd etc
2205    SHLL \[/etc] # ls
2206    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
2207    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2208    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2209    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2210    4 files 202 bytes occupied
2211    SHLL \[/etc] # chmod 0777 passwd
2212    SHLL \[/etc] # ls
2213    -rwxrwxrwx   1   root   root         102 Jan 01 00:00 passwd
2214    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2215    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2216    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2217    4 files 202 bytes occupied
2218    SHLL \[/etc] # chmod 0322 passwd
2219    SHLL \[/etc] # ls
2220    --wx-w--w-   1 nouser   root         102 Jan 01 00:00 passwd
2221    -rw-r--r--   1 nouser   root          42 Jan 01 00:00 group
2222    -rw-r--r--   1 nouser   root          30 Jan 01 00:00 issue
2223    -rw-r--r--   1 nouser   root          28 Jan 01 00:00 issue.net
2224    4 files 202 bytes occupied
2225    SHLL \[/etc] # chmod 0644 passwd
2226    SHLL \[/etc] # ls
2227    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
2228    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2229    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2230    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2231    4 files 202 bytes occupied
2232
2233**CONFIGURATION:**
2234
2235.. index:: CONFIGURE_SHELL_NO_COMMAND_CHMOD
2236.. index:: CONFIGURE_SHELL_COMMAND_CHMOD
2237
2238This command is included in the default shell command set.
2239When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CHMOD`` to have this
2240command included.
2241
2242This command can be excluded from the shell command set by
2243defining ``CONFIGURE_SHELL_NO_COMMAND_CHMOD`` when all
2244shell commands have been configured.
2245
2246**PROGRAMMING INFORMATION:**
2247
2248.. index:: rtems_shell_rtems_main_chmod
2249
2250The ``chmod`` is implemented by a C language function
2251which has the following prototype:
2252.. code:: c
2253
2254    int rtems_shell_rtems_main_chmod(
2255    int    argc,
2256    char \**argv
2257    );
2258
2259The configuration structure for the ``chmod`` has the
2260following prototype:
2261.. code:: c
2262
2263    extern rtems_shell_cmd_t rtems_shell_CHMOD_Command;
2264
2265chroot - change the root directory
2266----------------------------------
2267.. index:: chroot
2268
2269**SYNOPSYS:**
2270
2271.. code:: c
2272
2273    chroot \[dir]
2274
2275**DESCRIPTION:**
2276
2277This command changes the root directory to ``dir`` for subsequent
2278commands.
2279
2280**EXIT STATUS:**
2281
2282This command returns 0 on success and non-zero if an error is encountered.
2283
2284The destination directory ``dir`` must exist.
2285
2286**NOTES:**
2287
2288NONE
2289
2290**EXAMPLES:**
2291
2292The following is an example of how to use ``chroot``
2293and the impact it has on the environment for subsequent
2294command invocations:
2295.. code:: c
2296
2297    SHLL \[/] $ cat passwd
2298    cat: passwd: No such file or directory
2299    SHLL \[/] $ chroot etc
2300    SHLL \[/] $ cat passwd
2301    root:\*:0:0:root::/:/bin/sh
2302    rtems:\*:1:1:RTEMS Application::/:/bin/sh
2303    tty:!:2:2:tty owner::/:/bin/false
2304    SHLL \[/] $ cat /etc/passwd
2305    cat: /etc/passwd: No such file or directory
2306
2307**CONFIGURATION:**
2308
2309.. index:: CONFIGURE_SHELL_NO_COMMAND_CHROOT
2310.. index:: CONFIGURE_SHELL_COMMAND_CHROOT
2311
2312This command is included in the default shell command set.
2313When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CHROOT`` to have this
2314command included. Additional to that you have to add one
2315POSIX key value pair for each thread where you want to use
2316the command.
2317
2318This command can be excluded from the shell command set by
2319defining ``CONFIGURE_SHELL_NO_COMMAND_CHROOT`` when all
2320shell commands have been configured.
2321
2322**PROGRAMMING INFORMATION:**
2323
2324.. index:: rtems_shell_rtems_main_chroot
2325
2326The ``chroot`` is implemented by a C language function
2327which has the following prototype:
2328.. code:: c
2329
2330    int rtems_shell_rtems_main_chroot(
2331    int    argc,
2332    char \**argv
2333    );
2334
2335The configuration structure for the ``chroot`` has the
2336following prototype:
2337.. code:: c
2338
2339    extern rtems_shell_cmd_t rtems_shell_CHROOT_Command;
2340
2341cp - copy files
2342---------------
2343.. index:: cp
2344
2345**SYNOPSYS:**
2346
2347.. code:: c
2348
2349    cp \[-R \[-H | -L | -P]] \[-f | -i] \[-pv] src target
2350    cp \[-R \[-H | -L] ] \[-f | -i] \[-NpPv] source_file ... target_directory
2351
2352**DESCRIPTION:**
2353
2354In the first synopsis form, the cp utility copies the contents of the
2355source_file to the target_file. In the second synopsis form, the contents of
2356each named source_file is copied to the destination target_directory. The names
2357of the files themselves are not changed. If cp detects an attempt to copy a
2358file to itself, the copy will fail.
2359
2360The following options are available:
2361
2362*-f*
2363    For each existing destination pathname, attempt to overwrite it. If permissions
2364    do not allow copy to succeed, remove it and create a new file, without
2365    prompting for confirmation. (The -i option is ignored if the -f option is
2366    specified.)
2367
2368*-H*
2369    If the -R option is specified, symbolic links on the command line are followed.
2370    (Symbolic links encountered in the tree traversal are not followed.)
2371
2372*-i*
2373    Causes cp to write a prompt to the standard error output before copying a file
2374    that would overwrite an existing file. If the response from the standard input
2375    begins with the character ’y’, the file copy is attempted.
2376
2377*-L*
2378    If the -R option is specified, all symbolic links are followed.
2379
2380*-N*
2381    When used with -p, do not copy file flags.
2382
2383*-P*
2384    No symbolic links are followed.
2385
2386*-p*
2387    Causes cp to preserve in the copy as many of the modification time, access
2388    time, file flags, file mode, user ID, and group ID as allowed by permissions.
2389    If the user ID and group ID cannot be preserved, no error message is displayed
2390    and the exit value is not altered.
2391    If the source file has its set user ID bit on and the user ID cannot be
2392    preserved, the set user ID bit is not preserved in the copy’s permissions. If
2393    the source file has its set group ID bit on and the group ID cannot be
2394    preserved, the set group ID bit is not preserved in the copy’s permissions. If
2395    the source file has both its set user ID and set group ID bits on, and either
2396    the user ID or group ID cannot be preserved, neither the set user ID or set
2397    group ID bits are preserved in the copy’s permissions.
2398
2399*-R*
2400    If source_file designates a directory, cp copies the directory and the entire
2401    subtree connected at that point. This option also causes symbolic links to be
2402    copied, rather than indirected through, and for cp to create special files
2403    rather than copying them as normal files. Created directories have the same
2404    mode as the corresponding source directory, unmodified by the process’s umask.
2405
2406*-v*
2407    Cause cp to be verbose, showing files as they are copied.
2408
2409For each destination file that already exists, its contents are overwritten if
2410permissions allow, but its mode, user ID, and group ID are unchanged.
2411
2412In the second synopsis form, target_directory must exist unless there is only
2413one named source_file which is a directory and the -R flag is specified.
2414
2415If the destination file does not exist, the mode of the source file is used as
2416modified by the file mode creation mask (umask, see csh(1)). If the source file
2417has its set user ID bit on, that bit is removed unless both the source file and
2418the destination file are owned by the same user. If the source file has its set
2419group ID bit on, that bit is removed unless both the source file and the
2420destination file are in the same group and the user is a member of that group.
2421If both the set user ID and set group ID bits are set, all of the above
2422conditions must be fulfilled or both bits are removed.
2423
2424Appropriate permissions are required for file creation or overwriting.
2425
2426Symbolic links are always followed unless the -R flag is set, in which case
2427symbolic links are not followed, by default. The -H or -L flags (in conjunction
2428with the -R flag), as well as the -P flag cause symbolic links to be followed
2429as described above. The -H and -L options are ignored unless the -R option is
2430specified. In addition, these options override eachsubhedading other and the
2431command’s actions are determined by the last one specified.
2432
2433**EXIT STATUS:**
2434
2435This command returns 0 on success and non-zero if an error is encountered.
2436
2437**NOTES:**
2438
2439NONE
2440
2441**EXAMPLES:**
2442
2443The following is an example of how to use ``cp`` to
2444copy a file to a new name in the current directory:
2445.. code:: c
2446
2447    SHLL \[/] # cat joel
2448    cat: joel: No such file or directory
2449    SHLL \[/] # cp etc/passwd joel
2450    SHLL \[/] # cat joel
2451    root:\*:0:0:root::/:/bin/sh
2452    rtems:\*:1:1:RTEMS Application::/:/bin/sh
2453    tty:!:2:2:tty owner::/:/bin/false
2454    SHLL \[/] # ls
2455    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
2456    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
2457    -rw-r--r--   1   root   root         102 Jan 01 00:00 joel
2458    3 files 1710 bytes occupied
2459
2460The following is an example of how to use ``cp`` to
2461copy one or more files to a destination directory and
2462use the same ``basename`` in the destination directory:
2463.. code:: c
2464
2465    SHLL \[/] # mkdir tmp
2466    SHLL \[/] # ls tmp
2467    0 files 0 bytes occupied
2468    SHLL \[/] # cp /etc/passwd tmp
2469    SHLL \[/] # ls /tmp
2470    -rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
2471    1 files 102 bytes occupied
2472    SHLL \[/] # cp /etc/passwd /etc/group /tmp
2473    SHLL \[/] # ls /tmp
2474    -rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
2475    -rw-r--r--   1   root   root          42 Jan 01 00:01 group
2476    2 files 144 bytes occupied
2477    SHLL \[/] #
2478
2479**CONFIGURATION:**
2480
2481.. index:: CONFIGURE_SHELL_NO_COMMAND_CP
2482.. index:: CONFIGURE_SHELL_COMMAND_CP
2483
2484This command is included in the default shell command set.
2485When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CP`` to have this
2486command included.
2487
2488This command can be excluded from the shell command set by
2489defining ``CONFIGURE_SHELL_NO_COMMAND_CP`` when all
2490shell commands have been configured.
2491
2492**PROGRAMMING INFORMATION:**
2493
2494.. index:: rtems_shell_main_cp
2495
2496The ``cp`` command is implemented by a C language function which
2497has the following prototype:
2498.. code:: c
2499
2500    int rtems_shell_main_cp(
2501    int    argc,
2502    char \**argv
2503    );
2504
2505The configuration structure for the ``cp`` has the
2506following prototype:
2507.. code:: c
2508
2509    extern rtems_shell_cmd_t rtems_shell_CP_Command;
2510
2511**ORIGIN:**
2512
2513The implementation and portions of the documentation for this
2514command are from NetBSD 4.0.
2515
2516dd - convert and copy a file
2517----------------------------
2518.. index:: dd
2519
2520**SYNOPSYS:**
2521
2522.. code:: c
2523
2524    dd \[operands ...]
2525
2526**DESCRIPTION:**
2527
2528The dd utility copies the standard input to the standard output.
2529Input data is read and written in 512-byte blocks.  If input reads are
2530short, input from multiple reads are aggregated to form the output
2531block.  When finished, dd displays the number of complete and partial
2532input and output blocks and truncated input records to the standard
2533error output.
2534
2535The following operands are available:
2536
2537*bs=n*
2538    Set both input and output block size, superseding the ibs and obs
2539    operands.  If no conversion values other than noerror, notrunc or sync
2540    are specified, then each input block is copied to the output as a
2541    single block without any aggregation of short blocks.
2542
2543*cbs=n*
2544    Set the conversion record size to n bytes.  The conversion record size
2545    is required by the record oriented conversion values.
2546
2547*count=n*
2548    Copy only n input blocks.
2549
2550*files=n*
2551    Copy n input files before terminating.  This operand is only
2552    applicable when the input device is a tape.
2553
2554*ibs=n*
2555    Set the input block size to n bytes instead of the default 512.
2556
2557*if=file*
2558    Read input from file instead of the standard input.
2559
2560*obs=n*
2561    Set the output block size to n bytes instead of the default 512.
2562
2563*of=file*
2564    Write output to file instead of the standard output.  Any regular
2565    output file is truncated unless the notrunc conversion value is
2566    specified.  If an initial portion of the output file is skipped (see
2567    the seek operand) the output file is truncated at that point.
2568
2569*seek=n*
2570    Seek n blocks from the beginning of the output before copying.  On
2571    non-tape devices, a *lseek* operation is used.  Otherwise, existing
2572    blocks are read and the data discarded.  If the seek operation is past
2573    the end of file, space from the current end of file to the specified
2574    offset is filled with blocks of NUL bytes.
2575
2576*skip=n*
2577    Skip n blocks from the beginning of the input before copying.  On
2578    input which supports seeks, a *lseek* operation is used.  Otherwise,
2579    input data is read and discarded.  For pipes, the correct number of
2580    bytes is read.  For all other devices, the correct number of blocks is
2581    read without distinguishing between a partial or complete block being
2582    read.
2583
2584*progress=n*
2585    Switch on display of progress if n is set to any non-zero value.  This
2586    will cause a “.” to be printed (to the standard error output) for
2587    every n full or partial blocks written to the output file.
2588
2589*conv=value[,value...]*
2590    Where value is one of the symbols from the following list.
2591
2592    *ascii, oldascii*
2593
2594        The same as the unblock value except that characters are translated
2595        from EBCDIC to ASCII before the records are converted.  (These values
2596        imply unblock if the operand cbs is also specified.)  There are two
2597        conversion maps for ASCII.  The value ascii specifies the recom-
2598        mended one which is compatible with AT&T System V UNIX.  The value
2599        oldascii specifies the one used in historic AT&T and pre 4.3BSD-Reno
2600        systems.
2601
2602    *block*
2603
2604        Treats the input as a sequence of newline or end-of-file terminated
2605        variable length records independent of input and output block
2606        boundaries.  Any trailing newline character is discarded.  Each
2607        input record is converted to a fixed length output record where the
2608        length is specified by the cbs operand.  Input records shorter than
2609        the conversion record size are padded with spaces.  Input records
2610        longer than the conversion record size are truncated.  The number of
2611        truncated input records, if any, are reported to the standard error
2612        output at the completion of the copy.
2613
2614    *ebcdic, ibm, oldebcdic, oldibm*
2615
2616        The same as the block value except that characters are translated from
2617        ASCII to EBCDIC after the records are converted.  (These values imply
2618        block if the operand cbs is also specified.)  There are four
2619        conversion maps for EBCDIC.  The value ebcdic specifies the
2620        recommended one which is compatible with AT&T System V UNIX.  The
2621        value ibm is a slightly different mapping, which is compatible with
2622        the AT&T System V UNIX ibm value.  The values oldebcdic and oldibm are
2623        maps used in historic AT&T and pre 4.3BSD-Reno systems.
2624
2625    *lcase*
2626
2627        Transform uppercase characters into lowercase characters.
2628
2629    *noerror*
2630
2631        Do not stop processing on an input error.  When an input error occurs,
2632        a diagnostic message followed by the current input and output block
2633        counts will be written to the standard error output in the same format
2634        as the standard completion message.  If the sync conversion is also
2635        specified, any missing input data will be replaced with NUL bytes (or
2636        with spaces if a block oriented conversion value was specified) and
2637        processed as a normal input buffer.  If the sync conversion is not
2638        specified, the input block is omitted from the output.  On input files
2639        which are not tapes or pipes, the file offset will be positioned past
2640        the block in which the error occurred using lseek(2).
2641
2642    *notrunc*
2643
2644        Do not truncate the output file.  This will preserve any blocks in the
2645        output file not explicitly written by dd.  The notrunc value is not
2646        supported for tapes.
2647
2648    *osync*
2649
2650        Pad the final output block to the full output block size.  If the
2651        input file is not a multiple of the output block size after
2652        conversion, this conversion forces the final output block to be the
2653        same size as preceding blocks for use on devices that require
2654        regularly sized blocks to be written.  This option is incompatible
2655        with use of the bs=n block size specification.
2656
2657    *sparse*
2658
2659        If one or more non-final output blocks would consist solely of NUL
2660        bytes, try to seek the output file by the required space instead of
2661        filling them with NULs.  This results in a sparse file on some file
2662        systems.
2663
2664    *swab*
2665
2666        Swap every pair of input bytes.  If an input buffer has an odd number
2667        of bytes, the last byte will be ignored during swapping.
2668
2669    *sync*
2670
2671        Pad every input block to the input buffer size.  Spaces are used for
2672        pad bytes if a block oriented conversion value is specified, otherwise
2673        NUL bytes are used.
2674
2675    *ucase*
2676
2677        Transform lowercase characters into uppercase characters.
2678
2679    *unblock*
2680
2681        Treats the input as a sequence of fixed length records independent of
2682        input and output block boundaries.  The length of the input records is
2683        specified by the cbs operand.  Any trailing space characters are
2684        discarded and a newline character is appended.
2685
2686Where sizes are specified, a decimal number of bytes is expected.  Two
2687or more numbers may be separated by an “x” to indicate a product.
2688Each number may have one of the following optional suffixes:
2689
2690*b*
2691    Block; multiply by 512
2692
2693*k*
2694    Kibi; multiply by 1024 (1 KiB)
2695
2696*m*
2697    Mebi; multiply by 1048576 (1 MiB)
2698
2699*g*
2700    Gibi; multiply by 1073741824 (1 GiB)
2701
2702*t*
2703    Tebi; multiply by 1099511627776 (1 TiB)
2704
2705*w*
2706    Word; multiply by the number of bytes in an integer
2707
2708When finished, dd displays the number of complete and partial input
2709and output blocks, truncated input records and odd-length
2710byte-swapping ritten.  Partial output blocks to tape devices are
2711considered fatal errors.  Otherwise, the rest of the block will be
2712written.  Partial output blocks to character devices will produce a
2713warning message.  A truncated input block is one where a variable
2714length record oriented conversion value was specified and the input
2715line was too long to fit in the conversion record or was not newline
2716terminated.
2717
2718Normally, data resulting from input or conversion or both are
2719aggregated into output blocks of the specified size.  After the end of
2720input is reached, any remaining output is written as a block.  This
2721means that the final output block may be shorter than the output block
2722size.
2723
2724**EXIT STATUS:**
2725
2726This command returns 0 on success and non-zero if an error is encountered.
2727
2728**NOTES:**
2729
2730NONE
2731
2732**EXAMPLES:**
2733
2734The following is an example of how to use ``dd``:
2735.. code:: c
2736
2737    SHLL \[/] $ dd if=/nfs/boot-image of=/dev/hda1
2738
2739**CONFIGURATION:**
2740
2741.. index:: CONFIGURE_SHELL_NO_COMMAND_DD
2742.. index:: CONFIGURE_SHELL_COMMAND_DD
2743
2744This command is included in the default shell command set.  When
2745building a custom command set, define``CONFIGURE_SHELL_COMMAND_DD`` to have this command included.
2746
2747This command can be excluded from the shell command set by defining``CONFIGURE_SHELL_NO_COMMAND_DD`` when all shell commands have been
2748configured.
2749
2750**PROGRAMMING INFORMATION:**
2751
2752.. index:: rtems_shell_rtems_main_dd
2753
2754The ``dd`` command is implemented by a C language function which
2755has the following prototype:
2756.. code:: c
2757
2758    int rtems_shell_rtems_main_dd(
2759    int    argc,
2760    char \**argv
2761    );
2762
2763The configuration structure for the ``dd`` has the following
2764prototype:
2765.. code:: c
2766
2767    extern rtems_shell_cmd_t rtems_shell_DD_Command;
2768
2769debugrfs - debug RFS file system
2770--------------------------------
2771.. index:: debugrfs
2772
2773**SYNOPSYS:**
2774
2775.. code:: c
2776
2777    debugrfs \[-hl] path command \[options]
2778
2779**DESCRIPTION:**
2780
2781The command provides debugging information for the RFS file system.
2782
2783The options are:
2784
2785*-h*
2786    Print a help message.
2787
2788*-l*
2789    List the commands.
2790
2791*path*
2792    Path to the mounted RFS file system. The file system has to be mounted
2793    to view to use this command.
2794
2795The commands are:
2796
2797*block start \[end]*
2798    Display the contents of the blocks from start to end.
2799
2800*data*
2801    Display the file system data and configuration.
2802
2803*dir bno*
2804    Process the block as a directory displaying the entries.
2805
2806*group start \[end]*
2807    Display the group data from the start group to the end group.
2808
2809*inode \[-aef] \[start] \[end]*
2810
2811    Display the inodes between start and end. If no start and end is
2812    provides all inodes are displayed.
2813
2814    *-a*
2815
2816        Display all inodes. That is allocated and unallocated inodes.
2817
2818    *-e*
2819
2820        Search and display on inodes that have an error.
2821
2822    *-f*
2823
2824        Force display of inodes, even when in error.
2825
2826**EXIT STATUS:**
2827
2828This command returns 0 on success and non-zero if an error is encountered.
2829
2830**NOTES:**
2831
2832NONE
2833
2834**EXAMPLES:**
2835
2836The following is an example of how to use ``debugrfs``:
2837.. code:: c
2838
2839    SHLL \[/] $ debugrfs /c data
2840
2841**CONFIGURATION:**
2842
2843.. index:: CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS
2844.. index:: CONFIGURE_SHELL_COMMAND_DEBUGRFS
2845
2846This command is included in the default shell command set.
2847When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DEBUGRFS`` to have this
2848command included.
2849
2850This command can be excluded from the shell command set by
2851defining ``CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS`` when all
2852shell commands have been configured.
2853
2854**PROGRAMMING INFORMATION:**
2855
2856.. index:: rtems_shell_rtems_main_debugrfs
2857
2858The ``debugrfs`` command is implemented by a C language function which
2859has the following prototype:
2860.. code:: c
2861
2862    int rtems_shell_rtems_main_debugrfs(
2863    int    argc,
2864    char \**argv
2865    );
2866
2867The configuration structure for ``debugrfs`` has the following
2868prototype:
2869.. code:: c
2870
2871    extern rtems_shell_cmd_t rtems_shell_DEBUGRFS_Command;
2872
2873df - display file system disk space usage
2874-----------------------------------------
2875.. index:: df
2876
2877**SYNOPSYS:**
2878
2879.. code:: c
2880
2881    df \[-h] \[-B block_size]
2882
2883**DESCRIPTION:**
2884
2885This command print disk space usage for mounted file systems.
2886
2887**EXIT STATUS:**
2888
2889This command returns 0 on success and non-zero if an error is encountered.
2890
2891**NOTES:**
2892
2893NONE
2894
2895**EXAMPLES:**
2896
2897The following is an example of how to use ``df``:
2898.. code:: c
2899
2900    SHLL \[/] $ df -B 4K
2901    Filesystem     4K-blocks        Used   Available       Use%     Mounted on
2902    /dev/rda               124         1         124         0%   /mnt/ramdisk
2903    SHLL \[/] $ df
2904    Filesystem     1K-blocks        Used   Available       Use%     Mounted on
2905    /dev/rda               495         1         494         0%   /mnt/ramdisk
2906    SHLL \[/] $ df -h
2907    Filesystem     Size             Used   Available       Use%     Mounted on
2908    /dev/rda              495K        1K        494K         0%   /mnt/ramdisk
2909
2910**CONFIGURATION:**
2911
2912.. index:: CONFIGURE_SHELL_NO_COMMAND_DF
2913.. index:: CONFIGURE_SHELL_COMMAND_DF
2914
2915This command is included in the default shell command set.
2916When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DF`` to have this
2917command included.
2918
2919This command can be excluded from the shell command set by
2920defining ``CONFIGURE_SHELL_NO_COMMAND_DF`` when all
2921shell commands have been configured.
2922
2923**PROGRAMMING INFORMATION:**
2924
2925.. index:: rtems_shell_rtems_main_df
2926
2927The ``df`` is implemented by a C language function
2928which has the following prototype:
2929.. code:: c
2930
2931    int rtems_shell_main_df(
2932    int argc,
2933    char \**argv
2934    );
2935
2936The configuration structure for the ``df`` has the
2937following prototype:
2938.. code:: c
2939
2940    extern rtems_shell_cmd_t rtems_shell_DF_Command;
2941
2942dir - alias for ls
2943------------------
2944.. index:: dir
2945
2946**SYNOPSYS:**
2947
2948.. code:: c
2949
2950    dir \[dir]
2951
2952**DESCRIPTION:**
2953
2954This command is an alias or alternate name for the ``ls``.
2955See :ref:`ls <File-and-Directory-Commands-ls-_002d-list-files-in-the-directory>`
2956for more information.
2957
2958**EXIT STATUS:**
2959
2960This command returns 0 on success and non-zero if an error is encountered.
2961
2962**NOTES:**
2963
2964NONE
2965
2966**EXAMPLES:**
2967
2968The following is an example of how to use ``dir``:
2969.. code:: c
2970
2971    SHLL \[/] $ dir
2972    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
2973    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
2974    2 files 1608 bytes occupied
2975    SHLL \[/] $ dir etc
2976    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
2977    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
2978    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
2979    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
2980    4 files 202 bytes occupied
2981
2982**CONFIGURATION:**
2983
2984.. index:: CONFIGURE_SHELL_NO_COMMAND_DIR
2985.. index:: CONFIGURE_SHELL_COMMAND_DIR
2986
2987This command is included in the default shell command set.
2988When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DIR`` to have this
2989command included.
2990
2991This command can be excluded from the shell command set by
2992defining ``CONFIGURE_SHELL_NO_COMMAND_DIR`` when all
2993shell commands have been configured.
2994
2995**PROGRAMMING INFORMATION:**
2996
2997.. index:: rtems_shell_rtems_main_dir
2998
2999The ``dir`` is implemented by a C language function
3000which has the following prototype:
3001.. code:: c
3002
3003    int rtems_shell_rtems_main_dir(
3004    int    argc,
3005    char \**argv
3006    );
3007
3008The configuration structure for the ``dir`` has the
3009following prototype:
3010.. code:: c
3011
3012    extern rtems_shell_cmd_t rtems_shell_DIR_Command;
3013
3014fdisk - format disk
3015-------------------
3016.. index:: fdisk
3017
3018**SYNOPSYS:**
3019
3020.. code:: c
3021
3022    fdisk
3023
3024**CONFIGURATION:**
3025
3026.. index:: CONFIGURE_SHELL_NO_COMMAND_FDISK
3027.. index:: CONFIGURE_SHELL_COMMAND_FDISK
3028
3029This command is included in the default shell command set.
3030When building a custom command set, define``CONFIGURE_SHELL_COMMAND_FDISK`` to have this
3031command included.
3032
3033This command can be excluded from the shell command set by
3034defining ``CONFIGURE_SHELL_NO_COMMAND_FDISK`` when all
3035shell commands have been configured.
3036
3037hexdump - ascii/dec/hex/octal dump
3038----------------------------------
3039.. index:: hexdump
3040
3041**SYNOPSYS:**
3042
3043.. code:: c
3044
3045    hexdump \[-bcCdovx] \[-e format_string] \[-f format_file] \[-n length]
3046    \[-s skip] file ...
3047
3048**DESCRIPTION:**
3049
3050The hexdump utility is a filter which displays the specified files, or
3051the standard input, if no files are specified, in a user specified
3052format.
3053
3054The options are as follows:
3055
3056*-b*
3057    One-byte octal display.  Display the input offset in hexadecimal,
3058    followed by sixteen space-separated, three column, zero-filled, bytes
3059    of input data, in octal, per line.
3060
3061*-c*
3062    One-byte character display.  Display the input offset in hexadecimal,
3063    followed by sixteen space-separated, three column, space-filled,
3064    characters of input data per line.
3065
3066*-C*
3067    Canonical hex+ASCII display.  Display the input offset in hexadecimal,
3068    followed by sixteen space-separated, two column, hexadecimal bytes,
3069    followed by the same sixteen bytes in %_p format enclosed in “|”
3070    characters.
3071
3072*-d*
3073    Two-byte decimal display.  Display the input offset in hexadecimal,
3074    followed by eight space-separated, five column, zero-filled, two-byte
3075    units of input data, in unsigned decimal, per line.
3076
3077*-e format_string*
3078    Specify a format string to be used for displaying data.
3079
3080*-f format_file*
3081    Specify a file that contains one or more newline separated format
3082    strings.  Empty lines and lines whose first non-blank character is a
3083    hash mark (#) are ignored.
3084
3085*-n length*
3086    Interpret only length bytes of input.
3087
3088*-o*
3089    Two-byte octal display.  Display the input offset in hexadecimal,
3090    followed by eight space-separated, six column, zerofilled, two byte
3091    quantities of input data, in octal, per line.
3092
3093*-s offset*
3094    Skip offset bytes from the beginning of the input.  By default, offset
3095    is interpreted as a decimal number.  With a leading 0x or 0X, offset
3096    is interpreted as a hexadecimal number, otherwise, with a leading 0,
3097    offset is interpreted as an octal number.  Appending the character b,
3098    k, or m to offset causes it to be interpreted as a multiple of 512,
3099    1024, or 1048576, respectively.
3100
3101*-v*
3102    The -v option causes hexdump to display all input data.  Without the
3103    -v option, any number of groups of output lines, which would be
3104    identical to the immediately preceding group of output lines (except
3105    for the input offsets), are replaced with a line containing a single
3106    asterisk.
3107
3108*-x*
3109    Two-byte hexadecimal display.  Display the input offset in
3110    hexadecimal, followed by eight, space separated, four column,
3111    zero-filled, two-byte quantities of input data, in hexadecimal, per
3112    line.
3113
3114For each input file, hexdump sequentially copies the input to standard
3115output, transforming the data according to the format strings
3116specified by the -e and -f options, in the order that they were
3117specified.
3118
3119*Formats*
3120
3121A format string contains any number of format units, separated by
3122whitespace.  A format unit contains up to three items: an iteration
3123count, a byte count, and a format.
3124
3125The iteration count is an optional positive integer, which defaults to
3126one.  Each format is applied iteration count times.
3127
3128The byte count is an optional positive integer.  If specified it
3129defines the number of bytes to be interpreted by each iteration of the
3130format.
3131
3132If an iteration count and/or a byte count is specified, a single slash
3133must be placed after the iteration count and/or before the byte count
3134to disambiguate them.  Any whitespace before or after the slash is
3135ignored.
3136
3137The format is required and must be surrounded by double quote (“ “)
3138marks.  It is interpreted as a fprintf-style format string (see*fprintf*), with the following exceptions:
3139
3140- An asterisk (\*) may not be used as a field width or precision.
3141
3142- A byte count or field precision is required for each “s” con-
3143  version character (unlike the fprintf(3) default which prints the
3144  entire string if the precision is unspecified).
3145
3146- The conversion characters “h”, “l”, “n”, “p” and “q” are not
3147  supported.
3148
3149- The single character escape sequences described in the C standard
3150  are supported:
3151
3152      NUL                  \\0
3153      <alert character>    \\a
3154      <backspace>          \\b
3155      <form-feed>          \\f
3156      <newline>            \\n
3157      <carriage return>    \\r
3158      <tab>                \\t
3159      <vertical tab>       \\v
3160
3161Hexdump also supports the following additional conversion strings:
3162
3163*_a[dox]*
3164    Display the input offset, cumulative across input files, of the next
3165    byte to be displayed.  The appended characters d, o, and x specify the
3166    display base as decimal, octal or hexadecimal respectively.
3167
3168*_A[dox]*
3169    Identical to the _a conversion string except that it is only performed
3170    once, when all of the input data has been processed.
3171
3172*_c*
3173    Output characters in the default character set.  Nonprinting
3174    characters are displayed in three character, zero-padded octal, except
3175    for those representable by standard escape notation (see above), which
3176    are displayed as two character strings.
3177
3178*_p*
3179    Output characters in the default character set.  Nonprinting
3180    characters are displayed as a single “.”.
3181
3182*_u*
3183    Output US ASCII characters, with the exception that control characters
3184    are displayed using the following, lower-case, names.  Characters
3185    greater than 0xff, hexadecimal, are displayed as hexadecimal
3186    strings.
3187    000 nul  001 soh  002 stx  003 etx  004 eot  005 enq
3188    006 ack  007 bel  008 bs   009 ht   00A lf   00B vt
3189    00C ff   00D cr   00E so   00F si   010 dle  011 dc1
3190    012 dc2  013 dc3  014 dc4  015 nak  016 syn  017 etb
3191    018 can  019 em   01A sub  01B esc  01C fs   01D gs
3192    01E rs   01F us   07F del
3193
3194The default and supported byte counts for the conversion characters
3195are as follows:
3196
3197    %_c, %_p, %_u, %c       One byte counts only.
3198    %d, %i, %o, %u, %X, %x  Four byte default, one, two, four
3199    and eight byte counts supported.
3200    %E, %e, %f, %G, %g      Eight byte default, four byte
3201    counts supported.
3202
3203The amount of data interpreted by each format string is the sum of the
3204data required by each format unit, which is the iteration count times
3205the byte count, or the iteration count times the number of bytes
3206required by the format if the byte count is not specified.
3207
3208The input is manipulated in “blocks”, where a block is defined as
3209the largest amount of data specified by any format string.  Format
3210strings interpreting less than an input block’s worth of data, whose
3211last format unit both interprets some number of bytes and does not
3212have a specified iteration count, have the iteration count incremented
3213until the entire input block has been processed or there is not enough
3214data remaining in the block to satisfy the format string.
3215
3216If, either as a result of user specification or hexdump modifying the
3217iteration count as described above, an iteration count is greater than
3218one, no trailing whitespace characters are output during the last
3219iteration.
3220
3221It is an error to specify a byte count as well as multiple conversion
3222characters or strings unless all but one of the conversion characters
3223or strings is _a or _A.
3224
3225If, as a result of the specification of the -n option or end-of-file
3226being reached, input data only partially satisfies a format string,
3227the input block is zero-padded sufficiently to display all available
3228data (i.e. any format units overlapping the end of data will display
3229some num- ber of the zero bytes).
3230
3231Further output by such format strings is replaced by an equivalent
3232number of spaces.  An equivalent number of spaces is defined as the
3233number of spaces output by an s conversion character with the same
3234field width and precision as the original conversion character or
3235conversion string but with any “+”, “ ”, “#” conversion flag
3236characters removed, and ref- erencing a NULL string.
3237
3238If no format strings are specified, the default display is equivalent
3239to specifying the -x option.
3240
3241**EXIT STATUS:**
3242
3243This command returns 0 on success and non-zero if an error is encountered.
3244
3245**NOTES:**
3246
3247NONE
3248
3249**EXAMPLES:**
3250
3251The following is an example of how to use ``hexdump``:
3252.. code:: c
3253
3254    SHLL \[/] $ hexdump -C -n 512 /dev/hda1
3255
3256**CONFIGURATION:**
3257
3258.. index:: CONFIGURE_SHELL_NO_COMMAND_HEXDUMP
3259.. index:: CONFIGURE_SHELL_COMMAND_HEXDUMP
3260
3261This command is included in the default shell command set.  When
3262building a custom command set, define``CONFIGURE_SHELL_COMMAND_HEXDUMP`` to have this command included.
3263
3264This command can be excluded from the shell command set by defining``CONFIGURE_SHELL_NO_COMMAND_HEXDUMP`` when all shell commands have
3265been configured.
3266
3267**PROGRAMMING INFORMATION:**
3268
3269.. index:: rtems_shell_rtems_main_hexdump
3270
3271The ``hexdump`` command is implemented by a C language function
3272which has the following prototype:
3273.. code:: c
3274
3275    int rtems_shell_rtems_main_hexdump(
3276    int    argc,
3277    char \**argv
3278    );
3279
3280The configuration structure for the ``hexdump`` has the following
3281prototype:
3282.. code:: c
3283
3284    extern rtems_shell_cmd_t rtems_shell_HEXDUMP_Command;
3285
3286ln - make links
3287---------------
3288.. index:: ln
3289
3290**SYNOPSYS:**
3291
3292.. code:: c
3293
3294    ln \[-fhinsv] source_file \[target_file]
3295    ln \[-fhinsv] source_file ... target_dir
3296
3297**DESCRIPTION:**
3298
3299The ln utility creates a new directory entry (linked file) which has
3300the same modes as the original file.  It is useful for maintaining
3301multiple copies of a file in many places at once without using up
3302storage for the “copies”; instead, a link “points” to the original
3303copy.  There are two types of links; hard links and symbolic links.
3304How a link “points” to a file is one of the differences between a
3305hard or symbolic link.
3306
3307The options are as follows:
3308
3309*-f*
3310    Unlink any already existing file, permitting the link to occur.
3311
3312*-h*
3313    If the target_file or target_dir is a symbolic link, do not follow it.
3314    This is most useful with the -f option, to replace a symlink which may
3315    point to a directory.
3316
3317*-i*
3318    Cause ln to write a prompt to standard error if the target file
3319    exists.  If the response from the standard input begins with the
3320    character ‘y’ or ‘Y’, then unlink the target file so that the link may
3321    occur.  Otherwise, do not attempt the link.  (The -i option overrides
3322    any previous -f options.)
3323
3324*-n*
3325    Same as -h, for compatibility with other ln implementations.
3326
3327*-s*
3328    Create a symbolic link.
3329
3330*-v*
3331    Cause ln to be verbose, showing files as they are processed.
3332
3333By default ln makes hard links.  A hard link to a file is
3334indistinguishable from the original directory entry; any changes to a
3335file are effective independent of the name used to reference the file.
3336Hard links may not normally refer to directories and may not span file
3337systems.
3338
3339A symbolic link contains the name of the file to which it is linked.
3340The referenced file is used when an *open* operation is performed on
3341the link.  A *stat* on a symbolic link will return the linked-to
3342file; an *lstat* must be done to obtain information about the link.
3343The *readlink* call may be used to read the contents of a symbolic
3344link.  Symbolic links may span file systems and may refer to
3345directories.
3346
3347Given one or two arguments, ln creates a link to an existing file
3348source_file.  If target_file is given, the link has that name;
3349target_file may also be a directory in which to place the link;
3350otherwise it is placed in the current directory.  If only the
3351directory is specified, the link will be made to the last component of
3352source_file.
3353
3354Given more than two arguments, ln makes links in target_dir to all the
3355named source files.  The links made will have the same name as the
3356files being linked to.
3357
3358**EXIT STATUS:**
3359
3360The ``ln`` utility exits 0 on success, and >0 if an error occurs.
3361
3362**NOTES:**
3363
3364NONE
3365
3366**EXAMPLES:**
3367
3368.. code:: c
3369
3370    SHLL \[/] ln -s /dev/console /dev/con1
3371
3372**CONFIGURATION:**
3373
3374.. index:: CONFIGURE_SHELL_NO_COMMAND_LN
3375.. index:: CONFIGURE_SHELL_COMMAND_LN
3376
3377This command is included in the default shell command set.  When
3378building a custom command set, define``CONFIGURE_SHELL_COMMAND_LN`` to have this command included.
3379
3380This command can be excluded from the shell command set by
3381defining ``CONFIGURE_SHELL_NO_COMMAND_LN`` when all
3382shell commands have been configured.
3383
3384**PROGRAMMING INFORMATION:**
3385
3386.. index:: rtems_shell_rtems_main_ln
3387
3388The ``ln`` command is implemented by a C language function which
3389has the following prototype:
3390.. code:: c
3391
3392    int rtems_shell_rtems_main_ln(
3393    int    argc,
3394    char \**argv
3395    );
3396
3397The configuration structure for the ``ln`` has the following
3398prototype:
3399.. code:: c
3400
3401    extern rtems_shell_cmd_t rtems_shell_LN_Command;
3402
3403**ORIGIN:**
3404
3405The implementation and portions of the documentation for this command
3406are from NetBSD 4.0.
3407
3408.. _File-and-Directory-Commands-ls-_002d-list-files-in-the-directory:
3409
3410ls - list files in the directory
3411--------------------------------
3412.. index:: ls
3413
3414**SYNOPSYS:**
3415
3416.. code:: c
3417
3418    ls \[dir]
3419
3420**DESCRIPTION:**
3421
3422This command displays the contents of the specified directory.  If
3423no arguments are given, then it displays the contents of the current
3424working directory.
3425
3426**EXIT STATUS:**
3427
3428This command returns 0 on success and non-zero if an error is encountered.
3429
3430**NOTES:**
3431
3432This command currently does not display information on a set of
3433files like the POSIX ls(1).  It only displays the contents of
3434entire directories.
3435
3436**EXAMPLES:**
3437
3438The following is an example of how to use ``ls``:
3439.. code:: c
3440
3441    SHLL \[/] $ ls
3442    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
3443    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
3444    2 files 1608 bytes occupied
3445    SHLL \[/] $ ls etc
3446    -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
3447    -rw-r--r--   1   root   root          42 Jan 01 00:00 group
3448    -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
3449    -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
3450    4 files 202 bytes occupied
3451    SHLL \[/] $ ls dev etc
3452    -rwxr-xr-x   1  rtems   root           0 Jan 01 00:00 console
3453    -rwxr-xr-x   1   root   root           0 Jan 01 00:00 console_b
3454
3455**CONFIGURATION:**
3456
3457.. index:: CONFIGURE_SHELL_NO_COMMAND_LS
3458.. index:: CONFIGURE_SHELL_COMMAND_LS
3459
3460This command is included in the default shell command set.
3461When building a custom command set, define``CONFIGURE_SHELL_COMMAND_LS`` to have this
3462command included.
3463
3464This command can be excluded from the shell command set by
3465defining ``CONFIGURE_SHELL_NO_COMMAND_LS`` when all
3466shell commands have been configured.
3467
3468**PROGRAMMING INFORMATION:**
3469
3470.. index:: rtems_shell_rtems_main_ls
3471
3472The ``ls`` is implemented by a C language function
3473which has the following prototype:
3474.. code:: c
3475
3476    int rtems_shell_rtems_main_ls(
3477    int    argc,
3478    char \**argv
3479    );
3480
3481The configuration structure for the ``ls`` has the
3482following prototype:
3483.. code:: c
3484
3485    extern rtems_shell_cmd_t rtems_shell_LS_Command;
3486
3487md5 - compute the Md5 hash of a file or list of files
3488-----------------------------------------------------
3489.. index:: md5
3490
3491**SYNOPSYS:**
3492
3493.. code:: c
3494
3495    md5 <files>
3496
3497**DESCRIPTION:**
3498
3499This command prints the MD5 of a file. You can provide one or more
3500files on the command line and a hash for each file is printed in a
3501single line of output.
3502
3503**EXIT STATUS:**
3504
3505This command returns 0 on success and non-zero if an error is encountered.
3506
3507**NOTES:**
3508
3509NONE
3510
3511**EXAMPLES:**
3512
3513The following is an example of how to use ``md5``:
3514.. code:: c
3515
3516    SHLL \[/] $ md5 shell-init
3517    MD5 (shell-init) = 43b4d2e71b47db79eae679a2efeacf31
3518
3519**CONFIGURATION:**
3520
3521.. index:: CONFIGURE_SHELL_NO_COMMAND_MD5
3522.. index:: CONFIGURE_SHELL_COMMAND_MD5
3523
3524This command is included in the default shell command set.
3525When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MD5`` to have this
3526command included.
3527
3528This command can be excluded from the shell command set by
3529defining ``CONFIGURE_SHELL_NO_COMMAND_MD5`` when all
3530shell commands have been configured.
3531
3532**PROGRAMMING INFORMATION:**
3533
3534.. index:: rtems_shell_rtems_main_md5
3535
3536The ``df`` is implemented by a C language function
3537which has the following prototype:
3538.. code:: c
3539
3540    int rtems_shell_main_md5(
3541    int argc,
3542    char \**argv
3543    );
3544
3545The configuration structure for the ``md5`` has the
3546following prototype:
3547.. code:: c
3548
3549    extern rtems_shell_cmd_t rtems_shell_MD5_Command;
3550
3551mkdir - create a directory
3552--------------------------
3553.. index:: mkdir
3554
3555**SYNOPSYS:**
3556
3557.. code:: c
3558
3559    mkdir  dir \[dir1 .. dirN]
3560
3561**DESCRIPTION:**
3562
3563This command creates the set of directories in the order they
3564are specified on the command line.  If an error is encountered
3565making one of the directories, the command will continue to
3566attempt to create the remaining directories on the command line.
3567
3568**EXIT STATUS:**
3569
3570This command returns 0 on success and non-zero if an error is encountered.
3571
3572**NOTES:**
3573
3574If this command is invoked with no arguments, nothing occurs.
3575
3576The user must have sufficient permissions to create the directory.
3577For the ``fileio`` test provided with RTEMS, this means the user
3578must login as ``root`` not ``rtems``.
3579
3580**EXAMPLES:**
3581
3582The following is an example of how to use ``mkdir``:
3583.. code:: c
3584
3585    SHLL \[/] # ls
3586    drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
3587    drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
3588    2 files 1608 bytes occupied
3589    SHLL \[/] # mkdir joel
3590    SHLL \[/] # ls joel
3591    0 files 0 bytes occupied
3592    SHLL \[/] # cp etc/passwd joel
3593    SHLL \[/] # ls joel
3594    -rw-r--r--   1   root   root         102 Jan 01 00:02 passwd
3595    1 files 102 bytes occupied
3596
3597**CONFIGURATION:**
3598
3599.. index:: CONFIGURE_SHELL_NO_COMMAND_MKDIR
3600.. index:: CONFIGURE_SHELL_COMMAND_MKDIR
3601
3602This command is included in the default shell command set.
3603When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKDIR`` to have this
3604command included.
3605
3606This command can be excluded from the shell command set by
3607defining ``CONFIGURE_SHELL_NO_COMMAND_MKDIR`` when all
3608shell commands have been configured.
3609
3610**PROGRAMMING INFORMATION:**
3611
3612.. index:: rtems_shell_rtems_main_mkdir
3613
3614The ``mkdir`` is implemented by a C language function
3615which has the following prototype:
3616.. code:: c
3617
3618    int rtems_shell_rtems_main_mkdir(
3619    int    argc,
3620    char \**argv
3621    );
3622
3623The configuration structure for the ``mkdir`` has the
3624following prototype:
3625.. code:: c
3626
3627    extern rtems_shell_cmd_t rtems_shell_MKDIR_Command;
3628
3629mldos - DOSFS file system format
3630--------------------------------
3631.. index:: pwd
3632
3633**SYNOPSYS:**
3634
3635.. code:: c
3636
3637    mkdir \[-V label] \[-s sectors/cluster] \[-r size] \[-v] path
3638
3639**DESCRIPTION:**
3640
3641This command formats a block device entry with the DOSFS file system.
3642
3643*-V label*
3644
3645*-s sectors/cluster*
3646
3647*-r size*
3648
3649**EXIT STATUS:**
3650
3651This command returns 0 on success and non-zero if an error is encountered.
3652
3653**NOTES:**
3654
3655NONE
3656
3657**EXAMPLES:**
3658
3659The following is an example of how to use ``mkdos``:
3660.. code:: c
3661
3662    SHLL \[/] $ mkdos /dev/rda1
3663
3664**CONFIGURATION:**
3665
3666.. index:: CONFIGURE_SHELL_NO_COMMAND_MKDOS
3667.. index:: CONFIGURE_SHELL_COMMAND_MKDOS
3668
3669This command is included in the default shell command set.
3670When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKDOS`` to have this
3671command included.
3672
3673This command can be excluded from the shell command set by
3674defining ``CONFIGURE_SHELL_NO_COMMAND_MKDOS`` when all
3675shell commands have been configured.
3676
3677**PROGRAMMING INFORMATION:**
3678
3679.. index:: rtems_shell_rtems_main_mkdos
3680
3681The ``mkdos`` is implemented by a C language function
3682which has the following prototype:
3683.. code:: c
3684
3685    int rtems_shell_rtems_main_mkdos(
3686    int    argc,
3687    char \**argv
3688    );
3689
3690The configuration structure for the ``mkdos`` has the
3691following prototype:
3692.. code:: c
3693
3694    extern rtems_shell_cmd_t rtems_shell_MKDOS_Command;
3695
3696mknod - make device special file
3697--------------------------------
3698.. index:: mknod
3699
3700**SYNOPSYS:**
3701
3702.. code:: c
3703
3704    mknod \[-rR] \[-F fmt] \[-g gid] \[-m mode] \[-u uid] name \[c | b]
3705    \[driver | major] minor
3706    mknod \[-rR] \[-F fmt] \[-g gid] \[-m mode] \[-u uid] name \[c | b]
3707    major unit subunit
3708    mknod \[-rR] \[-g gid] \[-m mode] \[-u uid] name \[c | b] number
3709    mknod \[-rR] \[-g gid] \[-m mode] \[-u uid] name p
3710
3711**DESCRIPTION:**
3712
3713The mknod command creates device special files, or fifos.  Normally
3714the shell script /dev/MAKEDEV is used to create special files for
3715commonly known devices; it executes mknod with the appropriate
3716arguments and can make all the files required for the device.
3717
3718To make nodes manually, the arguments are:
3719
3720*-r*
3721    Replace an existing file if its type is incorrect.
3722
3723*-R*
3724    Replace an existing file if its type is incorrect.  Correct the
3725    mode, user and group.
3726
3727*-g gid*
3728    Specify the group for the device node.  The gid operand may be a
3729    numeric group ID or a group name.  If a group name is also a numeric
3730    group ID, the operand is used as a group name.  Precede a numeric
3731    group ID with a # to stop it being treated as a name.
3732
3733*-m mode*
3734    Specify the mode for the device node.  The mode may be absolute or
3735    symbolic, see *chmod*.
3736
3737*-u uid*
3738    Specify the user for the device node.  The uid operand may be a
3739    numeric user ID or a user name.  If a user name is also a numeric user
3740    ID, the operand is used as a user name.  Precede a numeric user ID
3741    with a # to stop it being treated as a name.
3742
3743*name*
3744    Device name, for example “tty” for a termios serial device or “hd”
3745    for a disk.
3746
3747*b | c | p*
3748    Type of device.  If the device is a block type device such as a tape
3749    or disk drive which needs both cooked and raw special files, the type
3750    is b.  All other devices are character type devices, such as terminal
3751    and pseudo devices, and are type c.  Specifying p creates fifo files.
3752
3753*driver | major*
3754    The major device number is an integer number which tells the kernel
3755    which device driver entry point to use.  If the device driver is
3756    configured into the current kernel it may be specified by driver name
3757    or major number.
3758
3759*minor*
3760    The minor device number tells the kernel which one of several similar
3761    devices the node corresponds to; for example, it may be a specific
3762    serial port or pty.
3763
3764*unit and subunit*
3765    The unit and subunit numbers select a subset of a device; for example,
3766    the unit may specify a particular disk, and the subunit a partition on
3767    that disk.  (Currently this form of specification is only supported
3768    by the bsdos format, for compatibility with the BSD/OS mknod).
3769
3770*number*
3771    A single opaque device number.  Useful for netbooted computers which
3772    require device numbers packed in a format that isn’t supported by
3773    -F.
3774
3775**EXIT STATUS:**
3776
3777The ``mknod`` utility exits 0 on success, and >0 if an error occurs.
3778
3779**NOTES:**
3780
3781NONE
3782
3783**EXAMPLES:**
3784
3785.. code:: c
3786
3787    SHLL \[/] mknod c 3 0 /dev/ttyS10
3788
3789**CONFIGURATION:**
3790
3791.. index:: CONFIGURE_SHELL_NO_COMMAND_MKNOD
3792.. index:: CONFIGURE_SHELL_COMMAND_MKNOD
3793
3794This command is included in the default shell command set.  When
3795building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKNOD`` to have this command included.
3796
3797This command can be excluded from the shell command set by
3798defining ``CONFIGURE_SHELL_NO_COMMAND_MKNOD`` when all
3799shell commands have been configured.
3800
3801**PROGRAMMING INFORMATION:**
3802
3803.. index:: rtems_shell_rtems_main_mknod
3804
3805The ``mknod`` command is implemented by a C language function which
3806has the following prototype:
3807.. code:: c
3808
3809    int rtems_shell_rtems_main_mknod(
3810    int    argc,
3811    char \**argv
3812    );
3813
3814The configuration structure for the ``mknod`` has the following
3815prototype:
3816.. code:: c
3817
3818    extern rtems_shell_cmd_t rtems_shell_MKNOD_Command;
3819
3820**ORIGIN:**
3821
3822The implementation and portions of the documentation for this command
3823are from NetBSD 4.0.
3824
3825mkrfs - format RFS file system
3826------------------------------
3827.. index:: mkrfs
3828
3829**SYNOPSYS:**
3830
3831.. code:: c
3832
3833    mkrfs \[-vsbiIo] device
3834
3835**DESCRIPTION:**
3836
3837Format the block device with the RTEMS File System (RFS). The default
3838configuration with not parameters selects a suitable block size based
3839on the size of the media being formatted.
3840
3841The media is broken up into groups of blocks. The number of blocks in
3842a group is based on the number of bits a block contains. The large a
3843block the more blocks a group contains and the fewer groups in the
3844file system.
3845
3846The following options are provided:
3847
3848*-v*
3849    Display configuration and progress of the format.
3850
3851*-s*
3852    Set the block size in bytes.
3853
3854*-b*
3855    The number of blocks in a group. The block count must be equal or less
3856    than the number of bits in a block.
3857
3858*-i*
3859    Number of inodes in a group. The inode count must be equal or less
3860    than the number of bits in a block.
3861
3862*-I*
3863    Initialise the inodes. The default is not to initialise the inodes and
3864    to rely on the inode being initialised when allocated. Initialising
3865    the inode table helps recovery if a problem appears.
3866
3867*-o*
3868    Integer percentage of the media used by inodes. The default is 1%.
3869
3870*device*
3871    Path of the device to format.
3872
3873**EXIT STATUS:**
3874
3875This command returns 0 on success and non-zero if an error is encountered.
3876
3877**NOTES:**
3878
3879NONE
3880
3881**EXAMPLES:**
3882
3883The following is an example of how to use ``mkrfs``:
3884.. code:: c
3885
3886    SHLL \[/] $ mkrfs /dev/fdda
3887
3888**CONFIGURATION:**
3889
3890.. index:: CONFIGURE_SHELL_NO_COMMAND_MKRFS
3891.. index:: CONFIGURE_SHELL_COMMAND_MKRFS
3892
3893This command is included in the default shell command set.
3894When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MKRFS`` to have this
3895command included.
3896
3897This command can be excluded from the shell command set by
3898defining ``CONFIGURE_SHELL_NO_COMMAND_MKRFS`` when all
3899shell commands have been configured.
3900
3901**PROGRAMMING INFORMATION:**
3902
3903.. index:: rtems_shell_rtems_main_mkrfs
3904
3905The ``mkrfs`` command is implemented by a C language function which
3906has the following prototype:
3907.. code:: c
3908
3909    int rtems_shell_rtems_main_mkrfs(
3910    int    argc,
3911    char \**argv
3912    );
3913
3914The configuration structure for ``mkrfs`` has the following
3915prototype:
3916.. code:: c
3917
3918    extern rtems_shell_cmd_t rtems_shell_MKRFS_Command;
3919
3920mount - mount disk
3921------------------
3922.. index:: mount
3923
3924**SYNOPSYS:**
3925
3926.. code:: c
3927
3928    mount \[-t fstype] \[-r] \[-L] device path
3929
3930**DESCRIPTION:**
3931
3932The ``mount`` command will mount a block device to a mount point
3933using the specified file system. The files systems are:
3934
3935- msdos - MSDOS File System
3936
3937- tftp  - TFTP Network File System
3938
3939- ftp   - FTP Network File System
3940
3941- nfs   - Network File System
3942
3943- rfs   - RTEMS File System
3944
3945When the file system type is ’msdos’ or ’rfs’ the driver is a "block
3946device driver" node present in the file system. The driver is ignored
3947with the ’tftp’ and ’ftp’ file systems. For the ’nfs’ file system the
3948driver is the ’host:/path’ string that described NFS host and the
3949exported file system path.
3950
3951**EXIT STATUS:**
3952
3953This command returns 0 on success and non-zero if an error is encountered.
3954
3955**NOTES:**
3956
3957The mount point must exist.
3958
3959The services offered by each file-system vary. For example you cannot list the
3960directory of a TFTP file-system as this server is not provided in the TFTP
3961protocol. You need to check each file-system’s documentation for the services
3962provided.
3963
3964**EXAMPLES:**
3965
3966Mount the Flash Disk driver to the ’/fd’ mount point:
3967.. code:: c
3968
3969    SHLL \[/] $ mount -t msdos /dev/flashdisk0 /fd
3970
3971Mount the NFS file system exported path ’bar’ by host ’foo’:
3972.. code:: c
3973
3974    $ mount -t nfs foo:/bar /nfs
3975
3976Mount the TFTP file system on ’/tftp’:
3977.. code:: c
3978
3979    $ mount -t tftp /tftp
3980
3981To access the TFTP files on server ’10.10.10.10’:
3982.. code:: c
3983
3984    $ cat /tftp/10.10.10.10/test.txt
3985
3986**CONFIGURATION:**
3987
3988.. index:: CONFIGURE_SHELL_NO_COMMAND_MOUNT
3989.. index:: CONFIGURE_SHELL_COMMAND_MOUNT
3990
3991This command is included in the default shell command set.
3992When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MOUNT`` to have this
3993command included.
3994
3995This command can be excluded from the shell command set by
3996defining ``CONFIGURE_SHELL_NO_COMMAND_MOUNT`` when all
3997shell commands have been configured.
3998
3999The mount command includes references to file-system code. If you do not wish
4000to include file-system that you do not use do not define the mount command
4001support for that file-system. The file-system mount command defines are:
4002
4003- msdos - CONFIGURE_SHELL_MOUNT_MSDOS
4004
4005- tftp - CONFIGURE_SHELL_MOUNT_TFTP
4006
4007- ftp - CONFIGURE_SHELL_MOUNT_FTP
4008
4009- nfs - CONFIGURE_SHELL_MOUNT_NFS
4010
4011- rfs - CONFIGURE_SHELL_MOUNT_RFS
4012
4013An example configuration is:
4014.. code:: c
4015
4016    #define CONFIGURE_SHELL_MOUNT_MSDOS
4017    #ifdef RTEMS_NETWORKING
4018    #define CONFIGURE_SHELL_MOUNT_TFTP
4019    #define CONFIGURE_SHELL_MOUNT_FTP
4020    #define CONFIGURE_SHELL_MOUNT_NFS
4021    #define CONFIGURE_SHELL_MOUNT_RFS
4022    #endif
4023
4024**PROGRAMMING INFORMATION:**
4025
4026.. index:: rtems_shell_rtems_main_mount
4027
4028The ``mount`` is implemented by a C language function
4029which has the following prototype:
4030.. code:: c
4031
4032    int rtems_shell_rtems_main_mount(
4033    int    argc,
4034    char \**argv
4035    );
4036
4037The configuration structure for the ``mount`` has the
4038following prototype:
4039.. code:: c
4040
4041    extern rtems_shell_cmd_t rtems_shell_MOUNT_Command;
4042
4043mv - move files
4044---------------
4045.. index:: mv
4046
4047**SYNOPSYS:**
4048
4049.. code:: c
4050
4051    mv \[-fiv] source_file target_file
4052    mv \[-fiv] source_file... target_file
4053
4054**DESCRIPTION:**
4055
4056In its first form, the mv utility renames the file named by the source
4057operand to the destination path named by the target operand.  This
4058form is assumed when the last operand does not name an already
4059existing directory.
4060
4061In its second form, mv moves each file named by a source operand to a
4062destination file in the existing directory named by the directory
4063operand.  The destination path for each operand is the pathname
4064produced by the concatenation of the last operand, a slash, and the
4065final pathname component of the named file.
4066
4067The following options are available:
4068
4069*-f*
4070    Do not prompt for confirmation before overwriting the destination
4071    path.
4072
4073*-i*
4074    Causes mv to write a prompt to standard error before moving a file
4075    that would overwrite an existing file.  If the response from the
4076    standard input begins with the character ’y’, the move is attempted.
4077
4078*-v*
4079    Cause mv to be verbose, showing files as they are processed.
4080
4081The last of any -f or -i options is the one which affects mv’s
4082behavior.
4083
4084It is an error for any of the source operands to specify a nonexistent
4085file or directory.
4086
4087It is an error for the source operand to specify a directory if the
4088target exists and is not a directory.
4089
4090If the destination path does not have a mode which permits writing, mv
4091prompts the user for confirmation as specified for the -i option.
4092
4093Should the *rename* call fail because source and target are on
4094different file systems, ``mv`` will remove the destination file,
4095copy the source file to the destination, and then remove the source.
4096The effect is roughly equivalent to:
4097.. code:: c
4098
4099    rm -f destination_path && \\
4100    cp -PRp source_file destination_path && \\
4101    rm -rf source_file
4102
4103**EXIT STATUS:**
4104
4105The ``mv`` utility exits 0 on success, and >0 if an error occurs.
4106
4107**NOTES:**
4108
4109NONE
4110
4111**EXAMPLES:**
4112
4113.. code:: c
4114
4115    SHLL \[/] mv /dev/console /dev/con1
4116
4117**CONFIGURATION:**
4118
4119.. index:: CONFIGURE_SHELL_NO_COMMAND_MV
4120.. index:: CONFIGURE_SHELL_COMMAND_MV
4121
4122This command is included in the default shell command set.  When
4123building a custom command set, define``CONFIGURE_SHELL_COMMAND_MV`` to have this command included.
4124
4125This command can be excluded from the shell command set by
4126defining ``CONFIGURE_SHELL_NO_COMMAND_MV`` when all
4127shell commands have been configured.
4128
4129**PROGRAMMING INFORMATION:**
4130
4131.. index:: rtems_shell_main_mv
4132
4133The ``mv`` command is implemented by a C language function which
4134has the following prototype:
4135.. code:: c
4136
4137    int rtems_shell_main_mv(
4138    int    argc,
4139    char \**argv
4140    );
4141
4142The configuration structure for the ``mv`` has the
4143following prototype:
4144.. code:: c
4145
4146    extern rtems_shell_cmd_t rtems_shell_MV_Command;
4147
4148**ORIGIN:**
4149
4150The implementation and portions of the documentation for this command
4151are from NetBSD 4.0.
4152
4153pwd - print work directory
4154--------------------------
4155.. index:: pwd
4156
4157**SYNOPSYS:**
4158
4159.. code:: c
4160
4161    pwd
4162
4163**DESCRIPTION:**
4164
4165This command prints the fully qualified filename of the current
4166working directory.
4167
4168**EXIT STATUS:**
4169
4170This command returns 0 on success and non-zero if an error is encountered.
4171
4172**NOTES:**
4173
4174NONE
4175
4176**EXAMPLES:**
4177
4178The following is an example of how to use ``pwd``:
4179.. code:: c
4180
4181    SHLL \[/] $ pwd
4182    /
4183    SHLL \[/] $ cd dev
4184    SHLL \[/dev] $ pwd
4185    /dev
4186
4187**CONFIGURATION:**
4188
4189.. index:: CONFIGURE_SHELL_NO_COMMAND_PWD
4190.. index:: CONFIGURE_SHELL_COMMAND_PWD
4191
4192This command is included in the default shell command set.
4193When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PWD`` to have this
4194command included.
4195
4196This command can be excluded from the shell command set by
4197defining ``CONFIGURE_SHELL_NO_COMMAND_PWD`` when all
4198shell commands have been configured.
4199
4200**PROGRAMMING INFORMATION:**
4201
4202.. index:: rtems_shell_rtems_main_pwd
4203
4204The ``pwd`` is implemented by a C language function
4205which has the following prototype:
4206.. code:: c
4207
4208    int rtems_shell_rtems_main_pwd(
4209    int    argc,
4210    char \**argv
4211    );
4212
4213The configuration structure for the ``pwd`` has the
4214following prototype:
4215.. code:: c
4216
4217    extern rtems_shell_cmd_t rtems_shell_PWD_Command;
4218
4219rmdir - remove empty directories
4220--------------------------------
4221.. index:: rmdir
4222
4223**SYNOPSYS:**
4224
4225.. code:: c
4226
4227    rmdir  \[dir1 .. dirN]
4228
4229**DESCRIPTION:**
4230
4231This command removes the specified set of directories.  If no
4232directories are provided on the command line, no actions are taken.
4233
4234**EXIT STATUS:**
4235
4236This command returns 0 on success and non-zero if an error is encountered.
4237
4238**NOTES:**
4239
4240This command is a implemented using the ``rmdir(2)`` system
4241call and all reasons that call may fail apply to this command.
4242
4243**EXAMPLES:**
4244
4245The following is an example of how to use ``rmdir``:
4246.. code:: c
4247
4248    SHLL \[/] # mkdir joeldir
4249    SHLL \[/] # rmdir joeldir
4250    SHLL \[/] # ls joeldir
4251    joeldir: No such file or directory.
4252
4253**CONFIGURATION:**
4254
4255.. index:: CONFIGURE_SHELL_NO_COMMAND_RMDIR
4256.. index:: CONFIGURE_SHELL_COMMAND_RMDIR
4257
4258This command is included in the default shell command set.
4259When building a custom command set, define``CONFIGURE_SHELL_COMMAND_RMDIR`` to have this
4260command included.
4261
4262This command can be excluded from the shell command set by
4263defining ``CONFIGURE_SHELL_NO_COMMAND_RMDIR`` when all
4264shell commands have been configured.
4265
4266**PROGRAMMING INFORMATION:**
4267
4268.. index:: rtems_shell_rtems_main_rmdir
4269
4270The ``rmdir`` is implemented by a C language function
4271which has the following prototype:
4272.. code:: c
4273
4274    int rtems_shell_rtems_main_rmdir(
4275    int    argc,
4276    char \**argv
4277    );
4278
4279The configuration structure for the ``rmdir`` has the
4280following prototype:
4281.. code:: c
4282
4283    extern rtems_shell_cmd_t rtems_shell_RMDIR_Command;
4284
4285rm - remove files
4286-----------------
4287.. index:: rm
4288
4289**SYNOPSYS:**
4290
4291.. code:: c
4292
4293    rm file1 \[file2 ... fileN]
4294
4295**DESCRIPTION:**
4296
4297This command deletes a name from the filesystem.  If the specified file name
4298was the last link to a file and there are no ``open`` file descriptor
4299references to that file, then it is deleted and the associated space in
4300the file system is made available for subsequent use.
4301
4302If the filename specified was the last link to a file but there
4303are open file descriptor references to it, then the file will
4304remain in existence until the last file descriptor referencing
4305it is closed.
4306
4307**EXIT STATUS:**
4308
4309This command returns 0 on success and non-zero if an error is encountered.
4310
4311**NOTES:**
4312
4313NONE
4314
4315**EXAMPLES:**
4316
4317The following is an example of how to use ``rm``:
4318.. code:: c
4319
4320    SHLL \[/] # cp /etc/passwd tmpfile
4321    SHLL \[/] # cat tmpfile
4322    root:\*:0:0:root::/:/bin/sh
4323    rtems:\*:1:1:RTEMS Application::/:/bin/sh
4324    tty:!:2:2:tty owner::/:/bin/false
4325    SHLL \[/] # rm tmpfile
4326    SHLL \[/] # cat tmpfile
4327    cat: tmpfile: No such file or directory
4328
4329**CONFIGURATION:**
4330
4331.. index:: CONFIGURE_SHELL_NO_COMMAND_RM
4332.. index:: CONFIGURE_SHELL_COMMAND_RM
4333
4334This command is included in the default shell command set.
4335When building a custom command set, define``CONFIGURE_SHELL_COMMAND_RM`` to have this
4336command included.
4337
4338This command can be excluded from the shell command set by
4339defining ``CONFIGURE_SHELL_NO_COMMAND_RM`` when all
4340shell commands have been configured.
4341
4342**PROGRAMMING INFORMATION:**
4343
4344.. index:: rtems_shell_main_rm
4345
4346The ``rm`` is implemented by a C language function
4347which has the following prototype:
4348.. code:: c
4349
4350    int rtems_shell_main_rm(
4351    int    argc,
4352    char \**argv
4353    );
4354
4355The configuration structure for the ``rm`` has the
4356following prototype:
4357.. code:: c
4358
4359    extern rtems_shell_cmd_t rtems_shell_RM_Command;
4360
4361umask - set file mode creation mask
4362-----------------------------------
4363.. index:: umask
4364
4365**SYNOPSYS:**
4366
4367.. code:: c
4368
4369    umask \[new_umask]
4370
4371**DESCRIPTION:**
4372
4373This command sets the user file creation mask to ``new_umask``.  The
4374argument ``new_umask`` may be octal, hexadecimal, or decimal.
4375
4376**EXIT STATUS:**
4377
4378This command returns 0 on success and non-zero if an error is encountered.
4379
4380**NOTES:**
4381
4382This command does not currently support symbolic mode masks.
4383
4384**EXAMPLES:**
4385
4386The following is an example of how to use ``umask``:
4387.. code:: c
4388
4389    SHLL \[/] $ umask
4390    022
4391    SHLL \[/] $ umask 0666
4392    0666
4393    SHLL \[/] $ umask
4394    0666
4395
4396**CONFIGURATION:**
4397
4398.. index:: CONFIGURE_SHELL_NO_COMMAND_UMASK
4399.. index:: CONFIGURE_SHELL_COMMAND_UMASK
4400
4401This command is included in the default shell command set.
4402When building a custom command set, define``CONFIGURE_SHELL_COMMAND_UMASK`` to have this
4403command included.
4404
4405This command can be excluded from the shell command set by
4406defining ``CONFIGURE_SHELL_NO_COMMAND_UMASK`` when all
4407shell commands have been configured.
4408
4409**PROGRAMMING INFORMATION:**
4410
4411.. index:: rtems_shell_rtems_main_umask
4412
4413The ``umask`` is implemented by a C language function
4414which has the following prototype:
4415.. code:: c
4416
4417    int rtems_shell_rtems_main_umask(
4418    int    argc,
4419    char \**argv
4420    );
4421
4422The configuration structure for the ``umask`` has the
4423following prototype:
4424.. code:: c
4425
4426    extern rtems_shell_cmd_t rtems_shell_UMASK_Command;
4427
4428unmount - unmount disk
4429----------------------
4430.. index:: unmount
4431
4432**SYNOPSYS:**
4433
4434.. code:: c
4435
4436    unmount path
4437
4438**DESCRIPTION:**
4439
4440This command unmounts the device at the specified ``path``.
4441
4442**EXIT STATUS:**
4443
4444This command returns 0 on success and non-zero if an error is encountered.
4445
4446**NOTES:**
4447
4448TBD - Surely there must be some warnings to go here.
4449
4450**EXAMPLES:**
4451
4452The following is an example of how to use ``unmount``:
4453.. code:: c
4454
4455    EXAMPLE_TBD
4456
4457**CONFIGURATION:**
4458
4459.. index:: CONFIGURE_SHELL_NO_COMMAND_UNMOUNT
4460.. index:: CONFIGURE_SHELL_COMMAND_UNMOUNT
4461
4462This command is included in the default shell command set.
4463When building a custom command set, define``CONFIGURE_SHELL_COMMAND_UNMOUNT`` to have this
4464command included.
4465
4466This command can be excluded from the shell command set by
4467defining ``CONFIGURE_SHELL_NO_COMMAND_UNMOUNT`` when all
4468shell commands have been configured.
4469
4470**PROGRAMMING INFORMATION:**
4471
4472.. index:: rtems_shell_rtems_main_unmount
4473
4474The ``unmount`` is implemented by a C language function
4475which has the following prototype:
4476.. code:: c
4477
4478    int rtems_shell_rtems_main_unmount(
4479    int    argc,
4480    char \**argv
4481    );
4482
4483The configuration structure for the ``unmount`` has the
4484following prototype:
4485.. code:: c
4486
4487    extern rtems_shell_cmd_t rtems_shell_UNMOUNT_Command;
4488
4489.. COMMENT: COPYRIGHT (c) 1988-2012.
4490
4491.. COMMENT: On-Line Applications Research Corporation (OAR).
4492
4493.. COMMENT: All rights reserved.
4494
4495Memory Commands
4496###############
4497
4498Introduction
4499============
4500
4501The RTEMS shell has the following memory commands:
4502
4503- ``mdump`` - Display contents of memory
4504
4505- ``wdump`` - Display contents of memory (word)
4506
4507- ``ldump`` - Display contents of memory (longword)
4508
4509- ``medit`` - Modify contents of memory
4510
4511- ``mfill`` - File memory with pattern
4512
4513- ``mmove`` - Move contents of memory
4514
4515- ``malloc`` - Obtain information on C Program Heap
4516
4517Commands
4518========
4519
4520This section details the Memory Commands available.  A
4521subsection is dedicated to each of the commands and
4522describes the behavior and configuration of that
4523command as well as providing an example usage.
4524
4525mdump - display contents of memory
4526----------------------------------
4527.. index:: mdump
4528
4529**SYNOPSYS:**
4530
4531.. code:: c
4532
4533    mdump \[address \[length \[size]]]
4534
4535**DESCRIPTION:**
4536
4537This command displays the contents of memory at the ``address``
4538and ``length`` in ``size`` byte units specified on the command line.
4539
4540When ``size`` is not provided, it defaults to ``1`` byte units.
4541Values of ``1``, ``2``, and ``4`` are valid; all others will
4542cause an error to be reported.
4543
4544When ``length`` is not provided, it defaults to ``320`` which
4545is twenty lines of output with sixteen bytes of output per line.
4546
4547When ``address`` is not provided, it defaults to ``0x00000000``.
4548
4549**EXIT STATUS:**
4550
4551This command always returns 0 to indicate success.
4552
4553**NOTES:**
4554
4555Dumping memory from a non-existent address may result in an unrecoverable
4556program fault.
4557
4558**EXAMPLES:**
4559
4560The following is an example of how to use ``mdump``:
4561.. code:: c
4562
4563    SHLL \[/] $ mdump 0x10000 32
4564    0x0001000000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
4565    0x0001001000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
4566    SHLL \[/] $ mdump 0x02000000 32
4567    0x02000000A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
4568    0x02000010A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
4569    SHLL \[/] $ mdump 0x02001000 32
4570    0x0200100003 00 80 00 82 10 60 00-81 98 40 00 83 48 00 00 ......`.....H..
4571    0x0200101084 00 60 01 84 08 A0 07-86 10 20 01 87 28 C0 02 ..`....... ..(..
4572
4573**CONFIGURATION:**
4574
4575.. index:: CONFIGURE_SHELL_NO_COMMAND_MDUMP
4576.. index:: CONFIGURE_SHELL_COMMAND_MDUMP
4577
4578This command is included in the default shell command set.
4579When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MDUMP`` to have this
4580command included.
4581
4582This command can be excluded from the shell command set by
4583defining ``CONFIGURE_SHELL_NO_COMMAND_MDUMP`` when all
4584shell commands have been configured.
4585
4586**PROGRAMMING INFORMATION:**
4587
4588.. index:: rtems_shell_rtems_main_mdump
4589
4590The ``mdump`` is implemented by a C language function
4591which has the following prototype:
4592.. code:: c
4593
4594    int rtems_shell_rtems_main_mdump(
4595    int    argc,
4596    char \**argv
4597    );
4598
4599The configuration structure for the ``mdump`` has the
4600following prototype:
4601.. code:: c
4602
4603    extern rtems_shell_cmd_t rtems_shell_MDUMP_Command;
4604
4605wdump - display contents of memory (word)
4606-----------------------------------------
4607.. index:: wdump
4608
4609**SYNOPSYS:**
4610
4611.. code:: c
4612
4613    wdump \[address \[length]]
4614
4615**DESCRIPTION:**
4616
4617This command displays the contents of memory at the ``address``
4618and ``length`` in bytes specified on the command line.
4619
4620This command is equivalent to ``mdump address length 2``.
4621
4622When ``length`` is not provided, it defaults to ``320`` which
4623is twenty lines of output with eight words of output per line.
4624
4625When ``address`` is not provided, it defaults to ``0x00000000``.
4626
4627**EXIT STATUS:**
4628
4629This command always returns 0 to indicate success.
4630
4631**NOTES:**
4632
4633Dumping memory from a non-existent address may result in an unrecoverable
4634program fault.
4635
4636**EXAMPLES:**
4637
4638The following is an example of how to use ``wdump``:
4639.. code:: c
4640
4641    SHLL \[/] $ wdump 0x02010000 32
4642    0x02010000 0201 08D8 0201 08C0-0201 08AC 0201 0874 ...............t
4643    0x02010010 0201 0894 0201 0718-0201 0640 0201 0798 ...............
4644
4645**CONFIGURATION:**
4646
4647.. index:: CONFIGURE_SHELL_NO_COMMAND_WDUMP
4648.. index:: CONFIGURE_SHELL_COMMAND_WDUMP
4649
4650This command is included in the default shell command set.
4651When building a custom command set, define``CONFIGURE_SHELL_COMMAND_WDUMP`` to have this
4652command included.
4653
4654This command can be excluded from the shell command set by
4655defining ``CONFIGURE_SHELL_NO_COMMAND_WDUMP`` when all
4656shell commands have been configured.
4657
4658**PROGRAMMING INFORMATION:**
4659
4660.. index:: rtems_shell_rtems_main_wdump
4661
4662The ``wdump`` is implemented by a C language function
4663which has the following prototype:
4664.. code:: c
4665
4666    int rtems_shell_rtems_main_wdump(
4667    int    argc,
4668    char \**argv
4669    );
4670
4671The configuration structure for the ``wdump`` has the
4672following prototype:
4673.. code:: c
4674
4675    extern rtems_shell_cmd_t rtems_shell_WDUMP_Command;
4676
4677ldump - display contents of memory (longword)
4678---------------------------------------------
4679.. index:: ldump
4680
4681**SYNOPSYS:**
4682
4683.. code:: c
4684
4685    ldump \[address \[length]]
4686
4687**DESCRIPTION:**
4688
4689This command displays the contents of memory at the ``address``
4690and ``length`` in bytes specified on the command line.
4691
4692This command is equivalent to ``mdump address length 4``.
4693
4694When ``length`` is not provided, it defaults to ``320`` which
4695is twenty lines of output with four longwords of output per line.
4696
4697When ``address`` is not provided, it defaults to ``0x00000000``.
4698
4699**EXIT STATUS:**
4700
4701This command always returns 0 to indicate success.
4702
4703**NOTES:**
4704
4705Dumping memory from a non-existent address may result in an unrecoverable
4706program fault.
4707
4708**EXAMPLES:**
4709
4710The following is an example of how to use ``ldump``:
4711.. code:: c
4712
4713    SHLL \[/] $ ldump 0x02010000 32
4714    0x02010000 020108D8 020108C0-020108AC 02010874 ...............t
4715    0x02010010 020 0894 02010718-02010640 02010798 ...............
4716
4717**CONFIGURATION:**
4718
4719.. index:: CONFIGURE_SHELL_NO_COMMAND_LDUMP
4720.. index:: CONFIGURE_SHELL_COMMAND_LDUMP
4721
4722This command is included in the default shell command set.
4723When building a custom command set, define``CONFIGURE_SHELL_COMMAND_LDUMP`` to have this
4724command included.
4725
4726This command can be excluded from the shell command set by
4727defining ``CONFIGURE_SHELL_NO_COMMAND_LDUMP`` when all
4728shell commands have been configured.
4729
4730**PROGRAMMING INFORMATION:**
4731
4732.. index:: rtems_shell_rtems_main_ldump
4733
4734The ``ldump`` is implemented by a C language function
4735which has the following prototype:
4736.. code:: c
4737
4738    int rtems_shell_rtems_main_ldump(
4739    int    argc,
4740    char \**argv
4741    );
4742
4743The configuration structure for the ``ldump`` has the
4744following prototype:
4745.. code:: c
4746
4747    extern rtems_shell_cmd_t rtems_shell_LDUMP_Command;
4748
4749medit - modify contents of memory
4750---------------------------------
4751.. index:: medit
4752
4753**SYNOPSYS:**
4754
4755.. code:: c
4756
4757    medit address value1 \[value2 ... valueN]
4758
4759**DESCRIPTION:**
4760
4761This command is used to modify the contents of the memory starting
4762at ``address`` using the octets specified by the parameters``value1`` through ``valueN``.
4763
4764**EXIT STATUS:**
4765
4766This command returns 0 on success and non-zero if an error is encountered.
4767
4768**NOTES:**
4769
4770Dumping memory from a non-existent address may result in an unrecoverable
4771program fault.
4772
4773**EXAMPLES:**
4774
4775The following is an example of how to use ``medit``:
4776.. code:: c
4777
4778    SHLL \[/] $ mdump 0x02000000 32
4779    0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
4780    0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
4781    SHLL \[/] $  medit 0x02000000 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09
4782    SHLL \[/] $ mdump 0x02000000 32
4783    0x02000000 01 02 03 04 05 06 07 08-09 00 22 BC A6 10 21 00 .........."...!.
4784    0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
4785
4786**CONFIGURATION:**
4787
4788.. index:: CONFIGURE_SHELL_NO_COMMAND_MEDIT
4789.. index:: CONFIGURE_SHELL_COMMAND_MEDIT
4790
4791This command is included in the default shell command set.
4792When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MEDIT`` to have this
4793command included.
4794
4795This command can be excluded from the shell command set by
4796defining ``CONFIGURE_SHELL_NO_COMMAND_MEDIT`` when all
4797shell commands have been configured.
4798
4799**PROGRAMMING INFORMATION:**
4800
4801.. index:: rtems_shell_rtems_main_medit
4802
4803The ``medit`` is implemented by a C language function
4804which has the following prototype:
4805.. code:: c
4806
4807    int rtems_shell_rtems_main_medit(
4808    int    argc,
4809    char \**argv
4810    );
4811
4812The configuration structure for the ``medit`` has the
4813following prototype:
4814.. code:: c
4815
4816    extern rtems_shell_cmd_t rtems_shell_MEDIT_Command;
4817
4818mfill - file memory with pattern
4819--------------------------------
4820.. index:: mfill
4821
4822**SYNOPSYS:**
4823
4824.. code:: c
4825
4826    mfill address length value
4827
4828**DESCRIPTION:**
4829
4830This command is used to fill the memory starting at ``address``
4831for the specified ``length`` in octets when the specified at``value``.
4832
4833**EXIT STATUS:**
4834
4835This command returns 0 on success and non-zero if an error is encountered.
4836
4837**NOTES:**
4838
4839Filling a non-existent address range may result in an unrecoverable
4840program fault.  Similarly overwriting interrupt vector tables, code
4841space or critical data areas can be fatal as shown in the example.
4842
4843**EXAMPLES:**
4844
4845In this example, the address used (``0x23d89a0``) as the base
4846address of the filled area is the end of the stack for the
4847Idle thread.  This address was determined manually using gdb and
4848is very specific to this application and BSP.  The first command
4849in this example is an ``mdump`` to display the initial contents
4850of this memory.  We see that the first 8 bytes are 0xA5 which is
4851the pattern used as a guard by the Stack Checker.  On
4852the first context switch after the pattern is overwritten
4853by the  ``mfill`` command, the Stack Checker detect the pattern
4854has been corrupted and generates a fatal error.
4855.. code:: c
4856
4857    SHLL \[/] $ mdump 0x23d89a0 16
4858    0x023D89A0 A5 A5 A5 A5 A5 A5 A5 A5-FE ED F0 0D 0B AD 0D 06 ................
4859    SHLL \[/] $ mfill 0x23d89a0 13 0x5a
4860    SHLL \[/] $ BLOWN STACK!!! Offending task(0x23D4418): id=0x09010001; name=0x0203D908
4861    stack covers range 0x23D89A0 - 0x23D99AF (4112 bytes)
4862    Damaged pattern begins at 0x023D89A8 and is 16 bytes long
4863
4864**CONFIGURATION:**
4865
4866.. index:: CONFIGURE_SHELL_NO_COMMAND_MFILL
4867.. index:: CONFIGURE_SHELL_COMMAND_MFILL
4868
4869This command is included in the default shell command set.
4870When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MFILL`` to have this
4871command included.
4872
4873This command can be excluded from the shell command set by
4874defining ``CONFIGURE_SHELL_NO_COMMAND_MFILL`` when all
4875shell commands have been configured.
4876
4877**PROGRAMMING INFORMATION:**
4878
4879.. index:: rtems_shell_rtems_main_mfill
4880
4881The ``mfill`` is implemented by a C language function
4882which has the following prototype:
4883.. code:: c
4884
4885    int rtems_shell_rtems_main_mfill(
4886    int    argc,
4887    char \**argv
4888    );
4889
4890The configuration structure for the ``mfill`` has the
4891following prototype:
4892.. code:: c
4893
4894    extern rtems_shell_cmd_t rtems_shell_MFILL_Command;
4895
4896mmove - move contents of memory
4897-------------------------------
4898.. index:: mmove
4899
4900**SYNOPSYS:**
4901
4902.. code:: c
4903
4904    mmove dst src length
4905
4906**DESCRIPTION:**
4907
4908This command is used to copy the contents of the memory
4909starting at ``src`` to the memory located at ``dst``
4910for the specified ``length`` in octets.
4911
4912**EXIT STATUS:**
4913
4914This command returns 0 on success and non-zero if an error is encountered.
4915
4916**NOTES:**
4917
4918NONE
4919
4920**EXAMPLES:**
4921
4922The following is an example of how to use ``mmove``:
4923.. code:: c
4924
4925    SHLL \[/] $ mdump 0x023d99a0 16
4926    0x023D99A0 A5 A5 A5 A5 A5 A5 A5 A5-A5 A5 A5 A5 A5 A5 A5 A5 ................
4927    SHLL \[/] $ mdump 0x02000000 16
4928    0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
4929    SHLL \[/] $ mmove 0x023d99a0 0x02000000 13
4930    SHLL \[/] $ mdump 0x023d99a0 16
4931    0x023D99A0 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 A5 A5 A5 .H..)..3..".....
4932
4933**CONFIGURATION:**
4934
4935.. index:: CONFIGURE_SHELL_NO_COMMAND_MMOVE
4936.. index:: CONFIGURE_SHELL_COMMAND_MMOVE
4937
4938This command is included in the default shell command set.
4939When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MMOVE`` to have this
4940command included.
4941
4942This command can be excluded from the shell command set by
4943defining ``CONFIGURE_SHELL_NO_COMMAND_MMOVE`` when all
4944shell commands have been configured.
4945
4946**PROGRAMMING INFORMATION:**
4947
4948.. index:: rtems_shell_rtems_main_mmove
4949
4950The ``mmove`` is implemented by a C language function
4951which has the following prototype:
4952.. code:: c
4953
4954    int rtems_shell_rtems_main_mmove(
4955    int    argc,
4956    char \**argv
4957    );
4958
4959The configuration structure for the ``mmove`` has the
4960following prototype:
4961.. code:: c
4962
4963    extern rtems_shell_cmd_t rtems_shell_MMOVE_Command;
4964
4965malloc - obtain information on C program heap
4966---------------------------------------------
4967.. index:: malloc
4968
4969**SYNOPSYS:**
4970
4971.. code:: c
4972
4973    malloc \[walk]
4974
4975**DESCRIPTION:**
4976
4977This command prints information about the current state of the C Program Heap
4978used by the ``malloc()`` family of calls if no or invalid options are passed
4979to the command.  This includes the following information:
4980
4981- Number of free blocks
4982
4983- Largest free block
4984
4985- Total bytes free
4986
4987- Number of used blocks
4988
4989- Largest used block
4990
4991- Total bytes used
4992
4993- Size of the allocatable area in bytes
4994
4995- Minimum free size ever in bytes
4996
4997- Maximum number of free blocks ever
4998
4999- Maximum number of blocks searched ever
5000
5001- Lifetime number of bytes allocated
5002
5003- Lifetime number of bytes freed
5004
5005- Total number of searches
5006
5007- Total number of successful allocations
5008
5009- Total number of failed allocations
5010
5011- Total number of successful frees
5012
5013- Total number of successful resizes
5014
5015When the subcommand ``walk`` is specified, then a heap walk will be
5016performed and information about each block is printed out.
5017
5018**EXIT STATUS:**
5019
5020This command returns 0 on success and non-zero if an error is encountered.
5021
5022**NOTES:**
5023
5024NONE
5025
5026**EXAMPLES:**
5027
5028The following is an example of how to use the ``malloc`` command.
5029.. code:: c
5030
5031    SHLL \[/] $ malloc
5032    C Program Heap and RTEMS Workspace are the same.
5033    Number of free blocks:                               2
5034    Largest free block:                          266207504
5035    Total bytes free:                            266208392
5036    Number of used blocks:                             167
5037    Largest used block:                              16392
5038    Total bytes used:                                83536
5039    Size of the allocatable area in bytes:       266291928
5040    Minimum free size ever in bytes:             266207360
5041    Maximum number of free blocks ever:                  6
5042    Maximum number of blocks searched ever:              5
5043    Lifetime number of bytes allocated:              91760
5044    Lifetime number of bytes freed:                   8224
5045    Total number of searches:                          234
5046    Total number of successful allocations:            186
5047    Total number of failed allocations:                  0
5048    Total number of successful frees:                   19
5049    Total number of successful resizes:                  0
5050    SHLL \[/] $ malloc walk
5051    malloc walk
5052    PASS[0]: page size 8, min block size 48
5053    area begin 0x00210210, area end 0x0FFFC000
5054    first block 0x00210214, last block 0x0FFFBFDC
5055    first free 0x00228084, last free 0x00228354
5056    PASS[0]: block 0x00210214: size 88
5057    ...
5058    PASS[0]: block 0x00220154: size 144
5059    PASS[0]: block 0x002201E4: size 168, prev 0x002205BC, next 0x00228354 (= last free)
5060    PASS[0]: block 0x0022028C: size 168, prev_size 168
5061    ...
5062    PASS[0]: block 0x00226E7C: size 4136
5063    PASS[0]: block 0x00227EA4: size 408, prev 0x00228084 (= first free), next 0x00226CE4
5064    PASS[0]: block 0x0022803C: size 72, prev_size 408
5065    PASS[0]: block 0x00228084: size 648, prev 0x0020F75C (= head), next 0x00227EA4
5066    PASS[0]: block 0x0022830C: size 72, prev_size 648
5067    PASS[0]: block 0x00228354: size 266157192, prev 0x002201E4, next 0x0020F75C (= tail)
5068    PASS[0]: block 0x0FFFBFDC: size 4028711480, prev_size 266157192
5069
5070**CONFIGURATION:**
5071
5072.. index:: CONFIGURE_SHELL_NO_COMMAND_MALLOC
5073.. index:: CONFIGURE_SHELL_COMMAND_MALLOC
5074
5075This command is included in the default shell command set.
5076When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MALLOC`` to have this
5077command included.
5078
5079This command can be excluded from the shell command set by
5080defining ``CONFIGURE_SHELL_NO_COMMAND_MALLOC`` when all
5081shell commands have been configured.
5082
5083**PROGRAMMING INFORMATION:**
5084
5085.. index:: rtems_shell_rtems_main_malloc
5086
5087The ``malloc`` is implemented by a C language function
5088which has the following prototype:
5089.. code:: c
5090
5091    int rtems_shell_rtems_main_malloc(
5092    int    argc,
5093    char \**argv
5094    );
5095
5096The configuration structure for the ``malloc`` has the
5097following prototype:
5098.. code:: c
5099
5100    extern rtems_shell_cmd_t rtems_shell_MALLOC_Command;
5101
5102.. COMMENT: COPYRIGHT (c) 1988-2008.
5103
5104.. COMMENT: On-Line Applications Research Corporation (OAR).
5105
5106.. COMMENT: All rights reserved.
5107
5108RTEMS Specific Commands
5109#######################
5110
5111Introduction
5112============
5113
5114The RTEMS shell has the following rtems commands:
5115
5116- ``shutdown`` - Shutdown the system
5117
5118- ``cpuuse`` - print or reset per thread cpu usage
5119
5120- ``stackuse`` - print per thread stack usage
5121
5122- ``perioduse`` - print or reset per period usage
5123
5124- ``profreport`` - print a profiling report
5125
5126- ``wkspace`` - Display information on Executive Workspace
5127
5128- ``config`` - Show the system configuration.
5129
5130- ``itask`` - List init tasks for the system
5131
5132- ``extension`` - Display information about extensions
5133
5134- ``task`` - Display information about tasks
5135
5136- ``queue`` - Display information about message queues
5137
5138- ``sema`` - display information about semaphores
5139
5140- ``region`` - display information about regions
5141
5142- ``part`` - display information about partitions
5143
5144- ``object`` - Display information about RTEMS objects
5145
5146- ``driver`` - Display the RTEMS device driver table
5147
5148- ``dname`` - Displays information about named drivers
5149
5150- ``pthread`` - Displays information about POSIX threads
5151
5152Commands
5153========
5154
5155This section details the RTEMS Specific Commands available.  A
5156subsection is dedicated to each of the commands and
5157describes the behavior and configuration of that
5158command as well as providing an example usage.
5159
5160shutdown - Shutdown the system
5161------------------------------
5162.. index:: shutdown
5163
5164**SYNOPSYS:**
5165
5166.. code:: c
5167
5168    shutdown
5169
5170**DESCRIPTION:**
5171
5172This command is used to shutdown the RTEMS application.
5173
5174**EXIT STATUS:**
5175
5176This command does not return.
5177
5178**NOTES:**
5179
5180**EXAMPLES:**
5181
5182The following is an example of how to use ``shutdown``:
5183.. code:: c
5184
5185    SHLL \[/] $ shutdown
5186    System shutting down at user request
5187
5188The user will not see another prompt and the system will
5189shutdown.
5190
5191**CONFIGURATION:**
5192
5193.. index:: CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN
5194.. index:: CONFIGURE_SHELL_COMMAND_SHUTDOWN
5195
5196This command is included in the default shell command set.
5197When building a custom command set, define``CONFIGURE_SHELL_COMMAND_SHUTDOWN`` to have this
5198command included.
5199
5200This command can be excluded from the shell command set by
5201defining ``CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN`` when all
5202shell commands have been configured.
5203
5204**PROGRAMMING INFORMATION:**
5205
5206The configuration structure for the ``shutdown`` has the
5207following prototype:
5208.. code:: c
5209
5210    extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;
5211
5212cpuuse - print or reset per thread cpu usage
5213--------------------------------------------
5214.. index:: cpuuse
5215
5216**SYNOPSYS:**
5217
5218.. code:: c
5219
5220    cpuuse \[-r]
5221
5222**DESCRIPTION:**
5223
5224This command may be used to print a report on the per thread
5225cpu usage or to reset the per thread CPU usage statistics. When
5226invoked with the ``-r`` option, the CPU usage statistics
5227are reset.
5228
5229**EXIT STATUS:**
5230
5231This command returns 0 on success and non-zero if an error is encountered.
5232
5233**NOTES:**
5234
5235The granularity of the timing information reported is dependent
5236upon the BSP and the manner in which RTEMS was built.  In the
5237default RTEMS configuration, if the BSP supports nanosecond
5238granularity timestamps, then the information reported will be
5239highly accurate. Otherwise, the accuracy of the information
5240reported is limited by the clock tick quantum.
5241
5242**EXAMPLES:**
5243
5244The following is an example of how to use ``cpuuse``:
5245.. code:: c
5246
5247    SHLL \[/] $ cpuuse
5248    CPU Usage by thread
5249    ID            NAME         SECONDS   PERCENT
5250    0x09010001   IDLE            49.745393   98.953
5251    0x0a010001   UI1              0.000000    0.000
5252    0x0a010002   SHLL             0.525928    1.046
5253    Time since last CPU Usage reset 50.271321 seconds
5254    SHLL \[/] $ cpuuse -r
5255    Resetting CPU Usage information
5256    SHLL \[/] $ cpuuse
5257    CPU Usage by thread
5258    ID            NAME         SECONDS   PERCENT
5259    0x09010001   IDLE             0.000000    0.000
5260    0x0a010001   UI1              0.000000    0.000
5261    0x0a010002   SHLL             0.003092  100.000
5262    Time since last CPU Usage reset 0.003092 seconds
5263
5264In the above example, the system had set idle for nearly
5265a minute when the first report was generated.  The``cpuuse -r`` and ``cpuuse`` commands were pasted
5266from another window so were executed with no gap between.
5267In the second report, only the ``shell`` thread has
5268run since the CPU Usage was reset.  It has consumed
5269approximately 3.092 milliseconds of CPU time processing
5270the two commands and generating the output.
5271
5272**CONFIGURATION:**
5273
5274.. index:: CONFIGURE_SHELL_NO_COMMAND_CPUUSE
5275.. index:: CONFIGURE_SHELL_COMMAND_CPUUSE
5276
5277This command is included in the default shell command set.
5278When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CPUUSE`` to have this
5279command included.
5280
5281This command can be excluded from the shell command set by
5282defining ``CONFIGURE_SHELL_NO_COMMAND_CPUUSE`` when all
5283shell commands have been configured.
5284
5285**PROGRAMMING INFORMATION:**
5286
5287.. index:: rtems_shell_rtems_main_cpuuse
5288
5289The ``cpuuse`` is implemented by a C language function
5290which has the following prototype:
5291.. code:: c
5292
5293    int rtems_shell_rtems_main_cpuuse(
5294    int    argc,
5295    char \**argv
5296    );
5297
5298The configuration structure for the ``cpuuse`` has the
5299following prototype:
5300.. code:: c
5301
5302    extern rtems_shell_cmd_t rtems_shell_CPUUSE_Command;
5303
5304stackuse - print per thread stack usage
5305---------------------------------------
5306.. index:: stackuse
5307
5308**SYNOPSYS:**
5309
5310.. code:: c
5311
5312    stackuse
5313
5314**DESCRIPTION:**
5315
5316This command prints a Stack Usage Report for all of the tasks
5317and threads in the system.  On systems which support it, the
5318usage of the interrupt stack is also included in the report.
5319
5320**EXIT STATUS:**
5321
5322This command always succeeds and returns 0.
5323
5324**NOTES:**
5325
5326The ``CONFIGURE_STACK_CHECKER_ENABLED`` ``confdefs.h`` constant
5327must be defined when the application is configured for this
5328command to have any information to report.
5329
5330**EXAMPLES:**
5331
5332The following is an example of how to use ``stackuse``:
5333.. code:: c
5334
5335    SHLL \[/] $ stackuse
5336    Stack usage by thread
5337    ID      NAME    LOW          HIGH     CURRENT     AVAILABLE     USED
5338    0x09010001  IDLE 0x023d89a0 - 0x023d99af 0x023d9760      4096        608
5339    0x0a010001  UI1  0x023d9f30 - 0x023daf3f 0x023dad18      4096       1804
5340    0x0a010002  SHLL 0x023db4c0 - 0x023df4cf 0x023de9d0     16384       5116
5341    0xffffffff  INTR 0x023d2760 - 0x023d375f 0x00000000      4080        316
5342
5343**CONFIGURATION:**
5344
5345.. index:: CONFIGURE_SHELL_NO_COMMAND_STACKUSE
5346.. index:: CONFIGURE_SHELL_COMMAND_STACKUSE
5347
5348This command is included in the default shell command set.
5349When building a custom command set, define``CONFIGURE_SHELL_COMMAND_STACKUSE`` to have this
5350command included.
5351
5352This command can be excluded from the shell command set by
5353defining ``CONFIGURE_SHELL_NO_COMMAND_STACKUSE`` when all
5354shell commands have been configured.
5355
5356**PROGRAMMING INFORMATION:**
5357
5358.. index:: rtems_shell_rtems_main_stackuse
5359
5360The ``stackuse`` is implemented by a C language function
5361which has the following prototype:
5362.. code:: c
5363
5364    int rtems_shell_rtems_main_stackuse(
5365    int    argc,
5366    char \**argv
5367    );
5368
5369The configuration structure for the ``stackuse`` has the
5370following prototype:
5371.. code:: c
5372
5373    extern rtems_shell_cmd_t rtems_shell_STACKUSE_Command;
5374
5375perioduse - print or reset per period usage
5376-------------------------------------------
5377.. index:: perioduse
5378
5379**SYNOPSYS:**
5380
5381.. code:: c
5382
5383    perioduse \[-r]
5384
5385**DESCRIPTION:**
5386
5387This command may be used to print a statistics report on the rate
5388monotonic periods in the application or to reset the rate monotonic
5389period usage statistics. When invoked with the ``-r`` option, the
5390usage statistics are reset.
5391
5392**EXIT STATUS:**
5393
5394This command returns 0 on success and non-zero if an error is encountered.
5395
5396**NOTES:**
5397
5398The granularity of the timing information reported is dependent
5399upon the BSP and the manner in which RTEMS was built.  In the
5400default RTEMS configuration, if the BSP supports nanosecond
5401granularity timestamps, then the information reported will be
5402highly accurate. Otherwise, the accuracy of the information
5403reported is limited by the clock tick quantum.
5404
5405**EXAMPLES:**
5406
5407The following is an example of how to use ``perioduse``:
5408.. code:: c
5409
5410    SHLL \[/] $ perioduse
5411    Period information by period
5412    --- CPU times are in seconds ---
5413    --- Wall times are in seconds ---
5414    ID     OWNER COUNT MISSED          CPU TIME                  WALL TIME
5415    MIN/MAX/AVG                MIN/MAX/AVG
5416    0x42010001 TA1    502      0 0:000039/0:042650/0:004158 0:000039/0:020118/0:002848
5417    0x42010002 TA2    502      0 0:000041/0:042657/0:004309 0:000041/0:020116/0:002848
5418    0x42010003 TA3    501      0 0:000041/0:041564/0:003653 0:000041/0:020003/0:002814
5419    0x42010004 TA4    501      0 0:000043/0:044075/0:004911 0:000043/0:020004/0:002814
5420    0x42010005 TA5     10      0 0:000065/0:005413/0:002739 0:000065/1:000457/0:041058
5421    MIN/MAX/AVG                MIN/MAX/AVG
5422    SHLL \[/] $ perioduse -r
5423    Resetting Period Usage information
5424    SHLL \[/] $ perioduse
5425    --- CPU times are in seconds ---
5426    --- Wall times are in seconds ---
5427    ID     OWNER COUNT MISSED          CPU TIME                  WALL TIME
5428    MIN/MAX/AVG                MIN/MAX/AVG
5429    0x42010001 TA1      0      0
5430    0x42010002 TA2      0      0
5431    0x42010003 TA3      0      0
5432    0x42010004 TA4      0      0
5433    0x42010005 TA5      0      0
5434
5435**CONFIGURATION:**
5436
5437.. index:: CONFIGURE_SHELL_NO_COMMAND_PERIODUSE
5438.. index:: CONFIGURE_SHELL_COMMAND_PERIODUSE
5439
5440This command is included in the default shell command set.
5441When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PERIODUSE`` to have this
5442command included.
5443
5444This command can be excluded from the shell command set by
5445defining ``CONFIGURE_SHELL_NO_COMMAND_PERIODUSE`` when all
5446shell commands have been configured.
5447
5448**PROGRAMMING INFORMATION:**
5449
5450.. index:: rtems_shell_rtems_main_perioduse
5451
5452The ``perioduse`` is implemented by a C language function
5453which has the following prototype:
5454.. code:: c
5455
5456    int rtems_shell_rtems_main_perioduse(
5457    int    argc,
5458    char \**argv
5459    );
5460
5461The configuration structure for the ``perioduse`` has the
5462following prototype:
5463.. code:: c
5464
5465    extern rtems_shell_cmd_t rtems_shell_PERIODUSE_Command;
5466
5467profreport - print a profiling report
5468-------------------------------------
5469.. index:: profreport
5470
5471**SYNOPSYS:**
5472
5473.. code:: c
5474
5475    profreport
5476
5477**DESCRIPTION:**
5478
5479This command may be used to print a profiling report.
5480
5481**EXIT STATUS:**
5482
5483This command returns 0.
5484
5485**NOTES:**
5486
5487Profiling must be enabled at build configuration time to get profiling
5488information.
5489
5490**EXAMPLES:**
5491
5492The following is an example of how to use ``profreport``:
5493.. code:: c
5494
5495    SHLL \[/] $ profreport
5496    <ProfilingReport name="Shell">
5497    <PerCPUProfilingReport processorIndex="0">
5498    <MaxThreadDispatchDisabledTime unit="ns">10447</MaxThreadDispatchDisabledTime>
5499    <MeanThreadDispatchDisabledTime unit="ns">2</MeanThreadDispatchDisabledTime>
5500    <TotalThreadDispatchDisabledTime unit="ns">195926627</TotalThreadDispatchDisabledTime>
5501    <ThreadDispatchDisabledCount>77908688</ThreadDispatchDisabledCount>
5502    <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
5503    <MaxInterruptTime unit="ns">688</MaxInterruptTime>
5504    <MeanInterruptTime unit="ns">127</MeanInterruptTime>
5505    <TotalInterruptTime unit="ns">282651157</TotalInterruptTime>
5506    <InterruptCount>2215855</InterruptCount>
5507    </PerCPUProfilingReport>
5508    <PerCPUProfilingReport processorIndex="1">
5509    <MaxThreadDispatchDisabledTime unit="ns">9053</MaxThreadDispatchDisabledTime>
5510    <MeanThreadDispatchDisabledTime unit="ns">41</MeanThreadDispatchDisabledTime>
5511    <TotalThreadDispatchDisabledTime unit="ns">3053830335</TotalThreadDispatchDisabledTime>
5512    <ThreadDispatchDisabledCount>73334202</ThreadDispatchDisabledCount>
5513    <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
5514    <MaxInterruptTime unit="ns">57</MaxInterruptTime>
5515    <MeanInterruptTime unit="ns">35</MeanInterruptTime>
5516    <TotalInterruptTime unit="ns">76980203</TotalInterruptTime>
5517    <InterruptCount>2141179</InterruptCount>
5518    </PerCPUProfilingReport>
5519    <SMPLockProfilingReport name="SMP lock stats">
5520    <MaxAcquireTime unit="ns">608</MaxAcquireTime>
5521    <MaxSectionTime unit="ns">1387</MaxSectionTime>
5522    <MeanAcquireTime unit="ns">112</MeanAcquireTime>
5523    <MeanSectionTime unit="ns">338</MeanSectionTime>
5524    <TotalAcquireTime unit="ns">119031</TotalAcquireTime>
5525    <TotalSectionTime unit="ns">357222</TotalSectionTime>
5526    <UsageCount>1055</UsageCount>
5527    <ContentionCount initialQueueLength="0">1055</ContentionCount>
5528    <ContentionCount initialQueueLength="1">0</ContentionCount>
5529    <ContentionCount initialQueueLength="2">0</ContentionCount>
5530    <ContentionCount initialQueueLength="3">0</ContentionCount>
5531    </SMPLockProfilingReport>
5532    <SMPLockProfilingReport name="Giant">
5533    <MaxAcquireTime unit="ns">4186</MaxAcquireTime>
5534    <MaxSectionTime unit="ns">7575</MaxSectionTime>
5535    <MeanAcquireTime unit="ns">160</MeanAcquireTime>
5536    <MeanSectionTime unit="ns">183</MeanSectionTime>
5537    <TotalAcquireTime unit="ns">1772793111</TotalAcquireTime>
5538    <TotalSectionTime unit="ns">2029733879</TotalSectionTime>
5539    <UsageCount>11039140</UsageCount>
5540    <ContentionCount initialQueueLength="0">11037655</ContentionCount>
5541    <ContentionCount initialQueueLength="1">1485</ContentionCount>
5542    <ContentionCount initialQueueLength="2">0</ContentionCount>
5543    <ContentionCount initialQueueLength="3">0</ContentionCount>
5544    </SMPLockProfilingReport>
5545    </ProfilingReport>
5546
5547**CONFIGURATION:**
5548
5549.. index:: CONFIGURE_SHELL_NO_COMMAND_PROFREPORT
5550.. index:: CONFIGURE_SHELL_COMMAND_PROFREPORT
5551
5552When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PROFREPORT`` to have this
5553command included.
5554
5555This command can be excluded from the shell command set by
5556defining ``CONFIGURE_SHELL_NO_COMMAND_PROFREPORT`` when all
5557shell commands have been configured.
5558
5559**PROGRAMMING INFORMATION:**
5560
5561The configuration structure for the ``profreport`` has the
5562following prototype:
5563.. code:: c
5564
5565    extern rtems_shell_cmd_t rtems_shell_PROFREPORT_Command;
5566
5567wkspace - display information on executive workspace
5568----------------------------------------------------
5569.. index:: wkspace
5570
5571**SYNOPSYS:**
5572
5573.. code:: c
5574
5575    wkspace
5576
5577**DESCRIPTION:**
5578
5579This command prints information on the current state of
5580the RTEMS Executive Workspace reported.  This includes the
5581following information:
5582
5583- Number of free blocks
5584
5585- Largest free block
5586
5587- Total bytes free
5588
5589- Number of used blocks
5590
5591- Largest used block
5592
5593- Total bytes used
5594
5595**EXIT STATUS:**
5596
5597This command always succeeds and returns 0.
5598
5599**NOTES:**
5600
5601NONE
5602
5603**EXAMPLES:**
5604
5605The following is an example of how to use ``wkspace``:
5606.. code:: c
5607
5608    SHLL \[/] $ wkspace
5609    Number of free blocks: 1
5610    Largest free block:    132336
5611    Total bytes free:      132336
5612    Number of used blocks: 36
5613    Largest used block:    16408
5614    Total bytes used:      55344
5615
5616**CONFIGURATION:**
5617
5618.. index:: CONFIGURE_SHELL_NO_COMMAND_WKSPACE
5619.. index:: CONFIGURE_SHELL_COMMAND_WKSPACE
5620
5621This command is included in the default shell command set.
5622When building a custom command set, define``CONFIGURE_SHELL_COMMAND_WKSPACE`` to have this
5623command included.
5624
5625This command can be excluded from the shell command set by
5626defining ``CONFIGURE_SHELL_NO_COMMAND_WKSPACE`` when all
5627shell commands have been configured.
5628
5629**PROGRAMMING INFORMATION:**
5630
5631.. index:: rtems_shell_rtems_main_wkspace
5632
5633The ``wkspace`` is implemented by a C language function
5634which has the following prototype:
5635.. code:: c
5636
5637    int rtems_shell_rtems_main_wkspace(
5638    int    argc,
5639    char \**argv
5640    );
5641
5642The configuration structure for the ``wkspace`` has the
5643following prototype:
5644.. code:: c
5645
5646    extern rtems_shell_cmd_t rtems_shell_WKSPACE_Command;
5647
5648config - show the system configuration.
5649---------------------------------------
5650.. index:: config
5651
5652**SYNOPSYS:**
5653
5654.. code:: c
5655
5656    config
5657
5658**DESCRIPTION:**
5659
5660This command display information about the RTEMS Configuration.
5661
5662**EXIT STATUS:**
5663
5664This command always succeeds and returns 0.
5665
5666**NOTES:**
5667
5668At this time, it does not report every configuration parameter.
5669This is an area in which user submissions or sponsorship of
5670a developer would be appreciated.
5671
5672**EXAMPLES:**
5673
5674The following is an example of how to use ``config``:
5675.. code:: c
5676
5677    INITIAL (startup) Configuration Info
5678
5679    WORKSPACE      start: 0x23d22e0;  size: 0x2dd20
5680    TIME           usec/tick: 10000;  tick/timeslice: 50;  tick/sec: 100
5681    MAXIMUMS       tasks: 20;  timers: 0;  sems: 50;  que's: 20;  ext's: 1
5682    partitions: 0;  regions: 0;  ports: 0;  periods: 0
5683
5684**CONFIGURATION:**
5685
5686.. index:: CONFIGURE_SHELL_NO_COMMAND_CONFIG
5687.. index:: CONFIGURE_SHELL_COMMAND_CONFIG
5688
5689This command is included in the default shell command set.
5690When building a custom command set, define``CONFIGURE_SHELL_COMMAND_CONFIG`` to have this
5691command included.
5692
5693This command can be excluded from the shell command set by
5694defining ``CONFIGURE_SHELL_NO_COMMAND_CONFIG`` when all
5695shell commands have been configured.
5696
5697**PROGRAMMING INFORMATION:**
5698
5699.. index:: rtems_shell_rtems_main_config
5700
5701The ``config`` is implemented by a C language function
5702which has the following prototype:
5703.. code:: c
5704
5705    int rtems_shell_rtems_main_config(
5706    int    argc,
5707    char \**argv
5708    );
5709
5710The configuration structure for the ``config`` has the
5711following prototype:
5712.. code:: c
5713
5714    extern rtems_shell_cmd_t rtems_shell_CONFIG_Command;
5715
5716itask - list init tasks for the system
5717--------------------------------------
5718.. index:: itask
5719
5720**SYNOPSYS:**
5721
5722.. code:: c
5723
5724    itask
5725
5726**DESCRIPTION:**
5727
5728This command prints a report on the set of initialization
5729tasks and threads in the system.
5730
5731**EXIT STATUS:**
5732
5733This command always succeeds and returns 0.
5734
5735**NOTES:**
5736
5737At this time, it includes only Classic API Initialization Tasks.
5738This is an area in which user submissions or sponsorship of
5739a developer would be appreciated.
5740
5741**EXAMPLES:**
5742
5743The following is an example of how to use ``itask``:
5744.. code:: c
5745
5746    SHLL \[/] $ itask
5747    #    NAME   ENTRY        ARGUMENT    PRIO   MODES  ATTRIBUTES   STACK SIZE
5748    ------------------------------------------------------------------------------
5749    0   UI1    \[0x2002258] 0 \[0x0]        1    nP      DEFAULT     4096 \[0x1000]
5750
5751**CONFIGURATION:**
5752
5753.. index:: CONFIGURE_SHELL_NO_COMMAND_ITASK
5754.. index:: CONFIGURE_SHELL_COMMAND_ITASK
5755
5756This command is included in the default shell command set.
5757When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ITASK`` to have this
5758command included.
5759
5760This command can be excluded from the shell command set by
5761defining ``CONFIGURE_SHELL_NO_COMMAND_ITASK`` when all
5762shell commands have been configured.
5763
5764**PROGRAMMING INFORMATION:**
5765
5766.. index:: rtems_shell_rtems_main_itask
5767
5768The ``itask`` is implemented by a C language function
5769which has the following prototype:
5770.. code:: c
5771
5772    int rtems_shell_rtems_main_itask(
5773    int    argc,
5774    char \**argv
5775    );
5776
5777The configuration structure for the ``itask`` has the
5778following prototype:
5779.. code:: c
5780
5781    extern rtems_shell_cmd_t rtems_shell_ITASK_Command;
5782
5783extension - display information about extensions
5784------------------------------------------------
5785.. index:: extension
5786
5787**SYNOPSYS:**
5788
5789.. code:: c
5790
5791    extension \[id \[id ...] ]
5792
5793**DESCRIPTION:**
5794
5795When invoked with no arguments, this command prints information on
5796the set of User Extensions currently active in the system.
5797
5798If invoked with a set of ids as arguments, then just
5799those objects are included in the information printed.
5800
5801**EXIT STATUS:**
5802
5803This command returns 0 on success and non-zero if an error is encountered.
5804
5805**NOTES:**
5806
5807NONE
5808
5809**EXAMPLES:**
5810
5811The following is an example of using the ``extension`` command
5812on a system with no user extensions.
5813.. code:: c
5814
5815    SHLL \[/] $ extension
5816    ID       NAME
5817    ------------------------------------------------------------------------------
5818
5819**CONFIGURATION:**
5820
5821.. index:: CONFIGURE_SHELL_NO_COMMAND_EXTENSION
5822.. index:: CONFIGURE_SHELL_COMMAND_EXTENSION
5823
5824This command is included in the default shell command set.
5825When building a custom command set, define``CONFIGURE_SHELL_COMMAND_EXTENSION`` to have this
5826command included.
5827
5828This command can be excluded from the shell command set by
5829defining ``CONFIGURE_SHELL_NO_COMMAND_EXTENSION`` when all
5830shell commands have been configured.
5831
5832**PROGRAMMING INFORMATION:**
5833
5834.. index:: rtems_shell_rtems_main_extension
5835
5836The ``extension`` is implemented by a C language function
5837which has the following prototype:
5838.. code:: c
5839
5840    int rtems_shell_rtems_main_extension(
5841    int    argc,
5842    char \**argv
5843    );
5844
5845The configuration structure for the ``extension`` has the
5846following prototype:
5847.. code:: c
5848
5849    extern rtems_shell_cmd_t rtems_shell_EXTENSION_Command;
5850
5851task - display information about tasks
5852--------------------------------------
5853.. index:: task
5854
5855**SYNOPSYS:**
5856
5857.. code:: c
5858
5859    task \[id \[id ...] ]
5860
5861**DESCRIPTION:**
5862
5863When invoked with no arguments, this command prints information on
5864the set of Classic API Tasks currently active in the system.
5865
5866If invoked with a set of ids as arguments, then just
5867those objects are included in the information printed.
5868
5869**EXIT STATUS:**
5870
5871This command returns 0 on success and non-zero if an error is encountered.
5872
5873**NOTES:**
5874
5875NONE
5876
5877**EXAMPLES:**
5878
5879The following is an example of how to use the ``task`` on an
5880application with just two Classic API tasks:
5881.. code:: c
5882
5883    SHLL \[/] $ task
5884    ID       NAME   PRIO   STAT   MODES  EVENTS   WAITID  WAITARG  NOTES
5885    ------------------------------------------------------------------------------
5886    0a010001   UI1      1   SUSP   P:T:nA  NONE
5887    0a010002   SHLL   100   READY  P:T:nA  NONE
5888
5889**CONFIGURATION:**
5890
5891.. index:: CONFIGURE_SHELL_NO_COMMAND_TASK
5892.. index:: CONFIGURE_SHELL_COMMAND_TASK
5893
5894This command is included in the default shell command set.
5895When building a custom command set, define``CONFIGURE_SHELL_COMMAND_TASK`` to have this
5896command included.
5897
5898This command can be excluded from the shell command set by
5899defining ``CONFIGURE_SHELL_NO_COMMAND_TASK`` when all
5900shell commands have been configured.
5901
5902**PROGRAMMING INFORMATION:**
5903
5904.. index:: rtems_shell_rtems_main_task
5905
5906The ``task`` is implemented by a C language function
5907which has the following prototype:
5908.. code:: c
5909
5910    int rtems_shell_rtems_main_task(
5911    int    argc,
5912    char \**argv
5913    );
5914
5915The configuration structure for the ``task`` has the
5916following prototype:
5917.. code:: c
5918
5919    extern rtems_shell_cmd_t rtems_shell_TASK_Command;
5920
5921queue - display information about message queues
5922------------------------------------------------
5923.. index:: queue
5924
5925**SYNOPSYS:**
5926
5927.. code:: c
5928
5929    queue \[id \[id ... ] ]
5930
5931**DESCRIPTION:**
5932
5933When invoked with no arguments, this command prints information on
5934the set of Classic API Message Queues currently active in the system.
5935
5936If invoked with a set of ids as arguments, then just
5937those objects are included in the information printed.
5938
5939**EXIT STATUS:**
5940
5941This command returns 0 on success and non-zero if an error is encountered.
5942
5943**NOTES:**
5944
5945NONE
5946
5947**EXAMPLES:**
5948
5949The following is an example of using the ``queue`` command
5950on a system with no Classic API Message Queues.
5951.. code:: c
5952
5953    SHLL \[/] $ queue
5954    ID       NAME   ATTRIBUTES   PEND   MAXPEND  MAXSIZE
5955    ------------------------------------------------------------------------------
5956
5957**CONFIGURATION:**
5958
5959.. index:: CONFIGURE_SHELL_NO_COMMAND_QUEUE
5960.. index:: CONFIGURE_SHELL_COMMAND_QUEUE
5961
5962This command is included in the default shell command set.
5963When building a custom command set, define``CONFIGURE_SHELL_COMMAND_QUEUE`` to have this
5964command included.
5965
5966This command can be excluded from the shell command set by
5967defining ``CONFIGURE_SHELL_NO_COMMAND_QUEUE`` when all
5968shell commands have been configured.
5969
5970**PROGRAMMING INFORMATION:**
5971
5972.. index:: rtems_shell_rtems_main_queue
5973
5974The ``queue`` is implemented by a C language function
5975which has the following prototype:
5976.. code:: c
5977
5978    int rtems_shell_rtems_main_queue(
5979    int    argc,
5980    char \**argv
5981    );
5982
5983The configuration structure for the ``queue`` has the
5984following prototype:
5985.. code:: c
5986
5987    extern rtems_shell_cmd_t rtems_shell_QUEUE_Command;
5988
5989sema - display information about semaphores
5990-------------------------------------------
5991.. index:: sema
5992
5993**SYNOPSYS:**
5994
5995.. code:: c
5996
5997    sema \[id \[id ... ] ]
5998
5999**DESCRIPTION:**
6000
6001When invoked with no arguments, this command prints information on
6002the set of Classic API Semaphores currently active in the system.
6003
6004If invoked with a set of objects ids as arguments, then just
6005those objects are included in the information printed.
6006
6007**EXIT STATUS:**
6008
6009This command returns 0 on success and non-zero if an error is encountered.
6010
6011**NOTES:**
6012
6013NONE
6014
6015**EXAMPLES:**
6016
6017The following is an example of how to use ``sema``:
6018.. code:: c
6019
6020    SHLL \[/] $ sema
6021    ID       NAME   ATTR        PRICEIL CURR_CNT HOLDID
6022    ------------------------------------------------------------------------------
6023    1a010001   LBIO   PR:BI:IN      0        1     00000000
6024    1a010002   TRmi   PR:BI:IN      0        1     00000000
6025    1a010003   LBI00  PR:BI:IN      0        1     00000000
6026    1a010004   TRia   PR:BI:IN      0        1     00000000
6027    1a010005   TRoa   PR:BI:IN      0        1     00000000
6028    1a010006   TRxa   <assoc.c: BAD NAME>   0    0 09010001
6029    1a010007   LBI01  PR:BI:IN      0        1     00000000
6030    1a010008   LBI02  PR:BI:IN      0        1     00000000
6031
6032**CONFIGURATION:**
6033
6034.. index:: CONFIGURE_SHELL_NO_COMMAND_SEMA
6035.. index:: CONFIGURE_SHELL_COMMAND_SEMA
6036
6037This command is included in the default shell command set.
6038When building a custom command set, define``CONFIGURE_SHELL_COMMAND_SEMA`` to have this
6039command included.
6040
6041This command can be excluded from the shell command set by
6042defining ``CONFIGURE_SHELL_NO_COMMAND_SEMA`` when all
6043shell commands have been configured.
6044
6045**PROGRAMMING INFORMATION:**
6046
6047.. index:: rtems_shell_rtems_main_sema
6048
6049The ``sema`` is implemented by a C language function
6050which has the following prototype:
6051.. code:: c
6052
6053    int rtems_shell_rtems_main_sema(
6054    int    argc,
6055    char \**argv
6056    );
6057
6058The configuration structure for the ``sema`` has the
6059following prototype:
6060.. code:: c
6061
6062    extern rtems_shell_cmd_t rtems_shell_SEMA_Command;
6063
6064region - display information about regions
6065------------------------------------------
6066.. index:: region
6067
6068**SYNOPSYS:**
6069
6070.. code:: c
6071
6072    region \[id \[id ... ] ]
6073
6074**DESCRIPTION:**
6075
6076When invoked with no arguments, this command prints information on
6077the set of Classic API Regions currently active in the system.
6078
6079If invoked with a set of object ids as arguments, then just
6080those object are included in the information printed.
6081
6082**EXIT STATUS:**
6083
6084This command returns 0 on success and non-zero if an error is encountered.
6085
6086**NOTES:**
6087
6088NONE
6089
6090**EXAMPLES:**
6091
6092The following is an example of using the ``region`` command
6093on a system with no user extensions.
6094.. code:: c
6095
6096    SHLL \[/] $ region
6097    ID       NAME   ATTR        STARTADDR LENGTH    PAGE_SIZE USED_BLOCKS
6098    ------------------------------------------------------------------------------
6099
6100**CONFIGURATION:**
6101
6102.. index:: CONFIGURE_SHELL_NO_COMMAND_REGION
6103.. index:: CONFIGURE_SHELL_COMMAND_REGION
6104
6105This command is included in the default shell command set.
6106When building a custom command set, define``CONFIGURE_SHELL_COMMAND_REGION`` to have this
6107command included.
6108
6109This command can be excluded from the shell command set by
6110defining ``CONFIGURE_SHELL_NO_COMMAND_REGION`` when all
6111shell commands have been configured.
6112
6113**PROGRAMMING INFORMATION:**
6114
6115.. index:: rtems_shell_rtems_main_region
6116
6117The ``region`` is implemented by a C language function
6118which has the following prototype:
6119.. code:: c
6120
6121    int rtems_shell_rtems_main_region(
6122    int    argc,
6123    char \**argv
6124    );
6125
6126The configuration structure for the ``region`` has the
6127following prototype:
6128.. code:: c
6129
6130    extern rtems_shell_cmd_t rtems_shell_REGION_Command;
6131
6132part - display information about partitions
6133-------------------------------------------
6134.. index:: part
6135
6136**SYNOPSYS:**
6137
6138.. code:: c
6139
6140    part \[id \[id ... ] ]
6141
6142**DESCRIPTION:**
6143
6144When invoked with no arguments, this command prints information on
6145the set of Classic API Partitions currently active in the system.
6146
6147If invoked with a set of object ids as arguments, then just
6148those objects are included in the information printed.
6149
6150**EXIT STATUS:**
6151
6152This command returns 0 on success and non-zero if an error is encountered.
6153
6154**NOTES:**
6155
6156NONE
6157
6158**EXAMPLES:**
6159
6160The following is an example of using the ``part`` command
6161on a system with no user extensions.
6162.. code:: c
6163
6164    SHLL \[/] $ part
6165    ID       NAME   ATTR        STARTADDR LENGTH    BUF_SIZE  USED_BLOCKS
6166    ------------------------------------------------------------------------------
6167
6168**CONFIGURATION:**
6169
6170.. index:: CONFIGURE_SHELL_NO_COMMAND_PART
6171.. index:: CONFIGURE_SHELL_COMMAND_PART
6172
6173This command is included in the default shell command set.
6174When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PART`` to have this
6175command included.
6176
6177This command can be excluded from the shell command set by
6178defining ``CONFIGURE_SHELL_NO_COMMAND_PART`` when all
6179shell commands have been configured.
6180
6181**PROGRAMMING INFORMATION:**
6182
6183.. index:: rtems_shell_rtems_main_part
6184
6185The ``part`` is implemented by a C language function
6186which has the following prototype:
6187.. code:: c
6188
6189    int rtems_shell_rtems_main_part(
6190    int    argc,
6191    char \**argv
6192    );
6193
6194The configuration structure for the ``part`` has the
6195following prototype:
6196.. code:: c
6197
6198    extern rtems_shell_cmd_t rtems_shell_PART_Command;
6199
6200object - display information about rtems objects
6201------------------------------------------------
6202.. index:: object
6203
6204**SYNOPSYS:**
6205
6206.. code:: c
6207
6208    object \[id \[id ...] ]
6209
6210**DESCRIPTION:**
6211
6212When invoked with a set of object ids as arguments, then
6213a report on those objects is printed.
6214
6215**EXIT STATUS:**
6216
6217This command returns 0 on success and non-zero if an error is encountered.
6218
6219**NOTES:**
6220
6221NONE
6222
6223**EXAMPLES:**
6224
6225The following is an example of how to use ``object``:
6226.. code:: c
6227
6228    SHLL \[/] $ object 0a010001 1a010002
6229    ID       NAME   PRIO   STAT   MODES  EVENTS   WAITID  WAITARG  NOTES
6230    ------------------------------------------------------------------------------
6231    0a010001   UI1      1   SUSP   P:T:nA  NONE
6232    ID       NAME   ATTR        PRICEIL CURR_CNT HOLDID
6233    ------------------------------------------------------------------------------
6234    1a010002   TRmi   PR:BI:IN      0        1     00000000
6235
6236**CONFIGURATION:**
6237
6238.. index:: CONFIGURE_SHELL_NO_COMMAND_OBJECT
6239.. index:: CONFIGURE_SHELL_COMMAND_OBJECT
6240
6241This command is included in the default shell command set.
6242When building a custom command set, define``CONFIGURE_SHELL_COMMAND_OBJECT`` to have this
6243command included.
6244
6245This command can be excluded from the shell command set by
6246defining ``CONFIGURE_SHELL_NO_COMMAND_OBJECT`` when all
6247shell commands have been configured.
6248
6249**PROGRAMMING INFORMATION:**
6250
6251.. index:: rtems_shell_rtems_main_object
6252
6253The ``object`` is implemented by a C language function
6254which has the following prototype:
6255.. code:: c
6256
6257    int rtems_shell_rtems_main_object(
6258    int    argc,
6259    char \**argv
6260    );
6261
6262The configuration structure for the ``object`` has the
6263following prototype:
6264.. code:: c
6265
6266    extern rtems_shell_cmd_t rtems_shell_OBJECT_Command;
6267
6268driver - display the rtems device driver table
6269----------------------------------------------
6270.. index:: driver
6271
6272**SYNOPSYS:**
6273
6274.. code:: c
6275
6276    driver [ major [ major ... ] ]
6277
6278**DESCRIPTION:**
6279
6280When invoked with no arguments, this command prints information on
6281the set of Device Drivers currently active in the system.
6282
6283If invoked with a set of major numbers as arguments, then just
6284those Device Drivers are included in the information printed.
6285
6286**EXIT STATUS:**
6287
6288This command returns 0 on success and non-zero if an error is encountered.
6289
6290**NOTES:**
6291
6292NONE
6293
6294**EXAMPLES:**
6295
6296The following is an example of how to use ``driver``:
6297.. code:: c
6298
6299    SHLL \[/] $ driver
6300    Major      Entry points
6301    ------------------------------------------------------------------------------
6302    0          init: \[0x200256c];  control: \[0x20024c8]
6303    open: \[0x2002518];  close: \[0x2002504]
6304    read: \[0x20024f0];  write: \[0x20024dc]
6305    1          init: \[0x20023fc];  control: \[0x2002448]
6306    open: \[0x0];  close: \[0x0]
6307    read: \[0x0];  write: \[0x0]
6308    SHLL \[/] $
6309
6310**CONFIGURATION:**
6311
6312.. index:: CONFIGURE_SHELL_NO_COMMAND_DRIVER
6313.. index:: CONFIGURE_SHELL_COMMAND_DRIVER
6314
6315This command is included in the default shell command set.
6316When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DRIVER`` to have this
6317command included.
6318
6319This command can be excluded from the shell command set by
6320defining ``CONFIGURE_SHELL_NO_COMMAND_DRIVER`` when all
6321shell commands have been configured.
6322
6323**PROGRAMMING INFORMATION:**
6324
6325.. index:: rtems_shell_rtems_main_driver
6326
6327The ``driver`` is implemented by a C language function
6328which has the following prototype:
6329.. code:: c
6330
6331    int rtems_shell_rtems_main_driver(
6332    int    argc,
6333    char \**argv
6334    );
6335
6336The configuration structure for the ``driver`` has the
6337following prototype:
6338.. code:: c
6339
6340    extern rtems_shell_cmd_t rtems_shell_DRIVER_Command;
6341
6342dname - displays information about named drivers
6343------------------------------------------------
6344.. index:: dname
6345
6346**SYNOPSYS:**
6347
6348.. code:: c
6349
6350    dname
6351
6352**DESCRIPTION:**
6353
6354This command XXX
6355
6356WARNING! XXX This command does not appear to work as of 27 February 2008.
6357
6358**EXIT STATUS:**
6359
6360This command returns 0 on success and non-zero if an error is encountered.
6361
6362**NOTES:**
6363
6364NONE
6365
6366**EXAMPLES:**
6367
6368The following is an example of how to use ``dname``:
6369.. code:: c
6370
6371    EXAMPLE_TBD
6372
6373**CONFIGURATION:**
6374
6375.. index:: CONFIGURE_SHELL_NO_COMMAND_DNAME
6376.. index:: CONFIGURE_SHELL_COMMAND_DNAME
6377
6378This command is included in the default shell command set.
6379When building a custom command set, define``CONFIGURE_SHELL_COMMAND_DNAME`` to have this
6380command included.
6381
6382This command can be excluded from the shell command set by
6383defining ``CONFIGURE_SHELL_NO_COMMAND_DNAME`` when all
6384shell commands have been configured.
6385
6386**PROGRAMMING INFORMATION:**
6387
6388.. index:: rtems_shell_rtems_main_dname
6389
6390The ``dname`` is implemented by a C language function
6391which has the following prototype:
6392.. code:: c
6393
6394    int rtems_shell_rtems_main_dname(
6395    int    argc,
6396    char \**argv
6397    );
6398
6399The configuration structure for the ``dname`` has the
6400following prototype:
6401.. code:: c
6402
6403    extern rtems_shell_cmd_t rtems_shell_DNAME_Command;
6404
6405pthread - display information about POSIX threads
6406-------------------------------------------------
6407.. index:: pthread
6408
6409**SYNOPSYS:**
6410
6411.. code:: c
6412
6413    pthread \[id \[id ...] ]
6414
6415**DESCRIPTION:**
6416
6417When invoked with no arguments, this command prints information on
6418the set of POSIX API threads currently active in the system.
6419
6420If invoked with a set of ids as arguments, then just
6421those objects are included in the information printed.
6422
6423**EXIT STATUS:**
6424
6425This command returns 0 on success and non-zero if an error is encountered.
6426
6427**NOTES:**
6428
6429This command is only available when the POSIX API is configured.
6430
6431**EXAMPLES:**
6432
6433The following is an example of how to use the ``task`` on an
6434application with four POSIX threads:
6435.. code:: c
6436
6437    SHLL \[/] $ pthread
6438    ID       NAME           PRI  STATE MODES   EVENTS    WAITID  WAITARG  NOTES
6439    ------------------------------------------------------------------------------
6440    0b010002   Main           133 READY  P:T:nA    NONE   43010001 0x7b1148
6441    0b010003   ISR            133 Wcvar  P:T:nA    NONE   43010003 0x7b1148
6442    0b01000c                  133 READY  P:T:nA    NONE   33010002 0x7b1148
6443    0b01000d                  133 Wmutex P:T:nA    NONE   33010002 0x7b1148
6444
6445**CONFIGURATION:**
6446
6447This command is part of the monitor commands which are always
6448available in the shell.
6449
6450**PROGRAMMING INFORMATION:**
6451
6452This command is not directly available for invocation.
6453
6454.. COMMENT: COPYRIGHT (c) 1988-2008.
6455
6456.. COMMENT: On-Line Applications Research Corporation (OAR).
6457
6458.. COMMENT: All rights reserved.
6459
6460Network Commands
6461################
6462
6463Introduction
6464============
6465
6466The RTEMS shell has the following network commands:
6467
6468- ``netstats`` - obtain network statistics
6469
6470- ``ifconfig`` - configure a network interface
6471
6472- ``route`` - show or manipulate the IP routing table
6473
6474- ``ping`` - ping a host or IP address
6475
6476Commands
6477========
6478
6479This section details the Network Commands available.  A
6480subsection is dedicated to each of the commands and
6481describes the behavior and configuration of that
6482command as well as providing an example usage.
6483
6484netstats - obtain network statistics
6485------------------------------------
6486.. index:: netstats
6487
6488**SYNOPSYS:**
6489
6490.. code:: c
6491
6492    netstats \[-Aimfpcut]
6493
6494**DESCRIPTION:**
6495
6496This command is used to display various types of network statistics.  The
6497information displayed can be specified using command line arguments in
6498various combinations.  The arguments are interpreted as follows:
6499
6500*-A*
6501    print All statistics
6502
6503*-i*
6504    print Inet Routes
6505
6506*-m*
6507    print MBUF Statistics
6508
6509*-f*
6510    print IF Statistics
6511
6512*-p*
6513    print IP Statistics
6514
6515*-c*
6516    print ICMP Statistics
6517
6518*-u*
6519    print UDP Statistics
6520
6521*-t*
6522    print TCP Statistics
6523
6524**EXIT STATUS:**
6525
6526This command returns 0 on success and non-zero if an error is encountered.
6527
6528**NOTES:**
6529
6530NONE
6531
6532**EXAMPLES:**
6533
6534The following is an example of how to use ``netstats``:
6535
6536The following is an example of using the ``netstats``
6537command to print the IP routing table:
6538.. code:: c
6539
6540    [/] $ netstats -i
6541    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6542    default         192.168.1.14       UGS         0        0      0 eth1
6543    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6544    192.168.1.14    00:A0:C8:1C:EE:28  UHL         1        0   1219 eth1
6545    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0      840   1202 eth1
6546    192.168.1.151   00:1C:23:B2:0F:BB  UHL         1       23   1219 eth1
6547
6548The following is an example of using the ``netstats``
6549command to print the MBUF statistics:
6550.. code:: c
6551
6552    [/] $ netstats -m
6553    \************ MBUF STATISTICS \************
6554    mbufs:2048    clusters: 128    free:  63
6555    drops:   0       waits:   0  drains:   0
6556    free:1967          data:79          header:2           socket:0
6557    pcb:0           rtable:0           htable:0           atable:0
6558    soname:0           soopts:0           ftable:0           rights:0
6559    ifaddr:0          control:0          oobdata:0
6560
6561The following is an example of using the ``netstats``
6562command to print the print the interface statistics:
6563.. code:: c
6564
6565    [/] $ netstats -f
6566    \************ INTERFACE STATISTICS \************
6567    \***** eth1 \*****
6568    Ethernet Address: 00:04:9F:00:5B:21
6569    Address:192.168.1.244   Broadcast Address:192.168.1.255   Net mask:255.255.255.0
6570    Flags: Up Broadcast Running Active Multicast
6571    Send queue limit:50   length:1    Dropped:0
6572    Rx Interrupts:889            Not First:0               Not Last:0
6573    Giant:0              Non-octet:0
6574    Bad CRC:0                Overrun:0              Collision:0
6575    Tx Interrupts:867             Deferred:0         Late Collision:0
6576    Retransmit Limit:0               Underrun:0             Misaligned:0
6577
6578The following is an example of using the ``netstats``
6579command to print the print IP statistics:
6580.. code:: c
6581
6582    [/] $ netstats -p
6583    \************ IP Statistics \************
6584    total packets received         894
6585    packets rcvd for unreachable dest          13
6586    datagrams delivered to upper level         881
6587    total ip packets generated here         871
6588
6589The following is an example of using the ``netstats``
6590command to print the ICMP statistics:
6591.. code:: c
6592
6593    [/] $ netstats -c
6594    \************ ICMP Statistics \************
6595    Type 0 sent         843
6596    number of responses         843
6597    Type 8 received         843
6598
6599The following is an example of using the ``netstats``
6600command to print the UDP statistics:
6601.. code:: c
6602
6603    [/] $ netstats -u
6604    \************ UDP Statistics \************
6605
6606The following is an example of using the ``netstats``
6607command to print the TCP statistics:
6608.. code:: c
6609
6610    [/] $ netstats -t
6611    \************ TCP Statistics \************
6612    connections accepted           1
6613    connections established           1
6614    segs where we tried to get rtt          34
6615    times we succeeded          35
6616    delayed acks sent           2
6617    total packets sent          37
6618    data packets sent          35
6619    data bytes sent        2618
6620    ack-only packets sent           2
6621    total packets received          47
6622    packets received in sequence          12
6623    bytes received in sequence         307
6624    rcvd ack packets          35
6625    bytes acked by rcvd acks        2590
6626    times hdr predict ok for acks          27
6627    times hdr predict ok for data pkts          10
6628
6629**CONFIGURATION:**
6630
6631.. index:: CONFIGURE_SHELL_NO_COMMAND_NETSTATS
6632.. index:: CONFIGURE_SHELL_COMMAND_NETSTATS
6633
6634This command is included in the default shell command set.
6635When building a custom command set, define``CONFIGURE_SHELL_COMMAND_NETSTATS`` to have this
6636command included.
6637
6638This command can be excluded from the shell command set by
6639defining ``CONFIGURE_SHELL_NO_COMMAND_NETSTATS`` when all
6640shell commands have been configured.
6641
6642**PROGRAMMING INFORMATION:**
6643
6644.. index:: rtems_shell_rtems_main_netstats
6645
6646The ``netstats`` is implemented by a C language function
6647which has the following prototype:
6648.. code:: c
6649
6650    int rtems_shell_rtems_main_netstats(
6651    int    argc,
6652    char \**argv
6653    );
6654
6655The configuration structure for the ``netstats`` has the
6656following prototype:
6657.. code:: c
6658
6659    extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command;
6660
6661ifconfig - configure a network interface
6662----------------------------------------
6663.. index:: ifconfig
6664
6665**SYNOPSYS:**
6666
6667.. code:: c
6668
6669    ifconfig
6670    ifconfig interface
6671    ifconfig interface \[up|down]
6672    ifconfig interface \[netmask|pointtopoint|broadcast] IP
6673
6674**DESCRIPTION:**
6675
6676This command may be used to display information about the
6677network interfaces in the system or configure them.
6678
6679**EXIT STATUS:**
6680
6681This command returns 0 on success and non-zero if an error is encountered.
6682
6683**NOTES:**
6684
6685Just like its counterpart on GNU/Linux and BSD systems, this command
6686is complicated.  More example usages would be a welcome submission.
6687
6688**EXAMPLES:**
6689
6690The following is an example of how to use ``ifconfig``:
6691.. code:: c
6692
6693    ************ INTERFACE STATISTICS \************
6694    \***** eth1 \*****
6695    Ethernet Address: 00:04:9F:00:5B:21
6696    Address:192.168.1.244   Broadcast Address:192.168.1.255   Net mask:255.255.255.0
6697    Flags: Up Broadcast Running Active Multicast
6698    Send queue limit:50   length:1    Dropped:0
6699    Rx Interrupts:5391           Not First:0               Not Last:0
6700    Giant:0              Non-octet:0
6701    Bad CRC:0                Overrun:0              Collision:0
6702    Tx Interrupts:5256            Deferred:0         Late Collision:0
6703    Retransmit Limit:0               Underrun:0             Misaligned:0
6704
6705**CONFIGURATION:**
6706
6707.. index:: CONFIGURE_SHELL_NO_COMMAND_IFCONFIG
6708.. index:: CONFIGURE_SHELL_COMMAND_IFCONFIG
6709
6710This command is included in the default shell command set.
6711When building a custom command set, define``CONFIGURE_SHELL_COMMAND_IFCONFIG`` to have this
6712command included.
6713
6714This command can be excluded from the shell command set by
6715defining ``CONFIGURE_SHELL_NO_COMMAND_IFCONFIG`` when all
6716shell commands have been configured.
6717
6718**PROGRAMMING INFORMATION:**
6719
6720.. index:: rtems_shell_rtems_main_ifconfig
6721
6722The ``ifconfig`` is implemented by a C language function
6723which has the following prototype:
6724.. code:: c
6725
6726    int rtems_shell_rtems_main_ifconfig(
6727    int    argc,
6728    char \**argv
6729    );
6730
6731The configuration structure for the ``ifconfig`` has the
6732following prototype:
6733.. code:: c
6734
6735    extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
6736
6737route - show or manipulate the ip routing table
6738-----------------------------------------------
6739.. index:: route
6740
6741**SYNOPSYS:**
6742
6743.. code:: c
6744
6745    route \[subcommand] \[args]
6746
6747**DESCRIPTION:**
6748
6749This command is used to display and manipulate the routing table.
6750When invoked with no arguments, the current routing information is
6751displayed.  When invoked with the subcommands ``add`` or ``del``,
6752then additional arguments must be provided to describe the route.
6753
6754Command templates include the following:
6755.. code:: c
6756
6757    route \[add|del] -net IP_ADDRESS gw GATEWAY_ADDRESS \[netmask MASK]
6758    route \[add|del] -host IP_ADDRESS gw GATEWAY_ADDRES \[netmask MASK]
6759
6760When not provided the netmask defaults to ``255.255.255.0``
6761
6762**EXIT STATUS:**
6763
6764This command returns 0 on success and non-zero if an error is encountered.
6765
6766**NOTES:**
6767
6768Just like its counterpart on GNU/Linux and BSD systems, this command
6769is complicated.  More example usages would be a welcome submission.
6770
6771**EXAMPLES:**
6772
6773The following is an example of how to use ``route`` to display,
6774add, and delete a new route:
6775.. code:: c
6776
6777    [/] $ route
6778    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6779    default         192.168.1.14       UGS         0        0      0 eth1
6780    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6781    192.168.1.14    00:A0:C8:1C:EE:28  UHL         1        0   1444 eth1
6782    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0    10844   1202 eth1
6783    192.168.1.151   00:1C:23:B2:0F:BB  UHL         2       37   1399 eth1
6784    \[/] $  route add -net 192.168.3.0 gw 192.168.1.14
6785    \[/] $ route
6786    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6787    default         192.168.1.14       UGS         0        0      0 eth1
6788    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6789    192.168.1.14    00:A0:C8:1C:EE:28  UHL         2        0   1498 eth1
6790    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0    14937   1202 eth1
6791    192.168.1.151   00:1C:23:B2:0F:BB  UHL         2       96   1399 eth1
6792    192.168.3.0     192.168.1.14       UGS         0        0      0 eth1
6793    \[/] $ route del -net 192.168.3.0 gw 192.168.1.14
6794    \[/] $ route
6795    Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
6796    default         192.168.1.14       UGS         0        0      0 eth1
6797    192.168.1.0     255.255.255.0      U           0        0      1 eth1
6798    192.168.1.14    00:A0:C8:1C:EE:28  UHL         1        0   1498 eth1
6799    192.168.1.51    00:1D:7E:0C:D0:7C  UHL         0    15945   1202 eth1
6800    192.168.1.151   00:1C:23:B2:0F:BB  UHL         2      117   1399 eth1
6801
6802**CONFIGURATION:**
6803
6804.. index:: CONFIGURE_SHELL_NO_COMMAND_ROUTE
6805.. index:: CONFIGURE_SHELL_COMMAND_ROUTE
6806
6807This command is included in the default shell command set.
6808When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ROUTE`` to have this
6809command included.
6810
6811This command can be excluded from the shell command set by
6812defining ``CONFIGURE_SHELL_NO_COMMAND_ROUTE`` when all
6813shell commands have been configured.
6814
6815**PROGRAMMING INFORMATION:**
6816
6817.. index:: rtems_shell_rtems_main_route
6818
6819The ``route`` is implemented by a C language function
6820which has the following prototype:
6821.. code:: c
6822
6823    int rtems_shell_rtems_main_route(
6824    int    argc,
6825    char \**argv
6826    );
6827
6828The configuration structure for the ``route`` has the
6829following prototype:
6830.. code:: c
6831
6832    extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
6833
6834ping - ping a host or IP address
6835--------------------------------
6836.. index:: ping
6837
6838**SYNOPSYS:**
6839
6840.. code:: c
6841
6842    ping \[-AaDdfnoQqRrv] \[-c count] \[-G sweepmaxsize] \[-g sweepminsize]
6843    \[-h sweepincrsize] \[-i wait] \[-l preload] \[-M mask | time] \[-m ttl]
6844    \[-p pattern] \[-S src_addr] \[-s packetsize] \[-t timeout]
6845    \[-W waittime] \[-z tos] host
6846    ping \[-AaDdfLnoQqRrv] \[-c count] \[-I iface] \[-i wait] \[-l preload]
6847    \[-M mask | time] \[-m ttl] \[-p pattern] \[-S src_addr]
6848    \[-s packetsize] \[-T ttl] \[-t timeout] \[-W waittime]
6849    \[-z tos] mcast-group
6850
6851**DESCRIPTION:**
6852
6853The ping utility uses the ICMP protocol’s mandatory ECHO_REQUEST
6854datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.
6855ECHO_REQUEST datagrams (“pings”) have an IP and ICMP header,
6856followed by a “struct timeval” and then an arbitrary number of
6857“pad” bytes used to fill out the packet.  The options are as
6858follows:
6859
6860*-A*
6861    Audible.  Output a bell (ASCII 0x07) character when no packet is
6862    received before the next packet is transmitted.  To cater for
6863    round-trip times that are longer than the interval between
6864    transmissions, further missing packets cause a bell only if the
6865    maximum number of unreceived packets has increased.
6866
6867*-a*
6868    Audible.  Include a bell (ASCII 0x07) character in the output when any
6869    packet is received.  This option is ignored if other format options
6870    are present.
6871
6872*-c count*
6873    Stop after sending (and receiving) count ECHO_RESPONSE packets.  If
6874    this option is not specified, ping will operate until interrupted.  If
6875    this option is specified in conjunction with ping sweeps, each sweep
6876    will consist of count packets.
6877
6878*-D*
6879    Set the Don’t Fragment bit.
6880
6881*-d*
6882    Set the SO_DEBUG option on the socket being used.
6883
6884*-f*
6885    Flood ping.  Outputs packets as fast as they come back or one
6886    hundred times per second, whichever is more.  For every ECHO_REQUEST
6887    sent a period “.” is printed, while for every ECHO_REPLY received a
6888    backspace is printed.  This provides a rapid display of how many
6889    packets are being dropped.  Only the super-user may use this option.
6890    This can be very hard on a network and should be used with caution.
6891
6892*-G sweepmaxsize*
6893    Specify the maximum size of ICMP payload when sending sweeping pings.
6894    This option is required for ping sweeps.
6895
6896*-g sweepminsize*
6897    Specify the size of ICMP payload to start with when sending sweeping
6898    pings.  The default value is 0.
6899
6900*-h sweepincrsize*
6901    Specify the number of bytes to increment the size of ICMP payload
6902    after each sweep when sending sweeping pings.  The default value is 1.
6903
6904*-I iface*
6905    Source multicast packets with the given interface address.  This flag
6906    only applies if the ping destination is a multicast address.
6907
6908*-i wait*
6909    Wait wait seconds between sending each packet.  The default is to wait
6910    for one second between each packet.  The wait time may be fractional,
6911    but only the super-user may specify values less than 1 second.  This
6912    option is incompatible with the -f option.
6913
6914*-L*
6915    Suppress loopback of multicast packets.  This flag only applies if the
6916    ping destination is a multicast address.
6917
6918*-l preload*
6919    If preload is specified, ping sends that many packets as fast as
6920    possible before falling into its normal mode of behavior.  Only the
6921    super-user may use this option.
6922
6923*-M mask | time*
6924    Use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO.  For mask, print
6925    the netmask of the remote machine.  Set the net.inet.icmp.maskrepl MIB
6926    variable to enable ICMP_MASKREPLY.  For time, print the origination,
6927    reception and transmission timestamps.
6928
6929*-m ttl*
6930    Set the IP Time To Live for outgoing packets.  If not specified, the
6931    kernel uses the value of the net.inet.ip.ttl MIB variable.
6932
6933*-n*
6934    Numeric output only.  No attempt will be made to lookup symbolic names
6935    for host addresses.
6936
6937*-o*
6938    Exit successfully after receiving one reply packet.
6939
6940*-p pattern*
6941    You may specify up to 16 “pad” bytes to fill out the packet you
6942    send.  This is useful for diagnosing data-dependent problems in a
6943    network.  For example, “-p ff” will cause the sent packet to be
6944    filled with all ones.
6945
6946*-Q*
6947    Somewhat quiet output.  Don’t display ICMP error messages that are in
6948    response to our query messages.  Originally, the -v flag was required
6949    to display such errors, but -v displays all ICMP error messages.  On a
6950    busy machine, this output can be overbear- ing.  Without the -Q flag,
6951    ping prints out any ICMP error mes- sages caused by its own
6952    ECHO_REQUEST messages.
6953
6954*-q*
6955    Quiet output.  Nothing is displayed except the summary lines at
6956    startup time and when finished.
6957
6958*-R*
6959    Record route.  Includes the RECORD_ROUTE option in the ECHO_REQUEST
6960    packet and displays the route buffer on returned packets.  Note that
6961    the IP header is only large enough for nine such routes; the
6962    traceroute(8) command is usually better at determining the route
6963    packets take to a particular destination.  If more routes come back
6964    than should, such as due to an illegal spoofed packet, ping will print
6965    the route list and then truncate it at the correct spot.  Many hosts
6966    ignore or discard the RECORD_ROUTE option.
6967
6968*-r*
6969    Bypass the normal routing tables and send directly to a host on an
6970    attached network.  If the host is not on a directly-attached network,
6971    an error is returned.  This option can be used to ping a local host
6972    through an interface that has no route through it (e.g., after the
6973    interface was dropped).
6974
6975*-S src_addr*
6976    Use the following IP address as the source address in outgoing
6977    packets.  On hosts with more than one IP address, this option can be
6978    used to force the source address to be something other than the IP
6979    address of the interface the probe packet is sent on.  If the IP
6980    address is not one of this machine’s interface addresses, an error is
6981    returned and nothing is sent.
6982
6983*-s packetsize*
6984    Specify the number of data bytes to be sent.  The default is 56, which
6985    translates into 64 ICMP data bytes when combined with the 8 bytes of
6986    ICMP header data.  Only the super-user may specify val- ues more than
6987    default.  This option cannot be used with ping sweeps.
6988
6989*-T ttl*
6990    Set the IP Time To Live for multicasted packets.  This flag only
6991    applies if the ping destination is a multicast address.
6992
6993*-t timeout*
6994    Specify a timeout, in seconds, before ping exits regardless of how
6995    many packets have been received.
6996
6997*-v*
6998    Verbose output.  ICMP packets other than ECHO_RESPONSE that are
6999    received are listed.
7000
7001*-W waittime*
7002    Time in milliseconds to wait for a reply for each packet sent.  If a
7003    reply arrives later, the packet is not printed as replied, but
7004    considered as replied when calculating statistics.
7005
7006*-z tos*
7007    Use the specified type of service.
7008
7009**EXIT STATUS:**
7010
7011The ping utility exits with one of the following values:
7012
70130    At least one response was heard from the specified host.
7014
70152    The transmission was successful but no responses were
7016received.
7017
7018any other value an error occurred.  These values are defined in
7019<sysexits.h>.
7020
7021**NOTES:**
7022
7023When using ping for fault isolation, it should first be run on the
7024local host, to verify that the local network interface is up and
7025running.  Then, hosts and gateways further and further away should be
7026“pinged”.  Round-trip times and packet loss statistics are computed.
7027If duplicate packets are received, they are not included in the packet
7028loss calculation, although the round trip time of these packets is
7029used in calculating the round-trip time statistics.  When the
7030specified number of packets have been sent a brief summary is
7031displayed, showing the number of packets sent and received, and the
7032minimum, mean, maximum, and standard deviation of the round-trip
7033times.
7034
7035This program is intended for use in network testing, measurement and
7036management.  Because of the load it can impose on the network, it is
7037unwise to use ping during normal operations or from automated scripts.
7038
7039**EXAMPLES:**
7040
7041The following is an example of how to use ``oing`` to ping:
7042.. code:: c
7043
7044    [/] # ping 10.10.10.1
7045    PING 10.10.10.1 (10.10.10.1): 56 data bytes
7046    64 bytes from 10.10.10.1: icmp_seq=0 ttl=63 time=0.356 ms
7047    64 bytes from 10.10.10.1: icmp_seq=1 ttl=63 time=0.229 ms
7048    64 bytes from 10.10.10.1: icmp_seq=2 ttl=63 time=0.233 ms
7049    64 bytes from 10.10.10.1: icmp_seq=3 ttl=63 time=0.235 ms
7050    64 bytes from 10.10.10.1: icmp_seq=4 ttl=63 time=0.229 ms
7051    --- 10.10.10.1 ping statistics ---
7052    5 packets transmitted, 5 packets received, 0.0% packet loss
7053    round-trip min/avg/max/stddev = 0.229/0.256/0.356/0.050 ms
7054    \[/] # ping -f -c 10000  10.10.10.1
7055    PING 10.10.10.1 (10.10.10.1): 56 data bytes
7056    .
7057    --- 10.10.10.1 ping statistics ---
7058    10000 packets transmitted, 10000 packets received, 0.0% packet loss
7059    round-trip min/avg/max/stddev = 0.154/0.225/0.533/0.027 ms
7060
7061**CONFIGURATION:**
7062
7063.. index:: CONFIGURE_SHELL_NO_COMMAND_PING
7064.. index:: CONFIGURE_SHELL_COMMAND_PING
7065
7066This command is included in the default shell command set.
7067When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PING`` to have this
7068command included.
7069
7070This command can be excluded from the shell command set by
7071defining ``CONFIGURE_SHELL_NO_COMMAND_PING`` when all
7072shell commands have been configured.
7073
7074**PROGRAMMING INFORMATION:**
7075
7076.. index:: rtems_shell_rtems_main_ping
7077
7078The ``ping`` is implemented by a C language function
7079which has the following prototype:
7080.. code:: c
7081
7082    int rtems_shell_rtems_main_ping(
7083    int    argc,
7084    char \**argv
7085    );
7086
7087The configuration structure for the ``ping`` has the
7088following prototype:
7089.. code:: c
7090
7091    extern rtems_shell_cmd_t rtems_shell_PING_Command;
7092
7093Function and Variable Index
7094###########################
7095
7096.. COMMENT: There are currently no Command and Variable Index entries.
7097
7098Concept Index
7099#############
7100
7101Command Index
7102#############
7103
Note: See TracBrowser for help on using the repository browser.