aboutsummaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-04-25 13:42:07 +0200
committerPetr Machata <pmachata@redhat.com>2012-04-25 13:42:07 +0200
commitcc0e1e4b83d69441cc5f61ea87eda5458ee9fae3 (patch)
tree38378e9ba7fc871111c488c5e2bdee9dc06a2407 /proc.c
parentfd2641c0d27705c89d224e3205b1296110b6598c (diff)
downloadltrace-cc0e1e4b83d69441cc5f61ea87eda5458ee9fae3.tar.gz
Replace some uses of error with fprintf
error is not standard so it has no business being used in generic code. The linux-gnu back end is useful for android, and that doesn't have that interface either.
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/proc.c b/proc.c
index 627e93c..51833fe 100644
--- a/proc.c
+++ b/proc.c
@@ -11,7 +11,6 @@
#include <errno.h>
#include <stdlib.h>
#include <assert.h>
-#include <error.h>
#include "common.h"
#include "breakpoint.h"
@@ -126,7 +125,8 @@ process_init(struct Process *proc, const char *filename, pid_t pid)
{
if (process_bare_init(proc, filename, pid, 0) < 0) {
fail:
- error(0, errno, "init process %d", pid);
+ fprintf(stderr, "failed to initialize process %d: %s\n",
+ pid, strerror(errno));
return -1;
}
@@ -245,7 +245,8 @@ process_clone(struct Process *retp, struct Process *proc, pid_t pid)
{
if (process_bare_init(retp, proc->filename, pid, 0) < 0) {
fail:
- error(0, errno, "clone process %d->%d", proc->pid, pid);
+ fprintf(stderr, "failed to clone process %d->%d : %s\n",
+ proc->pid, pid, strerror(errno));
return -1;
}
@@ -644,7 +645,8 @@ proc_add_library(struct Process *proc, struct library *lib)
struct library_symbol *libsym = NULL;
while ((libsym = library_each_symbol(lib, libsym, breakpoint_for_symbol,
proc)) != NULL)
- error(0, errno, "insert breakpoint for %s", libsym->name);
+ fprintf(stderr, "couldn't insert breakpoint for %s to %d: %s",
+ libsym->name, proc->pid, strerror(errno));
}
int
@@ -709,8 +711,9 @@ proc_add_breakpoint(struct Process *proc, struct breakpoint *bp)
assert(dict_find_entry(proc->breakpoints, bp->addr) == NULL);
if (dict_enter(proc->breakpoints, bp->addr, bp) < 0) {
- error(0, errno, "couldn't enter breakpoint %s@%p to dictionary",
- breakpoint_name(bp), bp->addr);
+ fprintf(stderr,
+ "couldn't enter breakpoint %s@%p to dictionary: %s\n",
+ breakpoint_name(bp), bp->addr, strerror(errno));
return -1;
}