_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
#endif
_syscall2(int, sys_getpriority, int, which, int, who);
-#if !defined (__x86_64__)
+#if defined(TARGET_NR__llseek) && !defined (__x86_64__)
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
loff_t *, res, uint, wh);
#endif
return ret;
}
-static abi_long pipe_set_flag(int fd, int readcmd, int writecmd, long newflag)
+
+static abi_long do_pipe2(int host_pipe[], int flags)
{
- int flags = fcntl(fd, readcmd);
- if (flags<0)
- return get_errno(flags);
- flags |= newflag;
- flags = fcntl(fd, writecmd, flags);
- return get_errno(flags);
+#ifdef CONFIG_PIPE2
+ return pipe2(host_pipe, flags);
+#else
+ return -ENOSYS;
+#endif
}
static abi_long do_pipe(void *cpu_env, int pipedes, int flags)
{
int host_pipe[2];
abi_long ret;
- ret = pipe(host_pipe);
+ ret = flags ? do_pipe2(host_pipe, flags) : pipe(host_pipe);
+
if (is_error(ret))
return get_errno(ret);
#if defined(TARGET_MIPS)
|| put_user_s32(host_pipe[1], pipedes + sizeof(host_pipe[0])))
return -TARGET_EFAULT;
#endif
- if (flags & O_NONBLOCK) {
- ret = pipe_set_flag(host_pipe[0], F_GETFL, F_SETFL, O_NONBLOCK);
- if (is_error(ret))
- return get_errno(ret);
- ret = pipe_set_flag(host_pipe[1], F_GETFL, F_SETFL, O_NONBLOCK);
- if (is_error(ret))
- return get_errno(ret);
- }
- if (flags & O_CLOEXEC) {
- ret = pipe_set_flag(host_pipe[0], F_GETFD, F_SETFD, FD_CLOEXEC);
- if (is_error(ret))
- return get_errno(ret);
- ret = pipe_set_flag(host_pipe[1], F_GETFD, F_SETFD, FD_CLOEXEC);
- if (is_error(ret))
- return get_errno(ret);
- }
return get_errno(ret);
}
/* kernel structure types definitions */
#define IFNAMSIZ 16
-#define STRUCT(name, list...) STRUCT_ ## name,
+#define STRUCT(name, ...) STRUCT_ ## name,
#define STRUCT_SPECIAL(name) STRUCT_ ## name,
enum {
#include "syscall_types.h"
#undef STRUCT
#undef STRUCT_SPECIAL
-#define STRUCT(name, list...) static const argtype struct_ ## name ## _def[] = { list, TYPE_NULL };
+#define STRUCT(name, ...) static const argtype struct_ ## name ## _def[] = { __VA_ARGS__, TYPE_NULL };
#define STRUCT_SPECIAL(name)
#include "syscall_types.h"
#undef STRUCT
#define MAX_STRUCT_SIZE 4096
static IOCTLEntry ioctl_entries[] = {
-#define IOCTL(cmd, access, types...) \
- { TARGET_ ## cmd, cmd, #cmd, access, { types } },
+#define IOCTL(cmd, access, ...) \
+ { TARGET_ ## cmd, cmd, #cmd, access, { __VA_ARGS__ } },
#include "ioctls.h"
{ 0, 0, },
};
env = info->env;
thread_env = env;
ts = (TaskState *)thread_env->opaque;
- info->tid = gettid();
task_settid(ts);
+ info->tid = gettid();
+ env->host_tid = info->tid;
if (info->child_tidptr)
put_user_u32(info->tid, info->child_tidptr);
if (info->parent_tidptr)
int size;
int i;
-#define STRUCT(name, list...) thunk_register_struct(STRUCT_ ## name, #name, struct_ ## name ## _def);
+#define STRUCT(name, ...) thunk_register_struct(STRUCT_ ## name, #name, struct_ ## name ## _def);
#define STRUCT_SPECIAL(name) thunk_register_struct_direct(STRUCT_ ## name, #name, &struct_ ## name ## _def);
#include "syscall_types.h"
#undef STRUCT
pts, NULL, 0));
case FUTEX_WAKE:
return get_errno(sys_futex(g2h(uaddr), op, val, NULL, NULL, 0));
+ case FUTEX_WAKE_OP:
+ return get_errno(sys_futex(g2h(uaddr), op, val, NULL, g2h(uaddr2), val3 ));
case FUTEX_FD:
return get_errno(sys_futex(g2h(uaddr), op, val, NULL, NULL, 0));
case FUTEX_REQUEUE:
/* FIXME: This probably breaks if a signal arrives. We should probably
be disabling signals. */
if (first_cpu->next_cpu) {
+ TaskState *ts;
CPUState **lastp;
CPUState *p;
/* Remove the CPU from the list. */
*lastp = p->next_cpu;
cpu_list_unlock();
- TaskState *ts = ((CPUState *)cpu_env)->opaque;
+ ts = ((CPUState *)cpu_env)->opaque;
if (ts->child_tidptr) {
put_user_u32(0, ts->child_tidptr);
sys_futex(g2h(ts->child_tidptr), FUTEX_WAKE, INT_MAX,
#endif
#ifdef TARGET_NR_mmap
case TARGET_NR_mmap:
-#if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_CRIS)
+#if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_MICROBLAZE)
{
abi_ulong *v;
abi_ulong v1, v2, v3, v4, v5, v6;