Changeset 4dc0fd6 in rtems


Ignore:
Timestamp:
Jan 19, 1998, 10:22:25 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
866c465f
Parents:
6f9c75c3
Message:

Patch from Eric Norum:

With this in place, it is possible to fdopen a TCP stream socket and
getc/fprintf/etc. on the STDIO stream!

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/termios.c

    r6f9c75c3 r4dc0fd6  
    114114        int             (*write)(int minor, const char *buf, int len);
    115115};
     116
    116117static struct rtems_termios_tty *ttyHead, *ttyTail;
    117118static rtems_id ttyMutex;
  • c/src/lib/libc/Makefile.in

    r6f9c75c3 r4dc0fd6  
    3131
    3232include $(RTEMS_CUSTOM)
    33 include $(PROJECT_ROOT)/make/lib.cfg
     33include $(RTEMS_ROOT)/make/lib.cfg
    3434
    3535#
  • c/src/lib/libc/syscalls.c

    r6f9c75c3 r4dc0fd6  
    2727
    2828#include <rtems.h>
     29#include <rtems/libio.h>
    2930
    3031#ifdef RTEMS_NEWLIB
     
    3637int __rtems_fstat(int _fd, struct stat* _sbuf)
    3738{
    38   if ( _fd > 2 ) {
    39     puts( "__rtems_fstat -- only stdio supported" );
    40     assert( 0 );
    41   }
    42   _sbuf->st_mode = S_IFCHR;
    4339#ifdef HAVE_BLKSIZE
    4440  _sbuf->st_blksize = 0;
    4541#endif
     42
     43  /*
     44   * For now assume stdin/stdout/stderr are always a TTY line
     45   */
     46  if (_fd <= 2) {
     47    _sbuf->st_mode = S_IFCHR;
     48  } else {
     49    switch (rtems_file_descriptor_type (_fd)) {
     50    case RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET:
     51      _sbuf->st_mode = S_IFSOCK;
     52      break;
     53
     54    default:
     55      puts( "__rtems_fstat -- unknown socket type" );
     56      assert( 0 );
     57    }
     58  }
    4659  return 0;
    4760}
     
    4962int __rtems_isatty(int _fd)
    5063{
    51   return 1;
     64  struct stat st;
     65
     66  if (__rtems_fstat(_fd, &st) < 0)
     67    return 0;
     68  return S_ISCHR (st.st_mode);
    5269}
    5370
  • c/src/lib/libc/termios.c

    r6f9c75c3 r4dc0fd6  
    114114        int             (*write)(int minor, const char *buf, int len);
    115115};
     116
    116117static struct rtems_termios_tty *ttyHead, *ttyTail;
    117118static rtems_id ttyMutex;
  • cpukit/libcsupport/src/termios.c

    r6f9c75c3 r4dc0fd6  
    114114        int             (*write)(int minor, const char *buf, int len);
    115115};
     116
    116117static struct rtems_termios_tty *ttyHead, *ttyTail;
    117118static rtems_id ttyMutex;
Note: See TracChangeset for help on using the changeset viewer.