Changeset e4f8c77 in mainline for uspace/lib/posix/fcntl.h


Ignore:
Timestamp:
2011-07-13T22:39:18Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e6910c8
Parents:
5974661 (diff), 8ecef91 (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 libposix.

File:
1 edited

Legend:

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

    r5974661 re4f8c77  
    3636#define POSIX_FCNTL_H_
    3737
     38#include "sys/types.h"
    3839#include "libc/fcntl.h"
     40#include "errno.h"
     41
     42/* Mask for file access modes. */
     43#undef O_ACCMODE
     44#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
    3945
    4046/* fcntl commands */
    4147#undef F_DUPFD
     48#undef F_DUPFD_CLOEXEC
    4249#undef F_GETFD
    4350#undef F_SETFD
     
    4653#undef F_GETOWN
    4754#undef F_SETOWN
    48 #define F_DUPFD         0       /* Duplicate file descriptor. */
    49 #define F_GETFD         1       /* Get file descriptor flags. */
    50 #define F_SETFD         2       /* Set file descriptor flags. */
    51 #define F_GETFL         3       /* Get file status flags. */
    52 #define F_SETFL         4       /* Set file status flags. */
    53 #define F_GETOWN        5       /* Get owner. */
    54 #define F_SETOWN        6       /* Set owner. */
     55#undef F_GETLK
     56#undef F_SETLK
     57#undef F_SETLKW
     58#define F_DUPFD            0 /* Duplicate file descriptor. */
     59#define F_DUPFD_CLOEXEC    1 /* Same as F_DUPFD but with FD_CLOEXEC flag set. */
     60#define F_GETFD            2 /* Get file descriptor flags. */
     61#define F_SETFD            3 /* Set file descriptor flags. */
     62#define F_GETFL            4 /* Get file status and access flags. */
     63#define F_SETFL            5 /* Set file status flags. */
     64#define F_GETOWN           6 /* Get socket owner. */
     65#define F_SETOWN           7 /* Set socket owner. */
     66#define F_GETLK            8 /* Get locking information. */
     67#define F_SETLK            9 /* Set locking information. */
     68#define F_SETLKW          10 /* Set locking information; wait if blocked. */
    5569
    5670/* File descriptor flags used with F_GETFD and F_SETFD. */
    5771#undef FD_CLOEXEC
    58 #define FD_CLOEXEC      1       /* Close on exec. */
     72#define FD_CLOEXEC         1 /* Close on exec. */
     73
     74#undef open
     75#define open(path, ...) \
     76        ({ \
     77                int rc = open(path, ##__VA_ARGS__); \
     78                if (rc < 0) { \
     79                        errno = -rc; \
     80                        rc = -1; \
     81                } \
     82                rc; \
     83        })
    5984
    6085extern int posix_fcntl(int fd, int cmd, ...);
Note: See TracChangeset for help on using the changeset viewer.