[launchd-changes] [23552] trunk/launchd/src
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 15:13:33 PDT 2008
Revision: 23552
http://trac.macosforge.org/projects/launchd/changeset/23552
Author: zarzycki at apple.com
Date: 2008-03-12 15:13:32 -0700 (Wed, 12 Mar 2008)
Log Message:
-----------
<rdar://problem/5795967> 64-bit launchd executables
Modified Paths:
--------------
trunk/launchd/src/launchd_core_logic.c
trunk/launchd/src/liblaunch.c
Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c 2008-03-12 17:14:11 UTC (rev 23551)
+++ trunk/launchd/src/launchd_core_logic.c 2008-03-12 22:13:32 UTC (rev 23552)
@@ -1209,6 +1209,7 @@
job_new(jobmgr_t jm, const char *label, const char *prog, const char *const *argv)
{
const char *const *argv_tmp = argv;
+ char tmp_path[PATH_MAX];
char auto_label[1000];
const char *bn = NULL;
char *co;
@@ -1229,7 +1230,12 @@
}
if (unlikely(label == AUTO_PICK_LEGACY_LABEL)) {
- bn = prog ? prog : basename((char *)argv[0]); /* prog for auto labels is kp.kp_kproc.p_comm */
+ if (prog) {
+ bn = prog;
+ } else {
+ strlcpy(tmp_path, argv[0], sizeof(tmp_path));
+ bn = basename(tmp_path); /* prog for auto labels is kp.kp_kproc.p_comm */
+ }
snprintf(auto_label, sizeof(auto_label), "%s.%s", sizeof(void *) == 8 ? "0xdeadbeeffeedface" : "0xbabecafe", bn);
label = auto_label;
/* This is so we can do gross things later. See NOTE_EXEC for anonymous jobs */
Modified: trunk/launchd/src/liblaunch.c
===================================================================
--- trunk/launchd/src/liblaunch.c 2008-03-12 17:14:11 UTC (rev 23551)
+++ trunk/launchd/src/liblaunch.c 2008-03-12 22:13:32 UTC (rev 23552)
@@ -40,6 +40,22 @@
#include <pwd.h>
#include <assert.h>
+#ifdef __LP64__
+/* workaround: 5723161 */
+#ifndef __DARWIN_ALIGN32
+#define __DARWIN_ALIGN32(x) (((size_t)(x) + 3) & ~3)
+#endif
+#undef CMSG_DATA
+#define CMSG_DATA(cmsg) \
+ ((uint8_t *)(cmsg) + __DARWIN_ALIGN32(sizeof(struct cmsghdr)))
+#undef CMSG_SPACE
+#define CMSG_SPACE(l) \
+ (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))
+#undef CMSG_LEN
+#define CMSG_LEN(l) \
+ (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + (l))
+#endif
+
#include "libbootstrap_public.h"
#include "libvproc_public.h"
#include "libvproc_private.h"
@@ -119,11 +135,11 @@
uint64_t opaque_size;
};
};
- int fd;
- mach_port_t mp;
- int err;
- long long number;
- uint32_t boolean; /* We'd use 'bool' but this struct needs to be used under Rosetta, and sizeof(bool) is different between PowerPC and Intel */
+ int64_t fd;
+ uint64_t mp;
+ uint64_t err;
+ int64_t number;
+ uint64_t boolean; /* We'd use 'bool' but this struct needs to be used under Rosetta, and sizeof(bool) is different between PowerPC and Intel */
double float_num;
};
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20080312/6098882c/attachment.html
More information about the launchd-changes
mailing list