aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2013-06-21 15:46:30 -0500
committerPeter Seebach <peter.seebach@windriver.com>2013-06-25 20:32:25 -0500
commite199ed80a0a67a2135d419e169ba378621dd55bd (patch)
treec284919558317f6a122df93438e2c93ce96acd68 /ports
parent62177dc38fabb880132e63aeef3b8d3878f9584c (diff)
downloadpseudo-e199ed80a0a67a2135d419e169ba378621dd55bd.tar.gz
pseudo-e199ed80a0a67a2135d419e169ba378621dd55bd.tar.bz2
pseudo-e199ed80a0a67a2135d419e169ba378621dd55bd.zip
Change debugging to use flags rather than levels
This is a moderately intrusive change. The basic overall effect: Debugging messages are now controlled, not by a numeric "level", but by a series of flags, which are expressed as a string of letters. Each flag has a single-letter form used for string specifications, a name, a description, a numeric value (1 through N), and a flag value (which is 1 << the numeric value). (This does mean that no flag has the value 1, so we only have 31 bits available. Tiny violins play.) The other significant change is that the pseudo_debug calls are now implemented with a do/while macro containing a conditional, so that computationally-expensive arguments are never evaluated if the corresponding debug flags weren't set. The assumption is that in the vast majority of cases (specifically, all of them so far) the debug flags for a given call are a compile-time constant, so the nested conditional will never actually show up in code when compiled with optimization; we'll just see the appropriate conditional test. The VERBOSE flag is magical, in that if the VERBOSE flag is used in a message, the debug flags have to have both VERBOSE and at least one other flag for the call to be made. This should dramatically improve performance for a lot of cases without as much need for PSEUDO_NDEBUG, and improve the ability of users to get coherent debugging output that means something and is relevant to a given case. It's also intended to set the stage for future development work involving improving the clarity and legibility of pseudo's diagnostic messages in general. Old things which used numeric values for PSEUDO_DEBUG will sort of continue to work, though they will almost always be less verbose than they used to. There should probably be a pass through adding "| PDBGF_CONSISTENCY" to a lot of the messages that are specific to some other type.
Diffstat (limited to 'ports')
-rw-r--r--ports/common/pseudo_wrappers.c32
-rw-r--r--ports/darwin/guts/fcntl.c4
-rw-r--r--ports/darwin/guts/open.c4
-rw-r--r--ports/linux/guts/__fxstat64.c2
-rw-r--r--ports/linux/guts/__fxstatat64.c2
-rw-r--r--ports/linux/guts/fcntl.c2
-rw-r--r--ports/linux/guts/fopen64.c4
-rw-r--r--ports/linux/guts/freopen64.c4
-rw-r--r--ports/linux/guts/get_current_dir_name.c1
-rw-r--r--ports/linux/guts/mkstemp64.c2
-rw-r--r--ports/linux/guts/openat.c4
-rw-r--r--ports/linux/newclone/pseudo_wrappers.c4
-rw-r--r--ports/linux/oldclone/pseudo_wrappers.c4
-rw-r--r--ports/uids_generic/guts/getgrgid_r.c2
-rw-r--r--ports/unix/guts/chdir.c2
-rw-r--r--ports/unix/guts/chroot.c4
-rw-r--r--ports/unix/guts/dup.c2
-rw-r--r--ports/unix/guts/dup2.c2
-rw-r--r--ports/unix/guts/fchmodat.c2
-rw-r--r--ports/unix/guts/fchown.c6
-rw-r--r--ports/unix/guts/fchownat.c2
-rw-r--r--ports/unix/guts/fopen.c4
-rw-r--r--ports/unix/guts/freopen.c4
-rw-r--r--ports/unix/guts/getcwd.c6
-rw-r--r--ports/unix/guts/getwd.c2
-rw-r--r--ports/unix/guts/mkdirat.c2
-rw-r--r--ports/unix/guts/mkdtemp.c2
-rw-r--r--ports/unix/guts/mkstemp.c2
-rw-r--r--ports/unix/guts/opendir.c2
-rw-r--r--ports/unix/guts/rename.c4
-rw-r--r--ports/unix/guts/renameat.c4
-rw-r--r--ports/unix/guts/rmdir.c2
-rw-r--r--ports/unix/guts/unlinkat.c2
-rw-r--r--ports/unix/pseudo_wrappers.c6
34 files changed, 66 insertions, 67 deletions
diff --git a/ports/common/pseudo_wrappers.c b/ports/common/pseudo_wrappers.c
index 2cfc400..3652ad4 100644
--- a/ports/common/pseudo_wrappers.c
+++ b/ports/common/pseudo_wrappers.c
@@ -33,7 +33,7 @@ execl_to_v(va_list ap, const char *argv0, char *const **envp) {
char **argv = malloc((sizeof *argv) * alloc_size);
if (!argv) {
- pseudo_debug(1, "execl failed: couldn't allocate memory for %lu arguments\n",
+ pseudo_debug(PDBGF_CLIENT, "execl failed: couldn't allocate memory for %lu arguments\n",
(unsigned long) alloc_size);
return NULL;
}
@@ -45,7 +45,7 @@ execl_to_v(va_list ap, const char *argv0, char *const **envp) {
alloc_size = alloc_size + 256;
argv = realloc(argv, (sizeof *argv) * alloc_size);
if (!argv) {
- pseudo_debug(1, "execl failed: couldn't allocate memory for %lu arguments\n",
+ pseudo_debug(PDBGF_CLIENT, "execl failed: couldn't allocate memory for %lu arguments\n",
(unsigned long) alloc_size);
return NULL;
}
@@ -81,7 +81,7 @@ execl(const char *file, const char *arg, ...) {
return -1;
}
- pseudo_debug(4, "called: execl\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: execl\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -98,7 +98,7 @@ execl(const char *file, const char *arg, ...) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: execl\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: execl\n");
errno = save_errno;
free(argv);
return rc;
@@ -126,7 +126,7 @@ execlp(const char *file, const char *arg, ...) {
return -1;
}
- pseudo_debug(4, "called: execlp\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: execlp\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -143,7 +143,7 @@ execlp(const char *file, const char *arg, ...) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: execlp\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: execlp\n");
errno = save_errno;
free(argv);
return rc;
@@ -172,7 +172,7 @@ execle(const char *file, const char *arg, ...) {
return -1;
}
- pseudo_debug(4, "called: execle\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: execle\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -189,7 +189,7 @@ execle(const char *file, const char *arg, ...) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: execle\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: execle\n");
errno = save_errno;
free(argv);
return rc;
@@ -207,7 +207,7 @@ execv(const char *file, char *const *argv) {
return rc;
}
- pseudo_debug(4, "called: execv\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: execv\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -224,7 +224,7 @@ execv(const char *file, char *const *argv) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: execv\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: execv\n");
errno = save_errno;
return rc;
}
@@ -241,7 +241,7 @@ execve(const char *file, char *const *argv, char *const *envp) {
return rc;
}
- pseudo_debug(4, "called: execve\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: execve\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -258,7 +258,7 @@ execve(const char *file, char *const *argv, char *const *envp) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: execve\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: execve\n");
errno = save_errno;
return rc;
}
@@ -275,7 +275,7 @@ execvp(const char *file, char *const *argv) {
return rc;
}
- pseudo_debug(4, "called: execvp\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: execvp\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -292,7 +292,7 @@ execvp(const char *file, char *const *argv) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: execvp\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: execvp\n");
errno = save_errno;
return rc;
}
@@ -309,7 +309,7 @@ fork(void) {
return rc;
}
- pseudo_debug(4, "called: fork\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: fork\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -325,7 +325,7 @@ fork(void) {
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: fork\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: fork\n");
errno = save_errno;
return rc;
}
diff --git a/ports/darwin/guts/fcntl.c b/ports/darwin/guts/fcntl.c
index 1cc8258..c0b142b 100644
--- a/ports/darwin/guts/fcntl.c
+++ b/ports/darwin/guts/fcntl.c
@@ -24,7 +24,7 @@
/* actually do something */
save_errno = errno;
if (rc != -1) {
- pseudo_debug(2, "fcntl_dup: %d->%d\n", fd, rc);
+ pseudo_debug(PDBGF_OP, "fcntl_dup: %d->%d\n", fd, rc);
pseudo_client_op(OP_DUP, 0, fd, rc, 0, 0);
}
errno = save_errno;
@@ -35,7 +35,7 @@
}
save_errno = errno;
- pseudo_debug(3, "fcntl(fd %d, cmd %d, %llx) => %d (%s)\n",
+ pseudo_debug(PDBGF_OP, "fcntl(fd %d, cmd %d, %llx) => %d (%s)\n",
fd, cmd, flag, rc, strerror(errno));
errno = save_errno;
diff --git a/ports/darwin/guts/open.c b/ports/darwin/guts/open.c
index c66cc15..8680e20 100644
--- a/ports/darwin/guts/open.c
+++ b/ports/darwin/guts/open.c
@@ -19,7 +19,7 @@
rc = real_stat(path, &buf);
existed = (rc != -1);
if (!existed)
- pseudo_debug(2, "open_creat: %s -> 0%o\n", path, mode);
+ pseudo_debug(PDBGF_FILE, "open_creat: %s -> 0%o\n", path, mode);
errno = save_errno;
}
@@ -42,7 +42,7 @@
}
pseudo_client_op(OP_OPEN, PSEUDO_ACCESS(flags), rc, -1, path, &buf);
} else {
- pseudo_debug(1, "open (fd %d, path %s, flags %d) succeeded, but stat failed (%s).\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "open (fd %d, path %s, flags %d) succeeded, but stat failed (%s).\n",
rc, path, flags, strerror(errno));
pseudo_client_op(OP_OPEN, PSEUDO_ACCESS(flags), rc, -1, path, 0);
}
diff --git a/ports/linux/guts/__fxstat64.c b/ports/linux/guts/__fxstat64.c
index 92c8219..8601904 100644
--- a/ports/linux/guts/__fxstat64.c
+++ b/ports/linux/guts/__fxstat64.c
@@ -15,7 +15,7 @@
return rc;
}
if (ver != _STAT_VER) {
- pseudo_debug(1, "version mismatch: got stat version %d, only supporting %d\n", ver, _STAT_VER);
+ pseudo_debug(PDBGF_CLIENT, "version mismatch: got stat version %d, only supporting %d\n", ver, _STAT_VER);
errno = save_errno;
return rc;
}
diff --git a/ports/linux/guts/__fxstatat64.c b/ports/linux/guts/__fxstatat64.c
index f8a9298..b989e7b 100644
--- a/ports/linux/guts/__fxstatat64.c
+++ b/ports/linux/guts/__fxstatat64.c
@@ -37,7 +37,7 @@
save_errno = errno;
if (ver != _STAT_VER) {
- pseudo_debug(1, "version mismatch: got stat version %d, only supporting %d\n", ver, _STAT_VER);
+ pseudo_debug(PDBGF_CLIENT, "version mismatch: got stat version %d, only supporting %d\n", ver, _STAT_VER);
errno = save_errno;
return rc;
}
diff --git a/ports/linux/guts/fcntl.c b/ports/linux/guts/fcntl.c
index 2e3e96d..639fd24 100644
--- a/ports/linux/guts/fcntl.c
+++ b/ports/linux/guts/fcntl.c
@@ -24,7 +24,7 @@
rc = real_fcntl(fd, cmd, arg);
save_errno = errno;
if (rc != -1) {
- pseudo_debug(2, "fcntl_dup: %d->%d\n", fd, rc);
+ pseudo_debug(PDBGF_OP, "fcntl_dup: %d->%d\n", fd, rc);
pseudo_client_op(OP_DUP, 0, fd, rc, 0, 0);
}
errno = save_errno;
diff --git a/ports/linux/guts/fopen64.c b/ports/linux/guts/fopen64.c
index b2724de..ac3fde1 100644
--- a/ports/linux/guts/fopen64.c
+++ b/ports/linux/guts/fopen64.c
@@ -17,14 +17,14 @@
if (rc) {
int fd = fileno(rc);
- pseudo_debug(2, "fopen64 '%s': fd %d <FILE %p>\n", path, fd, (void *) rc);
+ pseudo_debug(PDBGF_FILE, "fopen64 '%s': fd %d <FILE %p>\n", path, fd, (void *) rc);
if (real___fxstat64(_STAT_VER, fd, &buf) != -1) {
if (!existed) {
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);
} else {
- pseudo_debug(1, "fopen64 (fd %d) succeeded, but fstat failed (%s).\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "fopen64 (fd %d) succeeded, but fstat failed (%s).\n",
fd, strerror(errno));
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0);
}
diff --git a/ports/linux/guts/freopen64.c b/ports/linux/guts/freopen64.c
index b8e576b..bb69b34 100644
--- a/ports/linux/guts/freopen64.c
+++ b/ports/linux/guts/freopen64.c
@@ -16,14 +16,14 @@
if (rc) {
int fd = fileno(rc);
- pseudo_debug(2, "freopen64 '%s': fd %d\n", path, fd);
+ pseudo_debug(PDBGF_FILE, "freopen64 '%s': fd %d\n", path, fd);
if (real___fxstat64(_STAT_VER, fd, &buf) != -1) {
if (!existed) {
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);
} else {
- pseudo_debug(1, "fopen (fd %d) succeeded, but stat failed (%s).\n",
+ pseudo_debug(PDBGF_FILE, "fopen (fd %d) succeeded, but stat failed (%s).\n",
fd, strerror(errno));
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0);
}
diff --git a/ports/linux/guts/get_current_dir_name.c b/ports/linux/guts/get_current_dir_name.c
index e07a6ee..79f82f9 100644
--- a/ports/linux/guts/get_current_dir_name.c
+++ b/ports/linux/guts/get_current_dir_name.c
@@ -7,7 +7,6 @@
* char * rc = NULL;
*/
- pseudo_debug(3, "get_current_dir_name (getcwd)\n");
/* this relies on a Linux extension, but we dutifully
* emulated that extension.
*/
diff --git a/ports/linux/guts/mkstemp64.c b/ports/linux/guts/mkstemp64.c
index def4126..6497f2e 100644
--- a/ports/linux/guts/mkstemp64.c
+++ b/ports/linux/guts/mkstemp64.c
@@ -33,7 +33,7 @@
pseudo_client_op(OP_CREAT, 0, -1, -1, tmp_template, &buf);
pseudo_client_op(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, &buf);
} else {
- pseudo_debug(1, "mkstemp (fd %d) succeeded, but fstat failed (%s).\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "mkstemp (fd %d) succeeded, but fstat failed (%s).\n",
rc, strerror(errno));
pseudo_client_op(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, 0);
}
diff --git a/ports/linux/guts/openat.c b/ports/linux/guts/openat.c
index 8460073..1225368 100644
--- a/ports/linux/guts/openat.c
+++ b/ports/linux/guts/openat.c
@@ -45,7 +45,7 @@
#endif
existed = (rc != -1);
if (!existed)
- pseudo_debug(2, "openat_creat: %s -> 0%o\n", path, mode);
+ pseudo_debug(PDBGF_FILE, "openat_creat: %s -> 0%o\n", path, mode);
errno = save_errno;
}
@@ -76,7 +76,7 @@
}
pseudo_client_op(OP_OPEN, PSEUDO_ACCESS(flags), rc, dirfd, path, &buf);
} else {
- pseudo_debug(1, "openat (fd %d, path %d/%s, flags %d) succeeded, but stat failed (%s).\n",
+ pseudo_debug(PDBGF_FILE, "openat (fd %d, path %d/%s, flags %d) succeeded, but stat failed (%s).\n",
rc, dirfd, path, flags, strerror(errno));
pseudo_client_op(OP_OPEN, PSEUDO_ACCESS(flags), rc, dirfd, path, 0);
}
diff --git a/ports/linux/newclone/pseudo_wrappers.c b/ports/linux/newclone/pseudo_wrappers.c
index 9dbac42..092e532 100644
--- a/ports/linux/newclone/pseudo_wrappers.c
+++ b/ports/linux/newclone/pseudo_wrappers.c
@@ -60,7 +60,7 @@ clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...) {
ctid = va_arg(ap, pid_t *);
va_end(ap);
- pseudo_debug(4, "called: clone\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: clone\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -86,7 +86,7 @@ clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: clone\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: clone\n");
errno = save_errno;
return rc;
}
diff --git a/ports/linux/oldclone/pseudo_wrappers.c b/ports/linux/oldclone/pseudo_wrappers.c
index d6ea41e..f0a8eec 100644
--- a/ports/linux/oldclone/pseudo_wrappers.c
+++ b/ports/linux/oldclone/pseudo_wrappers.c
@@ -44,7 +44,7 @@ clone(int (*fn)(void *), void *child_stack, int flags, void *arg) {
return rc;
}
- pseudo_debug(4, "called: clone\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: clone\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -70,7 +70,7 @@ clone(int (*fn)(void *), void *child_stack, int flags, void *arg) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: clone\n");
+ pseudo_debug(PDBGF_WRAPPER, "completed: clone\n");
errno = save_errno;
return rc;
}
diff --git a/ports/uids_generic/guts/getgrgid_r.c b/ports/uids_generic/guts/getgrgid_r.c
index 06a91c9..b043995 100644
--- a/ports/uids_generic/guts/getgrgid_r.c
+++ b/ports/uids_generic/guts/getgrgid_r.c
@@ -11,7 +11,7 @@
while ((rc = wrap_getgrent_r(gbuf, buf, buflen, gbufp)) == 0) {
/* 0 means no error occurred, and *gbufp == gbuf */
if (gbuf->gr_gid == gid) {
- pseudo_debug(1, "found group gid %d, name %s\n",
+ pseudo_debug(PDBGF_CLIENT, "found group gid %d, name %s\n",
gbuf->gr_gid, gbuf->gr_name);
endgrent();
return rc;
diff --git a/ports/unix/guts/chdir.c b/ports/unix/guts/chdir.c
index 59a262f..9e30348 100644
--- a/ports/unix/guts/chdir.c
+++ b/ports/unix/guts/chdir.c
@@ -6,7 +6,7 @@
* wrap_chdir(const char *path) {
* int rc = -1;
*/
- pseudo_debug(2, "chdir: '%s'\n",
+ pseudo_debug(PDBGF_CLIENT, "chdir: '%s'\n",
path ? path : "<nil>");
if (!path) {
diff --git a/ports/unix/guts/chroot.c b/ports/unix/guts/chroot.c
index c5b6f2f..ac24955 100644
--- a/ports/unix/guts/chroot.c
+++ b/ports/unix/guts/chroot.c
@@ -6,9 +6,9 @@
* wrap_chroot(const char *path) {
* int rc = -1;
*/
- pseudo_debug(2, "chroot: %s\n", path);
+ pseudo_debug(PDBGF_CLIENT | PDBGF_CHROOT, "chroot: %s\n", path);
if (!pseudo_client_op(OP_CHROOT, 0, -1, -1, path, 0)) {
- pseudo_debug(1, "chroot failed: %s\n", strerror(errno));
+ pseudo_debug(PDBGF_OP | PDBGF_CHROOT, "chroot failed: %s\n", strerror(errno));
rc = -1;
} else {
rc = 0;
diff --git a/ports/unix/guts/dup.c b/ports/unix/guts/dup.c
index 13612b1..f03c2ad 100644
--- a/ports/unix/guts/dup.c
+++ b/ports/unix/guts/dup.c
@@ -10,7 +10,7 @@
rc = real_dup(fd);
save_errno = errno;
- pseudo_debug(2, "dup: %d->%d\n", fd, rc);
+ pseudo_debug(PDBGF_CLIENT, "dup: %d->%d\n", fd, rc);
pseudo_client_op(OP_DUP, 0, fd, rc, 0, 0);
errno = save_errno;
diff --git a/ports/unix/guts/dup2.c b/ports/unix/guts/dup2.c
index 04666d1..cd335ac 100644
--- a/ports/unix/guts/dup2.c
+++ b/ports/unix/guts/dup2.c
@@ -10,7 +10,7 @@
/* close existing one first - this also causes the socket to the
* server to get moved around if someone tries to overwrite it. */
- pseudo_debug(2, "dup2: %d->%d\n", oldfd, newfd);
+ pseudo_debug(PDBGF_CLIENT, "dup2: %d->%d\n", oldfd, newfd);
pseudo_client_op(OP_CLOSE, 0, newfd, -1, 0, 0);
rc = real_dup2(oldfd, newfd);
save_errno = errno;
diff --git a/ports/unix/guts/fchmodat.c b/ports/unix/guts/fchmodat.c
index 59a92ce..36a8490 100644
--- a/ports/unix/guts/fchmodat.c
+++ b/ports/unix/guts/fchmodat.c
@@ -42,7 +42,7 @@
*/
msg = pseudo_client_op(OP_STAT, 0, -1, -1, path, &buf);
if (!msg || msg->result != RESULT_SUCCEED) {
- pseudo_debug(2, "chmodat to 0%o on %d/%s, ino %llu, new file.\n",
+ pseudo_debug(PDBGF_FILE, "chmodat to 0%o on %d/%s, ino %llu, new file.\n",
mode, dirfd, path, (unsigned long long) buf.st_ino);
}
diff --git a/ports/unix/guts/fchown.c b/ports/unix/guts/fchown.c
index 1514e35..6e33f0f 100644
--- a/ports/unix/guts/fchown.c
+++ b/ports/unix/guts/fchown.c
@@ -12,7 +12,7 @@
if (base_fstat(fd, &buf) == -1) {
save_errno = errno;
- pseudo_debug(2, "fchown failing because fstat failed: %s\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "fchown failing because fstat failed: %s\n",
strerror(errno));
errno = save_errno;
return -1;
@@ -24,7 +24,7 @@
if (msg->result == RESULT_SUCCEED) {
pseudo_stat_msg(&buf, msg);
} else {
- pseudo_debug(2, "fchown fd %d, ino %llu, unknown file.\n",
+ pseudo_debug(PDBGF_FILE, "fchown fd %d, ino %llu, unknown file.\n",
fd, (unsigned long long) buf.st_ino);
}
} else {
@@ -39,7 +39,7 @@
if (group != (gid_t) -1) {
buf.st_gid = group;
}
- pseudo_debug(2, "fchown, fd %d: %d:%d -> %d:%d\n",
+ pseudo_debug(PDBGF_OP, "fchown, fd %d: %d:%d -> %d:%d\n",
fd, owner, group, buf.st_uid, buf.st_gid);
pseudo_client_op(OP_FCHOWN, 0, fd, -1, 0, &buf);
/* pretend we worked, errno should be unchanged */
diff --git a/ports/unix/guts/fchownat.c b/ports/unix/guts/fchownat.c
index 60ccfa5..f976d91 100644
--- a/ports/unix/guts/fchownat.c
+++ b/ports/unix/guts/fchownat.c
@@ -40,7 +40,7 @@
if (msg->result == RESULT_SUCCEED) {
pseudo_stat_msg(&buf, msg);
} else {
- pseudo_debug(2, "chownat to %d:%d on %d/%s, ino %llu, new file.\n",
+ pseudo_debug(PDBGF_FILE, "chownat to %d:%d on %d/%s, ino %llu, new file.\n",
owner, group, dirfd, path,
(unsigned long long) buf.st_ino);
}
diff --git a/ports/unix/guts/fopen.c b/ports/unix/guts/fopen.c
index c7b8da5..de940f5 100644
--- a/ports/unix/guts/fopen.c
+++ b/ports/unix/guts/fopen.c
@@ -16,14 +16,14 @@
if (rc) {
int fd = fileno(rc);
- pseudo_debug(2, "fopen '%s': fd %d <FILE %p>\n", path, fd, (void *) rc);
+ pseudo_debug(PDBGF_OP, "fopen '%s': fd %d <FILE %p>\n", path, fd, (void *) rc);
if (base_fstat(fd, &buf) != -1) {
if (!existed) {
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);
} else {
- pseudo_debug(1, "fopen (fd %d) succeeded, but fstat failed (%s).\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "fopen (fd %d) succeeded, but fstat failed (%s).\n",
fd, strerror(errno));
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0);
}
diff --git a/ports/unix/guts/freopen.c b/ports/unix/guts/freopen.c
index eb788b3..45ca135 100644
--- a/ports/unix/guts/freopen.c
+++ b/ports/unix/guts/freopen.c
@@ -16,14 +16,14 @@
if (rc) {
int fd = fileno(rc);
- pseudo_debug(2, "freopen '%s': fd %d\n", path, fd);
+ pseudo_debug(PDBGF_OP, "freopen '%s': fd %d\n", path, fd);
if (base_fstat(fd, &buf) != -1) {
if (!existed) {
pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf);
}
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf);
} else {
- pseudo_debug(1, "fopen (fd %d) succeeded, but stat failed (%s).\n",
+ pseudo_debug(PDBGF_OP, "fopen (fd %d) succeeded, but stat failed (%s).\n",
fd, strerror(errno));
pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0);
}
diff --git a/ports/unix/guts/getcwd.c b/ports/unix/guts/getcwd.c
index b3f552c..2915a18 100644
--- a/ports/unix/guts/getcwd.c
+++ b/ports/unix/guts/getcwd.c
@@ -6,7 +6,7 @@
* wrap_getcwd(char *buf, size_t size) {
* char * rc = NULL;
*/
- pseudo_debug(3, "wrap_getcwd: %p, %lu\n",
+ pseudo_debug(PDBGF_CLIENT, "wrap_getcwd: %p, %lu\n",
(void *) buf, (unsigned long) size);
if (!pseudo_cwd) {
pseudo_diag("Asked for CWD, but don't have it!\n");
@@ -44,7 +44,7 @@
}
}
if (pseudo_cwd_len - (pseudo_cwd_rel - pseudo_cwd) >= size) {
- pseudo_debug(1, "only %ld bytes available, need %ld (%ld + 1 - %ld)\n",
+ pseudo_debug(PDBGF_CLIENT, "only %ld bytes available, need %ld (%ld + 1 - %ld)\n",
(unsigned long) size,
(unsigned long) pseudo_cwd_len + 1 - pseudo_chroot_len,
(unsigned long) pseudo_cwd_len,
@@ -53,7 +53,7 @@
return NULL;
}
rc = buf;
- pseudo_debug(3, "getcwd: copying %d (%d + 1 - %d) characters from <%s>.\n",
+ pseudo_debug(PDBGF_CLIENT, "getcwd: copying %d (%d + 1 - %d) characters from <%s>.\n",
(int) ((pseudo_cwd_len + 1) - pseudo_chroot_len),
(int) pseudo_cwd_len, (int) pseudo_chroot_len,
pseudo_cwd_rel);
diff --git a/ports/unix/guts/getwd.c b/ports/unix/guts/getwd.c
index 836301e..b1bcf90 100644
--- a/ports/unix/guts/getwd.c
+++ b/ports/unix/guts/getwd.c
@@ -7,7 +7,7 @@
* char * rc = NULL;
*/
- pseudo_debug(3, "getwd (getcwd)\n");
+ pseudo_debug(PDBGF_CLIENT, "getwd (getcwd)\n");
rc = wrap_getcwd(buf, pseudo_path_max());
/* because it would violate everything we have ever known about
* UNIX for these functions to have the same errno semantics,
diff --git a/ports/unix/guts/mkdirat.c b/ports/unix/guts/mkdirat.c
index e846b70..a8fd825 100644
--- a/ports/unix/guts/mkdirat.c
+++ b/ports/unix/guts/mkdirat.c
@@ -27,7 +27,7 @@
if (stat_rc != -1) {
pseudo_client_op(OP_MKDIR, 0, -1, dirfd, path, &buf);
} else {
- pseudo_debug(1, "mkdir of %s succeeded, but stat failed: %s\n",
+ pseudo_debug(PDBGF_OP, "mkdir of %s succeeded, but stat failed: %s\n",
path, strerror(errno));
}
}
diff --git a/ports/unix/guts/mkdtemp.c b/ports/unix/guts/mkdtemp.c
index 194f0cb..5ef647b 100644
--- a/ports/unix/guts/mkdtemp.c
+++ b/ports/unix/guts/mkdtemp.c
@@ -32,7 +32,7 @@
if (base_stat(rc, &buf) != -1) {
pseudo_client_op(OP_CREAT, 0, -1, -1, tmp_template, &buf);
} else {
- pseudo_debug(1, "mkdtemp (path %s) succeeded, but fstat failed (%s).\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "mkdtemp (path %s) succeeded, but fstat failed (%s).\n",
rc, strerror(errno));
}
errno = save_errno;
diff --git a/ports/unix/guts/mkstemp.c b/ports/unix/guts/mkstemp.c
index 2ad3f19..1f055fd 100644
--- a/ports/unix/guts/mkstemp.c
+++ b/ports/unix/guts/mkstemp.c
@@ -33,7 +33,7 @@
pseudo_client_op(OP_CREAT, 0, -1, -1, tmp_template, &buf);
pseudo_client_op(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, &buf);
} else {
- pseudo_debug(1, "mkstemp (fd %d) succeeded, but fstat failed (%s).\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "mkstemp (fd %d) succeeded, but fstat failed (%s).\n",
rc, strerror(errno));
pseudo_client_op(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, 0);
}
diff --git a/ports/unix/guts/opendir.c b/ports/unix/guts/opendir.c
index 31f5738..c8a78f8 100644
--- a/ports/unix/guts/opendir.c
+++ b/ports/unix/guts/opendir.c
@@ -15,7 +15,7 @@
save_errno = errno;
fd = dirfd(rc);
if (base_fstat(fd, &buf) == -1) {
- pseudo_debug(1, "diropen (fd %d) succeeded, but fstat failed (%s).\n",
+ pseudo_debug(PDBGF_CONSISTENCY, "diropen (fd %d) succeeded, but fstat failed (%s).\n",
fd, strerror(errno));
pseudo_client_op(OP_OPEN, PSA_READ, fd, -1, path, 0);
} else {
diff --git a/ports/unix/guts/rename.c b/ports/unix/guts/rename.c
index 1473a8d..ad28293 100644
--- a/ports/unix/guts/rename.c
+++ b/ports/unix/guts/rename.c
@@ -12,7 +12,7 @@
int save_errno;
int old_db_entry = 0;
- pseudo_debug(2, "rename: %s->%s\n",
+ pseudo_debug(PDBGF_OP, "rename: %s->%s\n",
oldpath ? oldpath : "<nil>",
newpath ? newpath : "<nil>");
@@ -84,7 +84,7 @@
oldbuf.st_ino = newbuf.st_ino;
}
}
- pseudo_debug(1, "creating new '%s' [%llu] to rename\n",
+ pseudo_debug(PDBGF_FILE, "creating new '%s' [%llu] to rename\n",
oldpath, (unsigned long long) oldbuf.st_ino);
pseudo_client_op(OP_LINK, 0, -1, -1, oldpath, &oldbuf);
}
diff --git a/ports/unix/guts/renameat.c b/ports/unix/guts/renameat.c
index d8138bb..ade0509 100644
--- a/ports/unix/guts/renameat.c
+++ b/ports/unix/guts/renameat.c
@@ -12,7 +12,7 @@
int save_errno;
int old_db_entry = 0;
- pseudo_debug(2, "renameat: %d,%s->%d,%s\n",
+ pseudo_debug(PDBGF_FILE, "renameat: %d,%s->%d,%s\n",
olddirfd, oldpath ? oldpath : "<nil>",
newdirfd, newpath ? newpath : "<nil>");
@@ -96,7 +96,7 @@
oldbuf.st_ino = newbuf.st_ino;
}
}
- pseudo_debug(1, "creating new '%s' [%llu] to rename\n",
+ pseudo_debug(PDBGF_OP, "creating new '%s' [%llu] to rename\n",
oldpath, (unsigned long long) oldbuf.st_ino);
pseudo_client_op(OP_LINK, 0, -1, olddirfd, oldpath, &oldbuf);
}
diff --git a/ports/unix/guts/rmdir.c b/ports/unix/guts/rmdir.c
index a47e01c..ebc522a 100644
--- a/ports/unix/guts/rmdir.c
+++ b/ports/unix/guts/rmdir.c
@@ -28,7 +28,7 @@
pseudo_client_op(OP_DID_UNLINK, 0, -1, -1, path, &buf);
}
} else {
- pseudo_debug(1, "rmdir on <%s>, not in database, no effect.\n", path);
+ pseudo_debug(PDBGF_FILE, "rmdir on <%s>, not in database, no effect.\n", path);
}
/* return rc;
diff --git a/ports/unix/guts/unlinkat.c b/ports/unix/guts/unlinkat.c
index bd51b09..e723a01 100644
--- a/ports/unix/guts/unlinkat.c
+++ b/ports/unix/guts/unlinkat.c
@@ -53,7 +53,7 @@
pseudo_client_op(OP_DID_UNLINK, 0, -1, -1, path, &buf);
}
} else {
- pseudo_debug(1, "unlink on <%s>, not in database, no effect.\n", path);
+ pseudo_debug(PDBGF_FILE, "unlink on <%s>, not in database, no effect.\n", path);
}
/* return rc;
diff --git a/ports/unix/pseudo_wrappers.c b/ports/unix/pseudo_wrappers.c
index dddb1ec..b825d56 100644
--- a/ports/unix/pseudo_wrappers.c
+++ b/ports/unix/pseudo_wrappers.c
@@ -10,7 +10,7 @@ popen(const char *command, const char *mode) {
return rc;
}
- pseudo_debug(4, "called: popen\n");
+ pseudo_debug(PDBGF_WRAPPER, "called: popen\n");
pseudo_sigblock(&saved);
if (pseudo_getlock()) {
errno = EBUSY;
@@ -30,9 +30,9 @@ popen(const char *command, const char *mode) {
/* This can cause hangs on some recentish systems which use locale
* stuff for strerror...
*/
- pseudo_debug(4, "completed: popen (maybe: %s)\n", strerror(save_errno));
+ pseudo_debug(PDBGF_WRAPPER, "completed: popen (maybe: %s)\n", strerror(save_errno));
#endif
- pseudo_debug(4, "completed: popen (errno: %d)\n", save_errno);
+ pseudo_debug(PDBGF_WRAPPER, "completed: popen (errno: %d)\n", save_errno);
errno = save_errno;
return rc;
}