aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-12-17 03:38:36 +0100
committerPetr Machata <pmachata@redhat.com>2012-12-17 03:38:36 +0100
commit6dfc544b6aa6703d2292be34470aebf874d78452 (patch)
treebba67ea4e0bbfb2ce691d933fdfe3865eb2dcbbb
parent929bd57ca202fd2f2e8485ebf65d683e664f67b5 (diff)
downloadltrace-6dfc544b6aa6703d2292be34470aebf874d78452.tar.gz
Make enum process_status enumerators uppercase
Rationale: coding style consistency.
-rw-r--r--backend.h12
-rw-r--r--sysdeps/linux-gnu/events.c2
-rw-r--r--sysdeps/linux-gnu/proc.c23
-rw-r--r--sysdeps/linux-gnu/trace.c16
4 files changed, 27 insertions, 26 deletions
diff --git a/backend.h b/backend.h
index 57c2f03..314ad93 100644
--- a/backend.h
+++ b/backend.h
@@ -27,12 +27,12 @@
#include <gelf.h>
enum process_status {
- ps_invalid, /* Failure. */
- ps_stop, /* Job-control stop. */
- ps_tracing_stop,
- ps_sleeping,
- ps_zombie,
- ps_other, /* Necessary other states can be added as needed. */
+ PS_INVALID, /* Failure. */
+ PS_STOP, /* Job-control stop. */
+ PS_TRACING_STOP,
+ PS_SLEEPING,
+ PS_ZOMBIE,
+ PS_OTHER, /* Necessary other states can be added as needed. */
};
/*
diff --git a/sysdeps/linux-gnu/events.c b/sysdeps/linux-gnu/events.c
index 52e2f4f..71d99b6 100644
--- a/sysdeps/linux-gnu/events.c
+++ b/sysdeps/linux-gnu/events.c
@@ -188,7 +188,7 @@ next_event(void)
* now) the pain of figuring this out all over again.
* Petr Machata 2011-11-22. */
int i = 0;
- for (; i < 100 && process_status(pid) != ps_tracing_stop; ++i) {
+ for (; i < 100 && process_status(pid) != PS_TRACING_STOP; ++i) {
debug(2, "waiting for %d to stop", pid);
usleep(10000);
}
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index 9f6ef2c..6e01d28 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -177,44 +177,45 @@ process_status_cb(const char *line, const char *prefix, void *data)
} while (0)
switch (c) {
- case 'Z': RETURN(ps_zombie);
- case 't': RETURN(ps_tracing_stop);
+ case 'Z': RETURN(PS_ZOMBIE);
+ case 't': RETURN(PS_TRACING_STOP);
case 'T':
/* This can be either "T (stopped)" or, for older
* kernels, "T (tracing stop)". */
if (!strcmp(status, "T (stopped)\n"))
- RETURN(ps_stop);
+ RETURN(PS_STOP);
else if (!strcmp(status, "T (tracing stop)\n"))
- RETURN(ps_tracing_stop);
+ RETURN(PS_TRACING_STOP);
else {
fprintf(stderr, "Unknown process status: %s",
status);
- RETURN(ps_stop); /* Some sort of stop
+ RETURN(PS_STOP); /* Some sort of stop
* anyway. */
}
case 'D':
- case 'S': RETURN(ps_sleeping);
+ case 'S': RETURN(PS_SLEEPING);
}
- RETURN(ps_other);
+ RETURN(PS_OTHER);
#undef RETURN
}
enum process_status
process_status(pid_t pid)
{
- enum process_status ret = ps_invalid;
+ enum process_status ret = PS_INVALID;
FILE * file = open_status_file(pid);
if (file != NULL) {
each_line_starting(file, "State:\t", &process_status_cb, &ret);
fclose(file);
- if (ret == ps_invalid)
+ if (ret == PS_INVALID)
fprintf(stderr, "process_status %d: %s", pid,
strerror(errno));
- } else
+ } else {
/* If the file is not present, the process presumably
* exited already. */
- ret = ps_zombie;
+ ret = PS_ZOMBIE;
+ }
return ret;
}
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index 77dfade..42dd4d9 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -217,13 +217,13 @@ task_stopped(struct process *task, void *data)
* the meantime. This can happen when the whole thread group
* is terminating. */
switch (st) {
- case ps_invalid:
- case ps_tracing_stop:
- case ps_zombie:
+ case PS_INVALID:
+ case PS_TRACING_STOP:
+ case PS_ZOMBIE:
return CBS_CONT;
- case ps_sleeping:
- case ps_stop:
- case ps_other:
+ case PS_SLEEPING:
+ case PS_STOP:
+ case PS_OTHER:
return CBS_STOP;
}
@@ -299,8 +299,8 @@ send_sigstop(struct process *task, void *data)
* vforked process. We set up event handler specially to hint
* us. In that case parent is in D state, which we use to
* weed out unnecessary looping. */
- if (st == ps_sleeping
- && is_vfork_parent (task)) {
+ if (st == PS_SLEEPING
+ && is_vfork_parent(task)) {
task_info->vforked = 1;
return CBS_CONT;
}