forked from Lainports/freebsd-ports
- Update firefox and thunderbird to 16.0 - Update seamonkey to 2.13 - Update all -i18n ports respectively - switch firefox 16.0 and seamonkey 2.13 to ALSA by default for better latency during pause and seeking with HTML5 video - remove fedisableexcept() hacks, obsolete since FreeBSD 4.0 - support system hunspell dictionaries [1] - unbreak -esr ports with clang3.2 [2] - unbreak nss build when CC contains full path [3] - remove GNOME option grouping [4] - integrate enigmail into thunderbird/seamonkey as an option [5] - remove mail/enigmail* [6] - enable ENIGMAIL, LIGHTNING and GIO options by default - add more reporters in about:memory: page-faults-hard, page-faults-soft, resident, vsize - use bundled jemalloc 3.0.0 on FreeBSD < 10.0 for gecko 16.0, only heap-allocated reporter works in about:memory (see bug 762445) - use lrintf() instead of slow C cast in bundled libopus - use libjpeg-turbo's faster color conversion if available during build - record startup time for telemetry - use -z origin instead of hardcoding path to gecko runtime - fail early if incompatible libxul version is installed (in USE_GECKO) - *miscellaneous cleanups and fixups* PR: ports/171534 [1] PR: ports/171566 [2] PR: ports/172164 [3] PR: ports/172201 [4] Discussed with: ale, beat, Jan Beich [5] Approved by: ale [6] In collaboration with: Jan Beich <jbeich@tormail.org> Security: 6e5a9afd-12d3-11e2-b47d-c8600054b392 Feature safe: yes Approved by: portmgr (beat)
109 lines
3.1 KiB
Text
109 lines
3.1 KiB
Text
--- mozilla/toolkit/components/startup/nsAppStartup.cpp
|
|
+++ mozilla/toolkit/components/startup/nsAppStartup.cpp
|
|
@@ -50,18 +50,41 @@
|
|
#include <sys/syscall.h>
|
|
#endif
|
|
|
|
-#ifdef XP_MACOSX
|
|
+#if defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
|
|
+ || defined(__NetBSD__) || defined(__OpenBSD__)
|
|
+#include <sys/param.h>
|
|
#include <sys/sysctl.h>
|
|
#endif
|
|
|
|
-#ifdef __OpenBSD__
|
|
-#include <sys/param.h>
|
|
-#include <sys/sysctl.h>
|
|
+#if defined(__DragonFly__) || defined(__FreeBSD__)
|
|
+#include <sys/user.h>
|
|
#endif
|
|
|
|
#include "mozilla/Telemetry.h"
|
|
#include "mozilla/StartupTimeline.h"
|
|
|
|
+#if defined(__NetBSD__)
|
|
+#undef KERN_PROC
|
|
+#define KERN_PROC KERN_PROC2
|
|
+#define KINFO_PROC struct kinfo_proc2
|
|
+#else
|
|
+#define KINFO_PROC struct kinfo_proc
|
|
+#endif
|
|
+
|
|
+#if defined(XP_MACOSX)
|
|
+#define KP_START_SEC kp_proc.p_un.__p_starttime.tv_sec
|
|
+#define KP_START_USEC kp_proc.p_un.__p_starttime.tv_usec
|
|
+#elif defined(__DragonFly__)
|
|
+#define KP_START_SEC kp_start.tv_sec
|
|
+#define KP_START_USEC kp_start.tv_usec
|
|
+#elif defined(__FreeBSD__)
|
|
+#define KP_START_SEC ki_start.tv_sec
|
|
+#define KP_START_USEC ki_start.tv_usec
|
|
+#else
|
|
+#define KP_START_SEC p_ustart_sec
|
|
+#define KP_START_USEC p_ustart_usec
|
|
+#endif
|
|
+
|
|
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
|
|
|
#define kPrefLastSuccess "toolkit.startup.last_success"
|
|
@@ -836,42 +859,30 @@ CalculateProcessCreationTimestamp()
|
|
#endif
|
|
return timestamp;
|
|
}
|
|
-#elif defined(XP_MACOSX)
|
|
+#elif defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
|
|
+ || defined(__NetBSD__) || defined(__OpenBSD__)
|
|
static PRTime
|
|
CalculateProcessCreationTimestamp()
|
|
{
|
|
- int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
|
|
- size_t buffer_size;
|
|
- if (sysctl(mib, 4, NULL, &buffer_size, NULL, 0))
|
|
- return 0;
|
|
+ int mib[] = {
|
|
+ CTL_KERN,
|
|
+ KERN_PROC,
|
|
+ KERN_PROC_PID,
|
|
+ getpid(),
|
|
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
+ sizeof(KINFO_PROC),
|
|
+ 1,
|
|
+#endif
|
|
+ };
|
|
+ u_int miblen = sizeof(mib) / sizeof(mib[0]);
|
|
|
|
- struct kinfo_proc *proc = (kinfo_proc*) malloc(buffer_size);
|
|
- if (sysctl(mib, 4, proc, &buffer_size, NULL, 0)) {
|
|
- free(proc);
|
|
- return 0;
|
|
- }
|
|
- PRTime starttime = static_cast<PRTime>(proc->kp_proc.p_un.__p_starttime.tv_sec) * PR_USEC_PER_SEC;
|
|
- starttime += proc->kp_proc.p_un.__p_starttime.tv_usec;
|
|
- free(proc);
|
|
- return starttime;
|
|
-}
|
|
-#elif defined(__OpenBSD__)
|
|
-static PRTime
|
|
-CalculateProcessCreationTimestamp()
|
|
-{
|
|
- int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(), sizeof(struct kinfo_proc), 1 };
|
|
- size_t buffer_size;
|
|
- if (sysctl(mib, 6, NULL, &buffer_size, NULL, 0))
|
|
+ KINFO_PROC proc;
|
|
+ size_t buffer_size = sizeof(proc);
|
|
+ if (sysctl(mib, miblen, &proc, &buffer_size, NULL, 0))
|
|
return 0;
|
|
|
|
- struct kinfo_proc *proc = (struct kinfo_proc*) malloc(buffer_size);
|
|
- if (sysctl(mib, 6, proc, &buffer_size, NULL, 0)) {
|
|
- free(proc);
|
|
- return 0;
|
|
- }
|
|
- PRTime starttime = static_cast<PRTime>(proc->p_ustart_sec) * PR_USEC_PER_SEC;
|
|
- starttime += proc->p_ustart_usec;
|
|
- free(proc);
|
|
+ PRTime starttime = static_cast<PRTime>(proc.KP_START_SEC) * PR_USEC_PER_SEC;
|
|
+ starttime += proc.KP_START_USEC;
|
|
return starttime;
|
|
}
|
|
#else
|