VxWorks Reference Manual : Libraries

usrLib

NAME

usrLib - user interface subroutine library

ROUTINES

help( ) - print a synopsis of selected routines
netHelp( ) - print a synopsis of network routines
bootChange( ) - change the boot line
periodRun( ) - call a function periodically
period( ) - spawn a task to call a function periodically
repeatRun( ) - call a function repeatedly
repeat( ) - spawn a task to call a function repeatedly
sp( ) - spawn a task with default parameters
checkStack( ) - print a summary of each task's stack usage
i( ) - print a summary of each task's TCB
ti( ) - print complete information from a task's TCB
show( ) - print information on a specified object
ts( ) - suspend a task
tr( ) - resume a task
td( ) - delete a task
version( ) - print VxWorks version information
m( ) - modify memory
d( ) - display memory
cd( ) - change the default directory
pwd( ) - print the current default directory
copy( ) - copy in (or stdin) to out (or stdout)
copyStreams( ) - copy from/to specified streams
diskFormat( ) - format a disk
diskInit( ) - initialize a file system on a block device
squeeze( ) - reclaim fragmented free space on an RT-11 volume
ld( ) - load an object module into memory
ls( ) - list the contents of a directory
ll( ) - do a long listing of directory contents
lsOld( ) - list the contents of an RT-11 directory
mkdir( ) - make a directory
rmdir( ) - remove a directory
rm( ) - remove a file
devs( ) - list all system-known devices
lkup( ) - list symbols
lkAddr( ) - list symbols whose values are near a specified value
mRegs( ) - modify registers
pc( ) - return the contents of the program counter
printErrno( ) - print the definition of a specified error status value
printLogo( ) - print the VxWorks logo
logout( ) - log out of the VxWorks system
h( ) - display or set the size of shell history
spyReport( ) - display task activity data
spyTask( ) - run periodic task activity reports
spy( ) - begin periodic task activity reports
spyClkStart( ) - start collecting task activity data
spyClkStop( ) - stop collecting task activity data
spyStop( ) - stop spying and reporting
spyHelp( ) - display task monitoring help menu

DESCRIPTION

This library consists of routines meant to be executed from the VxWorks shell. It provides useful utilities for task monitoring and execution, system information, symbol table management, etc.

Many of the routines here are simply command-oriented interfaces to more general routines contained elsewhere in VxWorks. Users should feel free to modify or extend this library, and may find it preferable to customize capabilities by creating a new private library, using this one as a model, and appropriately linking the new one into the system.

Some routines here have optional parameters. If those parameters are zero, which is what the shell supplies if no argument is typed, default values are typically assumed.

A number of the routines in this module take an optional task name or ID as an argument. If this argument is omitted or zero, the "current" task is used. The current task (or "default" task) is the last task referenced. The usrLib library uses taskIdDefault( ) to set and get the last-referenced task ID, as do many other VxWorks routines.

NOTE

This library uses a small number of undocumented VxWorks internal routines.

INCLUDE FILES

usrLib.h

SEE ALSO

usrLib, spyLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

help( )

NAME

help( ) - print a synopsis of selected routines

SYNOPSIS


void help (void)

DESCRIPTION

This command prints the following list of the calling sequences for commonly used routines, mostly contained in usrLib.

help                       Print this list
dbgHelp                    Print debug help info
nfsHelp                    Print nfs help info
netHelp                    Print network help info
spyHelp                    Print task histogrammer help info
timexHelp                  Print execution timer help info
h         [n]              Print (or set) shell history
i         [task]           Summary of tasks' TCBs
ti        task             Complete info on TCB for task
sp        adr,args...      Spawn a task, pri=100, opt=0, stk=20000
taskSpawn name,pri,opt,stk,adr,args... Spawn a task
td        task             Delete a task
ts        task             Suspend a task
tr        task             Resume a task
d         [adr[,nunits[,width]]]   Display memory
m         adr[,width]      Modify memory
mRegs     [reg[,task]]     Modify a task's registers interactively
pc        [task]           Return task's program counter
version                    Print VxWorks version info, and boot line
iam     "user"[,"passwd"]  Set user name and passwd
whoami                     Print user name
cd        "path"           Set current working path
pwd                        Print working path
devs                       List devices
ls        ["path"[,long]]  List contents of directory
ll        ["path"]         List contents of directory - long format
rename    "old","new"      Change name of file
copy      ["in"][,"out"]   Copy in file to out file (0 = std in/out)
ld        [syms[,noAbort][,"name"]] Load std in into memory
                             (syms = add symbols to table:
                              -1 = none, 0 = globals, 1 = all)
lkup      ["substr"]       List symbols in system symbol table
lkAddr    address          List symbol table entries near address
checkStack  [task]         List task stack sizes and usage
printErrno  value          Print the name of a status value
period    secs,adr,args... Spawn task to call function periodically
repeat    n,adr,args...    Spawn task to call function n times
                             (0=forever)
diskFormat  "device"       Format disk
diskInit  "device"         Initialize file system on disk
squeeze   "device"         Squeeze free space on RT-11 device

NOTE:  Arguments specifying <task> can be either task ID or name.

RETURNS

N/A

SEE ALSO

usrLib, VxWorks Programmer's Guide: Target Shell windsh, Tornado User's Guide: Shell


Libraries : Routines

netHelp( )

NAME

netHelp( ) - print a synopsis of network routines

SYNOPSIS


void netHelp (void)

DESCRIPTION

This command prints a brief synopsis of network facilities that are typically called from the shell.

hostAdd      "hostname","inetaddr" - add a host to remote host table;
                                     "inetaddr" must be in standard
                                     Internet address format e.g. "90.0.0.4"
hostShow                           - print current remote host table
netDevCreate "devname","hostname",protocol
                                   - create an I/O device to access
                                     files on the specified host
                                     (protocol 0=rsh, 1=ftp)
routeAdd     "destaddr","gateaddr" - add route to route table
routeDelete  "destaddr","gateaddr" - delete route from route table
routeShow                          - print current route table
iam          "usr"[,"passwd"]      - specify the user name by which
                                     you will be known to remote
                                     hosts (and optional password)
whoami                             - print the current remote ID
rlogin       "host"                - log in to a remote host;
                                     "host" can be inet address or
                                     host name in remote host table

ifShow       ["ifname"]            - show info about network interfaces
inetstatShow                       - show all Internet protocol sockets
tcpstatShow                        - show statistics for TCP
udpstatShow                        - show statistics for UDP
ipstatShow                         - show statistics for IP
icmpstatShow                       - show statistics for ICMP
arptabShow                         - show a list of known ARP entries
mbufShow                           - show mbuf statistics

EXAMPLE:  -> hostAdd "wrs", "90.0.0.2"
          -> netDevCreate "wrs:", "wrs", 0
          -> iam "fred"
          -> copy <wrs:/etc/passwd   /* copy file from host "wrs" */
          -> rlogin "wrs"            /* rlogin to host "wrs"      */

RETURNS

N/A

SEE ALSO

usrLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

bootChange( )

NAME

bootChange( ) - change the boot line

SYNOPSIS


void bootChange (void)

DESCRIPTION

This command changes the boot line used in the boot ROMs. This is useful during a remote login session. After changing the boot parameters, you can reboot the target with the reboot( ) command, and then terminate your login ( ~. ) and remotely log in again. As soon as the system has rebooted, you will be logged in again.

This command stores the new boot line in non-volatile RAM, if the target has it.

RETURNS

N/A

SEE ALSO

usrLib, windsh, Tornado User's Guide: Shell


Libraries : Routines

periodRun( )

NAME

periodRun( ) - call a function periodically

SYNOPSIS

void periodRun
    (
    int     secs, /* no. of seconds to delay between calls */
    FUNCPTR func, /* function to call repeatedly */
    int     arg1, /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )

DESCRIPTION

This command repeatedly calls a specified function, with up to eight of its arguments, delaying the specified number of seconds between calls.

Normally, this routine is called only by period( ), which spawns it as a task.

RETURNS

N/A

SEE ALSO

usrLib, period( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

period( )

NAME

period( ) - spawn a task to call a function periodically

SYNOPSIS

int period
    (
    int     secs, /* period in seconds */
    FUNCPTR func, /* function to call repeatedly */
    int     arg1, /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )

DESCRIPTION

This command spawns a task that repeatedly calls a specified function, with up to eight of its arguments, delaying the specified number of seconds between calls.

For example, to have i( ) display task information every 5 seconds, just type:

    -> period 5, i

NOTE

The task is spawned using the sp( ) routine. See the description of sp( ) for details about priority, options, stack size, and task ID.

RETURNS

A task ID, or ERROR if the task cannot be spawned.

SEE ALSO

usrLib, periodRun( ), sp( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

repeatRun( )

NAME

repeatRun( ) - call a function repeatedly

SYNOPSIS

void repeatRun
    (
    int     n,    /* no. of times to call func (0=forever) */
    FUNCPTR func, /* function to call repeatedly */
    int     arg1, /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )

DESCRIPTION

This command calls a specified function n times, with up to eight of its arguments. If n is 0, the routine is called endlessly.

Normally, this routine is called only by repeat( ), which spawns it as a task.

RETURNS

N/A

SEE ALSO

usrLib, repeat( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

repeat( )

NAME

repeat( ) - spawn a task to call a function repeatedly

SYNOPSIS

int repeat
    (
    int     n,    /* no. of times to call func (0=forever) */
    FUNCPTR func, /* function to call repeatedly */
    int     arg1, /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )

DESCRIPTION

This command spawns a task that calls a specified function n times, with up to eight of its arguments. If n is 0, the routine is called endlessly, or until the spawned task is deleted.

NOTE

The task is spawned using sp( ). See the description of sp( ) for details about priority, options, stack size, and task ID.

RETURNS

A task ID, or ERROR if the task cannot be spawned.

SEE ALSO

usrLib, repeatRun( ), sp( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

sp( )

NAME

sp( ) - spawn a task with default parameters

SYNOPSIS

int sp
    (
    FUNCPTR func, /* function to call */
    int     arg1, /* first of nine args to pass to spawned task */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8,
    int     arg9
    )

DESCRIPTION

This command spawns a specified function as a task with the following defaults:

priority:

100

stack size:
20,000 bytes

task ID:
highest not currently used

task options:
VX_FP_TASK - execute with floating-point coprocessor support.

task name:
A name of the form tN where N is an integer which increments as new tasks are spawned, e.g., t1, t2, t3, etc.

The task ID is displayed after the task is spawned.

This command is a short form of the underlying taskSpawn( ) routine, convenient for spawning tasks in which the default parameters are satisfactory. If the default parameters are unacceptable, taskSpawn( ) should be called directly.

RETURNS

A task ID, or ERROR if the task cannot be spawned.

SEE ALSO

usrLib, taskLib, taskSpawn( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell

VARARGS1


Libraries : Routines

checkStack( )

NAME

checkStack( ) - print a summary of each task's stack usage

SYNOPSIS

void checkStack
    (
    int taskNameOrId /* task name or task ID; 0 = summarize all */
    )

DESCRIPTION

This command displays a summary of stack usage for a specified task, or for all tasks if no argument is given. The summary includes the total stack size (SIZE), the current number of stack bytes used (CUR), the maximum number of stack bytes used (HIGH), and the number of bytes never used at the top of the stack (MARGIN = SIZE - HIGH). For example:

    -> checkStack tShell

        NAME         ENTRY      TID    SIZE   CUR  HIGH  MARGIN
    ------------ ------------ -------- ----- ----- ----- ------
    tShell       _shell       23e1c78   9208   832  3632   5576
The maximum stack usage is determined by scanning down from the top of the stack for the first byte whose value is not 0xee. In VxWorks, when a task is spawned, all bytes of a task's stack are initialized to 0xee.

DEFICIENCIES

It is possible for a task to write beyond the end of its stack, but not write into the last part of its stack. This will not be detected by checkStack( ).

RETURNS

N/A

SEE ALSO

usrLib, taskSpawn( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

i( )

NAME

i( ) - print a summary of each task's TCB

SYNOPSIS

void i
    (
    int taskNameOrId /* task name or task ID, 0 = summarize all */
    )

DESCRIPTION

This command displays a synopsis of all the tasks in the system. The ti( ) routine provides more complete information on a specific task.

Both i( ) and ti( ) use taskShow( ); see the documentation for taskShow( ) for a description of the output format.

EXAMPLE

-> i

   NAME       ENTRY     TID    PRI   STATUS    PC       SP    ERRNO DELAY
---------- ---------- -------- --- --------- ------- -------- ----- -----
tExcTask   _excTask    20fcb00   0 PEND      200c5fc  20fca6c     0     0
tLogTask   _logTask    20fb5b8   0 PEND      200c5fc  20fb520     0     0
tShell     _shell      20efcac   1 READY     201dc90  20ef980     0     0
tRlogind   _rlogind    20f3f90   2 PEND      2038614  20f3db0     0     0
tTelnetd   _telnetd    20f2124   2 PEND      2038614  20f2070     0     0
tNetTask   _netTask    20f7398  50 PEND      2038614  20f7340     0     0
value = 57 = 0x39 = '9'

CAVEAT

This command should be used only as a debugging aid, since the information is obsolete by the time it is displayed.

RETURNS

N/A

SEE ALSO

usrLib, ti( ), taskShow( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

ti( )

NAME

ti( ) - print complete information from a task's TCB

SYNOPSIS

void ti
    (
    int taskNameOrId /* task name or task ID; 0 = use default */
    )

DESCRIPTION

This command prints the task control block (TCB) contents, including registers, for a specified task. If taskNameOrId is omitted or zero, the last task referenced is assumed.

The ti( ) routine uses taskShow( ); see the documentation for taskShow( ) for a description of the output format.

EXAMPLE

The following shows the TCB contents for the shell task:

-> ti

  NAME      ENTRY     TID    PRI  STATUS      PC       SP    ERRNO  DELAY
---------- --------- -------- --- --------- -------- -------- ------ -----
tShell     _shell     20efcac   1 READY      201dc90  20ef980      0     0

stack: base 0x20efcac  end 0x20ed59c  size 9532   high 1452   margin 8080

options: 0x1e
VX_UNBREAKABLE      VX_DEALLOC_STACK    VX_FP_TASK         VX_STDIO


D0 =       0   D4 =       0   A0 =       0   A4 =        0
D1 =       0   D5 =       0   A1 =       0   A5 =  203a084   SR =     3000
D2 =       0   D6 =       0   A2 =       0   A6 =  20ef9a0   PC =  2038614
D3 =       0   D7 =       0   A3 =       0   A7 =  20ef980
value = 34536868 = 0x20efda4

RETURNS

N/A

SEE ALSO

usrLib, taskShow( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

show( )

NAME

show( ) - print information on a specified object

SYNOPSIS

void show
    (
    int objId, /* object ID */
    int level  /* information level */
    )

DESCRIPTION

This command prints information on the specified object. System objects include tasks, local and shared semaphores, local and shared message queues, local and shared memory partitions, watchdogs, and symbol tables. An information level is interpreted by the objects show routine on a class by class basis. Refer to the object's library manual page for more information.

RETURNS

N/A

SEE ALSO

usrLib, i( ), ti( ), lkup( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

ts( )

NAME

ts( ) - suspend a task

SYNOPSIS

void ts
    (
    int taskNameOrId /* task name or task ID */
    )

DESCRIPTION

This command suspends the execution of a specified task. It simply calls taskSuspend( ).

RETURNS

N/A

SEE ALSO

usrLib, tr( ), taskSuspend( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

tr( )

NAME

tr( ) - resume a task

SYNOPSIS

void tr
    (
    int taskNameOrId /* task name or task ID */
    )

DESCRIPTION

This command resumes the execution of a suspended task. It simply calls taskResume( ).

RETURNS

N/A

SEE ALSO

usrLib, ts( ), taskResume( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

td( )

NAME

td( ) - delete a task

SYNOPSIS

void td
    (
    int taskNameOrId /* task name or task ID */
    )

DESCRIPTION

This command deletes a specified task. It simply calls taskDelete( ).

RETURNS

N/A

SEE ALSO

usrLib, taskDelete( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

version( )

NAME

version( ) - print VxWorks version information

SYNOPSIS


void version (void)

DESCRIPTION

This command prints the VxWorks version number, the date this copy of VxWorks was made, and other pertinent information.

EXAMPLE

-> version
VxWorks (for Mizar 7170) version 5.1
Kernel: WIND version 2.1.
Made on Tue Jul 27 20:26:23 CDT 1997.
Boot line:
enp(0,0)host:/usr/wpwr/target/config/mz7170/vxWorks e=90.0.0.50 h=90.0.0.4 u=target
value = 1 = 0x1

RETURNS

N/A

SEE ALSO

usrLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

m( )

NAME

m( ) - modify memory

SYNOPSIS

void m
    (
    void * adrs, /* address to change */
    int    width /* width of unit to be modified (1, 2, 4, 8) */
    )

DESCRIPTION

This command prompts the user for modifications to memory in byte, short word, or long word specified by width, starting at the specified address. It prints each address and the current contents of that address, in turn. If adrs or width is zero or absent, it defaults to the previous value. The user can respond in one of several ways:

RETURN
Do not change this address, but continue, prompting at the next address.

number
Set the content of this address to number.

. (dot)
Do not change this address, and quit.

EOF
Do not change this address, and quit.

All numbers entered and displayed are in hexadecimal.

RETURNS

N/A

SEE ALSO

usrLib, mRegs( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

d( )

NAME

d( ) - display memory

SYNOPSIS

void d
    (
    void * adrs,   /* address to display (if 0, display next block */
    int    nunits, /* number of units to print (if 0, use default) */
    int    width   /* width of displaying unit (1, 2, 4, 8) */
    )

DESCRIPTION

This command displays the contents of memory, starting at adrs. If adrs is omitted or zero, d( ) displays the next memory block, starting from where the last d( ) command completed.

Memory is displayed in units specified by width. If nunits is omitted or zero, the number of units displayed defaults to last use. If nunits is non-zero, that number of units is displayed and that number then becomes the default. If width is omitted or zero, it defaults to the previous value. If width is an invalid number, it is set to 1. The valid values for width are 1, 2, 4, and 8. The number of units d( ) displays is rounded up to the nearest number of full lines.

RETURNS

N/A

SEE ALSO

usrLib, m( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

cd( )

NAME

cd( ) - change the default directory

SYNOPSIS

STATUS cd
    (
    char * name /* new directory name */
    )

DESCRIPTION

This command sets the default directory to name. The default directory is a device name, optionally followed by a directory local to that device.

To change to a different directory, specify one of the following:

An instance of ".." indicates one level up in the directory tree.

Note that when accessing a remote file system via RSH or FTP, the VxWorks network device must already have been created using netDevCreate( ).

WARNING

The cd( ) command does very little checking that name represents a valid path. If the path is invalid, cd( ) may return OK, but subsequent calls that depend on the default path will fail.

EXAMPLES

The following example changes the directory to device /fd0/:

    -> cd "/fd0/"
This example changes the directory to device wrs: with the local directory ~leslie/target:
    -> cd "wrs:~leslie/target"
After the previous command, the following changes the directory to wrs:~leslie/target/config:
    -> cd "config"
After the previous command, the following changes the directory to wrs:~leslie/target/demo:
    -> cd "../demo"
After the previous command, the following changes the directory to wrs:/etc.
    -> cd "/etc"
Note that ~ can be used only on network devices (RSH or FTP).

RETURNS

OK or ERROR.

SEE ALSO

usrLib, pwd( ), VxWorks Programmer's Guide: Target Shell windsh, Tornado User's Guide: Shell


Libraries : Routines

pwd( )

NAME

pwd( ) - print the current default directory

SYNOPSIS


void pwd (void)

DESCRIPTION

This command displays the current working device/directory.

RETURNS

N/A

SEE ALSO

usrLib, cd( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

copy( )

NAME

copy( ) - copy in (or stdin) to out (or stdout)

SYNOPSIS

STATUS copy
    (
    char * in, /* name of file to read (if NULL assume stdin) */
    char * out /* name of file to write (if NULL assume stdout) */
    )

DESCRIPTION

This command copies from the input file to the output file, until an end-of-file is reached.

EXAMPLES

The following example displays the file dog, found on the default file device:

    -> copy <dog
This example copies from the console to the file dog, on device /ct0/, until an EOF (default CTRL-D) is typed:
    -> copy >/ct0/dog
This example copies the file dog, found on the default file device, to device /ct0/:
    -> copy <dog >/ct0/dog
This example makes a conventional copy from the file named file1 to the file named file2:
    -> copy "file1", "file2"
Remember that standard input and output are global; therefore, spawning the first three constructs will not work as expected.

RETURNS

OK, or ERROR if in or out cannot be opened/created, or if there is an error copying from in to out.

SEE ALSO

usrLib, copyStreams( ), tyEOFSet( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

copyStreams( )

NAME

copyStreams( ) - copy from/to specified streams

SYNOPSIS

STATUS copyStreams
    (
    int inFd, /* file descriptor of stream to copy from */
    int outFd /* file descriptor of stream to copy to */
    )

DESCRIPTION

This command copies from the stream identified by inFd to the stream identified by outFd until an end of file is reached in inFd. This command is used by copy( ).

RETURNS

OK, or ERROR if there is an error reading from inFd or writing to outFd.

SEE ALSO

usrLib, copy( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

diskFormat( )

NAME

diskFormat( ) - format a disk

SYNOPSIS

STATUS diskFormat
    (
    char * devName /* name of the device to initialize */
    )

DESCRIPTION

This command formats a disk and creates a file system on it. The device must already have been created by the device driver and initialized for use with a particular file system, via dosFsDevInit( ) or rt11FsDevInit( ).

This command calls ioctl( ) to perform the FIODISKFORMAT function.

EXAMPLE

    -> diskFormat "/fd0/"

RETURNS

OK, or ERROR if the device cannot be opened or formatted.

SEE ALSO

usrLib, dosFsLib, rt11FsLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

diskInit( )

NAME

diskInit( ) - initialize a file system on a block device

SYNOPSIS

STATUS diskInit
    (
    char * devName /* name of the device to initialize */
    )

DESCRIPTION

This command creates a new, blank file system on a block device. The device must already have been created by the device driver and initialized for use with a particular file system, via dosFsDevInit( ) or rt11FsDevInit( ).

This command calls ioctl( ) to perform the FIODISKINIT function.

EXAMPLE

    -> diskInit "/fd0/"

RETURNS

OK, or ERROR if the device cannot be opened or initialized.

SEE ALSO

usrLib, dosFsLib, rt11FsLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

squeeze( )

NAME

squeeze( ) - reclaim fragmented free space on an RT-11 volume

SYNOPSIS

STATUS squeeze
    (
    char * devName /* RT-11 device to squeeze, e.g., "/fd0/" */
    )

DESCRIPTION

This command moves data around on an RT-11 volume so that any areas of free space are merged.

NOTE

No device files should be open when this procedure is called. The subsequent condition of such files would be unknown and writing to them could corrupt the entire disk.

RETURNS

OK, or ERROR if the device cannot be opened or squeezed.

SEE ALSO

usrLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

ld( )

NAME

ld( ) - load an object module into memory

SYNOPSIS

MODULE_ID ld
    (
    int    syms,    /* -1, 0, or 1 */
    BOOL   noAbort, /* TRUE = don't abort script on error */
    char * name     /* name of object module, NULL = standard input */
    )

DESCRIPTION

This command loads an object module from a file or from standard input. The object module must be in UNIX a.out format. External references in the module are resolved during loading. The syms parameter determines how symbols are loaded; possible values are:

    0 - Add global symbols to the system symbol table.
    1 - Add global and local symbols to the system symbol table.
   -1 - Add no symbols to the system symbol table.

If there is an error during loading (e.g., externals undefined, too many symbols, etc.), then shellScriptAbort( ) is called to stop any script that this routine was called from. If noAbort is TRUE, errors are noted but ignored.

The normal way of using ld( ) is to load all symbols (syms = 1) during debugging and to load only global symbols later.

EXAMPLE

The following example loads the a.out file module from the default file device into memory, and adds any global symbols to the symbol table:

    -> ld <module
This example loads test.o with all symbols:
    -> ld 1,0,"test.o"

RETURNS

MODULE_ID, or NULL if there are too many symbols, the object file format is invalid, or there is an error reading the file.

SEE ALSO

usrLib, loadLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

ls( )

NAME

ls( ) - list the contents of a directory

SYNOPSIS

STATUS ls
    (
    char * dirName, /* name of dir to list */
    BOOL   doLong   /* if TRUE, do long listing */
    )

DESCRIPTION

This command is similar to UNIX ls. It lists the contents of a directory in one of two formats. If doLong is FALSE, only the names of the files (or subdirectories) in the specified directory are displayed. If doLong is TRUE, then the file name, size, date, and time are displayed. For a long listing, any entries that describe subdirectories are also flagged with the label "DIR".

The dirName parameter specifies which directory to list. If dirName is omitted or NULL, the current working directory is listed.

Empty directory entries and dosFs volume label entries are not reported.

NOTE

When used with netDrv devices (FTP or RSH), doLong has no effect.

RETURNS

OK or ERROR.

ERRNO

OK

SEE ALSO

usrLib, ll( ), lsOld( ), stat( ), VxWorks Programmer's Guide: Target Shell windsh, Tornado User's Guide: Shell


Libraries : Routines

ll( )

NAME

ll( ) - do a long listing of directory contents

SYNOPSIS

STATUS ll
    (
    char * dirName /* name of directory to list */
    )

DESCRIPTION

This command causes a long listing of a directory's contents to be displayed. It is equivalent to:

    -> ls dirName, TRUE

NOTE

When used with netDrv devices (FTP or RSH), ll( ) does not give directory information. It is equivalent to an ls( ) call with no long-listing option.

RETURNS

OK or ERROR.

SEE ALSO

usrLib, ls( ), stat( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

lsOld( )

NAME

lsOld( ) - list the contents of an RT-11 directory

SYNOPSIS

STATUS lsOld
    (
    char * dirName /* device to list */
    )

DESCRIPTION

This command is the old version of ls( ), which used the old-style ioctl( ) function FIODIRENTRY to get information about entries in a directory. Since VxWorks 5.0, a new version of ls( ), which uses POSIX directory and file functions, has replaced the older routine.

This version remains in the system to support certain drivers that do not currently support the POSIX directory and file functions. This includes netDrv, which provides the Remote Shell (RSH) and File Transfer Protocol (FTP) mode remote file access (although nfsDrv, which uses NFS, does support the directory calls). Also, the new ls( ) no longer reports empty directory entries on RT-11 disks (i.e., the entries that describe unallocated sections of an RT-11 disk).

If no directory name is specified, the current working directory is listed.

RETURNS

OK, or ERROR if the directory cannot be opened.

SEE ALSO

usrLib, ls( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

mkdir( )

NAME

mkdir( ) - make a directory

SYNOPSIS

STATUS mkdir
    (
    char * dirName /* directory name */
    )

DESCRIPTION

This command creates a new directory in a hierarchical file system. The dirName string specifies the name to be used for the new directory, and can be either a full or relative pathname.

This call is supported by the VxWorks NFS and dosFs file systems.

RETURNS

OK, or ERROR if the directory cannot be created.

SEE ALSO

usrLib, rmdir( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

rmdir( )

NAME

rmdir( ) - remove a directory

SYNOPSIS

STATUS rmdir
    (
    char * dirName /* name of directory to remove */
    )

DESCRIPTION

This command removes an existing directory from a hierarchical file system. The dirName string specifies the name of the directory to be removed, and may be either a full or relative pathname.

This call is supported by the VxWorks NFS and dosFs file systems.

RETURNS

OK, or ERROR if the directory cannot be removed.

SEE ALSO

usrLib, mkdir( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

rm( )

NAME

rm( ) - remove a file

SYNOPSIS

STATUS rm
    (
    char * fileName /* name of file to remove */
    )

DESCRIPTION

This command is provided for UNIX similarity. It simply calls remove( ).

RETURNS

OK, or ERROR if the file cannot be removed.

SEE ALSO

usrLib, remove( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

devs( )

NAME

devs( ) - list all system-known devices

SYNOPSIS


void devs (void)

DESCRIPTION

This command displays a list of all devices known to the I/O system.

RETURNS

N/A

SEE ALSO

usrLib, iosDevShow( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

lkup( )

NAME

lkup( ) - list symbols

SYNOPSIS

void lkup
    (
    char * substr /* substring to match */
    )

DESCRIPTION

This command lists all symbols in the system symbol table whose names contain the string substr. If substr is omitted or is 0, a short summary of symbol table statistics is printed. If substr is the empty string (""), all symbols in the table are listed.

This command also displays symbols that are local, i.e., symbols found in the system symbol table only because their module was loaded by ld( ).

By default, lkup( ) displays 22 symbols at a time. This can be changed by modifying the global variable symLkupPgSz. If this variable is set to 0, lkup( ) displays all the symbols without interruption.

RETURNS

N/A

SEE ALSO

usrLib, symLib, symEach( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

lkAddr( )

NAME

lkAddr( ) - list symbols whose values are near a specified value

SYNOPSIS

void lkAddr
    (
    unsigned int addr /* address around which to look */
    )

DESCRIPTION

This command lists the symbols in the system symbol table that are near a specified value. The symbols that are displayed include:

This command also displays symbols that are local, i.e., symbols found in the system symbol table only because their module was loaded by ld( ).

RETURNS

N/A

SEE ALSO

usrLib, symLib, symEach( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

mRegs( )

NAME

mRegs( ) - modify registers

SYNOPSIS

STATUS mRegs
    (
    char * regName,     /* register name, NULL for all */
    int    taskNameOrId /* task name or task ID, 0 = default task */
    )

DESCRIPTION

This command modifies the specified register for the specified task. If taskNameOrId is omitted or zero, the last task referenced is assumed. If the specified register is not found, it prints out the valid register list and returns ERROR. If no register is specified, it sequentially prompts the user for new values for a task's registers. It displays each register and the current contents of that register, in turn. The user can respond in one of several ways:

RETURN
Do not change this register, but continue, prompting at the next register.

number
Set this register to number.

. (dot)
Do not change this register, and quit.

EOF
Do not change this register, and quit.

All numbers are entered and displayed in hexadecimal, except floating-point values, which may be entered in double precision.

RETURNS

OK, or ERROR if the task or register does not exist.

SEE ALSO

usrLib, m( ), VxWorks Programmer's Guide: Target Shell windsh, Tornado User's Guide: Shell


Libraries : Routines

pc( )

NAME

pc( ) - return the contents of the program counter

SYNOPSIS

int pc
    (
    int task /* task ID */
    )

DESCRIPTION

This command extracts the contents of the program counter for a specified task from the task's TCB. If task is omitted or 0, the current task is used.

RETURNS

The contents of the program counter.

SEE ALSO

usrLib, ti( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

printErrno( )

NAME

printErrno( ) - print the definition of a specified error status value

SYNOPSIS

void printErrno
    (
    int errNo /* status code whose name is to be printed */
    )

DESCRIPTION

This command displays the error-status string, corresponding to a specified error-status value. It is only useful if the error-status symbol table has been built and included in the system. If errNo is zero, then the current task status is used by calling errnoGet( ).

This facility is described in errnoLib.

RETURNS

N/A

SEE ALSO

usrLib, errnoLib, errnoGet( ), VxWorks Programmer's Guide: Target Shell windsh, Tornado User's Guide: Shell


Libraries : Routines

printLogo( )

NAME

printLogo( ) - print the VxWorks logo

SYNOPSIS


void printLogo (void)

DESCRIPTION

This command displays the VxWorks banner seen at boot time. It also displays the VxWorks version number and kernel version number.

RETURNS

N/A

SEE ALSO

usrLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

logout( )

NAME

logout( ) - log out of the VxWorks system

SYNOPSIS


void logout (void)

DESCRIPTION

This command logs out of the VxWorks shell. If a remote login is active (via rlogin or telnet), it is stopped, and standard I/O is restored to the console.

SEE ALSO

usrLib, rlogin( ), telnet( ), shellLogout( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

h( )

NAME

h( ) - display or set the size of shell history

SYNOPSIS

void h
    (
    int size /* 0 = display, >0 = set history to new size */
    )

DESCRIPTION

This command displays or sets the size of VxWorks shell history. If no argument is specified, shell history is displayed. If size is specified, that number of the most recent commands is saved for display. The value of size is initially 20.

RETURNS

N/A

SEE ALSO

usrLib, shellHistory( ), ledLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

spyReport( )

NAME

spyReport( ) - display task activity data

SYNOPSIS


void spyReport (void)

DESCRIPTION

This routine reports on data gathered at interrupt level for the amount of CPU time utilized by each task, the amount of time spent at interrupt level, the amount of time spent in the kernel, and the amount of idle time. Time is displayed in ticks and as a percentage, and the data is shown since both the last call to spyClkStart( ) and the last spyReport( ). If no interrupts have occurred since the last spyReport( ), nothing is displayed.

RETURNS

N/A

SEE ALSO

usrLib, spyLib, spyClkStart( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

spyTask( )

NAME

spyTask( ) - run periodic task activity reports

SYNOPSIS

void spyTask
    (
    int freq /* reporting frequency, in seconds */
    )

DESCRIPTION

This routine is spawned as a task by spy( ) to provide periodic task activity reports. It prints a report, delays for the specified number of seconds, and repeats.

RETURNS

N/A

SEE ALSO

usrLib, spyLib, spy( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

spy( )

NAME

spy( ) - begin periodic task activity reports

SYNOPSIS

void spy
    (
    int freq,       /* reporting freq in sec, 0 = default of 5 */
    int ticksPerSec /* interrupt clock freq, 0 = default of 100 */
    )

DESCRIPTION

This routine collects task activity data and periodically runs spyReport( ). Data is gathered ticksPerSec times per second, and a report is made every freq seconds. If freq is zero, it defaults to 5 seconds. If ticksPerSec is omitted or zero, it defaults to 100.

This routine spawns spyTask( ) to do the actual reporting.

It is not necessary to call spyClkStart( ) before running spy( ).

RETURNS

N/A

SEE ALSO

usrLib, spyLib, spyClkStart( ), spyTask( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

spyClkStart( )

NAME

spyClkStart( ) - start collecting task activity data

SYNOPSIS

STATUS spyClkStart
    (
    int intsPerSec /* timer interrupt freq, 0 = default of 100 */
    )

DESCRIPTION

This routine begins data collection by enabling the auxiliary clock interrupts at a frequency of intsPerSec interrupts per second. If intsPerSec is omitted or zero, the frequency will be 100. Data from previous collections is cleared.

RETURNS

OK, or ERROR if the CPU has no auxiliary clock, or if task create and delete hooks cannot be installed.

SEE ALSO

usrLib, spyLib, sysAuxClkConnect( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

spyClkStop( )

NAME

spyClkStop( ) - stop collecting task activity data

SYNOPSIS


void spyClkStop (void)

DESCRIPTION

This routine disables the auxiliary clock interrupts. Data collected remains valid until the next spyClkStart( ) call.

RETURNS

N/A

SEE ALSO

usrLib, spyLib, spyClkStart( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

spyStop( )

NAME

spyStop( ) - stop spying and reporting

SYNOPSIS


void spyStop (void)

DESCRIPTION

This routine calls spyClkStop( ). Any periodic reporting by spyTask( ) is terminated.

RETURNS

N/A

SEE ALSO

usrLib, spyLib, spyClkStop( ), spyTask( ), VxWorks Programmer's Guide: Target Shell


Libraries : Routines

spyHelp( )

NAME

spyHelp( ) - display task monitoring help menu

SYNOPSIS


void spyHelp (void)

DESCRIPTION

This routine displays a summary of spyLib utilities:

spyHelp                       Print this list
spyClkStart [ticksPerSec]     Start task activity monitor running
                                at ticksPerSec ticks per second
spyClkStop                    Stop collecting data
spyReport                     Prints display of task activity
                                statistics
spyStop                       Stop collecting data and reports
spy     [freq[,ticksPerSec]]  Start spyClkStart and do a report
                                every freq seconds

ticksPerSec defaults to 100.  freq defaults to 5 seconds.

RETURNS

N/A

SEE ALSO

usrLib, spyLib, VxWorks Programmer's Guide: Target Shell