Changeset baef9df for lib/iow-stdio.c


Ignore:
Timestamp:
04/20/10 14:08:27 (12 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
5b8f9ee
Parents:
8ed31c2
Message:

Add back support for opening files for write with arbitary flags

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/iow-stdio.c

    r22cdd39 rbaef9df  
    5959#define DATA(iow) ((struct stdiow_t *)((iow)->data))
    6060
    61 static int safe_open(const char *filename)
     61static int safe_open(const char *filename, int flags)
    6262{
    6363        int fd;
     
    6565#ifdef O_DIRECT
    6666        fd = open(filename,
    67                 O_WRONLY
     67                flags
     68                |O_WRONLY
    6869                |O_CREAT
    6970                |O_TRUNC
     
    7576/* If that failed (or we don't support O_DIRECT) try opening without */
    7677        fd = open(filename,
    77                 O_WRONLY
     78                flags
     79                |O_WRONLY
    7880                |O_CREAT
    7981                |O_TRUNC,
     
    8486}
    8587
    86 iow_t *stdio_wopen(const char *filename)
     88iow_t *stdio_wopen(const char *filename,int flags)
    8789{
    8890        iow_t *iow = malloc(sizeof(iow_t));
     
    9395                DATA(iow)->fd = 1; /* STDOUT */
    9496        else {
    95                 DATA(iow)->fd = safe_open(filename);
     97                DATA(iow)->fd = safe_open(filename, flags);
    9698        }
    9799
Note: See TracChangeset for help on using the changeset viewer.