Changeset f00af83 in mainline for uspace/lib/posix/fcntl.c


Ignore:
Timestamp:
2011-08-19T17:09:26Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
07b39338, 921b84f, be79a663
Parents:
107f2e0
Message:

Removed no more supported functionality from freopen() and fcntl() as a reaction to mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/fcntl.c

    r107f2e0 rf00af83  
    5252int posix_fcntl(int fd, int cmd, ...)
    5353{
    54         int rc;
    5554        int flags;
    5655
    5756        switch (cmd) {
    5857        case F_DUPFD:
    59         case F_DUPFD_CLOEXEC: /* FD_CLOEXEC is not supported. */
    60                 /* VFS does not provide means to express constraints on the new
    61                  * file descriptor so the third argument is ignored. */
    62 
    63                 /* Retrieve node triplet corresponding to the file descriptor. */
    64                 /* Empty statement after label. */;
    65                 fdi_node_t node;
    66                 rc = fd_node(fd, &node);
    67                 if (rc != EOK) {
    68                         errno = -rc;
    69                         return -1;
    70                 }
    71 
    72                 /* Reopen the node so the fresh file descriptor is generated. */
    73                 int newfd = open_node(&node, 0);
    74                 if (newfd < 0) {
    75                         errno = -newfd;
    76                         return -1;
    77                 }
    78 
    79                 /* Associate the newly generated descriptor to the file description
    80                  * of the old file descriptor. Just reopened node will be automatically
    81                  * closed. */
    82                 rc = dup2(fd, newfd);
    83                 if (rc != EOK) {
    84                         errno = -rc;
    85                         return -1;
    86                 }
    87 
    88                 return newfd;
     58        case F_DUPFD_CLOEXEC:
     59                /* VFS currently does not provide the functionality to duplicate
     60                 * opened file descriptor. */
     61                // FIXME: implement this once dup() is available
     62                errno = ENOTSUP;
     63                return -1;
    8964        case F_GETFD:
    9065                /* FD_CLOEXEC is not supported. There are no other flags. */
Note: See TracChangeset for help on using the changeset viewer.