Ignore:
Timestamp:
Nov 29, 2009, 2:53:02 PM (12 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, 5, master
Children:
d4b4664b
Parents:
28352fae
Message:

Whitespace removal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/gdbarmsim/startup/syscalls.c

    r28352fae r32b8506  
    6565#define MAX_OPEN_FILES 20
    6666
    67 /* User file descriptors (fd) are integer indexes into 
     67/* User file descriptors (fd) are integer indexes into
    6868   the openfiles[] array. Error checking is done by using
    69    findslot(). 
    70 
    71    This openfiles array is manipulated directly by only 
     69   findslot().
     70
     71   This openfiles array is manipulated directly by only
    7272   these 5 functions:
    7373
     
    104104
    105105/* Return a pointer to the structure associated with
    106    the user file descriptor fd. */ 
     106   the user file descriptor fd. */
    107107static struct fdent*
    108108findslot (int fd)
     
    122122}
    123123
    124 /* Return the next lowest numbered free file 
    125    structure, or -1 if we can't find one. */ 
     124/* Return the next lowest numbered free file
     125   structure, or -1 if we can't find one. */
    126126static int
    127127newslot (void)
     
    143143{
    144144  int i;
    145  
     145
    146146  /* Open the standard file descriptors by opening the special
    147147   * teletype device, ":tt", read-only to obtain a descritpor for
     
    156156#ifdef ARM_RDI_MONITOR
    157157  int volatile block[3];
    158  
     158
    159159  block[0] = (int) ":tt";
    160160  block[2] = 3;     /* length of filename */
     
    243243/* fh, is a valid internal file handle.
    244244   ptr, is a null terminated string.
    245    len, is the length in bytes to read. 
     245   len, is the length in bytes to read.
    246246   Returns the number of bytes *not* written. */
    247247int
     
    252252#ifdef ARM_RDI_MONITOR
    253253  int block[3];
    254  
     254
    255255  block[0] = fh;
    256256  block[1] = (int) ptr;
    257257  block[2] = len;
    258  
     258
    259259  return checkerror (do_AngelSWI (AngelSWI_Reason_Read, block));
    260260#else
     
    272272}
    273273
    274 /* fd, is a valid user file handle. 
     274/* fd, is a valid user file handle.
    275275   Translates the return of _swiread into
    276276   bytes read. */
     
    297297  pfd->pos += len - res;
    298298
    299   /* res == len is not an error, 
     299  /* res == len is not an error,
    300300     at least if we want feof() to work.  */
    301301  return len - res;
     
    342342      dir = SEEK_SET;
    343343    }
    344  
     344
    345345#ifdef ARM_RDI_MONITOR
    346346  int block[2];
     
    353353      ptr += res;
    354354    }
    355  
     355
    356356  /* This code only does absolute seeks.  */
    357357  block[0] = pfd->handle;
     
    406406#ifdef ARM_RDI_MONITOR
    407407  int block[3];
    408  
     408
    409409  block[0] = fh;
    410410  block[1] = (int) ptr;
    411411  block[2] = len;
    412  
     412
    413413  return checkerror (do_AngelSWI (AngelSWI_Reason_Write, block));
    414414#else
     
    450450  pfd->pos += len - res;
    451451
    452   /* We wrote 0 bytes? 
     452  /* We wrote 0 bytes?
    453453     Retrieve errno just in case. */
    454454  if ((len - res) == 0)
    455455    return error (0);
    456  
     456
    457457  return (len - res);
    458458}
     
    465465  int block[3];
    466466#endif
    467  
     467
    468468  int fd = newslot ();
    469469
     
    473473      return -1;
    474474    }
    475  
     475
    476476  /* It is an error to open a file that already exists. */
    477   if ((flags & O_CREAT) 
     477  if ((flags & O_CREAT)
    478478      && (flags & O_EXCL))
    479479    {
     
    488488    }
    489489
    490   /* The flags are Unix-style, so we need to convert them. */ 
     490  /* The flags are Unix-style, so we need to convert them. */
    491491#ifdef O_BINARY
    492492  if (flags & O_BINARY)
    493493    aflags |= 1;
    494494#endif
    495  
     495
    496496  /* In O_RDONLY we expect aflags == 0. */
    497497
    498   if (flags & O_RDWR) 
     498  if (flags & O_RDWR)
    499499    aflags |= 2;
    500500
     
    510510      aflags |= 8;
    511511    }
    512  
     512
    513513#ifdef ARM_RDI_MONITOR
    514514  block[0] = (int) path;
    515515  block[2] = strlen (path);
    516516  block[1] = aflags;
    517  
     517
    518518  fh = do_AngelSWI (AngelSWI_Reason_Open, block);
    519  
     519
    520520#else
    521521  asm ("mov r0,%2; mov r1, %3; swi %a1; mov %0, r0"
     
    524524       : "r0","r1");
    525525#endif
    526  
     526
    527527  /* Return a user file descriptor or an error. */
    528528  if (fh >= 0)
     
    551551  register int r0 asm("r0");
    552552  r0 = fh;
    553   asm ("swi %a2" 
    554        : "=r"(r0) 
     553  asm ("swi %a2"
     554       : "=r"(r0)
    555555       : "0"(r0), "i" (SWI_Close));
    556556  return checkerror (r0);
     
    606606  if (heap_end == NULL)
    607607    heap_end = & end;
    608  
     608
    609609  prev_heap_end = heap_end;
    610  
     610
    611611  if (heap_end + incr > stack_ptr)
    612612    {
     
    617617
    618618      _write (1, "_sbrk: Heap and stack collision\n", 32);
    619      
     619
    620620      abort ();
    621621#else
     
    624624#endif
    625625    }
    626  
     626
    627627  heap_end += incr;
    628628
     
    631631#endif
    632632
    633 int 
     633int
    634634_swistat (int fd, struct stat * st)
    635635{
     
    676676  int fd, res;
    677677  memset (st, 0, sizeof (* st));
    678   /* The best we can do is try to open the file readonly. 
     678  /* The best we can do is try to open the file readonly.
    679679     If it exists, then we can guess a few things about it. */
    680680  if ((fd = _open (fname, O_RDONLY)) == -1)
     
    683683  res = _swistat (fd, st);
    684684  /* Not interested in the error. */
    685   _close (fd); 
     685  _close (fd);
    686686  return res;
    687687}
     
    706706  register int r0 asm("r0");
    707707  r0 = (int)path;
    708   asm ("swi %a2" 
     708  asm ("swi %a2"
    709709       : "=r"(r0)
    710710       : "0"(r0), "i" (SWI_Remove));
    711711  res = r0;
    712712#endif
    713   if (res == -1) 
     713  if (res == -1)
    714714    return error (res);
    715715  return 0;
     
    748748
    749749/* Return a clock that ticks at 100Hz.  */
    750 clock_t 
     750clock_t
    751751_clock (void)
    752752{
     
    774774      tp->tms_cstime = 0;       /* system time, children */
    775775    }
    776  
     776
    777777  return timeval;
    778778};
     
    832832  register int r0 asm("r0");
    833833  r0 = (int)s;
    834   asm ("swi %a2" 
     834  asm ("swi %a2"
    835835       : "=r" (r0)
    836836       : "0"(r0), "i" (SWI_CLI));
     
    854854  r0 = (int)oldpath;
    855855  r1 = (int)newpath;
    856   asm ("swi %a3" 
     856  asm ("swi %a3"
    857857       : "=r" (r0)
    858858       : "0" (r0), "r" (r1), "i" (SWI_Rename));
Note: See TracChangeset for help on using the changeset viewer.