Exemple #1
0
/*
 * Fcntl bridge
 */
static const char *flag_name(int flag)
{
#define FLAG_NAME(n) case n: return #n
    switch (flag) {
        FLAG_NAME(F_GETFD);
        FLAG_NAME(F_SETFD);
        FLAG_NAME(F_GETFL);
        FLAG_NAME(F_SETFL);
        FLAG_NAME(F_DUPFD);
        FLAG_NAME(F_GETLK);
        FLAG_NAME(F_SETLK);
        FLAG_NAME(F_SETLKW);
#if defined(F_GETOWN)
        FLAG_NAME(F_GETOWN);
#endif
#if defined(F_SETOWN)
        FLAG_NAME(F_SETOWN);
#endif
#if defined(F_GETSIG)
        FLAG_NAME(F_GETSIG);
#endif
#if defined(F_SETSIG)
        FLAG_NAME(F_SETSIG);
#endif
#if defined(F_GETLEASE)
        FLAG_NAME(F_GETLEASE);
#endif
#if defined(F_SETLEASE)
        FLAG_NAME(F_SETLEASE);
#endif
#if defined(F_NOTIFY)
        FLAG_NAME(F_NOTIFY);
#endif
    }
    return "(unknown flag)";
#undef FLAG_NAME
}
Exemple #2
0
#include "simterpose.h"
#include "sysdep.h"
#include <xbt.h>

#include <stdio.h>
#include </usr/include/linux/sched.h>   /* For clone flags */

typedef struct {
	int val;
	const char* name;
} flag_names_t;
#define FLAG_NAME(x) { x, #x}
#define FLAG_NAME_EOL {0,NULL}

static flag_names_t flags_open[] = {
		FLAG_NAME(O_RDWR),
		FLAG_NAME(O_RDONLY),
		FLAG_NAME(O_WRONLY),
		FLAG_NAME(O_NONBLOCK),
		FLAG_NAME(O_APPEND),
		FLAG_NAME(O_CREAT),
		FLAG_NAME(O_TRUNC),
		FLAG_NAME(O_EXCL),
		FLAG_NAME(O_NOCTTY),
		FLAG_NAME(O_SYNC),
		FLAG_NAME(O_DSYNC),
		FLAG_NAME(O_RSYNC),
		FLAG_NAME(O_NDELAY),
		FLAG_NAME(O_CLOEXEC),
        FLAG_NAME_EOL
};