aboutsummaryrefslogtreecommitdiffstats
path: root/ports/darwin
diff options
context:
space:
mode:
Diffstat (limited to 'ports/darwin')
-rw-r--r--ports/darwin/guts/fcntl.c20
1 files changed, 14 insertions, 6 deletions
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;
* }
*/