Split document.

This commit is contained in:
Amar Takhar 2016-01-16 15:32:09 -05:00
parent e1797c0eb0
commit 8ca13ed19f
11 changed files with 7005 additions and 1 deletions

3
shell/concept.rst Normal file
View File

@ -0,0 +1,3 @@
Concept Index
#############

View File

@ -0,0 +1,381 @@
Configuration and Initialization
################################
Introduction
============
This chapter provides information on how the application configures and
initializes the RTEMS shell.
Configuration
=============
The command set available to the application is user configurable. It is
configured using a mechanism similar to the ``confdefs.h`` mechanism used to
specify application configuration.
In the simplest case, if the user wishes to configure a command set with all
commands available that are neither filesystem management (e.g. mounting,
formating, etc.) or network related, then the following is all that is
required:
.. code-block:: c
#define CONFIGURE_SHELL_COMMANDS_INIT
#define CONFIGURE_SHELL_COMMANDS_ALL
#include <rtems/shellconfig.h>
In a slightly more complex example, if the user wishes to include all
networking commands as well as support for mounting MS-DOS and NFS filesystems,
then the following is all that is required:
.. code-block:: c
#define CONFIGURE_SHELL_COMMANDS_INIT
#define CONFIGURE_SHELL_COMMANDS_ALL
#define CONFIGURE_SHELL_MOUNT_MSDOS
#define CONFIGURE_SHELL_MOUNT_NFS
#include <rtems/shellconfig.h>
Customizing the Command Set
---------------------------
The user can configure specific command sets by either building up the set from
individual commands or starting with a complete set and disabling individual
commands. Each command has two configuration macros associated with it.
*CONFIGURE_SHELL_COMMAND_XXX*
Each command has a constant of this form which is defined when
building a command set by individually enabling specific
commands.
*CONFIGURE_SHELL_NO_COMMAND_XXX*
In contrast, each command has a similar command which is
defined when the application is configuring a command set
by disabling specific commands in the set.
Adding Custom Commands
----------------------
One of the design goals of the RTEMS Shell was to make it easy for a user to
add custom commands specific to their application. We believe this design goal
was accomplished. In order to add a custom command, the user is required to do
the following:
- Provide a *main-style* function which implements the command. If that
command function uses a ``getopt`` related function to parse arguments, it
*MUST* use the reentrant form.
- Provide a command definition structure of type ``rtems_shell_cmd_t``.
- Configure that command using the ``CONFIGURE_SHELL_USER_COMMANDS`` macro.
Custom aliases are configured similarly but the user only provides an alias
definition structure of type ``rtems_shell_alias_t`` and configures the alias
via the ``CONFIGURE_SHELL_USER_ALIASES`` macro.
In the following example, we have implemented a custom command named
``usercmd`` which simply prints the arguments it was passed. We have also
provided an alias for ``usercmd`` named ``userecho``.
.. code-block:: c
#include <rtems/shell.h>
int main_usercmd(int argc, char **argv)
{
int i;
printf( "UserCommand: argc=%d\n", argc );
for (i=0 ; i<argc ; i++ )
printf( "argv[%d]= %s\n", i, argv[i] );
return 0;
}
rtems_shell_cmd_t Shell_USERCMD_Command = {
"usercmd", /* name */
"usercmd n1 \[n2 \[n3...]]", /* usage */
"user", /* topic */
main_usercmd, /* command */
NULL, /* alias */
NULL /* next */
};
rtems_shell_alias_t Shell_USERECHO_Alias = {
"usercmd", /* command */
"userecho" /* alias */
};
#define CONFIGURE_SHELL_USER_COMMANDS &Shell_USERCMD_Command
#define CONFIGURE_SHELL_USER_ALIASES &Shell_USERECHO_Alias
#define CONFIGURE_SHELL_COMMANDS_INIT
#define CONFIGURE_SHELL_COMMANDS_ALL
#define CONFIGURE_SHELL_MOUNT_MSDOS
#include <rtems/shellconfig.h>
Notice in the above example, that the user wrote the*main* for their command
(e.g. ``main_usercmd``) which looks much like any other ``main()``. They then
defined a ``rtems_shell_cmd_t`` structure named ``Shell_USERCMD_Command`` which
describes that command. This command definition structure is registered into
the static command set by defining ``CONFIGURE_SHELL_USER_COMMANDS``
to ``&Shell_USERCMD_Command``.
Similarly, to add the ``userecho`` alias, the user provides the alias
definition structure named ``Shell_USERECHO_Alias`` and defines
``CONFIGURE_SHELL_USER_ALIASES`` to configure the alias.
The user can configure any number of commands and aliases in this manner.
Initialization
==============
The shell may be easily attached to a serial port or to the ``telnetd`` server.
This section describes how that is accomplished.
Attached to a Serial Port
-------------------------
Starting the shell attached to the console or a serial port is very simple. The
user invokes ``rtems_shell_init`` with parameters to indicate the
characteristics of the task that will be executing the shell including name,
stack size, and priority. The user also specifies the device that the shell is
to be attached to.
This example is taken from the ``fileio`` sample test. This shell portion of
this test can be run on any target which provides a console with input and
output capabilities. It does not include any commands which cannot be
supported on all BSPs. The source code for this test is in
``testsuites/samples/fileio`` with the shell configuration in the ``init.c``
file.
.. code-block:: c
#include <rtems/shell.h>
void start_shell(void)
{
printf(" =========================\n");
printf(" starting shell\n");
printf(" =========================\n");
rtems_shell_init(
"SHLL", /* task name */
RTEMS_MINIMUM_STACK_SIZE * 4, /* task stack size */
100, /* task priority */
"/dev/console", /* device name */
false, /* run forever */
true, /* wait for shell to terminate */
rtems_shell_login_check /* login check function,
use NULL to disable a login check */
);
}
In the above example, the call to ``rtems_shell_init`` spawns a task to run the
RTEMS Shell attached to ``/dev/console`` and executing at priority 100. The
caller suspends itself and lets the shell take over the console device. When
the shell is exited by the user, then control returns to the caller.
Attached to a Socket
--------------------
TBD
Access Control
==============
Login Checks
------------
Login checks are optional for the RTEMS shell and can be configured via a login
check handler passed to ``rtems_shell_init()``. One login check handler
is ``rtems_shell_login_check()``.
Configuration Files
-------------------
The following files are used by the login check handler
``rtems_shell_login_check()`` to validate a passphrase for a user and to set up
the user environment for the shell command execution.
:file:`/etc/passwd`
The format for each line is
.. code:: c
user_name:password:UID:GID:GECOS:directory:shell
with colon separated 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 password allows login without a password for this user. In
contrast to standard UNIX systems, this file is only readable and writeable
for the user with an UID of zero by default. The ``directory`` is used to
perform a filesystem change root operation in ``rtems_shell_login_check()``
in contrast to a normal usage as the HOME directory of the user.
The *default* content is:
.. code:: c
root::0:0::::
so there is *no password required* for the ``root`` user.
:file:`/etc/group`
The format for each line is:
.. code:: c
group_name:password:GID:user_list
with colon separated fields. The ``user_list`` is comma separated. For
more information refer to the Linux GROUP(5) man page. In contrast to
standard UNIX systems, this file is only readable and writeable for the
user with an UID of zero by default. The default content is
.. code:: c
root::0:
Command Visibility and Execution Permission
-------------------------------------------
Each command has:
- an owner,
- a group, and
- a read permission flag for the owner, the group and all other users, and
- an execution permission flag for the owner, the group and all other
users.
The read and write permission flags are stored in the command mode. The read
permission flags determine the visibility of the command for the current user.
The execution permission flags determine the ability to execute a command for
the current user. These command properties can be displayed and changed with
the:
- ``cmdls``,
- ``cmdchown``, and
- ``cmdchmod``
commands. The access is determined by the effective UID, the effective GID and
the supplementary group IDs of the current user and follows the standard
filesystem access procedure.
Add CRYPT(3) Formats
--------------------
By 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 available out of the box:
- ``crypt_md5_format``,
- ``crypt_sha256_format``, and
- ``crypt_sha512_format``.
An example follows:
.. index:: crypt_add_format
.. code:: c
#include <crypt.h>
void add_formats( void )
{
crypt_add_format( &crypt_md5_format );
crypt_add_format( &crypt_sha512_format );
}
Functions
=========
This section describes the Shell related C functions which are publicly
available related to initialization and configuration.
rtems_shell_init - Initialize the shell
---------------------------------------
.. index:: initialization
**CALLING SEQUENCE:**
.. index:: rtems_shell_init
.. code-block:: c
rtems_status_code rtems_shell_init(
const char *task_name,
size_t task_stacksize,
rtems_task_priority task_priority,
const char *devname,
bool forever,
bool wait,
rtems_login_check login_check
);
**DIRECTIVE STATUS CODES:**
``RTEMS_SUCCESSFUL`` - Shell task spawned successfully
others - to indicate a failure condition
**DESCRIPTION:**
This service creates a task with the specified characteristics to run the RTEMS
Shell attached to the specified ``devname``.
.. note::
This method invokes the ``rtems_task_create`` and ``rtems_task_start``
directives and as such may return any status code that those directives may
return.
There is one POSIX key necessary for all shell instances together and one
POSIX key value pair per instance. You should make sure that your RTEMS
configuration accounts for these resources.
rtems_shell_login_check - Default login check handler
-----------------------------------------------------
.. index:: initialization
**CALLING SEQUENCE:**
.. index:: rtems_shell_login_check
.. code:: c
bool rtems_shell_login_check(
const char \*user,
const char \*passphrase
);
**DIRECTIVE STATUS CODES:**
``true`` - login is allowed, and
``false`` - otherwise.
**DESCRIPTION:**
This function checks if the specified passphrase is valid for the specified
user.
.. note::
As a side-effect if the specified passphrase is valid for the specified
user, this function:
- performs a filesystem change root operation to the directory of the
specified user if the directory path is non-empty,
- changes the owner of the current shell device to the UID of the specified
user,
- sets the real and effective UID of the current user environment to the
UID of the specified user,
- sets the real and effective GID of the current user environment to the
GID of the specified user, and
- sets the supplementary group IDs of the current user environment to the
supplementary group IDs of the specified user.
In case the filesystem change root operation fails, then the environment
setup is aborted and ``false`` is returned.

2656
shell/file_and_directory.rst Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
Function and Variable Index
###########################
.. COMMENT: There are currently no Command and Variable Index entries.

1203
shell/general_commands.rst Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1 +1,46 @@
.. include:: shell.rst
========================
RTEMS Shell Users Guide
========================
COPYRIGHT © 1988 - 2015.
On-Line Applications Research Corporation (OAR).
The authors have used their best efforts in preparing this material. These
efforts include the development, research, and testing of the theories and
programs to determine their effectiveness. No warranty of any kind, expressed
or implied, with regard to the software or the material contained in this
document is provided. No liability arising out of the application or use of
any product described in this document is assumed. The authors reserve the
right to revise this material and to make changes from time to time in the
content hereof without obligation to notify anyone of such revision or changes.
The RTEMS Project is hosted at http://www.rtems.org/. Any inquiries concerning
RTEMS, its related support components, or its documentation should be directed
to the Community Project hosted at http://www.rtems.org/.
Table of Contents
-----------------
.. toctree::
preface
.. toctree::
:maxdepth: 3
:numbered:
configuration_and_init
general_commands
file_and_directory
memory_commands
rtems_specific_commands
network_commands
function_and_variable
concept
* :ref:`genindex`
* :ref:`search`

613
shell/memory_commands.rst Normal file
View File

@ -0,0 +1,613 @@
Memory Commands
###############
Introduction
============
The RTEMS shell has the following memory commands:
- ``mdump`` - Display contents of memory
- ``wdump`` - Display contents of memory (word)
- ``ldump`` - Display contents of memory (longword)
- ``medit`` - Modify contents of memory
- ``mfill`` - File memory with pattern
- ``mmove`` - Move contents of memory
- ``malloc`` - Obtain information on C Program Heap
Commands
========
This section details the Memory Commands available. A
subsection is dedicated to each of the commands and
describes the behavior and configuration of that
command as well as providing an example usage.
mdump - display contents of memory
----------------------------------
.. index:: mdump
**SYNOPSYS:**
.. code:: c
mdump \[address \[length \[size]]]
**DESCRIPTION:**
This command displays the contents of memory at the ``address``
and ``length`` in ``size`` byte units specified on the command line.
When ``size`` is not provided, it defaults to ``1`` byte units.
Values of ``1``, ``2``, and ``4`` are valid; all others will
cause an error to be reported.
When ``length`` is not provided, it defaults to ``320`` which
is twenty lines of output with sixteen bytes of output per line.
When ``address`` is not provided, it defaults to ``0x00000000``.
**EXIT STATUS:**
This command always returns 0 to indicate success.
**NOTES:**
Dumping memory from a non-existent address may result in an unrecoverable
program fault.
**EXAMPLES:**
The following is an example of how to use ``mdump``:
.. code:: c
SHLL \[/] $ mdump 0x10000 32
0x0001000000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0x0001001000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
SHLL \[/] $ mdump 0x02000000 32
0x02000000A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
0x02000010A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
SHLL \[/] $ mdump 0x02001000 32
0x0200100003 00 80 00 82 10 60 00-81 98 40 00 83 48 00 00 ......`.....H..
0x0200101084 00 60 01 84 08 A0 07-86 10 20 01 87 28 C0 02 ..`....... ..(..
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_MDUMP
.. index:: CONFIGURE_SHELL_COMMAND_MDUMP
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MDUMP`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_MDUMP`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_mdump
The ``mdump`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_mdump(
int argc,
char \**argv
);
The configuration structure for the ``mdump`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_MDUMP_Command;
wdump - display contents of memory (word)
-----------------------------------------
.. index:: wdump
**SYNOPSYS:**
.. code:: c
wdump \[address \[length]]
**DESCRIPTION:**
This command displays the contents of memory at the ``address``
and ``length`` in bytes specified on the command line.
This command is equivalent to ``mdump address length 2``.
When ``length`` is not provided, it defaults to ``320`` which
is twenty lines of output with eight words of output per line.
When ``address`` is not provided, it defaults to ``0x00000000``.
**EXIT STATUS:**
This command always returns 0 to indicate success.
**NOTES:**
Dumping memory from a non-existent address may result in an unrecoverable
program fault.
**EXAMPLES:**
The following is an example of how to use ``wdump``:
.. code:: c
SHLL \[/] $ wdump 0x02010000 32
0x02010000 0201 08D8 0201 08C0-0201 08AC 0201 0874 ...............t
0x02010010 0201 0894 0201 0718-0201 0640 0201 0798 ...............
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_WDUMP
.. index:: CONFIGURE_SHELL_COMMAND_WDUMP
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_WDUMP`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_WDUMP`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_wdump
The ``wdump`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_wdump(
int argc,
char \**argv
);
The configuration structure for the ``wdump`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_WDUMP_Command;
ldump - display contents of memory (longword)
---------------------------------------------
.. index:: ldump
**SYNOPSYS:**
.. code:: c
ldump \[address \[length]]
**DESCRIPTION:**
This command displays the contents of memory at the ``address``
and ``length`` in bytes specified on the command line.
This command is equivalent to ``mdump address length 4``.
When ``length`` is not provided, it defaults to ``320`` which
is twenty lines of output with four longwords of output per line.
When ``address`` is not provided, it defaults to ``0x00000000``.
**EXIT STATUS:**
This command always returns 0 to indicate success.
**NOTES:**
Dumping memory from a non-existent address may result in an unrecoverable
program fault.
**EXAMPLES:**
The following is an example of how to use ``ldump``:
.. code:: c
SHLL \[/] $ ldump 0x02010000 32
0x02010000 020108D8 020108C0-020108AC 02010874 ...............t
0x02010010 020 0894 02010718-02010640 02010798 ...............
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_LDUMP
.. index:: CONFIGURE_SHELL_COMMAND_LDUMP
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_LDUMP`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_LDUMP`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_ldump
The ``ldump`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_ldump(
int argc,
char \**argv
);
The configuration structure for the ``ldump`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_LDUMP_Command;
medit - modify contents of memory
---------------------------------
.. index:: medit
**SYNOPSYS:**
.. code:: c
medit address value1 \[value2 ... valueN]
**DESCRIPTION:**
This command is used to modify the contents of the memory starting
at ``address`` using the octets specified by the parameters``value1`` through ``valueN``.
**EXIT STATUS:**
This command returns 0 on success and non-zero if an error is encountered.
**NOTES:**
Dumping memory from a non-existent address may result in an unrecoverable
program fault.
**EXAMPLES:**
The following is an example of how to use ``medit``:
.. code:: c
SHLL \[/] $ mdump 0x02000000 32
0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
SHLL \[/] $ medit 0x02000000 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09
SHLL \[/] $ mdump 0x02000000 32
0x02000000 01 02 03 04 05 06 07 08-09 00 22 BC A6 10 21 00 .........."...!.
0x02000010 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_MEDIT
.. index:: CONFIGURE_SHELL_COMMAND_MEDIT
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MEDIT`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_MEDIT`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_medit
The ``medit`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_medit(
int argc,
char \**argv
);
The configuration structure for the ``medit`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_MEDIT_Command;
mfill - file memory with pattern
--------------------------------
.. index:: mfill
**SYNOPSYS:**
.. code:: c
mfill address length value
**DESCRIPTION:**
This command is used to fill the memory starting at ``address``
for the specified ``length`` in octets when the specified at``value``.
**EXIT STATUS:**
This command returns 0 on success and non-zero if an error is encountered.
**NOTES:**
Filling a non-existent address range may result in an unrecoverable
program fault. Similarly overwriting interrupt vector tables, code
space or critical data areas can be fatal as shown in the example.
**EXAMPLES:**
In this example, the address used (``0x23d89a0``) as the base
address of the filled area is the end of the stack for the
Idle thread. This address was determined manually using gdb and
is very specific to this application and BSP. The first command
in this example is an ``mdump`` to display the initial contents
of this memory. We see that the first 8 bytes are 0xA5 which is
the pattern used as a guard by the Stack Checker. On
the first context switch after the pattern is overwritten
by the ``mfill`` command, the Stack Checker detect the pattern
has been corrupted and generates a fatal error.
.. code:: c
SHLL \[/] $ mdump 0x23d89a0 16
0x023D89A0 A5 A5 A5 A5 A5 A5 A5 A5-FE ED F0 0D 0B AD 0D 06 ................
SHLL \[/] $ mfill 0x23d89a0 13 0x5a
SHLL \[/] $ BLOWN STACK!!! Offending task(0x23D4418): id=0x09010001; name=0x0203D908
stack covers range 0x23D89A0 - 0x23D99AF (4112 bytes)
Damaged pattern begins at 0x023D89A8 and is 16 bytes long
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_MFILL
.. index:: CONFIGURE_SHELL_COMMAND_MFILL
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MFILL`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_MFILL`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_mfill
The ``mfill`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_mfill(
int argc,
char \**argv
);
The configuration structure for the ``mfill`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_MFILL_Command;
mmove - move contents of memory
-------------------------------
.. index:: mmove
**SYNOPSYS:**
.. code:: c
mmove dst src length
**DESCRIPTION:**
This command is used to copy the contents of the memory
starting at ``src`` to the memory located at ``dst``
for the specified ``length`` in octets.
**EXIT STATUS:**
This command returns 0 on success and non-zero if an error is encountered.
**NOTES:**
NONE
**EXAMPLES:**
The following is an example of how to use ``mmove``:
.. code:: c
SHLL \[/] $ mdump 0x023d99a0 16
0x023D99A0 A5 A5 A5 A5 A5 A5 A5 A5-A5 A5 A5 A5 A5 A5 A5 A5 ................
SHLL \[/] $ mdump 0x02000000 16
0x02000000 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
SHLL \[/] $ mmove 0x023d99a0 0x02000000 13
SHLL \[/] $ mdump 0x023d99a0 16
0x023D99A0 A1 48 00 00 29 00 80 33-81 C5 22 BC A6 A5 A5 A5 .H..)..3..".....
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_MMOVE
.. index:: CONFIGURE_SHELL_COMMAND_MMOVE
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MMOVE`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_MMOVE`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_mmove
The ``mmove`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_mmove(
int argc,
char \**argv
);
The configuration structure for the ``mmove`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_MMOVE_Command;
malloc - obtain information on C program heap
---------------------------------------------
.. index:: malloc
**SYNOPSYS:**
.. code:: c
malloc \[walk]
**DESCRIPTION:**
This command prints information about the current state of the C Program Heap
used by the ``malloc()`` family of calls if no or invalid options are passed
to the command. This includes the following information:
- Number of free blocks
- Largest free block
- Total bytes free
- Number of used blocks
- Largest used block
- Total bytes used
- Size of the allocatable area in bytes
- Minimum free size ever in bytes
- Maximum number of free blocks ever
- Maximum number of blocks searched ever
- Lifetime number of bytes allocated
- Lifetime number of bytes freed
- Total number of searches
- Total number of successful allocations
- Total number of failed allocations
- Total number of successful frees
- Total number of successful resizes
When the subcommand ``walk`` is specified, then a heap walk will be
performed and information about each block is printed out.
**EXIT STATUS:**
This command returns 0 on success and non-zero if an error is encountered.
**NOTES:**
NONE
**EXAMPLES:**
The following is an example of how to use the ``malloc`` command.
.. code:: c
SHLL \[/] $ malloc
C Program Heap and RTEMS Workspace are the same.
Number of free blocks: 2
Largest free block: 266207504
Total bytes free: 266208392
Number of used blocks: 167
Largest used block: 16392
Total bytes used: 83536
Size of the allocatable area in bytes: 266291928
Minimum free size ever in bytes: 266207360
Maximum number of free blocks ever: 6
Maximum number of blocks searched ever: 5
Lifetime number of bytes allocated: 91760
Lifetime number of bytes freed: 8224
Total number of searches: 234
Total number of successful allocations: 186
Total number of failed allocations: 0
Total number of successful frees: 19
Total number of successful resizes: 0
SHLL \[/] $ malloc walk
malloc walk
PASS[0]: page size 8, min block size 48
area begin 0x00210210, area end 0x0FFFC000
first block 0x00210214, last block 0x0FFFBFDC
first free 0x00228084, last free 0x00228354
PASS[0]: block 0x00210214: size 88
...
PASS[0]: block 0x00220154: size 144
PASS[0]: block 0x002201E4: size 168, prev 0x002205BC, next 0x00228354 (= last free)
PASS[0]: block 0x0022028C: size 168, prev_size 168
...
PASS[0]: block 0x00226E7C: size 4136
PASS[0]: block 0x00227EA4: size 408, prev 0x00228084 (= first free), next 0x00226CE4
PASS[0]: block 0x0022803C: size 72, prev_size 408
PASS[0]: block 0x00228084: size 648, prev 0x0020F75C (= head), next 0x00227EA4
PASS[0]: block 0x0022830C: size 72, prev_size 648
PASS[0]: block 0x00228354: size 266157192, prev 0x002201E4, next 0x0020F75C (= tail)
PASS[0]: block 0x0FFFBFDC: size 4028711480, prev_size 266157192
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_MALLOC
.. index:: CONFIGURE_SHELL_COMMAND_MALLOC
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_MALLOC`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_MALLOC`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_malloc
The ``malloc`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_malloc(
int argc,
char \**argv
);
The configuration structure for the ``malloc`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_MALLOC_Command;
.. COMMENT: COPYRIGHT (c) 1988-2008.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

633
shell/network_commands.rst Normal file
View File

@ -0,0 +1,633 @@
Network Commands
################
Introduction
============
The RTEMS shell has the following network commands:
- ``netstats`` - obtain network statistics
- ``ifconfig`` - configure a network interface
- ``route`` - show or manipulate the IP routing table
- ``ping`` - ping a host or IP address
Commands
========
This section details the Network Commands available. A
subsection is dedicated to each of the commands and
describes the behavior and configuration of that
command as well as providing an example usage.
netstats - obtain network statistics
------------------------------------
.. index:: netstats
**SYNOPSYS:**
.. code:: c
netstats \[-Aimfpcut]
**DESCRIPTION:**
This command is used to display various types of network statistics. The
information displayed can be specified using command line arguments in
various combinations. The arguments are interpreted as follows:
*-A*
print All statistics
*-i*
print Inet Routes
*-m*
print MBUF Statistics
*-f*
print IF Statistics
*-p*
print IP Statistics
*-c*
print ICMP Statistics
*-u*
print UDP Statistics
*-t*
print TCP Statistics
**EXIT STATUS:**
This command returns 0 on success and non-zero if an error is encountered.
**NOTES:**
NONE
**EXAMPLES:**
The following is an example of how to use ``netstats``:
The following is an example of using the ``netstats``
command to print the IP routing table:
.. code:: c
[/] $ netstats -i
Destination Gateway/Mask/Hw Flags Refs Use Expire Interface
default 192.168.1.14 UGS 0 0 0 eth1
192.168.1.0 255.255.255.0 U 0 0 1 eth1
192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1219 eth1
192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 840 1202 eth1
192.168.1.151 00:1C:23:B2:0F:BB UHL 1 23 1219 eth1
The following is an example of using the ``netstats``
command to print the MBUF statistics:
.. code:: c
[/] $ netstats -m
\************ MBUF STATISTICS \************
mbufs:2048 clusters: 128 free: 63
drops: 0 waits: 0 drains: 0
free:1967 data:79 header:2 socket:0
pcb:0 rtable:0 htable:0 atable:0
soname:0 soopts:0 ftable:0 rights:0
ifaddr:0 control:0 oobdata:0
The following is an example of using the ``netstats``
command to print the print the interface statistics:
.. code:: c
[/] $ netstats -f
\************ INTERFACE STATISTICS \************
\***** eth1 \*****
Ethernet Address: 00:04:9F:00:5B:21
Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0
Flags: Up Broadcast Running Active Multicast
Send queue limit:50 length:1 Dropped:0
Rx Interrupts:889 Not First:0 Not Last:0
Giant:0 Non-octet:0
Bad CRC:0 Overrun:0 Collision:0
Tx Interrupts:867 Deferred:0 Late Collision:0
Retransmit Limit:0 Underrun:0 Misaligned:0
The following is an example of using the ``netstats``
command to print the print IP statistics:
.. code:: c
[/] $ netstats -p
\************ IP Statistics \************
total packets received 894
packets rcvd for unreachable dest 13
datagrams delivered to upper level 881
total ip packets generated here 871
The following is an example of using the ``netstats``
command to print the ICMP statistics:
.. code:: c
[/] $ netstats -c
\************ ICMP Statistics \************
Type 0 sent 843
number of responses 843
Type 8 received 843
The following is an example of using the ``netstats``
command to print the UDP statistics:
.. code:: c
[/] $ netstats -u
\************ UDP Statistics \************
The following is an example of using the ``netstats``
command to print the TCP statistics:
.. code:: c
[/] $ netstats -t
\************ TCP Statistics \************
connections accepted 1
connections established 1
segs where we tried to get rtt 34
times we succeeded 35
delayed acks sent 2
total packets sent 37
data packets sent 35
data bytes sent 2618
ack-only packets sent 2
total packets received 47
packets received in sequence 12
bytes received in sequence 307
rcvd ack packets 35
bytes acked by rcvd acks 2590
times hdr predict ok for acks 27
times hdr predict ok for data pkts 10
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_NETSTATS
.. index:: CONFIGURE_SHELL_COMMAND_NETSTATS
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_NETSTATS`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_NETSTATS`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_netstats
The ``netstats`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_netstats(
int argc,
char \**argv
);
The configuration structure for the ``netstats`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command;
ifconfig - configure a network interface
----------------------------------------
.. index:: ifconfig
**SYNOPSYS:**
.. code:: c
ifconfig
ifconfig interface
ifconfig interface \[up|down]
ifconfig interface \[netmask|pointtopoint|broadcast] IP
**DESCRIPTION:**
This command may be used to display information about the
network interfaces in the system or configure them.
**EXIT STATUS:**
This command returns 0 on success and non-zero if an error is encountered.
**NOTES:**
Just like its counterpart on GNU/Linux and BSD systems, this command
is complicated. More example usages would be a welcome submission.
**EXAMPLES:**
The following is an example of how to use ``ifconfig``:
.. code:: c
************ INTERFACE STATISTICS \************
\***** eth1 \*****
Ethernet Address: 00:04:9F:00:5B:21
Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0
Flags: Up Broadcast Running Active Multicast
Send queue limit:50 length:1 Dropped:0
Rx Interrupts:5391 Not First:0 Not Last:0
Giant:0 Non-octet:0
Bad CRC:0 Overrun:0 Collision:0
Tx Interrupts:5256 Deferred:0 Late Collision:0
Retransmit Limit:0 Underrun:0 Misaligned:0
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_IFCONFIG
.. index:: CONFIGURE_SHELL_COMMAND_IFCONFIG
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_IFCONFIG`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_IFCONFIG`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_ifconfig
The ``ifconfig`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_ifconfig(
int argc,
char \**argv
);
The configuration structure for the ``ifconfig`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
route - show or manipulate the ip routing table
-----------------------------------------------
.. index:: route
**SYNOPSYS:**
.. code:: c
route \[subcommand] \[args]
**DESCRIPTION:**
This command is used to display and manipulate the routing table.
When invoked with no arguments, the current routing information is
displayed. When invoked with the subcommands ``add`` or ``del``,
then additional arguments must be provided to describe the route.
Command templates include the following:
.. code:: c
route \[add|del] -net IP_ADDRESS gw GATEWAY_ADDRESS \[netmask MASK]
route \[add|del] -host IP_ADDRESS gw GATEWAY_ADDRES \[netmask MASK]
When not provided the netmask defaults to ``255.255.255.0``
**EXIT STATUS:**
This command returns 0 on success and non-zero if an error is encountered.
**NOTES:**
Just like its counterpart on GNU/Linux and BSD systems, this command
is complicated. More example usages would be a welcome submission.
**EXAMPLES:**
The following is an example of how to use ``route`` to display,
add, and delete a new route:
.. code:: c
[/] $ route
Destination Gateway/Mask/Hw Flags Refs Use Expire Interface
default 192.168.1.14 UGS 0 0 0 eth1
192.168.1.0 255.255.255.0 U 0 0 1 eth1
192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1444 eth1
192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 10844 1202 eth1
192.168.1.151 00:1C:23:B2:0F:BB UHL 2 37 1399 eth1
\[/] $ route add -net 192.168.3.0 gw 192.168.1.14
\[/] $ route
Destination Gateway/Mask/Hw Flags Refs Use Expire Interface
default 192.168.1.14 UGS 0 0 0 eth1
192.168.1.0 255.255.255.0 U 0 0 1 eth1
192.168.1.14 00:A0:C8:1C:EE:28 UHL 2 0 1498 eth1
192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 14937 1202 eth1
192.168.1.151 00:1C:23:B2:0F:BB UHL 2 96 1399 eth1
192.168.3.0 192.168.1.14 UGS 0 0 0 eth1
\[/] $ route del -net 192.168.3.0 gw 192.168.1.14
\[/] $ route
Destination Gateway/Mask/Hw Flags Refs Use Expire Interface
default 192.168.1.14 UGS 0 0 0 eth1
192.168.1.0 255.255.255.0 U 0 0 1 eth1
192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1498 eth1
192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 15945 1202 eth1
192.168.1.151 00:1C:23:B2:0F:BB UHL 2 117 1399 eth1
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_ROUTE
.. index:: CONFIGURE_SHELL_COMMAND_ROUTE
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ROUTE`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_ROUTE`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_route
The ``route`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_route(
int argc,
char \**argv
);
The configuration structure for the ``route`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
ping - ping a host or IP address
--------------------------------
.. index:: ping
**SYNOPSYS:**
.. code:: c
ping \[-AaDdfnoQqRrv] \[-c count] \[-G sweepmaxsize] \[-g sweepminsize]
\[-h sweepincrsize] \[-i wait] \[-l preload] \[-M mask | time] \[-m ttl]
\[-p pattern] \[-S src_addr] \[-s packetsize] \[-t timeout]
\[-W waittime] \[-z tos] host
ping \[-AaDdfLnoQqRrv] \[-c count] \[-I iface] \[-i wait] \[-l preload]
\[-M mask | time] \[-m ttl] \[-p pattern] \[-S src_addr]
\[-s packetsize] \[-T ttl] \[-t timeout] \[-W waittime]
\[-z tos] mcast-group
**DESCRIPTION:**
The ping utility uses the ICMP protocols mandatory ECHO_REQUEST
datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.
ECHO_REQUEST datagrams (“pings”) have an IP and ICMP header,
followed by a “struct timeval” and then an arbitrary number of
“pad” bytes used to fill out the packet. The options are as
follows:
*-A*
Audible. Output a bell (ASCII 0x07) character when no packet is
received before the next packet is transmitted. To cater for
round-trip times that are longer than the interval between
transmissions, further missing packets cause a bell only if the
maximum number of unreceived packets has increased.
*-a*
Audible. Include a bell (ASCII 0x07) character in the output when any
packet is received. This option is ignored if other format options
are present.
*-c count*
Stop after sending (and receiving) count ECHO_RESPONSE packets. If
this option is not specified, ping will operate until interrupted. If
this option is specified in conjunction with ping sweeps, each sweep
will consist of count packets.
*-D*
Set the Dont Fragment bit.
*-d*
Set the SO_DEBUG option on the socket being used.
*-f*
Flood ping. Outputs packets as fast as they come back or one
hundred times per second, whichever is more. For every ECHO_REQUEST
sent a period “.” is printed, while for every ECHO_REPLY received a
backspace is printed. This provides a rapid display of how many
packets are being dropped. Only the super-user may use this option.
This can be very hard on a network and should be used with caution.
*-G sweepmaxsize*
Specify the maximum size of ICMP payload when sending sweeping pings.
This option is required for ping sweeps.
*-g sweepminsize*
Specify the size of ICMP payload to start with when sending sweeping
pings. The default value is 0.
*-h sweepincrsize*
Specify the number of bytes to increment the size of ICMP payload
after each sweep when sending sweeping pings. The default value is 1.
*-I iface*
Source multicast packets with the given interface address. This flag
only applies if the ping destination is a multicast address.
*-i wait*
Wait wait seconds between sending each packet. The default is to wait
for one second between each packet. The wait time may be fractional,
but only the super-user may specify values less than 1 second. This
option is incompatible with the -f option.
*-L*
Suppress loopback of multicast packets. This flag only applies if the
ping destination is a multicast address.
*-l preload*
If preload is specified, ping sends that many packets as fast as
possible before falling into its normal mode of behavior. Only the
super-user may use this option.
*-M mask | time*
Use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO. For mask, print
the netmask of the remote machine. Set the net.inet.icmp.maskrepl MIB
variable to enable ICMP_MASKREPLY. For time, print the origination,
reception and transmission timestamps.
*-m ttl*
Set the IP Time To Live for outgoing packets. If not specified, the
kernel uses the value of the net.inet.ip.ttl MIB variable.
*-n*
Numeric output only. No attempt will be made to lookup symbolic names
for host addresses.
*-o*
Exit successfully after receiving one reply packet.
*-p pattern*
You may specify up to 16 “pad” bytes to fill out the packet you
send. This is useful for diagnosing data-dependent problems in a
network. For example, “-p ff” will cause the sent packet to be
filled with all ones.
*-Q*
Somewhat quiet output. Dont display ICMP error messages that are in
response to our query messages. Originally, the -v flag was required
to display such errors, but -v displays all ICMP error messages. On a
busy machine, this output can be overbear- ing. Without the -Q flag,
ping prints out any ICMP error mes- sages caused by its own
ECHO_REQUEST messages.
*-q*
Quiet output. Nothing is displayed except the summary lines at
startup time and when finished.
*-R*
Record route. Includes the RECORD_ROUTE option in the ECHO_REQUEST
packet and displays the route buffer on returned packets. Note that
the IP header is only large enough for nine such routes; the
traceroute(8) command is usually better at determining the route
packets take to a particular destination. If more routes come back
than should, such as due to an illegal spoofed packet, ping will print
the route list and then truncate it at the correct spot. Many hosts
ignore or discard the RECORD_ROUTE option.
*-r*
Bypass the normal routing tables and send directly to a host on an
attached network. If the host is not on a directly-attached network,
an error is returned. This option can be used to ping a local host
through an interface that has no route through it (e.g., after the
interface was dropped).
*-S src_addr*
Use the following IP address as the source address in outgoing
packets. On hosts with more than one IP address, this option can be
used to force the source address to be something other than the IP
address of the interface the probe packet is sent on. If the IP
address is not one of this machines interface addresses, an error is
returned and nothing is sent.
*-s packetsize*
Specify the number of data bytes to be sent. The default is 56, which
translates into 64 ICMP data bytes when combined with the 8 bytes of
ICMP header data. Only the super-user may specify val- ues more than
default. This option cannot be used with ping sweeps.
*-T ttl*
Set the IP Time To Live for multicasted packets. This flag only
applies if the ping destination is a multicast address.
*-t timeout*
Specify a timeout, in seconds, before ping exits regardless of how
many packets have been received.
*-v*
Verbose output. ICMP packets other than ECHO_RESPONSE that are
received are listed.
*-W waittime*
Time in milliseconds to wait for a reply for each packet sent. If a
reply arrives later, the packet is not printed as replied, but
considered as replied when calculating statistics.
*-z tos*
Use the specified type of service.
**EXIT STATUS:**
The ping utility exits with one of the following values:
0 At least one response was heard from the specified host.
2 The transmission was successful but no responses were
received.
any other value an error occurred. These values are defined in
<sysexits.h>.
**NOTES:**
When using ping for fault isolation, it should first be run on the
local host, to verify that the local network interface is up and
running. Then, hosts and gateways further and further away should be
“pinged”. Round-trip times and packet loss statistics are computed.
If duplicate packets are received, they are not included in the packet
loss calculation, although the round trip time of these packets is
used in calculating the round-trip time statistics. When the
specified number of packets have been sent a brief summary is
displayed, showing the number of packets sent and received, and the
minimum, mean, maximum, and standard deviation of the round-trip
times.
This program is intended for use in network testing, measurement and
management. Because of the load it can impose on the network, it is
unwise to use ping during normal operations or from automated scripts.
**EXAMPLES:**
The following is an example of how to use ``oing`` to ping:
.. code:: c
[/] # ping 10.10.10.1
PING 10.10.10.1 (10.10.10.1): 56 data bytes
64 bytes from 10.10.10.1: icmp_seq=0 ttl=63 time=0.356 ms
64 bytes from 10.10.10.1: icmp_seq=1 ttl=63 time=0.229 ms
64 bytes from 10.10.10.1: icmp_seq=2 ttl=63 time=0.233 ms
64 bytes from 10.10.10.1: icmp_seq=3 ttl=63 time=0.235 ms
64 bytes from 10.10.10.1: icmp_seq=4 ttl=63 time=0.229 ms
--- 10.10.10.1 ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.229/0.256/0.356/0.050 ms
\[/] # ping -f -c 10000 10.10.10.1
PING 10.10.10.1 (10.10.10.1): 56 data bytes
.
--- 10.10.10.1 ping statistics ---
10000 packets transmitted, 10000 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.154/0.225/0.533/0.027 ms
**CONFIGURATION:**
.. index:: CONFIGURE_SHELL_NO_COMMAND_PING
.. index:: CONFIGURE_SHELL_COMMAND_PING
This command is included in the default shell command set.
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PING`` to have this
command included.
This command can be excluded from the shell command set by
defining ``CONFIGURE_SHELL_NO_COMMAND_PING`` when all
shell commands have been configured.
**PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_ping
The ``ping`` is implemented by a C language function
which has the following prototype:
.. code:: c
int rtems_shell_rtems_main_ping(
int argc,
char \**argv
);
The configuration structure for the ``ping`` has the
following prototype:
.. code:: c
extern rtems_shell_cmd_t rtems_shell_PING_Command;

113
shell/preface.rst Normal file
View File

@ -0,0 +1,113 @@
Preface
#######
Real-time embedded systems vary widely based upon their operational and
maintenance requirements. Some of these systems provide ways for the user or
developer to interact with them. This interaction could be used for
operational, diagnostic, or configuration purposes. The capabilities described
in this manual are those provided with RTEMS to provide a command line
interface for user access. Some of these commands will be familiar as standard
POSIX utilities while others are RTEMS specific or helpful in debugging and
analyzing an embedded system. As a simple example of the powerful and very
familiar capabilities that the RTEMS Shell provides to an application, consider
the following example which hints at some of the capabilities available:
.. code-block:: shell
Welcome to rtems-4.10.99.0(SPARC/w/FPU/sis)
COPYRIGHT (c) 1989-2011.
On-Line Applications Research Corporation (OAR).
Login into RTEMS
login: rtems
Password:
RTEMS SHELL (Ver.1.0-FRC):/dev/console. Feb 28 2008. 'help' to list commands.
SHLL [/] $ cat /etc/passwd
root:*:0:0:root::/:/bin/sh
rtems:*:1:1:RTEMS Application::/:/bin/sh
tty:!:2:2:tty owner::/:/bin/false
SHLL [/] $ ls /dev
-rwxr-xr-x 1 rtems root 0 Jan 01 00:00 console
-rwxr-xr-x 1 root root 0 Jan 01 00:00 console_b
2 files 0 bytes occupied
SHLL [/] $ stackuse
Stack usage by thread
ID NAME LOW HIGH CURRENT AVAILABLE USED
0x09010001 IDLE 0x023d89a0 - 0x023d99af 0x023d9760 4096 608
0x0a010001 UI1 0x023d9f30 - 0x023daf3f 0x023dad18 4096 1804
0x0a010002 SHLL 0x023db4c0 - 0x023df4cf 0x023de9d0 16384 6204
0xffffffff INTR 0x023d2760 - 0x023d375f 0x00000000 4080 316
SHLL [/] $ mount -L
File systems: msdos
SHLL [/] $
In the above example, the user *rtems* logs into a SPARC based RTEMS system.
The first command is ``cat /etc/passwd``. This simple command lets us know
that this application is running the In Memory File System (IMFS) and that the
infrastructure has provided dummy entries for */etc/passwd* and a few other
files. The contents of */etc/passwd* let us know that the user could have
logged in as ``root``. In fact, the ``root`` user has more permissions than
``rtems`` who is not allowed to write into the filesystem.
The second command is ``ls /dev`` which lets us know that RTEMS has POSIX-style
device nodes which can be accesses through standard I/O function calls.
The third command executed is the RTEMS specific ``stackuse`` which gives a
report on the stack usage of each thread in the system. Since stack overflows
are a common error in deeply embedded systems, this is a surprising simple, yet
powerful debugging aid.
Finally, the last command, ``mount -L`` hints that RTEMS supports a variety of
mountable filesystems. With support for MS-DOS FAT on IDE/ATA and Flash devices
as well as network-based filesystens such as NFS and TFTP, the standard free
RTEMS provides a robuse infrastructure for embedded applications.
This manual describes the RTEMS Shell and its command set. In our terminology,
the Shell is just a loop reading user input and turning that input into
commands with argument. The Shell provided with RTEMS is a simple command
reading loop with limited scripting capabilities. It can be connected to via a
standard serial port or connected to the RTEMS ``telnetd`` server for use across
a network.
Each command in the command set is implemented as a single subroutine which has
a *main-style* prototype. The commands interpret their arguments and operate
upon stdin, stdout, and stderr by default. This allows each command to be
invoked independent of the shell.
The described separation of shell from commands from communications mechanism
was an important design goal. At one level, the RTEMS Shell is a complete
shell environment providing access to multiple POSIX compliant filesystems and
TCP/IP stack. The subset of capabilities available is easy to configure and
the standard Shell can be logged into from either a serial port or via telnet.
But at another level, the Shell is a large set of components which can be
integrated into the users developed command interpreter. In either case, it
is trivial to add custom commands to the command set available.
Acknowledgements
================
.. COMMENT: The RTEMS Project has been granted permission from The Open Group
.. COMMENT: IEEE to excerpt and use portions of the POSIX standards documents
.. COMMENT: in the RTEMS POSIX API User's Guide and RTEMS Shell User's Guide.
.. COMMENT: We have to include a specific acknowledgement paragraph in these
.. COMMENT: documents (e.g. preface or copyright page) and another slightly
.. COMMENT: different paragraph for each manual page that excerpts and uses
.. COMMENT: text from the standards.
.. COMMENT: This file should help ensure that the paragraphs are consistent
.. COMMENT: and not duplicated
The Institute of Electrical and Electronics Engineers, Inc and The Open Group,
have given us permission to reprint portions of their documentation.
.. pull-quote::
Portions of this text are reprinted and reproduced in electronic form from
IEEE Std 1003.1, 2004 Edition, Standard for Information Technology â
Operating System Interface (POSIX), The Open Group Base Specifications
Issue 6, Copyright © 2001-2004 by the Institute of Electrical and
Electronics Engineers, Inc and The Open Group. In the event of any
discrepancy between this version and the original IEEE and The Open Group
Standard, the original IEEE and The Open Group Standard is the referee
document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html. This notice shall appear on any
product containing this material.

File diff suppressed because it is too large Load Diff