aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.txt2
-rw-r--r--ports/darwin/guts/fcntl.c20
-rw-r--r--templates/wrapfuncs.c2
3 files changed, 17 insertions, 7 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 5f6044c..2ac7962 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,5 +1,7 @@
2011-03-24:
* (seebs) more work on OS X port.
+ * (seebs) include errno in the verbose debug output
+ * (seebs) fix darwin fcntl.
2011-02-18:
* (seebs) moving things to Unix port, cleanup for Darwin
diff --git a/ports/darwin/guts/fcntl.c b/ports/darwin/guts/fcntl.c
index b2b4ebc..ef42b33 100644
--- a/ports/darwin/guts/fcntl.c
+++ b/ports/darwin/guts/fcntl.c
@@ -6,20 +6,24 @@
* int rc = -1;
*/
int save_errno;
- struct kludge { off_t unknown[6]; } x;
+ long long flag = 0;
+ void *ptr = 0;
+ off_t off = 0;
va_start(ap, cmd);
- x = va_arg(ap, struct kludge);
+ flag = va_arg(ap, long long);
va_end(ap);
+ rc = real_fcntl(fd, cmd, flag);
- rc = real_fcntl(fd, cmd, x);
switch (cmd) {
case F_DUPFD:
#ifdef F_DUPFD_CLOEXEC
+ /* it doesn't exist now, but if I take this out they'll add it
+ * just to mess with me.
+ */
case F_DUPFD_CLOEXEC:
#endif
/* actually do something */
- rc = real_fcntl(fd, cmd, x);
save_errno = errno;
if (rc != -1) {
pseudo_debug(2, "fcntl_dup: %d->%d\n", fd, rc);
@@ -28,11 +32,15 @@
errno = save_errno;
break;
default:
- /* pretty sure this is safe on x86. */
- rc = real_fcntl(fd, cmd, x);
+ /* nothing to do, we hope */
break;
}
+ save_errno = errno;
+ pseudo_debug(3, "fcntl(fd %d, cmd %d, %llx) => %d (%s)\n",
+ fd, cmd, flag, rc, strerror(errno));
+ errno = save_errno;
+
/* return rc;
* }
*/
diff --git a/templates/wrapfuncs.c b/templates/wrapfuncs.c
index f6d4f0b..61b52ff 100644
--- a/templates/wrapfuncs.c
+++ b/templates/wrapfuncs.c
@@ -60,7 +60,7 @@ ${name}(${decl_args}) {
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- pseudo_debug(4, "completed: $name\n");
+ pseudo_debug(4, "completed: $name (maybe: %s)\n", strerror(save_errno));
errno = save_errno;
${rc_return}
}