forked from Imagelibrary/rtems
Whitespace removal.
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
|
||||
/* libi2c Implementation */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Authorship
|
||||
* ----------
|
||||
* This software was created by
|
||||
* Till Straumann <strauman@slac.stanford.edu>, 2005,
|
||||
* Stanford Linear Accelerator Center, Stanford University.
|
||||
*
|
||||
*
|
||||
* Acknowledgement of sponsorship
|
||||
* ------------------------------
|
||||
* This software was produced by
|
||||
* the Stanford Linear Accelerator Center, Stanford University,
|
||||
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
||||
*
|
||||
*
|
||||
* Government disclaimer of liability
|
||||
* ----------------------------------
|
||||
* Neither the United States nor the United States Department of Energy,
|
||||
@@ -23,18 +23,18 @@
|
||||
* completeness, or usefulness of any data, apparatus, product, or process
|
||||
* disclosed, or represents that its use would not infringe privately owned
|
||||
* rights.
|
||||
*
|
||||
*
|
||||
* Stanford disclaimer of liability
|
||||
* --------------------------------
|
||||
* Stanford University makes no representations or warranties, express or
|
||||
* implied, nor assumes any liability for the use of this software.
|
||||
*
|
||||
*
|
||||
* Stanford disclaimer of copyright
|
||||
* --------------------------------
|
||||
* Stanford University, owner of the copyright, hereby disclaims its
|
||||
* copyright and all other rights in this software. Hence, anyone may
|
||||
* freely use it for any purpose without restriction.
|
||||
*
|
||||
* freely use it for any purpose without restriction.
|
||||
*
|
||||
* Maintenance of notices
|
||||
* ----------------------
|
||||
* In the interest of clarity regarding the origin and status of this
|
||||
@@ -43,11 +43,11 @@
|
||||
* or distributed by the recipient and are to be affixed to any copy of
|
||||
* software made or distributed by the recipient that contains a copy or
|
||||
* derivative of this software.
|
||||
*
|
||||
*
|
||||
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
||||
*/
|
||||
*/
|
||||
/*
|
||||
* adaptations to also handle SPI devices
|
||||
* adaptations to also handle SPI devices
|
||||
* by Thomas Doerfler, embedded brains GmbH, Puchheim, Germany
|
||||
*/
|
||||
#if HAVE_CONFIG_H
|
||||
@@ -357,7 +357,7 @@ rtems_libi2c_initialize (void)
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* rtems_io_register_driver does NOT currently check nor report back
|
||||
* the return code of the 'init' operation, so we cannot
|
||||
* rely on return code since it may seem OK even if the driver 'init;
|
||||
@@ -534,8 +534,8 @@ rtems_libi2c_send_addr (rtems_device_minor_number minor, int rw)
|
||||
}
|
||||
|
||||
int
|
||||
rtems_libi2c_read_bytes (rtems_device_minor_number minor,
|
||||
unsigned char *bytes,
|
||||
rtems_libi2c_read_bytes (rtems_device_minor_number minor,
|
||||
unsigned char *bytes,
|
||||
int nbytes)
|
||||
{
|
||||
int sc;
|
||||
@@ -551,8 +551,8 @@ rtems_libi2c_read_bytes (rtems_device_minor_number minor,
|
||||
}
|
||||
|
||||
int
|
||||
rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
||||
const unsigned char *bytes,
|
||||
rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
||||
const unsigned char *bytes,
|
||||
int nbytes)
|
||||
{
|
||||
int sc;
|
||||
@@ -568,7 +568,7 @@ rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
||||
}
|
||||
|
||||
int
|
||||
rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
int cmd,
|
||||
...)
|
||||
{
|
||||
@@ -577,15 +577,15 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
void *args;
|
||||
bool is_started = false;
|
||||
DECL_CHECKED_BH (busno, bush, minor, -)
|
||||
|
||||
|
||||
va_start(ap, cmd);
|
||||
args = va_arg(ap, void *);
|
||||
|
||||
switch(cmd) {
|
||||
/*
|
||||
* add ioctls defined for this level here:
|
||||
* add ioctls defined for this level here:
|
||||
*/
|
||||
|
||||
|
||||
case RTEMS_LIBI2C_IOCTL_GET_DRV_T:
|
||||
/*
|
||||
* query driver table entry
|
||||
@@ -611,18 +611,18 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
* set tfr mode
|
||||
*/
|
||||
if (sc == 0) {
|
||||
sc = bush->ops->ioctl
|
||||
(bush,
|
||||
RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
|
||||
sc = bush->ops->ioctl
|
||||
(bush,
|
||||
RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
|
||||
&((rtems_libi2c_tfm_read_write_t *)args)->tfr_mode);
|
||||
}
|
||||
/*
|
||||
* perform read_write
|
||||
*/
|
||||
if (sc == 0) {
|
||||
sc = bush->ops->ioctl
|
||||
(bush,
|
||||
RTEMS_LIBI2C_IOCTL_READ_WRITE,
|
||||
sc = bush->ops->ioctl
|
||||
(bush,
|
||||
RTEMS_LIBI2C_IOCTL_READ_WRITE,
|
||||
&((rtems_libi2c_tfm_read_write_t *)args)->rd_wr);
|
||||
}
|
||||
if ((sc < 0) && (is_started)) {
|
||||
@@ -637,9 +637,9 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
}
|
||||
|
||||
static int
|
||||
do_s_rw (rtems_device_minor_number minor,
|
||||
unsigned char *bytes,
|
||||
int nbytes,
|
||||
do_s_rw (rtems_device_minor_number minor,
|
||||
unsigned char *bytes,
|
||||
int nbytes,
|
||||
int rw)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
@@ -669,7 +669,7 @@ do_s_rw (rtems_device_minor_number minor,
|
||||
}
|
||||
|
||||
int
|
||||
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
||||
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
||||
unsigned char *bytes,
|
||||
int nbytes)
|
||||
{
|
||||
@@ -677,7 +677,7 @@ rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
||||
}
|
||||
|
||||
int
|
||||
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
||||
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
||||
const unsigned char *bytes,
|
||||
int nbytes)
|
||||
{
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
#define _RTEMS_LIBI2C_H
|
||||
/*$Id$*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Authorship
|
||||
* ----------
|
||||
* This software was created by
|
||||
* Till Straumann <strauman@slac.stanford.edu>, 2005,
|
||||
* Stanford Linear Accelerator Center, Stanford University.
|
||||
*
|
||||
*
|
||||
* Acknowledgement of sponsorship
|
||||
* ------------------------------
|
||||
* This software was produced by
|
||||
* the Stanford Linear Accelerator Center, Stanford University,
|
||||
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
||||
*
|
||||
*
|
||||
* Government disclaimer of liability
|
||||
* ----------------------------------
|
||||
* Neither the United States nor the United States Department of Energy,
|
||||
@@ -31,18 +31,18 @@
|
||||
* completeness, or usefulness of any data, apparatus, product, or process
|
||||
* disclosed, or represents that its use would not infringe privately owned
|
||||
* rights.
|
||||
*
|
||||
*
|
||||
* Stanford disclaimer of liability
|
||||
* --------------------------------
|
||||
* Stanford University makes no representations or warranties, express or
|
||||
* implied, nor assumes any liability for the use of this software.
|
||||
*
|
||||
*
|
||||
* Stanford disclaimer of copyright
|
||||
* --------------------------------
|
||||
* Stanford University, owner of the copyright, hereby disclaims its
|
||||
* copyright and all other rights in this software. Hence, anyone may
|
||||
* freely use it for any purpose without restriction.
|
||||
*
|
||||
* freely use it for any purpose without restriction.
|
||||
*
|
||||
* Maintenance of notices
|
||||
* ----------------------
|
||||
* In the interest of clarity regarding the origin and status of this
|
||||
@@ -51,9 +51,9 @@
|
||||
* or distributed by the recipient and are to be affixed to any copy of
|
||||
* software made or distributed by the recipient that contains a copy or
|
||||
* derivative of this software.
|
||||
*
|
||||
*
|
||||
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
@@ -118,7 +118,7 @@ rtems_i2c_ioctl (
|
||||
|
||||
extern const rtems_driver_address_table rtems_libi2c_io_ops;
|
||||
|
||||
/* Unfortunately, if you want to add this driver to
|
||||
/* Unfortunately, if you want to add this driver to
|
||||
* a RTEMS configuration table then you need all the
|
||||
* members explicitly :-( (Device_driver_table should
|
||||
* hold pointers to rtems_driver_address_tables rather
|
||||
@@ -131,7 +131,7 @@ extern const rtems_driver_address_table rtems_libi2c_io_ops;
|
||||
*
|
||||
* Currently the preferred way is having the BSP
|
||||
* call 'rtems_libi2c_initialize' followed by
|
||||
* 'rtems_libi2c_register_bus' and
|
||||
* 'rtems_libi2c_register_bus' and
|
||||
* 'rtems_libi2c_register_drv' and/or
|
||||
* 'mknod' (for 'raw' device nodes)
|
||||
* from the 'pretasking_hook'.
|
||||
@@ -165,7 +165,7 @@ typedef struct rtems_libi2c_bus_t_
|
||||
} rtems_libi2c_bus_t;
|
||||
|
||||
/* Access functions a low level driver must provide;
|
||||
*
|
||||
*
|
||||
* All of these, except read_bytes and write_bytes
|
||||
* return RTEMS_SUCCESSFUL on success and an error status
|
||||
* otherwise. The read and write ops return the number
|
||||
@@ -189,7 +189,7 @@ typedef struct rtems_libi2c_bus_ops_
|
||||
int (*write_bytes) (rtems_libi2c_bus_t * bushdl, unsigned char *bytes,
|
||||
int nbytes);
|
||||
/* ioctl misc functions */
|
||||
int (*ioctl) (rtems_libi2c_bus_t * bushdl,
|
||||
int (*ioctl) (rtems_libi2c_bus_t * bushdl,
|
||||
int cmd,
|
||||
void *buffer
|
||||
);
|
||||
@@ -205,7 +205,7 @@ typedef struct rtems_libi2c_bus_ops_
|
||||
* (i.e., libi2c) and the minor number encodes a bus# and a i2c address.
|
||||
*
|
||||
* The name will be registered in the filesystem (parent
|
||||
* directories must exist, also IMFS filesystem must exist see
|
||||
* directories must exist, also IMFS filesystem must exist see
|
||||
* CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM). It may be NULL in which case
|
||||
* the library will pick a default.
|
||||
*
|
||||
@@ -264,10 +264,10 @@ extern rtems_device_major_number rtems_libi2c_major;
|
||||
* operations (the aforementioned EEPROM interprets any 3rd
|
||||
* and following byte written to the device as data, i.e., the
|
||||
* contents could easily be changed!).
|
||||
* The correct 'read-pointer offset' programming could be
|
||||
* The correct 'read-pointer offset' programming could be
|
||||
* implemented in 'open' and 'ioctl' of a high-level driver and
|
||||
* the user would then only have to perform harmless read
|
||||
* operations, e.g.,
|
||||
* operations, e.g.,
|
||||
*
|
||||
* fd = open("/dev/i2c.eeprom",O_RDONLY) / * opens and sets EEPROM read pointer * /
|
||||
* ioctl(fd, IOCTL_SEEK, 0x200) / * repositions the read pointer * /
|
||||
@@ -278,14 +278,14 @@ extern rtems_device_major_number rtems_libi2c_major;
|
||||
|
||||
/* struct provided at driver registration. The driver may store
|
||||
* private data behind the mandatory first fields but the size
|
||||
* must be set to the size of the entire struct, e.g.,
|
||||
* must be set to the size of the entire struct, e.g.,
|
||||
*
|
||||
* struct driver_pvt {
|
||||
* rtems_libi2c_drv_t pub;
|
||||
* struct { ... } pvt;
|
||||
* } my_driver = {
|
||||
* { ops: my_ops,
|
||||
* size: sizeof(my_driver)
|
||||
* size: sizeof(my_driver)
|
||||
* },
|
||||
* { ...};
|
||||
* };
|
||||
@@ -305,7 +305,7 @@ typedef struct rtems_libi2c_drv_t_
|
||||
*
|
||||
* The registration procedure also creates a filesystem node,
|
||||
* i.e., the returned minor number is not really needed.
|
||||
*
|
||||
*
|
||||
* If the 'name' argument is NULL, no filesystem node is
|
||||
* created (but this can be done 'manually' using rtems_libi2c_major
|
||||
* and the return value of this routine).
|
||||
@@ -357,13 +357,13 @@ rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
||||
|
||||
/* Send start, send address and read bytes */
|
||||
extern int
|
||||
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
||||
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
||||
unsigned char *bytes,
|
||||
int nbytes);
|
||||
|
||||
/* Send start, send address and write bytes */
|
||||
extern int
|
||||
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
||||
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
||||
const unsigned char *bytes,
|
||||
int nbytes);
|
||||
|
||||
@@ -385,12 +385,12 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
||||
* RTEMS_LIBI2C_IOCTL_READ_WRITE,
|
||||
* rtems_libi2c_read_write_t *arg);
|
||||
*
|
||||
* This call performs a simultanous read/write transfer,
|
||||
*
|
||||
* This call performs a simultanous read/write transfer,
|
||||
* which is possible (and sometimes needed) for SPI devices
|
||||
*
|
||||
*
|
||||
* arg is a pointer to a rd_wr info data structure
|
||||
*
|
||||
*
|
||||
* This call is only needed for SPI devices
|
||||
*/
|
||||
#define RTEMS_LIBI2C_IOCTL_START_TFM_READ_WRITE 2
|
||||
@@ -401,17 +401,17 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
* const unsigned char *wr_buffer,
|
||||
* int byte_cnt,
|
||||
* const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
|
||||
*
|
||||
*
|
||||
* This call addresses a slave and then:
|
||||
* - sets the proper transfer mode,
|
||||
* - performs a simultanous read/write transfer,
|
||||
* - performs a simultanous read/write transfer,
|
||||
* (which is possible and sometimes needed for SPI devices)
|
||||
* NOTE: - if rd_buffer is NULL, receive data will be dropped
|
||||
* - if wr_buffer is NULL, bytes with content 0 will transmitted
|
||||
*
|
||||
* rd_buffer is a pointer to a receive buffer (or NULL)
|
||||
*
|
||||
* rd_buffer is a pointer to a receive buffer (or NULL)
|
||||
* wr_buffer is a pointer to the data to be sent (or NULL)
|
||||
*
|
||||
*
|
||||
* This call is only needed for SPI devices
|
||||
*/
|
||||
|
||||
@@ -420,12 +420,12 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
||||
* RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
|
||||
* const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
|
||||
*
|
||||
*
|
||||
* This call sets an SPI device to the transfer mode needed (baudrate etc.)
|
||||
*
|
||||
*
|
||||
* tfr_mode is a pointer to a structure defining the SPI transfer mode needed
|
||||
* (see below).
|
||||
*
|
||||
* (see below).
|
||||
*
|
||||
* This call is only needed for SPI devices
|
||||
*/
|
||||
|
||||
@@ -435,10 +435,10 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
||||
* RTEMS_LIBI2C_IOCTL_GET_DRV_T,
|
||||
* const rtems_libi2c_drv_t *drv_t_ptr);
|
||||
*
|
||||
*
|
||||
* This call allows the a high-level driver to query its driver table entry,
|
||||
* including its private data appended to it during creation of the entry
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,16 +42,16 @@ const char *rtems_bsp_cmdline_get_param(
|
||||
)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
|
||||
if ( !name )
|
||||
return NULL;
|
||||
|
||||
|
||||
if ( !value )
|
||||
return NULL;
|
||||
|
||||
|
||||
if ( !length )
|
||||
return NULL;
|
||||
|
||||
|
||||
value[0] = '\0';
|
||||
|
||||
p = rtems_bsp_cmdline_get_param_raw( name );
|
||||
|
||||
@@ -23,7 +23,7 @@ const char *rtems_bsp_cmdline_get_param_raw(
|
||||
|
||||
if ( !name )
|
||||
return NULL;
|
||||
|
||||
|
||||
if ( !bsp_boot_cmdline )
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -37,6 +37,6 @@ const char *rtems_bsp_cmdline_get_param_rhs(
|
||||
if ( *(d-1) == '\"' )
|
||||
d--;
|
||||
*d = '\0';
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg __attribute__((unuse
|
||||
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
|
||||
rtems_task_priority floor = rtems_capture_watch_get_floor ();
|
||||
int last_count = 0;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
rtems_capture_task_t* tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
|
||||
@@ -431,14 +431,14 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg __attribute__((unuse
|
||||
|
||||
if (count < RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS)
|
||||
{
|
||||
j = RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS - count;
|
||||
j = RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS - count;
|
||||
while (j > 0)
|
||||
{
|
||||
fprintf (stdout, "\x1b[K\n");
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
last_count = count;
|
||||
|
||||
cli_load_thread_active = 0;
|
||||
@@ -477,13 +477,13 @@ rtems_capture_cli_task_load (int argc __attribute__((un
|
||||
}
|
||||
|
||||
name = rtems_build_name('C', 'P', 'l', 't');
|
||||
|
||||
|
||||
sc = rtems_task_create (name, priority, 4 * 1024,
|
||||
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
|
||||
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
|
||||
&id);
|
||||
|
||||
if (sc != RTEMS_SUCCESSFUL)
|
||||
|
||||
if (sc != RTEMS_SUCCESSFUL)
|
||||
{
|
||||
fprintf (stdout, "error: cannot create helper thread: %s\n",
|
||||
rtems_status_text (sc));
|
||||
@@ -660,7 +660,7 @@ rtems_capture_cli_get_name_id (char* arg,
|
||||
* remove unless the score has been updated.
|
||||
*/
|
||||
rtems_name rname;
|
||||
|
||||
|
||||
rname = rtems_build_name(arg[0], arg[1], arg[2], arg[3]);
|
||||
*name = rname;
|
||||
*valid_name = true;
|
||||
@@ -1118,7 +1118,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
||||
{
|
||||
bool found = false;
|
||||
int t;
|
||||
|
||||
|
||||
for (t = 0; t < RTEMS_CAPTURE_CLI_TRIGGERS_NUM; t++)
|
||||
if (strcmp (argv[arg], rtems_capture_cli_triggers[t].name) == 0)
|
||||
{
|
||||
@@ -1141,7 +1141,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
||||
{
|
||||
if (is_from)
|
||||
fprintf (stdout, "warning: extra 'from' ignored\n");
|
||||
|
||||
|
||||
is_from = 1;
|
||||
continue;
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
||||
else
|
||||
fprintf (stdout, "warning: extra arguments ignored\n");
|
||||
}
|
||||
|
||||
|
||||
if (valid_id)
|
||||
{
|
||||
if (is_from)
|
||||
@@ -1200,7 +1200,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
||||
rtems_capture_cli_triggers[trigger].name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!to_valid_name && !to_valid_id && !from_valid_name && !from_valid_id)
|
||||
{
|
||||
fprintf (stdout, trigger_set_usage);
|
||||
@@ -1351,7 +1351,7 @@ rtems_capture_cli_trace_records (int argc,
|
||||
* If we have no records then just exist. We still need to release
|
||||
* the reader lock.
|
||||
*/
|
||||
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
rtems_capture_release (read);
|
||||
@@ -1359,7 +1359,7 @@ rtems_capture_cli_trace_records (int argc,
|
||||
}
|
||||
|
||||
count = total < read ? total : read;
|
||||
|
||||
|
||||
while (count--)
|
||||
{
|
||||
if (csv)
|
||||
@@ -1403,7 +1403,7 @@ rtems_capture_cli_trace_records (int argc,
|
||||
}
|
||||
|
||||
count = total < read ? total : read;
|
||||
|
||||
|
||||
if (count < total)
|
||||
total -= count;
|
||||
else
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
* watch filters.
|
||||
*
|
||||
* This feature has been disabled as it becomes confusing when
|
||||
* setting up filters and some event leak.
|
||||
* setting up filters and some event leak.
|
||||
*/
|
||||
#if defined (RTEMS_CAPTURE_ENGINE_ALLOW_RELATED_EVENTS)
|
||||
#define RTEMS_CAPTURE_RECORD_EVENTS (RTEMS_CAPTURE_CREATED_BY_EVENT | \
|
||||
@@ -220,7 +220,7 @@ rtems_capture_by_in_to (uint32_t events,
|
||||
uint32_t valid_mask = RTEMS_CAPTURE_CONTROL_FROM_MASK (0);
|
||||
uint32_t valid_remainder = 0xffffffff;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
||||
{
|
||||
/*
|
||||
@@ -245,11 +245,11 @@ rtems_capture_by_in_to (uint32_t events,
|
||||
by->name, by->id))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
valid_mask >>= 1;
|
||||
valid_remainder >>= 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
|
||||
rtems_capture_task_t* task;
|
||||
rtems_capture_control_t* control;
|
||||
rtems_name name;
|
||||
|
||||
|
||||
task = _Workspace_Allocate (sizeof (rtems_capture_task_t));
|
||||
|
||||
if (task == NULL)
|
||||
@@ -414,9 +414,9 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
|
||||
*/
|
||||
|
||||
rtems_object_get_classic_name( new_task->Object.id, &name );
|
||||
|
||||
|
||||
rtems_capture_dup_name (&task->name, name);
|
||||
|
||||
|
||||
task->id = new_task->Object.id;
|
||||
task->flags = 0;
|
||||
task->in = 0;
|
||||
@@ -590,14 +590,14 @@ rtems_capture_trigger (rtems_capture_task_t* ft,
|
||||
uint32_t from_events = 0;
|
||||
uint32_t to_events = 0;
|
||||
uint32_t from_to_events = 0;
|
||||
|
||||
|
||||
if (ft)
|
||||
{
|
||||
fc = ft->control;
|
||||
if (fc)
|
||||
from_events = fc->from_triggers & events;
|
||||
}
|
||||
|
||||
|
||||
if (tt)
|
||||
{
|
||||
tc = tt->control;
|
||||
@@ -636,7 +636,7 @@ rtems_capture_trigger (rtems_capture_task_t* ft,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -711,7 +711,7 @@ rtems_capture_start_task (rtems_tcb* current_task,
|
||||
|
||||
if (st == NULL)
|
||||
st = rtems_capture_create_capture_task (started_task);
|
||||
|
||||
|
||||
if (rtems_capture_trigger (ct, st, RTEMS_CAPTURE_START))
|
||||
{
|
||||
rtems_capture_record (ct, RTEMS_CAPTURE_STARTED_BY_EVENT);
|
||||
@@ -802,7 +802,7 @@ rtems_capture_delete_task (rtems_tcb* current_task,
|
||||
rtems_capture_record (ct, RTEMS_CAPTURE_DELETED_BY_EVENT);
|
||||
rtems_capture_record (dt, RTEMS_CAPTURE_DELETED_EVENT);
|
||||
}
|
||||
|
||||
|
||||
rtems_capture_task_stack_usage (dt);
|
||||
|
||||
/*
|
||||
@@ -1223,7 +1223,7 @@ rtems_capture_flush (bool prime)
|
||||
capture_count = 0;
|
||||
capture_in = capture_records;
|
||||
capture_out = 0;
|
||||
|
||||
|
||||
rtems_interrupt_enable (level);
|
||||
|
||||
task = capture_tasks;
|
||||
@@ -1540,7 +1540,7 @@ rtems_capture_set_trigger (rtems_name from_name,
|
||||
* FROM ANY means trigger when the event happens TO this
|
||||
* task. TO ANY means FROM this task.
|
||||
*/
|
||||
|
||||
|
||||
if (mode == rtems_capture_to_any)
|
||||
{
|
||||
control = rtems_capture_create_control (from_name, from_id);
|
||||
@@ -1559,9 +1559,9 @@ rtems_capture_set_trigger (rtems_name from_name,
|
||||
{
|
||||
bool done = false;
|
||||
int i;
|
||||
|
||||
|
||||
control->by_triggers |= flags;
|
||||
|
||||
|
||||
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
||||
{
|
||||
if (rtems_capture_control_by_valid (control, i) &&
|
||||
@@ -1616,7 +1616,7 @@ rtems_capture_clear_trigger (rtems_name from_name,
|
||||
uint32_t flags;
|
||||
|
||||
flags = rtems_capture_map_trigger (trigger);
|
||||
|
||||
|
||||
if (mode == rtems_capture_to_any)
|
||||
{
|
||||
control = rtems_capture_find_control (from_name, from_id);
|
||||
@@ -1643,9 +1643,9 @@ rtems_capture_clear_trigger (rtems_name from_name,
|
||||
{
|
||||
bool done = false;
|
||||
int i;
|
||||
|
||||
|
||||
control->by_triggers &= ~flags;
|
||||
|
||||
|
||||
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
||||
{
|
||||
if (rtems_capture_control_by_valid (control, i) &&
|
||||
@@ -1808,7 +1808,7 @@ rtems_capture_release (uint32_t count)
|
||||
{
|
||||
rtems_capture_record_t* rec;
|
||||
uint32_t counted;
|
||||
|
||||
|
||||
rtems_interrupt_level level;
|
||||
|
||||
rtems_interrupt_disable (level);
|
||||
@@ -1819,7 +1819,7 @@ rtems_capture_release (uint32_t count)
|
||||
rtems_interrupt_enable (level);
|
||||
|
||||
counted = count;
|
||||
|
||||
|
||||
rec = &capture_records[capture_out];
|
||||
|
||||
while (counted--)
|
||||
@@ -1828,7 +1828,7 @@ rtems_capture_release (uint32_t count)
|
||||
rtems_capture_destroy_capture_task (rec->task);
|
||||
rec++;
|
||||
}
|
||||
|
||||
|
||||
rtems_interrupt_disable (level);
|
||||
|
||||
capture_count -= count;
|
||||
|
||||
@@ -85,7 +85,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
(*print)(
|
||||
context,
|
||||
"-------------------------------------------------------------------------------\n"
|
||||
@@ -113,7 +113,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
continue;
|
||||
|
||||
rtems_object_get_name( the_thread->Object.id, sizeof(name), name );
|
||||
|
||||
|
||||
(*print)(
|
||||
context,
|
||||
" 0x%08" PRIx32 " | %-38s |",
|
||||
|
||||
@@ -242,7 +242,7 @@ rtems_monitor_line_editor (
|
||||
|
||||
extended_key = rtems_monitor_getchar ();
|
||||
c = extended_key & KEYS_NORMAL_MASK;
|
||||
|
||||
|
||||
/*
|
||||
* Make the extended_key usable as a boolean.
|
||||
*/
|
||||
|
||||
@@ -101,7 +101,7 @@ rtems_monitor_init_task_dump(
|
||||
length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
|
||||
|
||||
length += rtems_monitor_pad(25, length);
|
||||
length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]",
|
||||
length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]",
|
||||
monitor_itask->argument, monitor_itask->argument);
|
||||
|
||||
length += rtems_monitor_pad(39, length);
|
||||
|
||||
@@ -50,19 +50,19 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
memset(&dstaddr, 0, sizeof(dstaddr));
|
||||
memset(&netmask, 0, sizeof(netmask));
|
||||
memset(&broadcast, 0, sizeof(broadcast));
|
||||
|
||||
|
||||
ipaddr.sin_len = sizeof(ipaddr);
|
||||
ipaddr.sin_family = AF_INET;
|
||||
|
||||
|
||||
dstaddr.sin_len = sizeof(dstaddr);
|
||||
dstaddr.sin_family = AF_INET;
|
||||
|
||||
|
||||
netmask.sin_len = sizeof(netmask);
|
||||
netmask.sin_family = AF_INET;
|
||||
|
||||
|
||||
broadcast.sin_len = sizeof(broadcast);
|
||||
broadcast.sin_family = AF_INET;
|
||||
|
||||
|
||||
cur_idx = 0;
|
||||
if (argc <= 1) {
|
||||
/* display all interfaces */
|
||||
@@ -81,11 +81,11 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
cur_idx += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((f_down !=0) && (f_ip != 0)) {
|
||||
f_up = 1;
|
||||
}
|
||||
|
||||
|
||||
while(argc > cur_idx) {
|
||||
if (strcmp(argv[cur_idx], "up") == 0) {
|
||||
f_up = 1;
|
||||
@@ -101,7 +101,7 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
if ((cur_idx + 1) >= argc) {
|
||||
printf("No netmask address\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (inet_pton(AF_INET, argv[cur_idx+1], &netmask.sin_addr) < 0) {
|
||||
printf("bad netmask: %s\n", argv[cur_idx]);
|
||||
return;
|
||||
@@ -112,7 +112,7 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
if ((cur_idx + 1) >= argc) {
|
||||
printf("No broadcast address\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (inet_pton(AF_INET, argv[cur_idx+1], &broadcast.sin_addr) < 0) {
|
||||
printf("bad broadcast: %s\n", argv[cur_idx]);
|
||||
return;
|
||||
@@ -123,22 +123,22 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
if ((cur_idx + 1) >= argc) {
|
||||
printf("No pointopoint address\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (inet_pton(AF_INET, argv[cur_idx+1], &dstaddr.sin_addr) < 0) {
|
||||
printf("bad pointopoint: %s\n", argv[cur_idx]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
f_ptp = 1;
|
||||
cur_idx += 1;
|
||||
} else {
|
||||
printf("Bad parameter: %s\n", argv[cur_idx]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cur_idx += 1;
|
||||
}
|
||||
|
||||
|
||||
printf("ifconfig ");
|
||||
if (iface != NULL) {
|
||||
printf("%s ", iface);
|
||||
@@ -147,25 +147,25 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
inet_ntop(AF_INET, &ipaddr.sin_addr, str, 256);
|
||||
printf("%s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_netmask != 0) {
|
||||
char str[256];
|
||||
inet_ntop(AF_INET, &netmask.sin_addr, str, 256);
|
||||
printf("netmask %s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_bcast != 0) {
|
||||
char str[256];
|
||||
inet_ntop(AF_INET, &broadcast.sin_addr, str, 256);
|
||||
printf("broadcast %s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_ptp != 0) {
|
||||
char str[256];
|
||||
inet_ntop(AF_INET, &dstaddr.sin_addr, str, 256);
|
||||
printf("pointopoint %s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_up != 0) {
|
||||
printf("up\n");
|
||||
} else if (f_down != 0) {
|
||||
@@ -174,12 +174,12 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((iface == NULL) || ((f_ip == 0) && (f_down == 0) && (f_up == 0))) {
|
||||
rtems_bsdnet_show_if_stats();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
flags = 0;
|
||||
if (f_netmask) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFNETMASK, &netmask);
|
||||
@@ -188,7 +188,7 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (f_bcast) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFBRDADDR, &broadcast);
|
||||
if (rc < 0) {
|
||||
@@ -196,7 +196,7 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (f_ptp) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFDSTADDR, &dstaddr);
|
||||
if (rc < 0) {
|
||||
@@ -205,8 +205,8 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
}
|
||||
flags |= IFF_POINTOPOINT;
|
||||
}
|
||||
|
||||
/* This must come _after_ setting the netmask, broadcast addresses */
|
||||
|
||||
/* This must come _after_ setting the netmask, broadcast addresses */
|
||||
if (f_ip) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFADDR, &ipaddr);
|
||||
if (rc < 0) {
|
||||
@@ -214,15 +214,15 @@ void mon_ifconfig(int argc, char *argv[],
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (f_up != 0) {
|
||||
flags |= IFF_UP;
|
||||
}
|
||||
|
||||
|
||||
if (f_down != 0) {
|
||||
printf("Warning: taking interfaces down is not supported\n");
|
||||
}
|
||||
|
||||
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFFLAGS, &flags);
|
||||
if (rc < 0) {
|
||||
printf("Could not set interface flags: %s\n", strerror(errno));
|
||||
@@ -245,28 +245,28 @@ void mon_route(int argc, char *argv[],
|
||||
int cur_idx;
|
||||
int flags;
|
||||
int rc;
|
||||
|
||||
|
||||
memset(&dst, 0, sizeof(dst));
|
||||
memset(&gw, 0, sizeof(gw));
|
||||
memset(&netmask, 0, sizeof(netmask));
|
||||
|
||||
|
||||
dst.sin_len = sizeof(dst);
|
||||
dst.sin_family = AF_INET;
|
||||
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
gw.sin_len = sizeof(gw);
|
||||
gw.sin_family = AF_INET;
|
||||
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
netmask.sin_len = sizeof(netmask);
|
||||
netmask.sin_family = AF_INET;
|
||||
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
||||
|
||||
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
||||
|
||||
if (argc < 2) {
|
||||
rtems_bsdnet_show_inet_routes();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "add") == 0) {
|
||||
cmd = RTM_ADD;
|
||||
} else if (strcmp(argv[1], "del") == 0) {
|
||||
@@ -276,12 +276,12 @@ void mon_route(int argc, char *argv[],
|
||||
printf("\tit should be 'add' or 'del'\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(argv[2], "-host") == 0) {
|
||||
f_host = 1;
|
||||
} else if (strcmp(argv[2], "-net") == 0) {
|
||||
@@ -291,14 +291,14 @@ void mon_route(int argc, char *argv[],
|
||||
printf("\tit should be '-host' or '-net'\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc < 4) {
|
||||
printf("not enough arguments\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inet_pton(AF_INET, argv[3], &dst.sin_addr);
|
||||
|
||||
|
||||
cur_idx = 4;
|
||||
while(cur_idx < argc) {
|
||||
if (strcmp(argv[cur_idx], "gw") == 0) {
|
||||
@@ -323,7 +323,7 @@ void mon_route(int argc, char *argv[],
|
||||
}
|
||||
cur_idx += 1;
|
||||
}
|
||||
|
||||
|
||||
flags = RTF_STATIC;
|
||||
if (f_gw != 0) {
|
||||
flags |= RTF_GATEWAY;
|
||||
|
||||
@@ -39,7 +39,7 @@ rtems_monitor_part_dump_header(
|
||||
ID NAME ATTR STARTADDR LENGTH BUF_SIZE USED_BLOCKS\n");
|
||||
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
||||
1 2 3 4 5 6 7 */
|
||||
|
||||
|
||||
rtems_monitor_separator();
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ rtems_monitor_dump_name(rtems_id id)
|
||||
{
|
||||
char name_buffer[18];
|
||||
|
||||
rtems_object_get_name( id, sizeof(name_buffer), name_buffer );
|
||||
rtems_object_get_name( id, sizeof(name_buffer), name_buffer );
|
||||
|
||||
return fprintf( stdout, name_buffer );
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ rtems_monitor_region_dump_header(
|
||||
ID NAME ATTR STARTADDR LENGTH PAGE_SIZE USED_BLOCKS\n");
|
||||
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
||||
1 2 3 4 5 6 7 */
|
||||
|
||||
|
||||
rtems_monitor_separator();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,18 +23,18 @@ rtems_monitor_sema_canonical(
|
||||
Semaphore_Control *rtems_sema = (Semaphore_Control *) sema_void;
|
||||
|
||||
canonical_sema->attribute = rtems_sema->attribute_set;
|
||||
canonical_sema->priority_ceiling =
|
||||
canonical_sema->priority_ceiling =
|
||||
rtems_sema->Core_control.mutex.Attributes.priority_ceiling;
|
||||
|
||||
canonical_sema->holder_id =
|
||||
canonical_sema->holder_id =
|
||||
rtems_sema->Core_control.mutex.holder_id;
|
||||
|
||||
if (_Attributes_Is_counting_semaphore(canonical_sema->attribute)) {
|
||||
/* we have a counting semaphore */
|
||||
canonical_sema->cur_count =
|
||||
canonical_sema->cur_count =
|
||||
rtems_sema->Core_control.semaphore.count;
|
||||
|
||||
canonical_sema->max_count =
|
||||
canonical_sema->max_count =
|
||||
rtems_sema->Core_control.semaphore.Attributes.maximum_count;
|
||||
}
|
||||
else {
|
||||
@@ -54,7 +54,7 @@ rtems_monitor_sema_dump_header(
|
||||
ID NAME ATTR PRICEIL CURR_CNT HOLDID \n");
|
||||
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
||||
1 2 3 4 5 6 7 */
|
||||
|
||||
|
||||
rtems_monitor_separator();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ rtems_monitor_task_canonical(
|
||||
canonical_task->state = rtems_thread->current_state;
|
||||
canonical_task->wait_id = rtems_thread->Wait.id;
|
||||
canonical_task->events = api->pending_events;
|
||||
/*
|
||||
/*
|
||||
* FIXME: make this optionally cpu_time_executed
|
||||
*/
|
||||
#if 0
|
||||
|
||||
@@ -53,7 +53,7 @@ static bool rtems_shell_register_command(const rtems_monitor_command_entry_t *e,
|
||||
if (strcmp("exit", e->command) != 0) {
|
||||
rtems_shell_cmd_t *shell_cmd =
|
||||
(rtems_shell_cmd_t *) malloc(sizeof(rtems_shell_cmd_t));
|
||||
|
||||
|
||||
if (shell_cmd != NULL) {
|
||||
shell_cmd->name = e->command;
|
||||
shell_cmd->topic = "monitor";
|
||||
@@ -61,7 +61,7 @@ static bool rtems_shell_register_command(const rtems_monitor_command_entry_t *e,
|
||||
shell_cmd->command = rtems_shell_main_monitor;
|
||||
shell_cmd->alias = NULL;
|
||||
shell_cmd->next = NULL;
|
||||
|
||||
|
||||
if (rtems_shell_add_cmd_struct(shell_cmd) == NULL) {
|
||||
free(shell_cmd);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ jcl(rtems_shell_dd_globals* globals, char **argv)
|
||||
char *arg;
|
||||
|
||||
oper = NULL;
|
||||
|
||||
|
||||
in.dbsz = out.dbsz = 512;
|
||||
|
||||
while ((oper = *++argv) != NULL) {
|
||||
@@ -372,7 +372,7 @@ get_num(rtems_shell_dd_globals* globals, const char *val)
|
||||
num = strtouq(val, &expr, 0);
|
||||
if (errno != 0) /* Overflow or underflow. */
|
||||
err(exit_jump, 1, "%s", oper);
|
||||
|
||||
|
||||
if (expr == val) /* No valid digits. */
|
||||
errx(exit_jump, 1, "%s: illegal numeric value", oper);
|
||||
|
||||
@@ -446,7 +446,7 @@ get_off_t(rtems_shell_dd_globals* globals, const char *val)
|
||||
num = strtoq(val, &expr, 0);
|
||||
if (errno != 0) /* Overflow or underflow. */
|
||||
err(exit_jump, 1, "%s", oper);
|
||||
|
||||
|
||||
if (expr == val) /* No valid digits. */
|
||||
errx(exit_jump, 1, "%s: illegal numeric value", oper);
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ pos_out(rtems_shell_dd_globals* globals)
|
||||
off_t cnt;
|
||||
ssize_t n;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* If not a tape, try seeking on the file. Seeking on a pipe is
|
||||
* going to fail, but don't protect the user -- they shouldn't
|
||||
|
||||
@@ -366,7 +366,7 @@ fts_read(
|
||||
}
|
||||
p->fts_info = FTS_DP;
|
||||
return (p);
|
||||
}
|
||||
}
|
||||
|
||||
/* Rebuild if only read the names and now traversing. */
|
||||
if (sp->fts_child && ISSET(FTS_NAMEONLY)) {
|
||||
@@ -571,7 +571,7 @@ fts_children(
|
||||
if (instr == FTS_NAMEONLY) {
|
||||
SET(FTS_NAMEONLY);
|
||||
instr = BNAMES;
|
||||
} else
|
||||
} else
|
||||
instr = BCHILD;
|
||||
|
||||
/*
|
||||
@@ -777,7 +777,7 @@ mem1: saved_errno = errno;
|
||||
p->fts_accpath = cur->fts_accpath;
|
||||
} else if (nlinks == 0
|
||||
#ifdef DT_DIR
|
||||
|| (nostat &&
|
||||
|| (nostat &&
|
||||
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
|
||||
#endif
|
||||
) {
|
||||
@@ -899,7 +899,7 @@ fts_stat(
|
||||
if (!lstat(p->fts_accpath, sbp)) {
|
||||
errno = 0;
|
||||
return (FTS_SLNONE);
|
||||
}
|
||||
}
|
||||
p->fts_errno = saved_errno;
|
||||
goto err;
|
||||
}
|
||||
@@ -974,7 +974,7 @@ fts_sort(
|
||||
}
|
||||
for (ap = sp->fts_array, p = head; p; p = p->fts_link)
|
||||
*ap++ = p;
|
||||
qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *),
|
||||
qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *),
|
||||
(int (*) __P((const void *, const void *)))sp->fts_compar);
|
||||
for (head = *(ap = sp->fts_array); --nitems; ++ap)
|
||||
ap[0]->fts_link = ap[1];
|
||||
@@ -1081,7 +1081,7 @@ fts_pow2(
|
||||
* Allow essentially unlimited paths; find, rm, ls should all work on any tree.
|
||||
* Most systems will allow creation of paths much longer than MAXPATHLEN, even
|
||||
* though the kernel won't resolve them. Round up the new size to a power of 2,
|
||||
* so we don't realloc the path 2 bytes at a time.
|
||||
* so we don't realloc the path 2 bytes at a time.
|
||||
*/
|
||||
static int
|
||||
fts_palloc(
|
||||
|
||||
@@ -132,7 +132,7 @@ retry:
|
||||
if (!odmode) {
|
||||
*pr->cchar = 'c';
|
||||
(void)printf(pr->fmt, (int)wc);
|
||||
} else {
|
||||
} else {
|
||||
*pr->cchar = 'C';
|
||||
assert(strcmp(pr->fmt, "%3C") == 0);
|
||||
width = wcwidth(wc);
|
||||
|
||||
@@ -276,8 +276,8 @@ get(rtems_shell_hexdump_globals* globals)
|
||||
* XXX bcmp() is not quite right in the presence
|
||||
* of multibyte characters.
|
||||
*/
|
||||
if (vflag != ALL &&
|
||||
valid_save &&
|
||||
if (vflag != ALL &&
|
||||
valid_save &&
|
||||
bcmp(curp, savp, nread) == 0) {
|
||||
if (vflag != DUP)
|
||||
(void)printf("*\n");
|
||||
|
||||
@@ -76,7 +76,7 @@ oldsyntax(rtems_shell_hexdump_globals* globals, int argc, char ***argvp)
|
||||
char **argv, *end;
|
||||
|
||||
struct getopt_data getopt_reent;
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
|
||||
/* Add initial (default) address format. -A may change it later. */
|
||||
#define TYPE_OFFSET 7
|
||||
|
||||
@@ -63,7 +63,7 @@ newsyntax(rtems_shell_hexdump_globals* globals, int argc, char ***argvp)
|
||||
char *p, **argv;
|
||||
|
||||
struct getopt_data getopt_reent;
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
|
||||
argv = *argvp;
|
||||
if ((p = rindex(argv[0], 'h')) != NULL &&
|
||||
|
||||
@@ -10,42 +10,42 @@
|
||||
* Parts of this software was created by
|
||||
* Till Straumann <strauman@slac.stanford.edu>, 2003-2007
|
||||
* Stanford Linear Accelerator Center, Stanford University.
|
||||
*
|
||||
* Acknowledgement of sponsorship
|
||||
* ------------------------------
|
||||
* Parts of this software was produced by
|
||||
*
|
||||
* Acknowledgement of sponsorship
|
||||
* ------------------------------
|
||||
* Parts of this software was produced by
|
||||
* the Stanford Linear Accelerator Center, Stanford University,
|
||||
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
||||
*
|
||||
* Government disclaimer of liability
|
||||
* ----------------------------------
|
||||
* Neither the United States nor the United States Department of Energy,
|
||||
* nor any of their employees, makes any warranty, express or implied, or
|
||||
* assumes any legal liability or responsibility for the accuracy,
|
||||
*
|
||||
* Government disclaimer of liability
|
||||
* ----------------------------------
|
||||
* Neither the United States nor the United States Department of Energy,
|
||||
* nor any of their employees, makes any warranty, express or implied, or
|
||||
* assumes any legal liability or responsibility for the accuracy,
|
||||
* completeness, or usefulness of any data, apparatus, product, or process
|
||||
* disclosed, or represents that its use would not infringe privately owned
|
||||
* rights.
|
||||
*
|
||||
* Stanford disclaimer of liability
|
||||
* --------------------------------
|
||||
* Stanford University makes no representations or warranties, express or
|
||||
* implied, nor assumes any liability for the use of this software.
|
||||
*
|
||||
* Stanford disclaimer of copyright
|
||||
* --------------------------------
|
||||
* Stanford University, owner of the copyright, hereby disclaims its
|
||||
* copyright and all other rights in this software. Hence, anyone may
|
||||
* freely use it for any purpose without restriction.
|
||||
*
|
||||
* Maintenance of notices
|
||||
* ----------------------
|
||||
* In the interest of clarity regarding the origin and status of this
|
||||
* SLAC software, this and all the preceding Stanford University notices
|
||||
* are to remain affixed to any copy or derivative of this software made
|
||||
* or distributed by the recipient and are to be affixed to any copy of
|
||||
* software made or distributed by the recipient that contains a copy or
|
||||
* derivative of this software.
|
||||
*
|
||||
* rights.
|
||||
*
|
||||
* Stanford disclaimer of liability
|
||||
* --------------------------------
|
||||
* Stanford University makes no representations or warranties, express or
|
||||
* implied, nor assumes any liability for the use of this software.
|
||||
*
|
||||
* Stanford disclaimer of copyright
|
||||
* --------------------------------
|
||||
* Stanford University, owner of the copyright, hereby disclaims its
|
||||
* copyright and all other rights in this software. Hence, anyone may
|
||||
* freely use it for any purpose without restriction.
|
||||
*
|
||||
* Maintenance of notices
|
||||
* ----------------------
|
||||
* In the interest of clarity regarding the origin and status of this
|
||||
* SLAC software, this and all the preceding Stanford University notices
|
||||
* are to remain affixed to any copy or derivative of this software made
|
||||
* or distributed by the recipient and are to be affixed to any copy of
|
||||
* software made or distributed by the recipient that contains a copy or
|
||||
* derivative of this software.
|
||||
*
|
||||
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
||||
*
|
||||
* Copyright (c) 2009 embedded brains GmbH and others.
|
||||
|
||||
@@ -36,7 +36,7 @@ int rtems_shell_main_blksync(
|
||||
const char* driver = NULL;
|
||||
int arg;
|
||||
int fd;
|
||||
|
||||
|
||||
for (arg = 1; arg < argc; arg++) {
|
||||
if (argv[arg][0] == '-') {
|
||||
fprintf( stderr, "%s: invalid option: %s\n", argv[0], argv[arg]);
|
||||
@@ -51,18 +51,18 @@ int rtems_shell_main_blksync(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fd = open (driver, O_WRONLY, 0);
|
||||
if (fd < 0) {
|
||||
fprintf( stderr, "%s: driver open failed: %s\n", argv[0], strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (ioctl (fd, RTEMS_BLKIO_SYNCDEV) < 0) {
|
||||
fprintf( stderr, "%s: driver sync failed: %s\n", argv[0], strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
close (fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ __RCSID("$NetBSD: cp.c,v 1.39 2005/10/24 12:59:07 kleink Exp $");
|
||||
#endif
|
||||
/*
|
||||
* Cp copies source files to target files.
|
||||
*
|
||||
*
|
||||
* The global PATH_T structure "to" always contains the path to the
|
||||
* current target file. Since fts(3) does not change directories,
|
||||
* this path can be either absolute or dot-relative.
|
||||
*
|
||||
*
|
||||
* The basic algorithm is to initialize "to" and use fts(3) to traverse
|
||||
* the file hierarchy rooted in the argument list. A trivial case is the
|
||||
* case of 'cp file1 file2'. The more interesting case is the case of
|
||||
@@ -129,7 +129,7 @@ main_cp(rtems_shell_cp_globals* cp_globals, int argc, char *argv[])
|
||||
struct getopt_data getopt_reent;
|
||||
|
||||
Hflag = Lflag = Pflag = 0;
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
|
||||
while ((ch = getopt_r(argc, argv, "HLPRafilnprv", &getopt_reent)) != -1)
|
||||
switch (ch) {
|
||||
@@ -208,7 +208,7 @@ main_cp(rtems_shell_cp_globals* cp_globals, int argc, char *argv[])
|
||||
#if 0
|
||||
(void)signal(SIGINFO, siginfo);
|
||||
#endif
|
||||
|
||||
|
||||
/* Save the target base in "to". */
|
||||
target = argv[--argc];
|
||||
if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
|
||||
@@ -446,7 +446,7 @@ copy(rtems_shell_cp_globals* cp_globals,
|
||||
curr->fts_level == 0)) {
|
||||
if (copy_file(cp_globals, curr, dne))
|
||||
badcp = rval = 1;
|
||||
} else {
|
||||
} else {
|
||||
if (copy_link(cp_globals, curr, !dne))
|
||||
badcp = rval = 1;
|
||||
}
|
||||
@@ -552,4 +552,4 @@ rtems_shell_cmd_t rtems_shell_CP_Command = {
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ int rtems_shell_main_date(
|
||||
|
||||
sprintf( buf, "%s %s", argv[1], argv[2] );
|
||||
result = strptime(
|
||||
buf,
|
||||
buf,
|
||||
"%Y-%m-%d %T",
|
||||
&TOD
|
||||
);
|
||||
|
||||
@@ -158,7 +158,7 @@ parity(u_char c)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = c ^ (c >> 1) ^ (c >> 2) ^ (c >> 3) ^
|
||||
i = c ^ (c >> 1) ^ (c >> 2) ^ (c >> 3) ^
|
||||
(c >> 4) ^ (c >> 5) ^ (c >> 6) ^ (c >> 7);
|
||||
return (i & 1);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ setup(rtems_shell_dd_globals* globals)
|
||||
}
|
||||
|
||||
(void)gettimeofday(&tv, (struct timezone *)NULL);
|
||||
st.start = tv.tv_sec + tv.tv_usec * 1e-6;
|
||||
st.start = tv.tv_sec + tv.tv_usec * 1e-6;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -301,7 +301,7 @@ getfdtype(rtems_shell_dd_globals* globals, IO *io)
|
||||
if (S_ISREG(sb.st_mode))
|
||||
io->flags |= ISTRUNC;
|
||||
#if RTEMS_REMOVED
|
||||
if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
|
||||
if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
|
||||
if (ioctl(io->fd, FIODTYPE, &type) == -1) {
|
||||
err(exit_jump, 1, "%s", io->name);
|
||||
} else {
|
||||
|
||||
@@ -35,7 +35,7 @@ int rtems_shell_main_getenv(int argc, char *argv[])
|
||||
}
|
||||
|
||||
printf ("%s\n", string);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ main_hexdump(rtems_shell_hexdump_globals* globals, int argc, char *argv[])
|
||||
#if RTEMS_REMOVED
|
||||
(void)setlocale(LC_ALL, "");
|
||||
#endif
|
||||
|
||||
|
||||
if (!(p = rindex(argv[0], 'o')) || strcmp(p, "od"))
|
||||
newsyntax(globals, argc, &argv);
|
||||
else
|
||||
@@ -158,4 +158,4 @@ rtems_shell_cmd_t rtems_shell_HEXDUMP_Command = {
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -53,19 +53,19 @@ int rtems_shell_main_ifconfig(
|
||||
memset(&dstaddr, 0, sizeof(dstaddr));
|
||||
memset(&netmask, 0, sizeof(netmask));
|
||||
memset(&broadcast, 0, sizeof(broadcast));
|
||||
|
||||
|
||||
ipaddr.sin_len = sizeof(ipaddr);
|
||||
ipaddr.sin_family = AF_INET;
|
||||
|
||||
|
||||
dstaddr.sin_len = sizeof(dstaddr);
|
||||
dstaddr.sin_family = AF_INET;
|
||||
|
||||
|
||||
netmask.sin_len = sizeof(netmask);
|
||||
netmask.sin_family = AF_INET;
|
||||
|
||||
|
||||
broadcast.sin_len = sizeof(broadcast);
|
||||
broadcast.sin_family = AF_INET;
|
||||
|
||||
|
||||
cur_idx = 0;
|
||||
if (argc <= 1) {
|
||||
/* display all interfaces */
|
||||
@@ -84,11 +84,11 @@ int rtems_shell_main_ifconfig(
|
||||
cur_idx += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((f_down !=0) && (f_ip != 0)) {
|
||||
f_up = 1;
|
||||
}
|
||||
|
||||
|
||||
while(argc > cur_idx) {
|
||||
if (strcmp(argv[cur_idx], "up") == 0) {
|
||||
f_up = 1;
|
||||
@@ -104,7 +104,7 @@ int rtems_shell_main_ifconfig(
|
||||
if ((cur_idx + 1) >= argc) {
|
||||
printf("No netmask address\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (inet_pton(AF_INET, argv[cur_idx+1], &netmask.sin_addr) < 0) {
|
||||
printf("bad netmask: %s\n", argv[cur_idx]);
|
||||
return -1;
|
||||
@@ -115,7 +115,7 @@ int rtems_shell_main_ifconfig(
|
||||
if ((cur_idx + 1) >= argc) {
|
||||
printf("No broadcast address\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (inet_pton(AF_INET, argv[cur_idx+1], &broadcast.sin_addr) < 0) {
|
||||
printf("bad broadcast: %s\n", argv[cur_idx]);
|
||||
return -1;
|
||||
@@ -126,7 +126,7 @@ int rtems_shell_main_ifconfig(
|
||||
if ((cur_idx + 1) >= argc) {
|
||||
printf("No pointopoint address\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (inet_pton(AF_INET, argv[cur_idx+1], &dstaddr.sin_addr) < 0) {
|
||||
printf("bad pointopoint: %s\n", argv[cur_idx]);
|
||||
return -1;
|
||||
@@ -139,7 +139,7 @@ int rtems_shell_main_ifconfig(
|
||||
}
|
||||
cur_idx += 1;
|
||||
}
|
||||
|
||||
|
||||
printf("ifconfig ");
|
||||
if (iface != NULL) {
|
||||
printf("%s ", iface);
|
||||
@@ -148,25 +148,25 @@ int rtems_shell_main_ifconfig(
|
||||
inet_ntop(AF_INET, &ipaddr.sin_addr, str, 256);
|
||||
printf("%s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_netmask != 0) {
|
||||
char str[256];
|
||||
inet_ntop(AF_INET, &netmask.sin_addr, str, 256);
|
||||
printf("netmask %s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_bcast != 0) {
|
||||
char str[256];
|
||||
inet_ntop(AF_INET, &broadcast.sin_addr, str, 256);
|
||||
printf("broadcast %s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_ptp != 0) {
|
||||
char str[256];
|
||||
inet_ntop(AF_INET, &dstaddr.sin_addr, str, 256);
|
||||
printf("pointopoint %s ", str);
|
||||
}
|
||||
|
||||
|
||||
if (f_up != 0) {
|
||||
printf("up\n");
|
||||
} else if (f_down != 0) {
|
||||
@@ -175,12 +175,12 @@ int rtems_shell_main_ifconfig(
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((iface == NULL) || ((f_ip == 0) && (f_down == 0) && (f_up == 0))) {
|
||||
rtems_bsdnet_show_if_stats();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
flags = 0;
|
||||
if (f_netmask) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFNETMASK, &netmask);
|
||||
@@ -189,7 +189,7 @@ int rtems_shell_main_ifconfig(
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (f_bcast) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFBRDADDR, &broadcast);
|
||||
if (rc < 0) {
|
||||
@@ -197,7 +197,7 @@ int rtems_shell_main_ifconfig(
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (f_ptp) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFDSTADDR, &dstaddr);
|
||||
if (rc < 0) {
|
||||
@@ -206,8 +206,8 @@ int rtems_shell_main_ifconfig(
|
||||
}
|
||||
flags |= IFF_POINTOPOINT;
|
||||
}
|
||||
|
||||
/* This must come _after_ setting the netmask, broadcast addresses */
|
||||
|
||||
/* This must come _after_ setting the netmask, broadcast addresses */
|
||||
if (f_ip) {
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFADDR, &ipaddr);
|
||||
if (rc < 0) {
|
||||
@@ -215,15 +215,15 @@ int rtems_shell_main_ifconfig(
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (f_up != 0) {
|
||||
flags |= IFF_UP;
|
||||
}
|
||||
|
||||
|
||||
if (f_down != 0) {
|
||||
printf("Warning: taking interfaces down is not supported\n");
|
||||
}
|
||||
|
||||
|
||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFFLAGS, &flags);
|
||||
if (rc < 0) {
|
||||
printf("Could not set interface flags: %s\n", strerror(errno));
|
||||
|
||||
@@ -141,7 +141,7 @@ main_ln(rtems_shell_ln_globals* globals, int argc, char *argv[])
|
||||
setprogname(argv[0]);
|
||||
(void)setlocale(LC_ALL, "");
|
||||
#endif
|
||||
|
||||
|
||||
while ((ch = getopt_r(argc, argv, "fhinsv", &getopt_reent)) != -1)
|
||||
switch (ch) {
|
||||
case 'f':
|
||||
@@ -159,7 +159,7 @@ main_ln(rtems_shell_ln_globals* globals, int argc, char *argv[])
|
||||
case 's':
|
||||
sflag = 1;
|
||||
break;
|
||||
case 'v':
|
||||
case 'v':
|
||||
vflag = 1;
|
||||
break;
|
||||
case '?':
|
||||
|
||||
@@ -158,7 +158,7 @@ main_ls(rtems_shell_ls_globals* globals, int argc, char *argv[])
|
||||
|
||||
struct getopt_data getopt_reent;
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
|
||||
|
||||
#if RTEMS_REMOVED
|
||||
setprogname(argv[0]);
|
||||
#endif
|
||||
@@ -452,7 +452,7 @@ traverse(rtems_shell_ls_globals* globals, int argc, char *argv[], int options)
|
||||
fts_close(ftsp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If not recursing down this tree and don't need stat info, just get
|
||||
* the names.
|
||||
@@ -701,7 +701,7 @@ mastercmp_no_listdir(const FTSENT **a, const FTSENT **b)
|
||||
{
|
||||
int a_info, b_info;
|
||||
int l_f_listdir = 0;
|
||||
|
||||
|
||||
a_info = (*a)->fts_info;
|
||||
if (a_info == FTS_ERR)
|
||||
return (0);
|
||||
|
||||
@@ -52,7 +52,7 @@ int rtems_shell_main_mdump(
|
||||
return -1;
|
||||
}
|
||||
if (max <= 0) {
|
||||
max = 1; /* print 1 item if 0 or neg. */
|
||||
max = 1; /* print 1 item if 0 or neg. */
|
||||
res = 0;
|
||||
} else {
|
||||
max--;
|
||||
|
||||
@@ -62,13 +62,13 @@ int rtems_shell_libc_mounter(
|
||||
/*
|
||||
* Mount the disk.
|
||||
*/
|
||||
|
||||
|
||||
if (mount (&mt_entry, fs->fs_ops, options, (char*) driver, (char*) path) < 0)
|
||||
{
|
||||
fprintf (stderr, "mount: mount failed: %s\n", strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ int rtems_shell_main_mount(
|
||||
int arg;
|
||||
|
||||
rtems_shell_mount_fsys_init();
|
||||
|
||||
|
||||
for (arg = 1; arg < argc; arg++) {
|
||||
if (argv[arg][0] == '-') {
|
||||
if (argv[arg][1] == 't') {
|
||||
@@ -159,26 +159,26 @@ int rtems_shell_main_mount(
|
||||
fprintf (stderr, "mount: no file-system; see the -L option\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (fs->driver_needed && !driver) {
|
||||
fprintf (stderr, "mount: no driver\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (!mount_point) {
|
||||
fprintf (stderr, "mount: no mount point\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Mount the disk.
|
||||
*/
|
||||
|
||||
|
||||
if (fs->mounter (driver, mount_point, fs, options))
|
||||
return 1;
|
||||
|
||||
printf ("mounted %s -> %s\n", driver, mount_point);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,12 @@ rtems_shell_nfs_mounter (
|
||||
}
|
||||
|
||||
nfsInit (0, 0);
|
||||
|
||||
|
||||
uidhost = strdup (device);
|
||||
path = strchr (uidhost, ':');
|
||||
*path = '\0';
|
||||
path++;
|
||||
|
||||
|
||||
ret = nfsMount(uidhost, path, (char*) mntpoint);
|
||||
|
||||
free (uidhost);
|
||||
|
||||
@@ -40,11 +40,11 @@ int rtems_shell_main_msdos_format(
|
||||
cluster_align: 0,
|
||||
info_level: 0
|
||||
};
|
||||
|
||||
|
||||
unsigned long tmp;
|
||||
const char* driver = NULL;
|
||||
int arg;
|
||||
|
||||
|
||||
for (arg = 1; arg < argc; arg++) {
|
||||
if (argv[arg][0] == '-') {
|
||||
switch (argv[arg][1]) {
|
||||
@@ -74,7 +74,7 @@ int rtems_shell_main_msdos_format(
|
||||
|
||||
rqdata.sectors_per_cluster = (uint32_t) tmp;
|
||||
break;
|
||||
|
||||
|
||||
case 'r':
|
||||
arg++;
|
||||
if (arg == argc) {
|
||||
@@ -92,7 +92,7 @@ int rtems_shell_main_msdos_format(
|
||||
|
||||
rqdata.files_per_root_dir = (uint32_t) tmp;
|
||||
break;
|
||||
|
||||
|
||||
case 't':
|
||||
arg++;
|
||||
if (arg == argc) {
|
||||
@@ -117,11 +117,11 @@ int rtems_shell_main_msdos_format(
|
||||
case 'v':
|
||||
rqdata.info_level++;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
fprintf (stderr, "error: invalid option: %s\n", argv[arg]);
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
if (!driver)
|
||||
@@ -137,7 +137,7 @@ int rtems_shell_main_msdos_format(
|
||||
fprintf (stderr, "error: no driver\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
printf ("msdos format: %s\n", driver);
|
||||
|
||||
if (rqdata.info_level)
|
||||
@@ -152,7 +152,7 @@ int rtems_shell_main_msdos_format(
|
||||
printf (" %-20s: %d\n", "quick_format", rqdata.quick_format);
|
||||
printf (" %-20s: %lu\n", "cluster align", rqdata.cluster_align);
|
||||
}
|
||||
|
||||
|
||||
if (msdos_format (driver, &rqdata) < 0) {
|
||||
fprintf (stderr, "error: format failed: %s\n", strerror (errno));
|
||||
return 1;
|
||||
|
||||
@@ -128,8 +128,8 @@ rtems_shell_main_mv(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#define do_move(a1, a2) do_move_mv(globals, a1, a2)
|
||||
#define fastcopy(a1, a2, a3) fastcopy_mv(globals, a1, a2, a3)
|
||||
#define copy(a1, a2) copy_mv(globals, a1, a2)
|
||||
#define fastcopy(a1, a2, a3) fastcopy_mv(globals, a1, a2, a3)
|
||||
#define copy(a1, a2) copy_mv(globals, a1, a2)
|
||||
#define usage() usage_mv(globals)
|
||||
|
||||
static int do_move_mv(rtems_shell_mv_globals* globals, char *from, char *to);
|
||||
@@ -151,9 +151,9 @@ main_mv(rtems_shell_mv_globals* globals, int argc, char *argv[])
|
||||
|
||||
struct getopt_data getopt_reent;
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
|
||||
|
||||
/* setprogname(argv[0]); */
|
||||
|
||||
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
while ((ch = getopt_r(argc, argv, "ifv", &getopt_reent)) != -1)
|
||||
@@ -331,7 +331,7 @@ fastcopy_mv(rtems_shell_mv_globals* globals, char *from, char *to, struct stat *
|
||||
int nread, from_fd, to_fd;
|
||||
|
||||
blen = 0;
|
||||
|
||||
|
||||
if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
|
||||
warn("%s", from);
|
||||
return (1);
|
||||
@@ -363,7 +363,7 @@ err: if (unlink(to))
|
||||
(void)close(to_fd);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
(void)free(bp);
|
||||
(void)close(from_fd);
|
||||
#ifdef xBSD4_4
|
||||
|
||||
@@ -52,7 +52,7 @@ int rtems_shell_main_mwdump(
|
||||
}
|
||||
|
||||
if (max <= 0) {
|
||||
max = 1; /* print 1 item if 0 or neg. */
|
||||
max = 1; /* print 1 item if 0 or neg. */
|
||||
res = 0;
|
||||
} else {
|
||||
max--;
|
||||
|
||||
@@ -56,7 +56,7 @@ int rtems_shell_main_netstats( /* command */
|
||||
int verbose = 0;
|
||||
struct getopt_data getopt_reent;
|
||||
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
while ( (option = getopt_r( argc, argv, "Aimfpcutv", &getopt_reent)) != -1 ) {
|
||||
|
||||
switch ((char)option) {
|
||||
@@ -75,7 +75,7 @@ int rtems_shell_main_netstats( /* command */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( verbose ) {
|
||||
printf(
|
||||
"doAll=%d\n"
|
||||
|
||||
@@ -145,10 +145,10 @@ main_rm(rtems_shell_rm_globals* globals, int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
char *p;
|
||||
|
||||
|
||||
struct getopt_data getopt_reent;
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
|
||||
|
||||
/*
|
||||
* Test for the special case where the utility is called as
|
||||
* "unlink", for which the functionality provided is greatly
|
||||
|
||||
@@ -41,28 +41,28 @@ int rtems_shell_main_route(
|
||||
int cur_idx;
|
||||
int flags;
|
||||
int rc;
|
||||
|
||||
|
||||
memset(&dst, 0, sizeof(dst));
|
||||
memset(&gw, 0, sizeof(gw));
|
||||
memset(&netmask, 0, sizeof(netmask));
|
||||
|
||||
|
||||
dst.sin_len = sizeof(dst);
|
||||
dst.sin_family = AF_INET;
|
||||
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
gw.sin_len = sizeof(gw);
|
||||
gw.sin_family = AF_INET;
|
||||
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||
|
||||
netmask.sin_len = sizeof(netmask);
|
||||
netmask.sin_family = AF_INET;
|
||||
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
||||
|
||||
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
||||
|
||||
if (argc < 2) {
|
||||
rtems_bsdnet_show_inet_routes();
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "add") == 0) {
|
||||
cmd = RTM_ADD;
|
||||
} else if (strcmp(argv[1], "del") == 0) {
|
||||
@@ -72,12 +72,12 @@ int rtems_shell_main_route(
|
||||
printf("\tit should be 'add' or 'del'\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(argv[2], "-host") == 0) {
|
||||
f_host = 1;
|
||||
} else if (strcmp(argv[2], "-net") == 0) {
|
||||
@@ -87,14 +87,14 @@ int rtems_shell_main_route(
|
||||
printf("\tit should be '-host' or '-net'\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (argc < 4) {
|
||||
printf("not enough arguments\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
inet_pton(AF_INET, argv[3], &dst.sin_addr);
|
||||
|
||||
|
||||
cur_idx = 4;
|
||||
while(cur_idx < argc) {
|
||||
if (strcmp(argv[cur_idx], "gw") == 0) {
|
||||
@@ -119,7 +119,7 @@ int rtems_shell_main_route(
|
||||
}
|
||||
cur_idx += 1;
|
||||
}
|
||||
|
||||
|
||||
flags = RTF_STATIC;
|
||||
if (f_gw != 0) {
|
||||
flags |= RTF_GATEWAY;
|
||||
|
||||
@@ -31,20 +31,20 @@ int rtems_shell_main_setenv(int argc, char *argv[])
|
||||
}
|
||||
|
||||
env = argv[1];
|
||||
|
||||
|
||||
for (arg = 2; arg < argc; arg++)
|
||||
len += strlen (argv[arg]);
|
||||
|
||||
len += argc - 2 - 1;
|
||||
|
||||
string = malloc (len + 1);
|
||||
|
||||
|
||||
if (!string)
|
||||
{
|
||||
printf ("error: no memory\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
for (arg = 2, p = string; arg < argc; arg++)
|
||||
{
|
||||
strcpy (p, argv[arg]);
|
||||
@@ -55,7 +55,7 @@ int rtems_shell_main_setenv(int argc, char *argv[])
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (setenv (env, string, 1) < 0)
|
||||
{
|
||||
printf ("error: %s\n", strerror (errno));
|
||||
|
||||
@@ -42,7 +42,7 @@ int rtems_shell_main_time(
|
||||
sc = rtems_clock_get_uptime(&start);
|
||||
if (sc != RTEMS_SUCCESSFUL)
|
||||
printf("error: cannot read time\n");
|
||||
|
||||
|
||||
if (argc) {
|
||||
shell_cmd = rtems_shell_lookup_cmd(argv[1]);
|
||||
if ( argv[1] == NULL ) {
|
||||
@@ -65,12 +65,12 @@ int rtems_shell_main_time(
|
||||
--period.tv_sec;
|
||||
period.tv_nsec += 1000000000UL;
|
||||
}
|
||||
|
||||
|
||||
printf("time: %li:%02li:%02li.%03li\n",
|
||||
period.tv_sec / 3600,
|
||||
period.tv_sec / 60, period.tv_sec % 60,
|
||||
period.tv_nsec / 1000000);
|
||||
|
||||
|
||||
return errorlevel;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ int rtems_shell_main_unmount(
|
||||
{
|
||||
char* mount_point = NULL;
|
||||
int arg;
|
||||
|
||||
|
||||
for (arg = 1; arg < argc; arg++) {
|
||||
if (!mount_point)
|
||||
mount_point = argv[arg];
|
||||
@@ -48,19 +48,19 @@ int rtems_shell_main_unmount(
|
||||
fprintf (stderr, "error: no mount point\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Unmount the disk.
|
||||
*/
|
||||
|
||||
|
||||
if (unmount (mount_point) < 0) {
|
||||
fprintf (stderr, "error: unmount failed: %s: %s\n",
|
||||
mount_point, strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
printf ("unmounted %s\n", mount_point);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ int rtems_shell_main_unsetenv(int argc, char *argv[])
|
||||
printf ("error: %s\n", strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ printstream(rtems_shell_ls_globals* globals, DISPLAY *dp)
|
||||
if (f_size) {
|
||||
if (f_humanize)
|
||||
extwidth += dp->s_size + 1;
|
||||
else
|
||||
else
|
||||
extwidth += dp->s_block + 1;
|
||||
}
|
||||
if (f_type)
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* Help list the topics
|
||||
* help [topic] list the commands for the topic
|
||||
* help [command] help for the command
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
rtems_shell_cmd_t * rtems_shell_first_cmd;
|
||||
@@ -111,7 +111,7 @@ rtems_shell_cmd_t *rtems_shell_add_cmd_struct(
|
||||
)
|
||||
{
|
||||
rtems_shell_cmd_t *shell_pvt;
|
||||
|
||||
|
||||
shell_pvt = rtems_shell_first_cmd;
|
||||
while (shell_pvt) {
|
||||
if (strcmp(shell_pvt->name, shell_cmd->name) == 0)
|
||||
@@ -126,13 +126,13 @@ rtems_shell_cmd_t *rtems_shell_add_cmd_struct(
|
||||
while (shell_pvt->next)
|
||||
shell_pvt = shell_pvt->next;
|
||||
shell_pvt->next = shell_cmd;
|
||||
}
|
||||
}
|
||||
rtems_shell_add_topic( shell_cmd->topic );
|
||||
return shell_cmd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a command as a set of arguments to the set and
|
||||
* Add a command as a set of arguments to the set and
|
||||
* allocate the command structure on the fly.
|
||||
*/
|
||||
rtems_shell_cmd_t * rtems_shell_add_cmd(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Dynamically build the shell prompt
|
||||
* Dynamically build the shell prompt
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -38,7 +38,7 @@ void rtems_shell_get_prompt(
|
||||
)
|
||||
{
|
||||
char curdir[256];
|
||||
|
||||
|
||||
/* XXX: show_prompt user adjustable */
|
||||
getcwd(curdir,sizeof(curdir));
|
||||
snprintf(prompt, size - 1, "%s%s[%s] %c ",
|
||||
|
||||
@@ -19,15 +19,15 @@
|
||||
|
||||
int rtems_shell_make_args(
|
||||
char *commandLine,
|
||||
int *argc_p,
|
||||
char **argv_p,
|
||||
int *argc_p,
|
||||
char **argv_p,
|
||||
int max_args
|
||||
)
|
||||
{
|
||||
int argc;
|
||||
char *command;
|
||||
int status = 0;
|
||||
|
||||
|
||||
argc = 0;
|
||||
command = commandLine;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static int findOnPATH(
|
||||
strcat( scriptFile, "/" );
|
||||
strcat(
|
||||
scriptFile,
|
||||
( (userScriptName[0] == '.' && userScriptName[1] == '/') ?
|
||||
( (userScriptName[0] == '.' && userScriptName[1] == '/') ?
|
||||
&userScriptName[2] : userScriptName)
|
||||
);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ static int findOnPATH(
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
/*
|
||||
* Does the command (argv[0]) contain a path ?, i.e. starts with
|
||||
* '.' or contains a '/'?
|
||||
*/
|
||||
@@ -120,7 +120,7 @@ int rtems_shell_main_joel(
|
||||
char scriptFile[PATH_MAX];
|
||||
struct getopt_data getopt_reent;
|
||||
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||
while ( (option = getopt_r( argc, argv, "o:p:s:t:v", &getopt_reent)) != -1 ) {
|
||||
switch ((char)option) {
|
||||
case 'o':
|
||||
@@ -149,10 +149,10 @@ int rtems_shell_main_joel(
|
||||
case 't':
|
||||
taskName = getopt_reent.optarg;
|
||||
break;
|
||||
case 'v':
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
case '?':
|
||||
case '?':
|
||||
default:
|
||||
rtems_shell_joel_usage();
|
||||
return -1;
|
||||
@@ -160,7 +160,7 @@ int rtems_shell_main_joel(
|
||||
}
|
||||
|
||||
if ( verbose ) {
|
||||
fprintf( stderr,
|
||||
fprintf( stderr,
|
||||
"outputFile: %s\n"
|
||||
"taskPriority: %" PRId32 "\n"
|
||||
"stackSize: %" PRId32 "\n"
|
||||
@@ -179,10 +179,10 @@ int rtems_shell_main_joel(
|
||||
if ( getopt_reent.optind >= argc ) {
|
||||
fprintf( stderr, "Shell: No script to execute\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Find script on the path.
|
||||
* Find script on the path.
|
||||
*
|
||||
* NOTE: It is terrible that this is done twice but it
|
||||
* seems to be the most expedient thing.
|
||||
@@ -217,7 +217,7 @@ int rtems_shell_main_joel(
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_JOEL_Command = {
|
||||
"joel", /* name */
|
||||
"joel [args] SCRIPT", /* usage */
|
||||
@@ -303,7 +303,7 @@ int rtems_shell_script_file(
|
||||
scriptHead[length - 1] = '\0';
|
||||
|
||||
/* fprintf( stderr, "FIRST LINE: -%s-\n", scriptHead ); */
|
||||
|
||||
|
||||
/*
|
||||
* Verify the name of the "shell" is joel. This means
|
||||
* the line starts with "#! joel".
|
||||
|
||||
@@ -135,7 +135,7 @@ copy_file(rtems_shell_cp_globals* cp_globals __attribute__((unused)), FTSENT *en
|
||||
(void)free(buf);
|
||||
return (0);
|
||||
} else if (iflag) {
|
||||
(void)fprintf(stderr, "overwrite %s? %s",
|
||||
(void)fprintf(stderr, "overwrite %s? %s",
|
||||
to.p_path, YESNO);
|
||||
checkch = ch = getchar();
|
||||
while (ch != '\n' && ch != EOF)
|
||||
@@ -147,9 +147,9 @@ copy_file(rtems_shell_cp_globals* cp_globals __attribute__((unused)), FTSENT *en
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fflag) {
|
||||
/* remove existing destination file name,
|
||||
/* remove existing destination file name,
|
||||
* create a new file */
|
||||
(void)unlink(to.p_path);
|
||||
if (!lflag)
|
||||
@@ -255,7 +255,7 @@ copy_file(rtems_shell_cp_globals* cp_globals __attribute__((unused)), FTSENT *en
|
||||
}
|
||||
}
|
||||
(void)close(from_fd);
|
||||
|
||||
|
||||
/*
|
||||
* Don't remove the target even after an error. The target might
|
||||
* not be a regular file, or its attributes might be important,
|
||||
@@ -401,7 +401,7 @@ setfile(rtems_shell_cp_globals* cp_globals, struct stat *fs, int fd)
|
||||
rval = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return (rval);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ void Stack_check_Initialize( void )
|
||||
p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */
|
||||
p[3] = 0x600D0D06;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If appropriate, setup the interrupt stack for high water testing
|
||||
* also.
|
||||
@@ -441,7 +441,7 @@ void Stack_check_Dump_threads_usage(
|
||||
} else {
|
||||
(*print_handler)( print_context, "%8" PRId32 "\n", used );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ void rtems_stack_checker_report_usage_with_plugin(
|
||||
print_handler = print;
|
||||
|
||||
(*print)( context, "Stack usage by thread\n");
|
||||
(*print)( context,
|
||||
(*print)( context,
|
||||
" ID NAME LOW HIGH CURRENT AVAILABLE USED\n"
|
||||
);
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ try_again:
|
||||
|
||||
if (state_fd > 0) {
|
||||
rewind(state_f);
|
||||
len = fprintf(state_f,
|
||||
len = fprintf(state_f,
|
||||
"clock: %04x tv: %016lu %08lu adj: %08d\n",
|
||||
clock_seq, last.tv_sec, last.tv_usec, adjustment);
|
||||
fflush(state_f);
|
||||
|
||||
Reference in New Issue
Block a user