Changeset 798b8da in rtems


Ignore:
Timestamp:
12/10/13 01:53:13 (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, master
Children:
371f32f4
Parents:
967c1438 (diff), 663ffd0e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into am

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/shared/include/linker-symbols.h

    r967c1438 r798b8da  
    129129
    130130LINKER_SYMBOL(bsp_translation_table_base)
     131LINKER_SYMBOL(bsp_translation_table_end)
    131132
    132133#define BSP_FAST_TEXT_SECTION __attribute__((section(".bsp_fast_text")))
  • cpukit/libcsupport/include/rtems/libio_.h

    r967c1438 r798b8da  
    4141
    4242#define RTEMS_FILESYSTEM_SYMLOOP_MAX 32
     43
     44/*
     45 * Not defined in newlib so provide here. Users should use dup2 and
     46 * not this non-portable fcntl command. Provided here to allow the
     47 * RTEMS implementation to work.
     48 */
     49#define F_DUP2FD 20
    4350
    4451/*
  • cpukit/libcsupport/src/dup2.c

    r967c1438 r798b8da  
    5555   */
    5656
    57   return fcntl( fildes, F_DUPFD, fildes2 );
     57  return fcntl( fildes, F_DUP2FD, fildes2 );
    5858}
  • cpukit/libcsupport/src/fcntl.c

    r967c1438 r798b8da  
    2525#include <rtems/libio_.h>
    2626
    27 static int duplicate_iop( rtems_libio_t *iop, int fd2 )
     27static int duplicate_iop( rtems_libio_t *iop )
    2828{
    2929  int rv = 0;
    3030
    31   /*
    32    * FIXME: We ignore the start value fd2 for the file descriptor search.  This
    33    * is not POSIX conform.
    34    */
    3531  rtems_libio_t *diop = rtems_libio_allocate();
    3632
     
    6359}
    6460
     61static int duplicate2_iop( rtems_libio_t *iop, int fd2 )
     62{
     63  rtems_libio_t *iop2;
     64  int            rv = 0;
     65
     66  rtems_libio_check_fd( fd2 );
     67  iop2 = rtems_libio_iop( fd2 );
     68
     69  if (iop != iop2)
     70  {
     71    int oflag;
     72
     73    if ((iop2->flags & LIBIO_FLAGS_OPEN) != 0) {
     74      rv = (*iop2->pathinfo.handlers->close_h)( iop2 );
     75    }
     76
     77    if (rv == 0) {
     78      oflag = rtems_libio_to_fcntl_flags( iop->flags );
     79      oflag &= ~O_CREAT;
     80      iop2->flags |= rtems_libio_fcntl_flags( oflag );
     81
     82      rtems_filesystem_instance_lock( &iop->pathinfo );
     83      rtems_filesystem_location_clone( &iop2->pathinfo, &iop->pathinfo );
     84      rtems_filesystem_instance_unlock( &iop->pathinfo );
     85
     86      /*
     87       * XXX: We call the open handler here to have a proper open and close
     88       *      pair.
     89       *
     90       * FIXME: What to do with the path?
     91       */
     92      rv = (*iop2->pathinfo.handlers->open_h)( iop2, NULL, oflag, 0 );
     93      if ( rv == 0 ) {
     94        rv = fd2;
     95      }
     96    }
     97  }
     98
     99  return rv;
     100}
     101
    65102static int vfcntl(
    66103  int fd,
     
    89126  switch ( cmd ) {
    90127    case F_DUPFD:        /* dup */
     128      ret = duplicate_iop( iop );
     129      break;
     130
     131    case F_DUP2FD:       /* dup2 */
    91132      fd2 = va_arg( ap, int );
    92       ret = duplicate_iop( iop, fd2 );
     133      ret = duplicate2_iop( iop, fd2 );
    93134      break;
    94135
  • cpukit/libfs/src/imfs/imfs_init.c

    r967c1438 r798b8da  
    5454  [IMFS_MEMORY_FILE] = &IMFS_node_control_memfile,
    5555  [IMFS_LINEAR_FILE] = &IMFS_node_control_linfile,
    56   [IMFS_FIFO] = &IMFS_node_control_default
     56  [IMFS_FIFO] = &IMFS_node_control_fifo
    5757};
    5858
  • cpukit/libfs/src/pipe/fifo.c

    r967c1438 r798b8da  
    391391    return -EINTR;
    392392
    393   while (read < count) {
    394     while (PIPE_EMPTY(pipe)) {
    395       /* Not an error */
    396       if (pipe->Writers == 0)
    397         goto out_locked;
    398 
    399       if (LIBIO_NODELAY(iop)) {
    400         ret = -EAGAIN;
    401         goto out_locked;
    402       }
    403 
    404       /* Wait until pipe is no more empty or no writer exists */
    405       pipe->waitingReaders ++;
    406       PIPE_UNLOCK(pipe);
    407       if (! PIPE_READWAIT(pipe))
    408         ret = -EINTR;
    409       if (! PIPE_LOCK(pipe)) {
    410         /* WARN waitingReaders not restored! */
    411         ret = -EINTR;
    412         goto out_nolock;
    413       }
    414       pipe->waitingReaders --;
    415       if (ret != 0)
    416         goto out_locked;
     393  while (PIPE_EMPTY(pipe)) {
     394    /* Not an error */
     395    if (pipe->Writers == 0)
     396      goto out_locked;
     397
     398    if (LIBIO_NODELAY(iop)) {
     399      ret = -EAGAIN;
     400      goto out_locked;
    417401    }
    418402
    419     /* Read chunk bytes */
    420     chunk = MIN(count - read,  pipe->Length);
    421     chunk1 = pipe->Size - pipe->Start;
    422     if (chunk > chunk1) {
    423       memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1);
    424       memcpy(buffer + read + chunk1, pipe->Buffer, chunk - chunk1);
     403    /* Wait until pipe is no more empty or no writer exists */
     404    pipe->waitingReaders ++;
     405    PIPE_UNLOCK(pipe);
     406    if (! PIPE_READWAIT(pipe))
     407      ret = -EINTR;
     408    if (! PIPE_LOCK(pipe)) {
     409      /* WARN waitingReaders not restored! */
     410      ret = -EINTR;
     411      goto out_nolock;
    425412    }
    426     else
    427       memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk);
    428 
    429     pipe->Start += chunk;
    430     pipe->Start %= pipe->Size;
    431     pipe->Length -= chunk;
    432     /* For buffering optimization */
    433     if (PIPE_EMPTY(pipe))
    434       pipe->Start = 0;
    435 
    436     if (pipe->waitingWriters > 0)
    437       PIPE_WAKEUPWRITERS(pipe);
    438     read += chunk;
    439   }
     413    pipe->waitingReaders --;
     414    if (ret != 0)
     415      goto out_locked;
     416  }
     417
     418  /* Read chunk bytes */
     419  chunk = MIN(count - read,  pipe->Length);
     420  chunk1 = pipe->Size - pipe->Start;
     421  if (chunk > chunk1) {
     422    memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk1);
     423    memcpy(buffer + read + chunk1, pipe->Buffer, chunk - chunk1);
     424  }
     425  else
     426    memcpy(buffer + read, pipe->Buffer + pipe->Start, chunk);
     427
     428  pipe->Start += chunk;
     429  pipe->Start %= pipe->Size;
     430  pipe->Length -= chunk;
     431  /* For buffering optimization */
     432  if (PIPE_EMPTY(pipe))
     433    pipe->Start = 0;
     434
     435  if (pipe->waitingWriters > 0)
     436    PIPE_WAKEUPWRITERS(pipe);
     437  read += chunk;
    440438
    441439out_locked:
  • cpukit/libnetworking/lib/syslog.c

    r967c1438 r798b8da  
    143143        myAddress.sin_family = AF_INET;
    144144        myAddress.sin_addr.s_addr = INADDR_ANY;
    145         myAddress.sin_port = 0;
     145        myAddress.sin_port = htons (SYSLOG_PORT);;
    146146        memset (myAddress.sin_zero, '\0', sizeof myAddress.sin_zero);
    147147        if (bind (LogFd, (struct sockaddr *)&myAddress, sizeof (myAddress)) < 0) {
Note: See TracChangeset for help on using the changeset viewer.