Exemple #1
0
int __clone(
  int (*fn)(void *),
  void *child_stack,
  int flags,
  void *arg, ...)
{
  void *ptid;
  void *tls;
  void *ctid;
  va_list al;
  int err;

  va_start(al, arg);
  ptid = va_arg(al, void *);
  tls = va_arg(al, void *);
  ctid = va_arg(al, void *);
  va_end(al);

  err = EINVAL;
  if (!fn)
    goto err;
  if (!child_stack)
    goto err;

  /* prepare fn&arg in child_stack */
  child_stack = (void *)((unsigned int)child_stack - 8);
  *(unsigned int *)child_stack = (unsigned int)fn;
  *(unsigned int *)(child_stack + 4) = (unsigned int)arg;

  return __csky_clone(flags, child_stack, ptid, ctid, tls);
err:
  return __syscall_error(-err);
}
Exemple #2
0
long int
syscall (long int syscall_number, long int arg1, long int arg2, long int arg3,
	 long int arg4, long int arg5, long int arg6, long int arg7)
{
  long int ret;
  INTERNAL_SYSCALL_DECL (err);

  ret = INTERNAL_SYSCALL_NCS (syscall_number, err, 7, arg1, arg2, arg3, arg4,
			      arg5, arg6, arg7);

  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
    return __syscall_error (ret);

  return ret;
}
long syscall (long syscall_number, long arg1, long arg2, long arg3,
	      long arg4, long arg5, long arg6, long arg7)
{
  long ret, err; 

  ret = INTERNAL_SYSCALL_NCS(syscall_number, err, 7, arg1, arg2, arg3, arg4,
			     arg5, arg6, arg7);

  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
    {
      extern long __syscall_error() attribute_hidden;
      return __syscall_error();
    }

  return ret;
}