• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ current_process函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中current_process函数的典型用法代码示例。如果您正苦于以下问题:C++ current_process函数的具体用法?C++ current_process怎么用?C++ current_process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了current_process函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: start_erl

int start_erl(int argc, char **argv) {
  union SIGNAL *sig;
  PROCESS erts_;
  OSENTRYPOINT erts;

  if(hunt("erts", 0, NULL, NULL)) {
    erl_dbg_fprintf(stderr, "ERROR: erts already running\n");
    return 0;
  }

  erl_block = get_bid(erl_tmp_);
  erl_dbg_fprintf(stdout, "Erlang block id: %li\n", (unsigned long)erl_block);
  fflush(stderr);

  /* initialise DNS service, needed for distributed Erlang */
  config_dns();

  erl_argc = argc;
  erl_argv = argv;		/* so that erts may copy the struct */

  /* used by erts to detect shutdown of ose shell (interactive mode only) */
  erlang_starter_ = current_process(); 

  /* create and start the erlang emulator as ose process "erts" */
  erts_ = create_process(OS_BG_PROC, /* processtype */
			 "erts", /* name        */
			 erts,	 /* entrypoint  */
			 524288, /* stacksize   */
			 20,	 /* priority (if OS_PRI_PROC) */
			 0,	 /* timeslice */
			 erl_block, /* block */
			 NULL,0,0); /* not used    */

  set_fsem((OSFSEMVAL) 0, current_process());

  efs_clone(erts_);
  start(erts_);

  /* sync with erts, this function must not return until erts has copied argv */
  wait_fsem((OSFSEMVAL) 1);

  /* in interactive mode the ose shell will "hang", waiting for erts to terminate */
  if(!start_detached) {	
    static const SIGSELECT recv_attach_sig[2] = {1, OS_ATTACH_SIG};
    erl_dbg_fprintf(stdout, "erts started in interactive mode\n");
    attach(NULL, erts_);
    sig = receive((SIGSELECT*)recv_attach_sig);
    erl_dbg_fprintf(stderr, "\n*** Erlang finished ***\n");
    free_buf(&sig);
  }
  return 0;

}
开发者ID:system,项目名称:erlang-otp,代码行数:53,代码来源:erl.exec.c


示例2: k_receive_message

// FEEL FREE TO MODIFY ACCORDING TO delayed_send, the following modifications were only made to suit console handling process/uart i-process
// Process receives a message from sender
void * k_receive_message (uint32_t *sender_ID) {
	envelope *envel = (current_process())->m_envelope;

	if (envel == 0)
		return 0;
	/*while (envel == 0) {
		move_to_blocked((current_process())->m_pid, MSG_BLOCKED);
		k_release_processor();
		envel = (current_process())->m_envelope;
	}*/

	dequeue_envelope((current_process())->m_pid, envel);

	return envel->info->message;
}
开发者ID:AetheonX,项目名称:AwesomeOS,代码行数:17,代码来源:message.c


示例3: set_breakpoint

static struct breakpoint *
set_breakpoint (enum bkpt_type type, enum raw_bkpt_type raw_type,
		CORE_ADDR where, int size,
		int (*handler) (CORE_ADDR), int *err)
{
  struct process_info *proc = current_process ();
  struct breakpoint *bp;
  struct raw_breakpoint *raw;

  raw = set_raw_breakpoint_at (raw_type, where, size, err);

  if (raw == NULL)
    {
      /* warn? */
      return NULL;
    }

  bp = xcalloc (1, sizeof (struct breakpoint));
  bp->type = type;

  bp->raw = raw;
  bp->handler = handler;

  bp->next = proc->breakpoints;
  proc->breakpoints = bp;

  return bp;
}
开发者ID:dbl001,项目名称:binutils,代码行数:28,代码来源:mem-break.c


示例4: reinsert_breakpoints_at

void
reinsert_breakpoints_at (CORE_ADDR pc)
{
  struct process_info *proc = current_process ();
  struct raw_breakpoint *bp;
  int found = 0;

  for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
    if ((bp->raw_type == raw_bkpt_type_sw
	 || bp->raw_type == raw_bkpt_type_hw)
	&& bp->pc == pc)
      {
	found = 1;

	reinsert_raw_breakpoint (bp);
      }

  if (!found)
    {
      /* This can happen when we remove all breakpoints while handling
	 a step-over.  */
      if (debug_threads)
	debug_printf ("Could not find raw breakpoint at 0x%s "
		      "in list (reinserting).\n",
		      paddress (pc));
    }
}
开发者ID:dbl001,项目名称:binutils,代码行数:27,代码来源:mem-break.c


示例5: get_env

/*
 * getenv_int:
 */
static char *getenv_int(const char *name) {
#ifdef __OSE__
   return get_env(get_bid(current_process()),name);
#else
   return getenv(name);
#endif
}
开发者ID:AxisOfEval,项目名称:otp,代码行数:10,代码来源:run_erl_common.c


示例6: aarch64_arch_setup

static void
aarch64_arch_setup (void)
{
  current_process ()->tdesc = aarch64_linux_read_description ();

  aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
}
开发者ID:cupertinomiranda,项目名称:binutils,代码行数:7,代码来源:linux-aarch64-low.c


示例7: lynx_resume

static void
lynx_resume (struct thread_resume *resume_info, size_t n)
{
  ptid_t ptid = resume_info[0].thread;
  const int request
    = (resume_info[0].kind == resume_step
       ? (n == 1 ? PTRACE_SINGLESTEP_ONE : PTRACE_SINGLESTEP)
       : PTRACE_CONT);
  const int signal = resume_info[0].sig;

  /* If given a minus_one_ptid, then try using the current_process'
     private->last_wait_event_ptid.  On most LynxOS versions,
     using any of the process' thread works well enough, but
     LynxOS 178 is a little more sensitive, and triggers some
     unexpected signals (Eg SIG61) when we resume the inferior
     using a different thread.  */
  if (ptid_equal (ptid, minus_one_ptid))
    ptid = current_process()->priv->last_wait_event_ptid;

  /* The ptid might still be minus_one_ptid; this can happen between
     the moment we create the inferior or attach to a process, and
     the moment we resume its execution for the first time.  It is
     fine to use the current_thread's ptid in those cases.  */
  if (ptid_equal (ptid, minus_one_ptid))
    ptid = thread_to_gdb_id (current_thread);

  regcache_invalidate ();

  errno = 0;
  lynx_ptrace (request, ptid, 1, signal, 0);
  if (errno)
    perror_with_name ("ptrace");
}
开发者ID:dcolascione,项目名称:binutils,代码行数:33,代码来源:lynx-low.c


示例8: set_breakpoint_at

struct breakpoint *
set_breakpoint_at (CORE_ADDR where, int (*handler) (CORE_ADDR))
{
  struct process_info *proc = current_process ();
  struct breakpoint *bp;
  struct raw_breakpoint *raw;

  raw = set_raw_breakpoint_at (where);

  if (raw == NULL)
    {
      /* warn? */
      return NULL;
    }

  bp = xcalloc (1, sizeof (struct breakpoint));
  bp->type = other_breakpoint;

  bp->raw = raw;
  bp->handler = handler;

  bp->next = proc->breakpoints;
  proc->breakpoints = bp;

  return bp;
}
开发者ID:5kg,项目名称:gdb,代码行数:26,代码来源:mem-break.c


示例9: check_breakpoints

void
check_breakpoints (CORE_ADDR stop_pc)
{
  struct process_info *proc = current_process ();
  struct breakpoint *bp, **bp_link;

  bp = proc->breakpoints;
  bp_link = &proc->breakpoints;

  while (bp)
    {
      if (bp->raw->pc == stop_pc)
	{
	  if (!bp->raw->inserted)
	    {
	      warning ("Hit a removed breakpoint?");
	      return;
	    }

	  if (bp->handler != NULL && (*bp->handler) (stop_pc))
	    {
	      *bp_link = bp->next;

	      release_breakpoint (proc, bp);

	      bp = *bp_link;
	      continue;
	    }
	}

      bp_link = &bp->next;
      bp = *bp_link;
    }
}
开发者ID:5kg,项目名称:gdb,代码行数:34,代码来源:mem-break.c


示例10: tile_arch_setup

static void
tile_arch_setup (void)
{
  int pid = pid_of (current_thread);
  unsigned int machine;
  int is_elf64 = linux_pid_exe_is_elf_64_file (pid, &machine);

  if (sizeof (void *) == 4)
    if (is_elf64 > 0)
      error (_("Can't debug 64-bit process with 32-bit GDBserver"));

  if (!is_elf64)
    current_process ()->tdesc = tdesc_tilegx32;
  else
    current_process ()->tdesc = tdesc_tilegx;
}
开发者ID:Jactry,项目名称:binutils-gdb,代码行数:16,代码来源:linux-tile-low.c


示例11: thread_db_init

int
thread_db_init (void)
{
  struct process_info *proc = current_process ();

  /* FIXME drow/2004-10-16: This is the "overall process ID", which
     GNU/Linux calls tgid, "thread group ID".  When we support
     attaching to threads, the original thread may not be the correct
     thread.  We would have to get the process ID from /proc for NPTL.

     This isn't the only place in gdbserver that assumes that the first
     process in the list is the thread group leader.  */

  if (thread_db_load_search ())
    {
      /* It's best to avoid td_ta_thr_iter if possible.  That walks
	 data structures in the inferior's address space that may be
	 corrupted, or, if the target is running, the list may change
	 while we walk it.  In the latter case, it's possible that a
	 thread exits just at the exact time that causes GDBserver to
	 get stuck in an infinite loop.  As the kernel supports clone
	 events and /proc/PID/task/ exists, then we already know about
	 all threads in the process.  When we need info out of
	 thread_db on a given thread (e.g., for TLS), we'll use
	 find_one_thread then.  That uses thread_db entry points that
	 do not walk libpthread's thread list, so should be safe, as
	 well as more efficient.  */
      if (!linux_proc_task_list_dir_exists (pid_of (proc)))
	thread_db_find_new_threads ();
      thread_db_look_up_symbols ();
      return 1;
    }

  return 0;
}
开发者ID:Manishearth,项目名称:gdb,代码行数:35,代码来源:thread-db.c


示例12: attach_thread

static int
attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
{
  struct process_info *proc = current_process ();
  int pid = pid_of (proc);
  ptid_t ptid = ptid_build (pid, ti_p->ti_lid, 0);
  struct lwp_info *lwp;
  int err;

  if (debug_threads)
    debug_printf ("Attaching to thread %ld (LWP %d)\n",
		  (unsigned long) ti_p->ti_tid, ti_p->ti_lid);
  err = linux_attach_lwp (ptid);
  if (err != 0)
    {
      warning ("Could not attach to thread %ld (LWP %d): %s\n",
	       (unsigned long) ti_p->ti_tid, ti_p->ti_lid,
	       linux_ptrace_attach_fail_reason_string (ptid, err));
      return 0;
    }

  lwp = find_lwp_pid (ptid);
  gdb_assert (lwp != NULL);
  lwp->thread_known = 1;
  lwp->th = *th_p;

  return 1;
}
开发者ID:Manishearth,项目名称:gdb,代码行数:28,代码来源:thread-db.c


示例13: erts_run_erl_log_error

/* error_logf()
 * Prints the arguments to stderr or syslog
 * Works like printf (see vfprintf)
 */
void erts_run_erl_log_error(int priority, int line, const char *format, ...)
{
    va_list args;
    va_start(args, format);

#ifdef HAVE_SYSLOG_H
    if (RUN_DAEMON) {
	vsyslog(priority,format,args);
    }
    else
#endif
#ifdef __OSE__
    if (RUN_DAEMON) {
      char *buff = malloc(sizeof(char)*1024);
      vsnprintf(buff,1024,format, args);
      ramlog_printf(buff);
    }
    else
#endif
    {
	time_t now = time(NULL);
	fprintf(stderr, "run_erl:%d [%d] %s", line,
#ifdef __OSE__
		(int)current_process(),
#else
		(int)getpid(),
#endif
		ctime(&now));
	vfprintf(stderr, format, args);
    }
    va_end(args);
}
开发者ID:AxisOfEval,项目名称:otp,代码行数:36,代码来源:run_erl_common.c


示例14: thread_db_create_event

static int
thread_db_create_event (CORE_ADDR where)
{
  td_event_msg_t msg;
  td_err_e err;
  struct lwp_info *lwp;
  struct thread_db *thread_db = current_process ()->priv->thread_db;

  gdb_assert (thread_db->td_ta_event_getmsg_p != NULL);

  if (debug_threads)
    debug_printf ("Thread creation event.\n");

  /* FIXME: This assumes we don't get another event.
     In the LinuxThreads implementation, this is safe,
     because all events come from the manager thread
     (except for its own creation, of course).  */
  err = thread_db->td_ta_event_getmsg_p (thread_db->thread_agent, &msg);
  if (err != TD_OK)
    fprintf (stderr, "thread getmsg err: %s\n",
	     thread_db_err_str (err));

  /* If we do not know about the main thread yet, this would be a good time to
     find it.  We need to do this to pick up the main thread before any newly
     created threads.  */
  lwp = get_thread_lwp (current_thread);
  if (lwp->thread_known == 0)
    find_one_thread (current_thread->entry.id);

  /* msg.event == TD_EVENT_CREATE */

  find_new_threads_callback (msg.th_p, NULL);

  return 0;
}
开发者ID:cupertinomiranda,项目名称:binutils,代码行数:35,代码来源:thread-db.c


示例15: aarch64_get_debug_reg_state

static struct aarch64_debug_reg_state *
aarch64_get_debug_reg_state ()
{
  struct process_info *proc;

  proc = current_process ();
  return &proc->priv->arch_private->debug_reg_state;
}
开发者ID:warelle,项目名称:binutils-aqua,代码行数:8,代码来源:linux-aarch64-low.c


示例16: delete_all_breakpoints

void
delete_all_breakpoints (void)
{
  struct process_info *proc = current_process ();

  while (proc->breakpoints)
    delete_breakpoint_1 (proc, proc->breakpoints);
}
开发者ID:5kg,项目名称:gdb,代码行数:8,代码来源:mem-break.c


示例17: current_target_desc

const struct target_desc *
current_target_desc (void)
{
  if (current_thread == NULL)
    return &default_description;

  return current_process ()->tdesc;
}
开发者ID:Winter3un,项目名称:ctf_task,代码行数:8,代码来源:tdesc.c


示例18: syscall_env

void syscall_env( struct syscall_packet *scp )
{
	struct process *proc = NULL;
	scp->rc = SMK_UNKNOWN_SYSCALL;

	switch (scp->opcode)
	{
		case OP( ENV, ONE ):
				proc = checkout_process( getpid(), WRITER );
				assert( proc != NULL );
				scp->rc = set_environment( current_process(), scp->name, scp->ptr, scp->size );
				commit_process( proc );
				break;

		case OP( ENV, TWO ):
				proc = checkout_process( getpid(), READER );
				assert( proc != NULL );
				scp->rc = get_environment( current_process(), scp->name, scp->ptr, &(scp->size) );
				commit_process( proc );
				break;

		case OP( ENV, THREE ):
				proc = checkout_process( getpid(), READER );
				assert( proc != NULL );
				scp->rc = get_environment_size( current_process(), scp->name, &(scp->size) );
				commit_process( proc );
				break;

		case OP( ENV, FOUR ):
				proc = checkout_process( getpid(), READER );
				assert( proc != NULL );
				scp->rc = get_environment_information( current_process(), scp->id, scp->name, &(scp->size) );
				commit_process( proc );
				break;

		case OP( ENV, FIVE ):
				proc = checkout_process( getpid(), WRITER );
				assert( proc != NULL );
				scp->rc = remove_environment( current_process(), scp->name );
				commit_process( proc );
				break;

	}

}
开发者ID:UIKit0,项目名称:racoon,代码行数:45,代码来源:syscall_env.c


示例19: ipcom_getenv

/*
 *===========================================================================
 *                    ipcom_getenv
 *===========================================================================
 * Description:
 * Parameters:
 * Returns:
 *
 */
IP_PUBLIC char *
ipcom_getenv(const char *name)
{
#if IPCOM_USE_ENV == IPCOM_ENV_IPCOM
    Ip_err           retval;
    Ipcom_proc      *proc;
    Ipcom_env_entry *env;
    char            *value = IP_NULL;

    proc = ipcom_proc_self();
    ip_assert(proc != IP_NULL);

    retval = ipcom_once(&proc->env_once, ipcom_env_init, proc);
    if (retval != IPCOM_SUCCESS)
    {
        IP_PANIC();
        return IP_NULL;
    }

    ipcom_mutex_lock(proc->env_mutex);

    env = ipcom_hash_get(proc->env_tree, name);
    if (env != IP_NULL)
        value = (char *)env->value;

    ipcom_mutex_unlock(proc->env_mutex);

    return value;

#elif IPCOM_USE_ENV == IPCOM_ENV_NATIVE && (defined(IP_PORT_OSE) || defined(IP_PORT_OSE5))
    char *env;
    static char buf[256];

    env = get_env(current_process(), name);
    if (env != IP_NULL)
    {
        ipcom_strncpy(buf, env, sizeof(buf));
        free_buf((union SIGNAL **)&env);
        return (char *)buf;
    }
    return IP_NULL;

#elif IPCOM_USE_ENV == IPCOM_ENV_NATIVE
    return getenv(name);

#elif defined(IPCOM_USE_SYSVAR) && IPCOM_VR_MAX == 1
    static char buf[256];
    Ip_size_t  buf_size = sizeof(buf);

    return ipcom_sysvar_get(name, buf, &buf_size);

#else
    return IP_NULL;

#endif /* #if IPCOM_USE_ENV == IPCOM_ENV_IPCOM */
}
开发者ID:HuaweiHonor4C,项目名称:kernel_hi6210sft_mm,代码行数:65,代码来源:ipcom_getenv.c


示例20: set_raw_breakpoint_at

static struct raw_breakpoint *
set_raw_breakpoint_at (CORE_ADDR where)
{
  struct process_info *proc = current_process ();
  struct raw_breakpoint *bp;
  int err;
  unsigned char buf[MAX_BREAKPOINT_LEN];

  if (breakpoint_data == NULL)
    error ("Target does not support breakpoints.");

  bp = find_raw_breakpoint_at (where);
  if (bp != NULL)
    {
      bp->refcount++;
      return bp;
    }

  bp = xcalloc (1, sizeof (*bp));
  bp->pc = where;
  bp->refcount = 1;

  /* Note that there can be fast tracepoint jumps installed in the
     same memory range, so to get at the original memory, we need to
     use read_inferior_memory, which masks those out.  */
  err = read_inferior_memory (where, buf, breakpoint_len);
  if (err != 0)
    {
      if (debug_threads)
	fprintf (stderr,
		 "Failed to read shadow memory of"
		 " breakpoint at 0x%s (%s).\n",
		 paddress (where), strerror (err));
      free (bp);
      return NULL;
    }
  memcpy (bp->old_data, buf, breakpoint_len);

  err = (*the_target->write_memory) (where, breakpoint_data,
				     breakpoint_len);
  if (err != 0)
    {
      if (debug_threads)
	fprintf (stderr,
		 "Failed to insert breakpoint at 0x%s (%s).\n",
		 paddress (where), strerror (err));
      free (bp);
      return NULL;
    }

  /* Link the breakpoint in.  */
  bp->inserted = 1;
  bp->next = proc->raw_breakpoints;
  proc->raw_breakpoints = bp;
  return bp;
}
开发者ID:5kg,项目名称:gdb,代码行数:56,代码来源:mem-break.c



注:本文中的current_process函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ current_pt_regs函数代码示例发布时间:2022-05-30
下一篇:
C++ current_item函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap