summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/libio.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Canonicalize config.h includeSebastian Huber2020-04-161-1/+1
| | | | | | | | Use the following variant which was already used by most source files: #ifdef HAVE_CONFIG_H #include "config.h" #endif
* libio: Robust file descriptor reference countingSebastian Huber2020-03-131-1/+14
| | | | | | | | | | | | There was a race conditon in the reference counting of file descriptors during a close() operation. After the call to the close handler, the rtems_libio_free() function cleared the flags to zero. However, at this point in time there may still exist some holders of the file descriptor. With RTEMS_DEBUG enabled this could lead to failed assertions in rtems_libio_iop_drop(). Change the code to use only atomic read-modify-write operations on the rtems_libio_iop::flags.
* libio: Use FIFO for iop free listSebastian Huber2017-09-151-8/+15
| | | | Update #3136.
* libio: Add hold/drop iop referenceSebastian Huber2017-09-151-5/+5
| | | | | | | Check iop reference count in close() and return -1 with errno set to EBUSY in case the file descriptor is still in use. Update #3132.
* libio: Add rtems_libio_iop_flags_initialize()Sebastian Huber2017-09-151-1/+0
| | | | Update #3132.
* libio: Remove LIBIO_FLAGS_CREATESebastian Huber2017-09-141-5/+0
| | | | Close #3134.
* libio: Remove special-case reference countSebastian Huber2017-09-141-30/+2
| | | | | | The top-level IO library structures should contain no special-case data. Update #2859.
* posix/mman: add mmap support for shm objectsGedare Bloom2017-05-051-2/+30
| | | | Update #2859.
* Change all references of rtems.com to rtems.org.Chris Johns2014-03-211-1/+1
|
* Filesystem: Zero flags in rtems_libio_free()Sebastian Huber2013-10-311-1/+1
|
* libcsupport: Doxygen Enhancement Task #8Alex Ivanov2012-12-151-30/+7
| | | | http://www.google-melange.com/gci/task/view/google/gci2012/7996208
* Remove All CVS Id Strings Possible Using a ScriptJoel Sherrill2012-05-111-2/+0
| | | | | | | | | | | | Script does what is expected and tries to do it as smartly as possible. + remove occurrences of two blank comment lines next to each other after Id string line removed. + remove entire comment blocks which only exited to contain CVS Ids + If the processing left a blank line at the top of a file, it was removed.
* Filesystem: Remove per file descriptor semaphoreSebastian Huber2012-05-041-24/+4
| | | | | | | | | The per file descriptor semaphore (field of rtems_libio_t) is unused in RTEMS. There is a considerable memory overhead due to that. A semaphore needs roughly 124 bytes which is huge compared to the approximately 72 bytes for the file descriptor structure itself. Device drivers can create their own synchronization primitives in the open handler on demand.
* Filesystem: Reference counting for locationsSebastian Huber2012-03-131-101/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o A new data structure rtems_filesystem_global_location_t was introduced to be used for o the mount point location in the mount table entry, o the file system root location in the mount table entry, o the root directory location in the user environment, and o the current directory location in the user environment. During the path evaluation global start locations are obtained to ensure that the current file system instance will be not unmounted in the meantime. o The user environment uses now reference counting and is protected from concurrent access. o The path evaluation process was completely rewritten and simplified. The IMFS, RFS, NFS, and DOSFS use now a generic path evaluation method. Recursive calls in the path evaluation have been replaced with iteration to avoid stack overflows. Only the evaluation of symbolic links is recursive. No dynamic memory allocations and intermediate buffers are used in the high level path evaluation. No global locks are held during the file system instance specific path evaluation process. o Recursive symbolic link evaluation is now limited by RTEMS_FILESYSTEM_SYMLOOP_MAX. Applications can retrieve this value via sysconf(). o The device file system (devFS) uses now no global variables and allocation from the workspace. Node names are allocated from the heap. o The upper layer lseek() performs now some parameter checks. o The upper layer ftruncate() performs now some parameter checks. o unmask() is now restricted to the RWX flags and protected from concurrent access. o The fchmod_h and rmnod_h file system node handlers are now a file system operation. o The unlink_h operation has been removed. All nodes are now destroyed with the rmnod_h operation. o New lock_h, unlock_h, clonenod_h, and are_nodes_equal_h file system operations. o The path evaluation and file system operations are now protected by per file system instance lock and unlock operations. o Fix and test file descriptor duplicate in fcntl(). o New test fstests/fsnofs01.
* 2010-04-30 Sebastian Huber <sebastian.huber@embedded-brains.de>Sebastian Huber2010-04-301-32/+17
| | | | | | | | * libcsupport/include/rtems/libio_.h, libcsupport/src/envlock.c, libcsupport/src/libio.c: Added and use rtems_libio_lock() and rtems_libio_unlock(). Cleaned up includes and declarations. Do not use RTEMS_NO_PRIORITY for unused ceiling priority in rtems_semaphore_create().
* Whitespace removal.Ralf Corsepius2009-11-291-3/+3
|
* Reflect rtems_libio_number_iops being uint32_t.Ralf Corsepius2009-09-151-2/+2
|
* 2009-01-29 Nickolay Semyonov-Kolchin <nbkolchin@gmail.com>Joel Sherrill2009-01-291-6/+8
| | | | | | | | PR 1359/cpukit * libcsupport/src/libio.c: rtems_libio_allocate: rtems_libio_iop_freelist incorrectly zeroed on semaphore error. Now checks error and does not modify anything until sure it has created semaphore.
* Added const qualifier to various pointers and data tables toThomas Doerfler2008-05-271-2/+2
| | | | | | reduce size of data area. IMFS: Fixed creation of symbolic links to avoid a compiler warning. DOSFS: Use LibBlock instead of read() to read the boot record.
* 2007-03-26 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2007-03-261-51/+4
| | | | | | | | | | | | | | | | | | | * libcsupport/src/assoc.c, libcsupport/src/libio.c, libcsupport/src/write.c: Split files to shrink minimum.exe. Hopefully this will not be deemed necessary to commit to the 4.7 branch. * libcsupport/src/assoclocalbyname.c, libcsupport/src/assoclocalbyremote.c, libcsupport/src/assoclocalbyremotebitfield.c, libcsupport/src/assocnamebylocal.c, libcsupport/src/assocnamebylocalbitfield.c, libcsupport/src/assocnamebyremote.c, libcsupport/src/assocnamebyremotebitfield.c, libcsupport/src/assocptrbylocal.c, libcsupport/src/assocptrbyname.c, libcsupport/src/assocptrbyremote.c, libcsupport/src/assocremotebylocal.c, libcsupport/src/assocremotebylocalbitfield.c, libcsupport/src/assocremotebyname.c, libcsupport/src/libio_init.c, libcsupport/src/write_r.c: New files.
* 2006-03-07 Till Strauman <strauman@slac.stanford.edu>Joel Sherrill2006-03-071-11/+16
| | | | | | PR 886/filesystem * libcsupport/src/libio.c: fcntl(fd,F_GETFL) fails to set O_NONBLOCK if the descriptor is in non-blocking mode.
* Remove stray white spaces.Ralf Corsepius2004-04-181-20/+20
|
* Remove stray white spaces.Ralf Corsepius2004-04-151-2/+0
|
* 2004-03-23 Ralf Corsepius <ralf_corsepius@rtems.org>Ralf Corsepius2004-03-231-8/+8
| | | | | | | | | | | | | | | | | | * libcsupport/include/chain.h, libcsupport/include/clockdrv.h, libcsupport/include/ringbuf.h, libcsupport/include/spurious.h, libcsupport/include/timerdrv.h, libcsupport/include/vmeintr.h, libcsupport/include/motorola/mc68230.h, libcsupport/include/rtems/assoc.h, libcsupport/include/rtems/libio.h, libcsupport/include/rtems/libio_.h, libcsupport/include/rtems/termiostypes.h, libcsupport/include/zilog/z8036.h, libcsupport/include/zilog/z8530.h, libcsupport/include/zilog/z8536.h, libcsupport/src/__gettod.c, libcsupport/src/assoc.c, libcsupport/src/assocnamebad.c, libcsupport/src/error.c, libcsupport/src/libio.c, libcsupport/src/libio_sockets.c, libcsupport/src/malloc.c, libcsupport/src/no_libc.c, libcsupport/src/termios.c, libcsupport/src/termiosreserveresources.c: Convert to using c99 fixed-size types.
* 2003-09-04 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2003-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/chain.h, include/clockdrv.h, include/console.h, include/iosupp.h, include/rtc.h, include/spurious.h, include/timerdrv.h, include/vmeintr.h, include/motorola/mc68230.h, include/rtems/libcsupport.h, include/rtems/libio.h, include/rtems/libio_.h, include/rtems/termiostypes.h, include/sys/termios.h, include/zilog/z8036.h, include/zilog/z8530.h, include/zilog/z8536.h, src/__brk.c, src/__gettod.c, src/__sbrk.c, src/__times.c, src/access.c, src/base_fs.c, src/cfgetispeed.c, src/cfgetospeed.c, src/cfsetispeed.c, src/cfsetospeed.c, src/chdir.c, src/chmod.c, src/chown.c, src/chroot.c, src/close.c, src/ctermid.c, src/dup.c, src/dup2.c, src/eval.c, src/fchdir.c, src/fchmod.c, src/fcntl.c, src/fdatasync.c, src/fpathconf.c, src/fs_null_handlers.c, src/fstat.c, src/fsync.c, src/ftruncate.c, src/getdents.c, src/getpwent.c, src/hosterr.c, src/ioctl.c, src/isatty.c, src/libio.c, src/libio_sockets.c, src/link.c, src/lseek.c, src/lstat.c, src/malloc.c, src/mallocfreespace.c, src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mount.c, src/newlibc.c, src/no_libc.c, src/no_posix.c, src/open.c, src/pathconf.c, src/pipe.c, src/privateenv.c, src/read.c, src/readlink.c, src/rewinddir.c, src/rmdir.c, src/seekdir.c, src/stat.c, src/symlink.c, src/sync.c, src/tcdrain.c, src/tcflow.c, src/tcflush.c, src/tcgetattr.c, src/tcgetprgrp.c, src/tcsendbreak.c, src/tcsetattr.c, src/tcsetpgrp.c, src/telldir.c, src/termios.c, src/termiosinitialize.c, src/truncate.c, src/umask.c, src/unixlibc.c, src/unlink.c, src/unmount.c, src/utime.c, src/write.c: URL for license changed.
* 2001-10-26 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2001-10-261-16/+5
| | | | | * libc/libio.c: Cleanup of initialization per suggestion from Eric Norum.
* 2001-10-25 Jennifer Averett <jennifer@OARcorp.com>Joel Sherrill2001-10-251-4/+14
| | | | | | | * libc/libio.c: Initialize more fields to NULL/0 during initialiation. * include/rtems/libio_.h: Fix freenode macro so it works for sockets which do not have the full set of filesystem operations and are initialized via something other than open().
* 2001-04-24 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2001-04-241-0/+2
| | | | | | | | | * libc/libio.c (rtems_libio_allocate): Make sure size and offset fields are cleared on each file open. Before this field was cleared, this resulted in the value from the last time that IOP was used being still in place. Discovered by Andrew Bythell <abythell@nortelnetworks.com>. * libc/open.c: Remove redundant setting of iop->offset.
* 2001-01-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de>Joel Sherrill2001-01-081-0/+4
| | | | | | | * configure.in: Add libc/config.h * libc/Makefile.am: Add INCLUDES += -I. to pickup config.h * libc/.cvsignore: Add config.h and stamp-h * libc/*.c: Add config.h support.
* 2000-11-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>Joel Sherrill2000-11-101-0/+2
| | | | * libc/libio.c: Special treatment of O_NDELAY for Cygwin.
* 2000-11-01 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2000-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * include/Makefile.am, include/rtems/libio_.h, libc/Makefile.am, libc/assoc.c, libc/assocnamebad.c, libc/base_fs.c, libc/cfsetispeed.c, libc/cfsetospeed.c, libc/chdir.c, libc/chmod.c, libc/chown.c, libc/close.c, libc/closedir.c, libc/dup2.c, libc/error.c, libc/eval.c, libc/fchdir.c, libc/fchmod.c, libc/fcntl.c, libc/fdatasync.c, libc/fpathconf.c, libc/fstat.c, libc/fsync.c, libc/ftruncate.c, libc/getdents.c, libc/ioctl.c, libc/libio.c, libc/libio_sockets.c, libc/link.c, libc/lseek.c, libc/malloc.c, libc/mallocfreespace.c, libc/mknod.c, libc/mount.c, libc/newlibc.c, libc/no_libc.c, libc/open.c, libc/read.c, libc/readlink.c, libc/rmdir.c, libc/stat.c, libc/symlink.c, libc/tcsetattr.c, libc/telldir.c, libc/ttyname.c, libc/ttyname_r.c, libc/umask.c, libc/unlink.c, libc/unmount.c, libc/utime.c, libc/write.c: assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved from libc to lib/include/rtems and now must be referenced as <rtems/XXX.h>. * include/rtems/Makefile.am, include/rtems/.cvsignore: New file. * include/rtems/assoc.h, include/rtems/error.h, include/rtems/libcsupport.h, include/rtems/libio.h, include/rtems/libio_.h: New/moved files.
* 2000-09-05 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2000-09-051-0/+1
| | | | * libio.c: Added O_NONBLOCK to list of flags.
* Merged from 4.5.0-beta3aJoel Sherrill2000-06-121-2/+2
|
* Removed duplicate definition of rtems_filesystem_umask.Joel Sherrill1999-11-301-6/+0
|
* Updated copyright notice.Joel Sherrill1999-11-171-2/+1
|
* Removed an uninitialized variable.Jennifer Averett1999-03-291-4/+5
|
* Use proper include for libio.h.Joel Sherrill1999-03-161-1/+1
|
* Added code to translate internal libio flags to POSIX style flags.Joel Sherrill1999-03-081-3/+20
|
* Added F_GETFL support so the fdopen() implementation in newlib 1.8.1Joel Sherrill1999-03-061-0/+18
| | | | | | | | would work. At the same time, the initial implementation of F_SETFL was added. A support routine was added to convert internal libio flags back to the POSIX style. Eventually the internal representation should be eliminated in the interest of simplicity and code reduction. This problem was reported by Jake Janovetz <janovetz@tempest.ece.uiuc.edu>.
* Patch from Eric Norum <eric@skatter.usask.ca> to eliminate externalJoel Sherrill1999-03-011-32/+0
| | | | | IO handlers scheme that was implemented originally just to support sockets. The file system IO switch is more general and works fine.
* Merged Eric Norum's select patch that was based on 4.0 and resolvedJoel Sherrill1998-12-101-61/+96
| | | | all conflicts.
* Added base version of file system infrastructure. This includes a majorJoel Sherrill1998-11-231-446/+217
| | | | | | | | | | | | | | | | | | | | | | | | overhaul of the RTEMS system call interface. This base file system is the "In-Memory File System" aka IMFS. The design and implementation was done by the following people: + Joel Sherrill (joel@OARcorp.com) + Jennifer Averett (jennifer@OARcorp.com) + Steve "Mr Mount" Salitasc (salitasc@OARcorp.com) + Kerwin Wade (wade@OARcorp.com) PROBLEMS ======== + It is VERY likely that merging this will break the UNIX port. This can/will be fixed. + There is likely some reentrancy/mutual exclusion needed. + Eventually, there should be a "mini-IMFS" description table to eliminate links, symlinks, etc to save memory. All you need to have "classic RTEMS" functionality is technically directories and device IO. All the rest could be left out to save memory.
* rtems_libio_number_iops is now defined in confdefs.h so the maximumJoel Sherrill1998-04-181-1/+1
| | | | file descriptors is user configurable.
* Numerous changes which in total greatly reduced the amount of sourceJoel Sherrill1998-04-151-18/+0
| | | | | | | | | | | | code in each BSP's bspstart.c. These changes were: + confdefs.h now knows libio's semaphore requirements + shared/main.c now copies Configuration to BSP_Configuration + shared/main.c fills in the Cpu_table with default values This removed the need for rtems_libio_config() and the constant BSP_LIBIO_MAX_FDS in every BSP. Plus now the maximum number of open files can now be set on the gcc command line.
* Patch from Eric Norum <eric@skatter.usask.ca>:Joel Sherrill1998-02-171-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've gone through and cleaned up the TFTP driver so that it fits into the libio system. Here's the comment from the new driver: /* * Usage: * * To open `/bootfiles/image' on `hostname' for reading: * fd = open ("/TFTP/hostname/bootfiles/image", O_RDONLY); * * The `hostname' can be a symbolic name or four * dot-separated decimal values. * * To open a file on the host which supplied the BOOTP * information just leave the `hostname' part empty: * fd = open ("/TFTP//bootfiles/image", O_RDONLY); * */ You can `fopen' TFTP files the same way: fp = fopen (fullname, "r"); nread = fread (cbuf, sizeof cbuf[0], sizeof cbuf, fp); The diff's are included below. I've also modified the TFTP demo program and the bootstrap PROM example. They should be on my ftp site `soon'. The one thing I don't like is the way I had to do an end-run on the libio routines to get errno passed back from my driver to the application (since there are some errno codes that don't map to RTEMS status codes). My approach was to set errno in the driver and have the driver routine return an RTEMS status code that I `know' isn't in the errno_assoc[] in libio.c. Perhaps there should be an RTEMS_TRANPARENT_ERRNO status code (or something similar) which driver routines could return to indicate that the driver routine has set errno and that the libio routines shouldn't attempt to map the returned status code to errno. Actually, I think the entire I/O system needs looking at -- as you've already mentioned. The hacks I've dropped in to syscalls.c to make fstat work, for example, are *not* shining examples of good code......
* Bug fix from Eric Norum:Joel Sherrill1997-09-191-1/+0
| | | | | | | | | | | After weeks of trying to figure why my RTEMS/KASQ server crashes now and then I found a nasty bug I introduced in adding multiple-driver support to libio. The bug only affects `add-on' driver classes (like the networking code). Old-style file descriptors were not affected. The bug cleared 32 bytes of memory (unspecified location) whenever a `close' of a socket was performed! I was clearing an IOP I hadn't allocated -- and the pointer wasn't initiallized, either!
* Added RTEMS_IO_ERROR status code.Joel Sherrill1997-08-281-0/+1
|
* Added error numbers and changed default error code from 0 to -1 forJoel Sherrill1997-08-271-7/+9
| | | | error number mapping.
* Fixed iop/memory leak bug reported by Dan Dickey.Joel Sherrill1997-08-221-1/+6
|
* Added ka9q tcpip stack and network driver for the gen68360. This effortJoel Sherrill1997-04-091-14/+92
| | | | | | | | | | | | | was done based on the 3.6.0 release and had to be autoconf'ed locally. It is turned on is the bsp enables it and it is not explicitly disabled via the configure option --disable-tcpip. As many warnings as possible were removed locally after the code was merged. Only the gen68360 and mvme136 bsps were compiled this way. The ka9q port and network driver were submitted by Eric Norum (eric@skatter.USask.Ca). The network demo programs are not included in the tree at this point.