Changeset 4c53333 in mainline for uspace/lib/posix/source/fcntl.c


Ignore:
Timestamp:
2013-07-11T08:21:10Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
64e63ce1
Parents:
80445cf (diff), c8bb1633 (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 mainline changes

File:
1 moved

Legend:

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

    r80445cf r4c53333  
    3434
    3535#define LIBPOSIX_INTERNAL
     36#define __POSIX_DEF__(x) posix_##x
    3637
    3738#include "internal/common.h"
    38 #include "fcntl.h"
     39#include "posix/fcntl.h"
    3940
    4041#include "libc/unistd.h"
    4142#include "libc/vfs/vfs.h"
    42 #include "errno.h"
     43#include "posix/errno.h"
    4344
    4445/**
     
    9596}
    9697
     98/**
     99 * Open, possibly create, a file.
     100 *
     101 * @param pathname Path to the file.
     102 * @param flags Access mode flags.
     103 */
     104int posix_open(const char *pathname, int flags, ...)
     105{
     106        mode_t mode = 0;
     107        if ((flags & O_CREAT) > 0) {
     108                va_list args;
     109                va_start(args, flags);
     110                mode = va_arg(args, mode_t);
     111                va_end(args);
     112        }
     113
     114        int rc = open(pathname, flags, mode);
     115        if (rc < 0) {
     116                errno = -rc;
     117                rc = -1;
     118        }
     119
     120        return rc;
     121}
     122
    97123/** @}
    98124 */
Note: See TracChangeset for help on using the changeset viewer.