[processargs] Rename PA_SVC_LOADER to PA_LDSVC_LOADER

We ended up calling the loader service LDSVC in FIDL. This change aligns
the processargs name with the FIDL name.

Change-Id: I5cb2332f047676c2e49fa5b20719aa841185cf19
diff --git a/docs/program_loading.md b/docs/program_loading.md
index f04015f..f83e089 100644
--- a/docs/program_loading.md
+++ b/docs/program_loading.md
@@ -316,7 +316,7 @@
 
 An ELF interpreter receives a channel handle for its loader service in its
 `processargs` bootstrap message, identified by the *handle info entry*
-`PA_HND(PA_SVC_LOADER, 0)`.  All requests are synchronous RPCs made
+`PA_HND(PA_LDSVC_LOADER, 0)`.  All requests are synchronous RPCs made
 with [**channel_call**()](syscalls/channel_call.md).  Both requests and
 replies start with the `zx_loader_svc_msg_t` header; some contain
 additional data; some contain a VMO handle.  Request opcodes are:
diff --git a/docs/userboot.md b/docs/userboot.md
index 3950e24..7210360 100644
--- a/docs/userboot.md
+++ b/docs/userboot.md
@@ -144,7 +144,7 @@
 Following the standard program loading protocol, when `userboot` loads a
 program via `PT_INTERP`, it sends an additional `processargs` message
 before the main message, intended for the use of the dynamic linker.  This
-message includes a `PA_SVC_LOADER` handle for a channel on which `userboot`
+message includes a `PA_LDSVC_LOADER` handle for a channel on which `userboot`
 provides a minimal implementation of the
 standard [loader service](program_loading.md#the-loader-service).
 
diff --git a/system/core/userboot/userboot-elf.c b/system/core/userboot/userboot-elf.c
index 8bd6fe2..870547a 100644
--- a/system/core/userboot/userboot-elf.c
+++ b/system/core/userboot/userboot-elf.c
@@ -106,7 +106,7 @@
             [BOOTSTRAP_ROOT_VMAR] = PA_HND(PA_VMAR_ROOT, 0),
             [BOOTSTRAP_SEGMENTS_VMAR] = PA_HND(PA_VMAR_LOADED, 0),
             [BOOTSTRAP_THREAD] = PA_HND(PA_THREAD_SELF, 0),
-            [BOOTSTRAP_LOADER_SVC] = PA_HND(PA_SVC_LOADER, 0),
+            [BOOTSTRAP_LOADER_SVC] = PA_HND(PA_LDSVC_LOADER, 0),
         },
         .env = LOADER_BOOTSTRAP_ENVIRON,
     };
diff --git a/system/public/zircon/processargs.h b/system/public/zircon/processargs.h
index d7eed7b..07c74fc 100644
--- a/system/public/zircon/processargs.h
+++ b/system/public/zircon/processargs.h
@@ -88,8 +88,12 @@
 // --- Loader Service and VMO Handles ---
 // Used by libc init (or equivalent) and dynamic loader
 
-// Channel for dynamic loader service
-#define PA_SVC_LOADER            0x10
+// Service for loading shared libraries.
+// See |fuchsia.ldsvc.Loader| for the interface definition.
+#define PA_LDSVC_LOADER          0x10
+
+// DEPRECATED: Use PA_LDSVC instead.
+#define PA_SVC_LOADER PA_LDSVC_LOADER
 
 // Handle to the VMO containing the ELF image of the system vDSO.  This
 // handle is duplicable, transferable, readable, and executable, but not
diff --git a/system/ulib/fdio/include/lib/fdio/spawn.h b/system/ulib/fdio/include/lib/fdio/spawn.h
index 7b1ca10..e0fc62d 100644
--- a/system/ulib/fdio/include/lib/fdio/spawn.h
+++ b/system/ulib/fdio/include/lib/fdio/spawn.h
@@ -26,7 +26,7 @@
 // Provides the spawned process with the shared library loader used by this
 // process.
 //
-// The shared library loader is passed as |PA_SVC_LOADER|.
+// The shared library loader is passed as |PA_LDSVC_LOADER|.
 #define FDIO_SPAWN_CLONE_LDSVC ((uint32_t)0x0002u)
 
 // Clones the filesystem namespace into the spawned process.
diff --git a/system/ulib/fdio/spawn.c b/system/ulib/fdio/spawn.c
index 0b07800..11d155f 100644
--- a/system/ulib/fdio/spawn.c
+++ b/system/ulib/fdio/spawn.c
@@ -171,7 +171,7 @@
 
     if ((flags & FDIO_SPAWN_CLONE_LDSVC) != 0) {
         handle_infos[h].handle = FIDL_HANDLE_PRESENT;
-        handle_infos[h].id = PA_SVC_LOADER;
+        handle_infos[h].id = PA_LDSVC_LOADER;
         status = dl_clone_loader_service(&handles[h++]);
         if (status != ZX_OK) {
             report_error(err_msg, "failed to clone library loader service: %d", status);
diff --git a/system/ulib/launchpad/launchpad.c b/system/ulib/launchpad/launchpad.c
index 4193d2e..da527ff 100644
--- a/system/ulib/launchpad/launchpad.c
+++ b/system/ulib/launchpad/launchpad.c
@@ -25,7 +25,7 @@
 #include <threads.h>
 
 enum special_handles {
-    HND_LOADER_SVC,
+    HND_LDSVC_LOADER,
     HND_EXEC_VMO,
     HND_SEGMENTS_VMAR,
     HND_SPECIAL_COUNT
@@ -473,7 +473,7 @@
 }
 
 static zx_status_t setup_loader_svc(launchpad_t* lp) {
-    if (lp->special_handles[HND_LOADER_SVC] != ZX_HANDLE_INVALID)
+    if (lp->special_handles[HND_LDSVC_LOADER] != ZX_HANDLE_INVALID)
         return ZX_OK;
 
     zx_handle_t loader_svc;
@@ -481,7 +481,7 @@
     if (status < 0)
         return status;
 
-    lp->special_handles[HND_LOADER_SVC] = loader_svc;
+    lp->special_handles[HND_LDSVC_LOADER] = loader_svc;
     return ZX_OK;
 }
 
@@ -532,7 +532,7 @@
 
     zx_handle_t interp_vmo;
     status = loader_svc_rpc(
-        lp->special_handles[HND_LOADER_SVC], LDMSG_OP_LOAD_OBJECT,
+        lp->special_handles[HND_LDSVC_LOADER], LDMSG_OP_LOAD_OBJECT,
         interp, interp_len, &interp_vmo);
     if (status != ZX_OK)
         return status;
@@ -754,7 +754,7 @@
         if (status != ZX_OK)
             return lp_error(lp, status, "file_load: setup_loader_svc() failed");
 
-        status = loader_svc_rpc(lp->special_handles[HND_LOADER_SVC],
+        status = loader_svc_rpc(lp->special_handles[HND_LDSVC_LOADER],
                              LDMSG_OP_LOAD_SCRIPT_INTERPRETER,
                              interp_start, interp_len, &vmo);
         if (status != ZX_OK)
@@ -855,8 +855,8 @@
         zx_handle_close(svc);
         return lp->error;
     }
-    zx_handle_t result = lp->special_handles[HND_LOADER_SVC];
-    lp->special_handles[HND_LOADER_SVC] = svc;
+    zx_handle_t result = lp->special_handles[HND_LDSVC_LOADER];
+    lp->special_handles[HND_LDSVC_LOADER] = svc;
     return result;
 }
 
@@ -978,8 +978,8 @@
             nhandles += HND_LOADER_COUNT;
             continue;
 
-        case HND_LOADER_SVC:
-            id = PA_SVC_LOADER;
+        case HND_LDSVC_LOADER:
+            id = PA_LDSVC_LOADER;
             break;
 
         case HND_EXEC_VMO:
diff --git a/system/ulib/process-launcher/launcher.cpp b/system/ulib/process-launcher/launcher.cpp
index 4a15e99..7e05fd2 100644
--- a/system/ulib/process-launcher/launcher.cpp
+++ b/system/ulib/process-launcher/launcher.cpp
@@ -246,8 +246,8 @@
     fidl_vector_t* payload = message.GetPayloadAs<fidl_vector_t>();
     fuchsia_process_HandleInfo* handles = static_cast<fuchsia_process_HandleInfo*>(payload->data);
     for (size_t i = 0; i < payload->count; ++i) {
-        if (handles[i].id == PA_SVC_LOADER) {
-            // We need to feed PA_SVC_LOADER to launchpad through a different API.
+        if (handles[i].id == PA_LDSVC_LOADER) {
+            // We need to feed PA_LDSVC_LOADER to launchpad through a different API.
             ldsvc_.reset(handles[i].handle);
         } else {
             ids_.push_back(handles[i].id);
diff --git a/third_party/ulib/musl/ldso/dynlink.c b/third_party/ulib/musl/ldso/dynlink.c
index 2a0cbdc..2ec9a22 100644
--- a/third_party/ulib/musl/ldso/dynlink.c
+++ b/third_party/ulib/musl/ldso/dynlink.c
@@ -1921,7 +1921,7 @@
     zx_handle_t exec_vmo = ZX_HANDLE_INVALID;
     for (int i = 0; i < nhandles; ++i) {
         switch (PA_HND_TYPE(handle_info[i])) {
-        case PA_SVC_LOADER:
+        case PA_LDSVC_LOADER:
             if (loader_svc != ZX_HANDLE_INVALID ||
                 handles[i] == ZX_HANDLE_INVALID) {
                 error("bootstrap message bad LOADER_SVC %#x vs %#x",