Esempio n. 1
0
  /* Fetch a thread state structure from PID and store it at ADDR.  */
  int get_regs (int flavor, mach_msg_type_number_t count)
    {
      error_t err;
      task_t task = __pid2task (pid);
      thread_t thread;
      if (task == MACH_PORT_NULL)
	return -1;
      err = fetch_user_thread (task, &thread);
      __mach_port_deallocate (__mach_task_self (), task);
      if (!err)
	err = __thread_get_state (thread, flavor, addr, &count);
      __mach_port_deallocate (__mach_task_self (), thread);
      return err ? __hurd_fail (err) : 0;
    }
Esempio n. 2
0
/* Adjust the current time of day by the amount in DELTA.
   If OLDDELTA is not NULL, it is filled in with the amount
   of time adjustment remaining to be done from the last `__adjtime' call.
   This call is restricted to the super-user.  */
int
__adjtime (const struct timeval *delta, struct timeval *olddelta)
{
  error_t err;
  mach_port_t hostpriv;

  hostpriv = __pid2task (-1);
  if (hostpriv == MACH_PORT_NULL)
    return -1;
  err = __host_adjust_time (hostpriv, delta, olddelta);
  __mach_port_deallocate (__mach_task_self (), hostpriv);
  if (err)
    return __hurd_fail (err);
  return 0;
}