summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/fcntl.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* cpukit/libcsupport/src/[a-f]*: Change license to BSD-2Joel Sherrill2022-04-011-3/+22
| | | | Updates #3053.
* doxygen: Switch @brief and @ingroupSebastian Huber2020-04-281-1/+2
| | | | This order change fixes the Latex documentation build via Doxygen.
* Canonicalize config.h includeSebastian Huber2020-04-161-2/+2
| | | | | | | | 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-2/+2
| | | | | | | | | | | | 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: Add hold/drop iop referenceSebastian Huber2017-09-151-0/+2
| | | | | | | 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: LIBIO_GET_IOP() LIBIO_GET_IOP_WITH_ACCESS()Sebastian Huber2017-09-151-4/+5
| | | | | | | | | Replace rtems_libio_check_fd(), rtems_libio_iop(), rtems_libio_check_open() and rtems_libio_check_permissions() combinations with new LIBIO_GET_IOP() and LIBIO_GET_IOP_WITH_ACCESS() macros. Update #3132.
* libio: Add rtems_libio_iop_flags()Sebastian Huber2017-09-151-5/+5
| | | | Update #3132.
* libio: Add rtems_libio_iop_flags_initialize()Sebastian Huber2017-09-151-6/+9
| | | | Update #3132.
* libio: Add iop set/clear flagsSebastian Huber2017-09-151-5/+6
| | | | Update #3132.
* libio: Remove LIBIO_FLAGS_CREATESebastian Huber2017-09-141-2/+0
| | | | Close #3134.
* basdefs.h: Add and use RTEMS_UNUSEDSebastian Huber2015-10-261-1/+1
|
* Filesystem: Use rtems_libio_iop_to_descriptor()Sebastian Huber2015-02-041-1/+1
| | | | | Drop parameter check from previously unused rtems_libio_iop_to_descriptor().
* Change all references of rtems.com to rtems.org.Chris Johns2014-03-211-1/+1
|
* PR2158: Add support for dup2.Chris Johns2013-12-101-6/+47
| | | | | Split the dub call into dup and dup2 in fcntl.c. This requires a private command which is placed in the internal libio header.
* libcsupport: Doxygen Enhancement Task #3Mathew Kallada2012-12-081-2/+7
| | | | http://www.google-melange.com/gci/task/view/google/gci2012/7992210
* 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: Reference counting for locationsSebastian Huber2012-03-131-19/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-07-16 Sebastian Huber <sebastian.huber@embedded-brains.de>Sebastian Huber2010-07-151-3/+1
| | | | | | | | | | | | | | | | | | | | | * libcsupport/include/rtems/libio.h: Removed file_info and handlers fields in rtems_libio_t. * libcsupport/src/close.c, libcsupport/src/fcntl.c, libcsupport/src/fdatasync.c, libcsupport/src/fstat.c, libcsupport/src/fsync.c, libcsupport/src/ftruncate.c, libcsupport/src/getdents.c, libcsupport/src/ioctl.c, libcsupport/src/libio_sockets.c, libcsupport/src/lseek.c, libcsupport/src/open.c, libcsupport/src/read.c, libcsupport/src/readv.c, libcsupport/src/write.c, libcsupport/src/writev.c, libfs/src/devfs/devclose.c, libfs/src/devfs/devioctl.c, libfs/src/devfs/devopen.c, libfs/src/devfs/devread.c, libfs/src/devfs/devwrite.c libfs/src/dosfs/msdos_dir.c libfs/src/dosfs/msdos_file.c libfs/src/imfs/deviceio.c libfs/src/imfs/imfs_directory.c libfs/src/imfs/imfs_fifo.c libfs/src/imfs/memfile.c libfs/src/nfsclient/src/nfs.c libfs/src/rfs/rtems-rfs-rtems-file.c libfs/src/rfs/rtems-rfs-rtems.h libnetworking/lib/ftpfs.c: Reflect changes above.
* 2010-07-01 Jennifer Averett <Jennifer.Averett@OARcorp.com>Jennifer Averett2010-07-011-6/+4
| | | | | | | | | | | | | | | | | | | | | * libcsupport/src/chdir.c, libcsupport/src/chmod.c, libcsupport/src/chown.c, libcsupport/src/close.c, libcsupport/src/eval.c, libcsupport/src/fchdir.c, libcsupport/src/fchmod.c, libcsupport/src/fchown.c, libcsupport/src/fcntl.c, libcsupport/src/fdatasync.c, libcsupport/src/freenode.c, libcsupport/src/fstat.c, libcsupport/src/fsync.c, libcsupport/src/ftruncate.c, libcsupport/src/ioctl.c, libcsupport/src/link.c, libcsupport/src/lseek.c, libcsupport/src/mknod.c, libcsupport/src/mount.c, libcsupport/src/open.c, libcsupport/src/read.c, libcsupport/src/readlink.c, libcsupport/src/readv.c, libcsupport/src/rmdir.c, libcsupport/src/stat.c, libcsupport/src/statvfs.c, libcsupport/src/symlink.c, libcsupport/src/unlink.c, libcsupport/src/unmount.c, libcsupport/src/write.c: Removed filesystem checks for NULL methods checks from the main posix rountines. These are now required to have at a miminum default routines in the tables.
* Rework autoconf defines.Ralf Corsepius2009-09-301-1/+1
|
* Add __attribute__((unused)) to function arguments.Ralf Corsepius2009-09-151-1/+1
|
* Remove stray white spaces.Ralf Corsepius2004-04-181-4/+4
|
* Remove stray white spaces.Ralf Corsepius2004-04-151-1/+0
|
* 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.
* 2003-02-05 Till Straumann <strauman@slac.stanford.edu>Joel Sherrill2003-02-051-5/+39
| | | | | PR 340/filesystem * src/fcntl.c: Add missing _fcntl_r assumed to exist by newlib.
* 2002-02-05 Ralf Corsepius <corsepiu@faw.uni-ulm.de>Joel Sherrill2002-01-061-0/+1
| | | | | | * libc/Makefile.am: Add MULTISUBDIR support. * libc/fcntl.c: Add #include <stdarg.h>. * libc/privateenv.c: Add #include <stdlib.h>.
* 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-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-10-18 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2000-10-181-4/+6
| | | | | | | * libc/fcntl.c: Do not require every filesystem to have an fcntl() handler. Most fcntl() operations can be performed with no filesystem support. * ChangeLog: Corrected comment.
* 2000-09-28 Joel Sherrill <joel@OARcorp.com>Joel Sherrill2000-09-281-2/+2
| | | | | | | | | | | | | | | * libc/libio.h (rtems_filesystem_file_handlers_r, rtems_filesystem_operations_table): Added _h to all structure fields to indicate they are "handlers". * libc/libio_.h, libc/chdir.c, libc/chmod.c, libc/chown.c, libc/close.c, libc/eval.c, libc/fchdir.c, libc/fchmod.c, libc/fcntl.c, libc/fdatasync.c, libc/fstat.c, libc/fsync.c, libc/ftruncate.c, libc/getdents.c, libc/imfs_eval.c, libc/imfs_unlink.c, libc/ioctl.c, libc/ioman.c, libc/link.c, libc/lseek.c, libc/mknod.c, libc/mount.c, libc/open.c, libc/read.c, libc/readlink.c, libc/rmdir.c, libc/stat.c, libc/symlink.c, libc/unlink.c, libc/unmount.c, libc/utime.c, libc/write.c: Modified to reflect above name change.
* 2000-08-11 Chris Johns <ccj@acm.org>Joel Sherrill2000-08-111-4/+10
| | | | | | | | | | | | | | | * libc/chmod.c: Return ENOTSUP if filesystem does not have handler. * libc/eval.c: Ditto. * libc/fcntl.c: Ditto. * libc/fsync.c: Ditto. * libc/ioctl.c: Ditto. * libc/ioman.c: Ditto. * libc/link.c: Ditto. * libc/memfile.c: Ditto. * libc/mknod.c: Ditto. * libc/symlink.c: Ditto. * libc/libio.h(rtems_filesystem_dev_major_t): New macro. * libc/libio.h(rtems_filesystem_dev_minor_t): New macro.
* Updated copyright notice.Joel Sherrill1999-11-171-2/+1
|
* Fixed F_SETFL to properly convert between internalJoel Sherrill1999-11-021-2/+3
| | | | libio flags and external fcntl.h style flags.
* Corrected return value.Jennifer Averett1999-03-311-1/+1
|
* Another cleanup patch for the previous rejected hunk.Joel Sherrill1999-03-191-0/+1
|
* A cleanup patch on fcntl.c from Eric Norum <eric@skatter.usask.ca> forJoel Sherrill1999-03-191-0/+2
| | | | | 2 lines of code that did not get included when Joel tried to manually add a rejected patch.
* Patch from Eric Norum <eric@skatter.usask.ca> that adds externalJoel Sherrill1999-03-191-24/+36
| | | | fcntl support and an external fcntl handler for sockets.
* Added support for F_GETFL and F_SETFL.Joel Sherrill1999-03-081-2/+3
|
* Added F_GETFL support so the fdopen() implementation in newlib 1.8.1Joel Sherrill1999-03-061-2/+17
| | | | | | | | 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-7/+0
| | | | | IO handlers scheme that was implemented originally just to support sockets. The file system IO switch is more general and works fine.
* More general fix based on bug report and patch from Ian Lance TaylorJoel Sherrill1999-01-201-0/+1
| | | | | | | | | | <ian@airs.com> to fix this problem: There is a small bug in __rtems_close in c/src/lib/libc/libio.c. It does not check whether the file descriptor it is passed is open. This can cause it to make a null dereference if it is passed a file descriptor which is in the valid range but which was not opened, or which was already closed.
* Merged Eric Norum's select patch that was based on 4.0 and resolvedJoel Sherrill1998-12-101-4/+4
| | | | all conflicts.
* Added source for F_DUPFD.Jennifer Averett1998-12-031-12/+18
|
* Added base version of file system infrastructure. This includes a majorJoel Sherrill1998-11-231-0/+111
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.