Deleted Added
full compact
dt_proc.c (178565) dt_proc.c (184696)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 941 unchanged lines hidden (view full) ---

950
951 (void) pthread_mutex_unlock(&dpr->dpr_lock);
952 (void) pthread_attr_destroy(&a);
953
954 return (err);
955}
956
957struct ps_prochandle *
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 941 unchanged lines hidden (view full) ---

950
951 (void) pthread_mutex_unlock(&dpr->dpr_lock);
952 (void) pthread_attr_destroy(&a);
953
954 return (err);
955}
956
957struct ps_prochandle *
958dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
958dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv,
959 proc_child_func *pcf, void *child_arg)
959{
960 dt_proc_hash_t *dph = dtp->dt_procs;
961 dt_proc_t *dpr;
962 int err;
963
964 if ((dpr = dt_zalloc(dtp, sizeof (dt_proc_t))) == NULL)
965 return (NULL); /* errno is set for us */
966

--- 9 unchanged lines hidden (view full) ---

976 dpr->dpr_hdl = dtp;
977 dpr->dpr_pid = Pstatus(dpr->dpr_proc)->pr_pid;
978
979 (void) Punsetflags(dpr->dpr_proc, PR_RLC);
980 (void) Psetflags(dpr->dpr_proc, PR_KLC);
981#else
982 (void) proc_clearflags(dpr->dpr_proc, PR_RLC);
983 (void) proc_setflags(dpr->dpr_proc, PR_KLC);
960{
961 dt_proc_hash_t *dph = dtp->dt_procs;
962 dt_proc_t *dpr;
963 int err;
964
965 if ((dpr = dt_zalloc(dtp, sizeof (dt_proc_t))) == NULL)
966 return (NULL); /* errno is set for us */
967

--- 9 unchanged lines hidden (view full) ---

977 dpr->dpr_hdl = dtp;
978 dpr->dpr_pid = Pstatus(dpr->dpr_proc)->pr_pid;
979
980 (void) Punsetflags(dpr->dpr_proc, PR_RLC);
981 (void) Psetflags(dpr->dpr_proc, PR_KLC);
982#else
983 (void) proc_clearflags(dpr->dpr_proc, PR_RLC);
984 (void) proc_setflags(dpr->dpr_proc, PR_KLC);
984 if ((err = proc_create(file, argv, &dpr->dpr_proc)) != 0)
985 if ((err = proc_create(file, argv, pcf, child_arg, &dpr->dpr_proc)) != 0)
985 return (dt_proc_error(dtp, dpr,
986 "failed to execute %s: %s\n", file, strerror(err)));
987 dpr->dpr_hdl = dtp;
988 dpr->dpr_pid = proc_getpid(dpr->dpr_proc);
989#endif
990
991#if defined(sun)
992 if (dt_proc_create_thread(dtp, dpr, dtp->dt_prcmode) != 0)

--- 185 unchanged lines hidden (view full) ---

1178 while ((dpr = dt_list_next(&dph->dph_lrulist)) != NULL)
1179 dt_proc_destroy(dtp, dpr->dpr_proc);
1180
1181 dtp->dt_procs = NULL;
1182 dt_free(dtp, dph);
1183}
1184
1185struct ps_prochandle *
986 return (dt_proc_error(dtp, dpr,
987 "failed to execute %s: %s\n", file, strerror(err)));
988 dpr->dpr_hdl = dtp;
989 dpr->dpr_pid = proc_getpid(dpr->dpr_proc);
990#endif
991
992#if defined(sun)
993 if (dt_proc_create_thread(dtp, dpr, dtp->dt_prcmode) != 0)

--- 185 unchanged lines hidden (view full) ---

1179 while ((dpr = dt_list_next(&dph->dph_lrulist)) != NULL)
1180 dt_proc_destroy(dtp, dpr->dpr_proc);
1181
1182 dtp->dt_procs = NULL;
1183 dt_free(dtp, dph);
1184}
1185
1186struct ps_prochandle *
1186dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
1187dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv,
1188 proc_child_func *pcf, void *child_arg)
1187{
1188 dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target");
1189{
1190 dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target");
1189 struct ps_prochandle *P = dt_proc_create(dtp, file, argv);
1191 struct ps_prochandle *P = dt_proc_create(dtp, file, argv, pcf, child_arg);
1190
1191 if (P != NULL && idp != NULL && idp->di_id == 0)
1192#if defined(sun)
1193 idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */
1194#else
1195 idp->di_id = proc_getpid(P); /* $target = created pid */
1196#endif
1197

--- 26 unchanged lines hidden ---
1192
1193 if (P != NULL && idp != NULL && idp->di_id == 0)
1194#if defined(sun)
1195 idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */
1196#else
1197 idp->di_id = proc_getpid(P); /* $target = created pid */
1198#endif
1199

--- 26 unchanged lines hidden ---