]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/usb-darwin.c
Update Github repository to match macOS 11.2 CUPS sources (cups-494.1).
[thirdparty/cups.git] / backend / usb-darwin.c
index 0d009f0ad942a857c28fef3ffc6115911b3a322d..3f03630f01b9793f0095ef6fae379cf4c487f37a 100644 (file)
@@ -288,11 +288,11 @@ static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
 #define IS_64BIT 1
 #define IS_NOT_64BIT 0
 
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__arm64e__)
 static pid_t   child_pid;              /* Child PID */
-static void run_legacy_backend(int argc, char *argv[], int fd) _CUPS_NORETURN; /* Starts child backend process running as a ppc executable */
-#endif /* __i386__ || __x86_64__ */
-static void sigterm_handler(int sig);  /* SIGTERM handler */
+static void run_legacy_backend(int argc, char *argv[], int fd) _CUPS_NORETURN; /* Starts child backend process running as a x86_64 executable */
+static void sigterm_handler(int sig);    /* SIGTERM handler */
+#endif /* __arm64e__ */
 static void sigquit_handler(int sig, siginfo_t *si, void *unused) _CUPS_NORETURN;
 
 #ifdef PARSE_PS_ERRORS
@@ -436,18 +436,18 @@ print_device(const char *uri,             /* I - Device URI */
 
     status = registry_open(&driverBundlePath);
 
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__arm64e__)
     /*
      * If we were unable to load the class drivers for this printer it's
-     * probably because they're ppc or i386. In this case try to run this
-     * backend as i386 or ppc executables so we can use them...
+     * probably because they're x86_64 (or older). In this case try to run this
+     * backend as x86_64 so we can use them...
      */
     if (status == -2)
     {
       run_legacy_backend(argc, argv, print_fd);
       /* Never returns here */
     }
-#endif /* __i386__ || __x86_64__ */
+#endif /* __arm64e__ */
 
     if (status ==  -2)
     {
@@ -2053,11 +2053,11 @@ static void setup_cfLanguage(void)
 }
 
 #pragma mark -
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__arm64e__)
 /*!
  * @function   run_legacy_backend
  *
- * @abstract   Starts child backend process running as a ppc or i386 executable.
+ * @abstract   Starts child backend process running as a x86_64 executable.
  *
  * @result     Never returns; always calls exit().
  *
@@ -2076,18 +2076,14 @@ static void run_legacy_backend(int argc,
 
 
  /*
-  * If we're running as x86_64 or i386 and couldn't load the class driver
-  * (because it's ppc or i386), then try to re-exec ourselves in ppc or i386
-  * mode to try again. If we don't have a ppc or i386 architecture we may be
+  * If we're running as ARM and couldn't load the class driver
+  * (because it's x86_64, i386 or ppc), then try to re-exec ourselves in x86_64
+  * mode to try again. If we don't have that architecture we may be
   * running with the same architecture again so guard against this by setting
   * and testing an environment variable...
   */
 
-#  ifdef __x86_64__
-  usb_legacy_status = getenv("USB_I386_STATUS");
-#  else
-  usb_legacy_status = getenv("USB_PPC_STATUS");
-#  endif /* __x86_64__ */
+  usb_legacy_status = getenv("USB_LEGACY_STATUS");
 
   if (!usb_legacy_status)
   {
@@ -2116,21 +2112,13 @@ static void run_legacy_backend(int argc,
     * Set the environment variable...
     */
 
-#  ifdef __x86_64__
-    setenv("USB_I386_STATUS", "1", false);
-#  else
-    setenv("USB_PPC_STATUS", "1", false);
-#  endif /* __x86_64__ */
+    setenv("USB_LEGACY_STATUS", "1", false);
 
    /*
     * Tell the kernel to use the specified CPU architecture...
     */
 
-#  ifdef __x86_64__
-    cpu_type_t cpu = CPU_TYPE_I386;
-#  else
-    cpu_type_t cpu = CPU_TYPE_POWERPC;
-#  endif /* __x86_64__ */
+    cpu_type_t cpu = CPU_TYPE_X86_64;
     size_t ocount = 1;
     posix_spawnattr_t attrs;
 
@@ -2139,11 +2127,7 @@ static void run_legacy_backend(int argc,
       posix_spawnattr_setsigdefault(&attrs, &oldmask);
       if (posix_spawnattr_setbinpref_np(&attrs, 1, &cpu, &ocount) || ocount != 1)
       {
-#  ifdef __x86_64__
-       perror("DEBUG: Unable to set binary preference to i386");
-#  else
-       perror("DEBUG: Unable to set binary preference to ppc");
-#  endif /* __x86_64__ */
+       perror("DEBUG: Unable to set binary preference to X86_64");
        _cupsLangPrintFilter(stderr, "ERROR",
                             _("Unable to use legacy USB class driver."));
        exit(CUPS_BACKEND_STOP);
@@ -2217,8 +2201,6 @@ static void run_legacy_backend(int argc,
 
   exit(exitstatus);
 }
-#endif /* __i386__ || __x86_64__ */
-
 
 /*
  * 'sigterm_handler()' - SIGTERM handler.
@@ -2227,7 +2209,6 @@ static void run_legacy_backend(int argc,
 static void
 sigterm_handler(int sig)               /* I - Signal */
 {
-#if defined(__i386__) || defined(__x86_64__)
  /*
   * If we started a child process pass the signal on to it...
   */
@@ -2253,8 +2234,8 @@ sigterm_handler(int sig)          /* I - Signal */
       _exit(CUPS_BACKEND_STOP);
     }
   }
-#endif /* __i386__ || __x86_64__ */
 }
+#endif /* __arm64e__ */
 
 
 /*