summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/update/updater/updater.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-05-13 00:08:52 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-05-13 00:08:52 +0200
commite16bcd08aae85a7d9c2de5a4b1c733280cb81112 (patch)
tree220026724ceb8fbcf18bf627fde022c2d8df0e91 /toolkit/mozapps/update/updater/updater.cpp
parent6571d2ceb42930dab01677ef0e95e732d5076fb8 (diff)
downloadUXP-e16bcd08aae85a7d9c2de5a4b1c733280cb81112.tar
UXP-e16bcd08aae85a7d9c2de5a4b1c733280cb81112.tar.gz
UXP-e16bcd08aae85a7d9c2de5a4b1c733280cb81112.tar.lz
UXP-e16bcd08aae85a7d9c2de5a4b1c733280cb81112.tar.xz
UXP-e16bcd08aae85a7d9c2de5a4b1c733280cb81112.zip
Remove MOZ_WIDGET_GONK [2/2]
Tag #288
Diffstat (limited to 'toolkit/mozapps/update/updater/updater.cpp')
-rw-r--r--toolkit/mozapps/update/updater/updater.cpp137
1 files changed, 3 insertions, 134 deletions
diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp
index 63a92c084..dbf50329c 100644
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -110,33 +110,10 @@ struct UpdateServerThreadArgs
#define USE_EXECV
#endif
-#if defined(MOZ_WIDGET_GONK)
-# include "automounter_gonk.h"
-# include <unistd.h>
-# include <android/log.h>
-# include <linux/ioprio.h>
-# include <sys/resource.h>
-
-#if ANDROID_VERSION < 21
-// The only header file in bionic which has a function prototype for ioprio_set
-// is libc/include/sys/linux-unistd.h. However, linux-unistd.h conflicts
-// badly with unistd.h, so we declare the prototype for ioprio_set directly.
-extern "C" MOZ_EXPORT int ioprio_set(int which, int who, int ioprio);
-#else
-# include <sys/syscall.h>
-static int ioprio_set(int which, int who, int ioprio) {
- return syscall(__NR_ioprio_set, which, who, ioprio);
-}
-#endif
-
-# define MAYBE_USE_HARD_LINKS 1
-static bool sUseHardLinks = true;
-#else
# define MAYBE_USE_HARD_LINKS 0
-#endif
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
- !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
+ !defined(XP_MACOSX)
#include "nss.h"
#include "prerror.h"
#endif
@@ -2495,44 +2472,9 @@ ReadMARChannelIDs(const NS_tchar *path, MARChannelStringTable *results)
static int
GetUpdateFileName(NS_tchar *fileName, int maxChars)
{
-#if defined(MOZ_WIDGET_GONK)
- // If an update.link file exists, then it will contain the name
- // of the update file (terminated by a newline).
-
- NS_tchar linkFileName[MAXPATHLEN];
- NS_tsnprintf(linkFileName, sizeof(linkFileName)/sizeof(linkFileName[0]),
- NS_T("%s/update.link"), gPatchDirPath);
- AutoFile linkFile(NS_tfopen(linkFileName, NS_T("rb")));
- if (linkFile == nullptr) {
- NS_tsnprintf(fileName, maxChars,
- NS_T("%s/update.mar"), gPatchDirPath);
- return OK;
- }
-
- char dataFileName[MAXPATHLEN];
- size_t bytesRead;
-
- if ((bytesRead = fread(dataFileName, 1, sizeof(dataFileName)-1, linkFile)) <= 0) {
- *fileName = NS_T('\0');
- return READ_ERROR;
- }
- if (dataFileName[bytesRead-1] == '\n') {
- // Strip trailing newline (for \n and \r\n)
- bytesRead--;
- }
- if (dataFileName[bytesRead-1] == '\r') {
- // Strip trailing CR (for \r, \r\n)
- bytesRead--;
- }
- dataFileName[bytesRead] = '\0';
-
- strncpy(fileName, dataFileName, maxChars-1);
- fileName[maxChars-1] = '\0';
-#else
- // We currently only support update.link files under GONK
+ // We currently don't support update.link files
NS_tsnprintf(fileName, maxChars,
NS_T("%s/update.mar"), gPatchDirPath);
-#endif
return OK;
}
@@ -2776,26 +2718,8 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
-#if defined(MOZ_WIDGET_GONK)
- if (EnvHasValue("LD_PRELOAD")) {
- // If the updater is launched with LD_PRELOAD set, then we wind up
- // preloading libmozglue.so. Under some circumstances, this can cause
- // the remount of /system to fail when going from rw to ro, so if we
- // detect LD_PRELOAD we unsetenv it and relaunch ourselves without it.
- // This will cause the offending preloaded library to be closed.
- //
- // For a variety of reasons, this is really hard to do in a safe manner
- // in the parent process, so we do it here.
- unsetenv("LD_PRELOAD");
- execv(argv[0], argv);
- __android_log_print(ANDROID_LOG_INFO, "updater",
- "execve failed: errno: %d. Exiting...", errno);
- _exit(1);
- }
-#endif
-
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
- !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
+ !defined(XP_MACOSX)
// On Windows and Mac we rely on native APIs to do verifications so we don't
// need to initialize NSS at all there.
// Otherwise, minimize the amount of NSS we depend on by avoiding all the NSS
@@ -3085,36 +3009,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
-#ifdef MOZ_WIDGET_GONK
- const char *prioEnv = getenv("MOZ_UPDATER_PRIO");
- if (prioEnv) {
- int32_t prioVal;
- int32_t oomScoreAdj;
- int32_t ioprioClass;
- int32_t ioprioLevel;
- if (sscanf(prioEnv, "%d/%d/%d/%d",
- &prioVal, &oomScoreAdj, &ioprioClass, &ioprioLevel) == 4) {
- LOG(("MOZ_UPDATER_PRIO=%s", prioEnv));
- if (setpriority(PRIO_PROCESS, 0, prioVal)) {
- LOG(("setpriority(%d) failed, errno = %d", prioVal, errno));
- }
- if (ioprio_set(IOPRIO_WHO_PROCESS, 0,
- IOPRIO_PRIO_VALUE(ioprioClass, ioprioLevel))) {
- LOG(("ioprio_set(%d,%d) failed: errno = %d",
- ioprioClass, ioprioLevel, errno));
- }
- FILE *fs = fopen("/proc/self/oom_score_adj", "w");
- if (fs) {
- fprintf(fs, "%d", oomScoreAdj);
- fclose(fs);
- } else {
- LOG(("Unable to open /proc/self/oom_score_adj for writing, errno = %d",
- errno));
- }
- }
- }
-#endif
-
#ifdef XP_WIN
if (pid > 0) {
HANDLE parent = OpenProcess(SYNCHRONIZE, false, (DWORD) pid);
@@ -3439,27 +3333,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
-#if defined(MOZ_WIDGET_GONK)
- // In gonk, the master b2g process sets its umask to 0027 because
- // there's no reason for it to ever create world-readable files.
- // The updater binary, however, needs to do this, and it inherits
- // the master process's cautious umask. So we drop down a bit here.
- umask(0022);
-
- // Remount the /system partition as read-write for gonk. The destructor will
- // remount /system as read-only. We add an extra level of scope here to avoid
- // calling LogFinish() before the GonkAutoMounter destructor has a chance
- // to be called
- {
-#if !defined(TEST_UPDATER)
- GonkAutoMounter mounter;
- if (mounter.GetAccess() != MountAccess::ReadWrite) {
- WriteStatusFile(FILESYSTEM_MOUNT_READWRITE_ERROR);
- return 1;
- }
-#endif
-#endif
-
if (sStagedUpdate) {
// When staging updates, blow away the old installation directory and create
// it from scratch.
@@ -3759,10 +3632,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif /* XP_WIN */
-#if defined(MOZ_WIDGET_GONK)
- } // end the extra level of scope for the GonkAutoMounter
-#endif
-
#ifdef XP_MACOSX
// When the update is successful remove the precomplete file in the root of
// the application bundle and move the distribution directory from