Blame SOURCES/net-snmp-5.8-licensing.patch

f13900
diff -ruNp a/agent/mibgroup/host/data_access/swrun_darwin.c b/agent/mibgroup/host/data_access/swrun_darwin.c
f13900
--- a/agent/mibgroup/host/data_access/swrun_darwin.c	2020-06-10 09:56:52.517606921 +0200
f13900
+++ b/agent/mibgroup/host/data_access/swrun_darwin.c	1970-01-01 01:00:00.000000000 +0100
f13900
@@ -1,496 +0,0 @@
f13900
-/*
f13900
- * swrun_darwin.c:
f13900
- *     hrSWRunTable data access:
f13900
- *     Darwin
f13900
- */
f13900
-/*
f13900
- * Copyright (C) 2007 Apple, Inc. All rights reserved.
f13900
- * Use is subject to license terms specified in the COPYING file
f13900
- * distributed with the Net-SNMP package.
f13900
- */
f13900
-#include <net-snmp/net-snmp-config.h>
f13900
-#include <net-snmp/net-snmp-includes.h>
f13900
-#include <net-snmp/agent/net-snmp-agent-includes.h>
f13900
-#include <net-snmp/library/container.h>
f13900
-#include <net-snmp/library/snmp_debug.h>
f13900
-#include <net-snmp/data_access/swrun.h>
f13900
-#include "swrun_private.h"
f13900
-
f13900
-#include <stdlib.h>
f13900
-#include <unistd.h>
f13900
-
f13900
-#include <libproc.h>
f13900
-#include <sys/proc_info.h>
f13900
-#include <sys/sysctl.h>	/* for sysctl() and struct kinfo_proc */
f13900
-
f13900
-#define __APPLE_API_EVOLVING 1
f13900
-#include <sys/acl.h> /* or else CoreFoundation.h barfs */
f13900
-#undef __APPLE_API_EVOLVING 
f13900
-
f13900
-#include <CoreFoundation/CFBase.h>
f13900
-#include <CoreFoundation/CFNumber.h>
f13900
-#include <CoreFoundation/CFBundle.h>
f13900
-#include <CoreServices/CoreServices.h>
f13900
-#include <IOKit/IOCFBundle.h>
f13900
-#include <mach/mach.h>
f13900
-#include <mach/mach_time.h>
f13900
-
f13900
-/** sigh... can't find Processes.h */
f13900
-#ifndef kProcessDictionaryIncludeAllInformationMask 
f13900
-#define kProcessDictionaryIncludeAllInformationMask (long)0xFFFFFFFF
f13900
-#endif
f13900
-#ifndef procNotFound
f13900
-#define procNotFound -600
f13900
-#endif
f13900
-
f13900
-/* ---------------------------------------------------------------------
f13900
- */
f13900
-static int _kern_argmax;
f13900
-static int _set_command_name(netsnmp_swrun_entry *entry);
f13900
-
f13900
-/** avoid kernel bug in 10.2. 8192 oughta be enough anyways, right? */
f13900
-#define MAX_KERN_ARGMAX 8192
f13900
-
f13900
-/* ---------------------------------------------------------------------
f13900
- */
f13900
-void
f13900
-netsnmp_arch_swrun_init(void)
f13900
-{
f13900
-    int    mib[2] = { CTL_KERN, KERN_ARGMAX };
f13900
-    size_t size, mib_size = sizeof(mib)/sizeof(mib[0]);
f13900
-    
f13900
-    DEBUGMSGTL(("swrun:load:arch","init\n"));
f13900
-
f13900
-    size = sizeof(_kern_argmax);
f13900
-    if (sysctl(mib, mib_size, &_kern_argmax, &size, NULL, 0) == -1) {
f13900
-        snmp_log(LOG_ERR, "Error in ARGMAX sysctl(): %s", strerror(errno));
f13900
-        _kern_argmax = MAX_KERN_ARGMAX;
f13900
-    }
f13900
-    else if (_kern_argmax > MAX_KERN_ARGMAX) {
f13900
-        DEBUGMSGTL(("swrun:load:arch",
f13900
-                    "artificially limiting ARGMAX to %d (from %d)\n",
f13900
-                    MAX_KERN_ARGMAX, _kern_argmax));
f13900
-        _kern_argmax = MAX_KERN_ARGMAX;
f13900
-    }
f13900
-
f13900
-
f13900
-}
f13900
-
f13900
-/* ---------------------------------------------------------------------
f13900
- */
f13900
-#define SWRUNINDENT "           "
f13900
-int
f13900
-netsnmp_arch_swrun_container_load( netsnmp_container *container, u_int flags)
f13900
-{
f13900
-    int	                 mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL};
f13900
-    size_t               buf_size, mib_size = sizeof(mib)/sizeof(mib[0]);
f13900
-    struct kinfo_proc   *processes = NULL;
f13900
-    struct proc_taskallinfo taskinfo;
f13900
-    netsnmp_swrun_entry *entry;
f13900
-    int                  rc, num_entries, i;
f13900
-
f13900
-    DEBUGMSGTL(("swrun:load:arch"," load\n"));
f13900
-
f13900
-    /*
f13900
-     * get size to allocate. This introduces a bit of a race condition,
f13900
-     * as the size could change between this call and the next...
f13900
-     */
f13900
-    rc = sysctl(mib, mib_size, NULL, &buf_size, NULL, 0);
f13900
-    if (rc < 0) {
f13900
-        snmp_log(LOG_ERR, "KERN_PROC_ALL size sysctl failed: %d\n", rc);
f13900
-        return -1;
f13900
-    }
f13900
-
f13900
-    processes = (struct kinfo_proc*) malloc(buf_size);
f13900
-    if (NULL == processes) {
f13900
-        snmp_log(LOG_ERR, "malloc failed\n");
f13900
-        return -1;
f13900
-    }
f13900
-
f13900
-    rc = sysctl(mib, mib_size, processes, &buf_size, NULL, 0);
f13900
-    if (rc < 0) {
f13900
-        snmp_log(LOG_ERR, "KERN_PROC_ALL sysctl failed: %d\n", rc);
f13900
-        free(processes);
f13900
-        return -1;
f13900
-    }
f13900
-    
f13900
-    num_entries = buf_size / sizeof(struct kinfo_proc);
f13900
-    
f13900
-    for (i = 0; i < num_entries; i++) {
f13900
-        /*
f13900
-         * skip empty names.
f13900
-         * p_stat = (SIDL|SRUN|SSLEEP|SSTOP|SZOMB)
f13900
-         */
f13900
-        if (('\0' == processes[i].kp_proc.p_comm[0]) ||
f13900
-            (0 == processes[i].kp_proc.p_pid)) {
f13900
-            DEBUGMSGTL(("swrun:load:arch",
f13900
-                        " skipping p_comm '%s', pid %5d, p_pstat %d\n",
f13900
-                        processes[i].kp_proc.p_comm ? 
f13900
-                        processes[i].kp_proc.p_comm : "NULL",
f13900
-                        processes[i].kp_proc.p_pid,
f13900
-                        processes[i].kp_proc.p_stat));
f13900
-            continue;
f13900
-        }
f13900
-
f13900
-        DEBUGMSGTL(("swrun:load:arch"," %s pid %5d\n",
f13900
-                    processes[i].kp_proc.p_comm,
f13900
-                    processes[i].kp_proc.p_pid));
f13900
-
f13900
-        entry = netsnmp_swrun_entry_create(processes[i].kp_proc.p_pid);
f13900
-        if (NULL == entry)
f13900
-            continue; /* error already logged by function */
f13900
-        rc = CONTAINER_INSERT(container, entry);
f13900
-
f13900
-        /*
f13900
-         * p_comm is a partial name, but it is all we have at this point.
f13900
-         */
f13900
-        entry->hrSWRunName_len = snprintf(entry->hrSWRunName,
f13900
-                                          sizeof(entry->hrSWRunName)-1,
f13900
-                                          "%s", processes[i].kp_proc.p_comm);
f13900
-
f13900
-        /** sysctl for name, path, params */
f13900
-        rc = _set_command_name(entry);
f13900
-
f13900
-        /*
f13900
-         * map p_stat to RunStatus. Odd that there is no 'running' status.
f13900
-         */
f13900
-        switch(processes[i].kp_proc.p_stat) {
f13900
-            case SRUN:
f13900
-                entry->hrSWRunStatus = HRSWRUNSTATUS_RUNNABLE;
f13900
-                break;
f13900
-            case SSLEEP:
f13900
-            case SSTOP:
f13900
-                entry->hrSWRunStatus = HRSWRUNSTATUS_NOTRUNNABLE;
f13900
-                break;
f13900
-            case SIDL:
f13900
-            case SZOMB:
f13900
-            default:
f13900
-                entry->hrSWRunStatus = HRSWRUNSTATUS_INVALID;
f13900
-                break;
f13900
-        } 
f13900
-
f13900
-        /*
f13900
-         * check for system processes
f13900
-         */
f13900
-        if (P_SYSTEM & processes[i].kp_proc.p_flag) {
f13900
-            entry->hrSWRunType = HRSWRUNTYPE_OPERATINGSYSTEM;
f13900
-            DEBUGMSGTL(("swrun:load:arch", SWRUNINDENT "SYSTEM\n"));
f13900
-        }
f13900
-        else entry->hrSWRunType = HRSWRUNTYPE_APPLICATION;
f13900
-
f13900
-        /*
f13900
-         * get mem size, run time
f13900
-         */
f13900
-        rc = proc_pidinfo( processes[i].kp_proc.p_pid, PROC_PIDTASKALLINFO, 0,
f13900
-                           &taskinfo, sizeof(taskinfo));
f13900
-        if (sizeof(taskinfo) != rc) {
f13900
-            DEBUGMSGTL(("swrun:load:arch", " proc_pidinfo returned %d\n", rc));
f13900
-        }
f13900
-        else {
f13900
-            uint64_t task_mem = taskinfo.ptinfo.pti_resident_size / 1024;
f13900
-            union {
f13900
-                u_quad_t     uq; /* u_int64_t */
f13900
-                UnsignedWide uw; /* struct u_int32_t hi/lo */
f13900
-            } at, ns;
f13900
-            at.uq = taskinfo.ptinfo.pti_total_user +
f13900
-                    taskinfo.ptinfo.pti_total_system;
f13900
-            ns = at;
f13900
-            ns.uq = ns.uq / 10000000LL; /* nano to deci */
f13900
-            if (task_mem > INT32_MAX) {
f13900
-                DEBUGMSGTL(("swrun:load:arch", SWRUNINDENT "mem overflow\n"));
f13900
-                task_mem = INT32_MAX;
f13900
-            }
f13900
-            if (ns.uq > INT32_MAX) {
f13900
-                DEBUGMSGTL(("swrun:load:arch", SWRUNINDENT "time overflow\n"));
f13900
-                ns.uq = INT32_MAX;
f13900
-            }
f13900
-            entry->hrSWRunPerfMem = task_mem;
f13900
-            entry->hrSWRunPerfCPU = ns.uq;
f13900
-        }
f13900
-    }
f13900
-    free(processes);
f13900
-
f13900
-    DEBUGMSGTL(("swrun:load:arch"," loaded %d entries\n",
f13900
-                (int)CONTAINER_SIZE(container)));
f13900
-
f13900
-    return 0;
f13900
-}
f13900
-
f13900
-/* ---------------------------------------------------------------------
f13900
- * The following code was snagged from Darwin code, and the original
f13900
- * file had the following licences:
f13900
- */
f13900
-
f13900
-/*
f13900
- * Copyright (c) 2002-2004 Apple Computer, Inc.  All rights reserved.
f13900
- *
f13900
- * @APPLE_LICENSE_HEADER_START@
f13900
- * 
f13900
- * The contents of this file constitute Original Code as defined in and
f13900
- * are subject to the Apple Public Source License Version 1.1 (the
f13900
- * "License").  You may not use this file except in compliance with the
f13900
- * License.  Please obtain a copy of the License at
f13900
- * http://www.apple.com/publicsource and read it before using this file.
f13900
- * 
f13900
- * This Original Code and all software distributed under the License are
f13900
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
f13900
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
f13900
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
f13900
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
f13900
- * License for the specific language governing rights and limitations
f13900
- * under the License.
f13900
- * 
f13900
- * @APPLE_LICENSE_HEADER_END@
f13900
- */
f13900
-#ifdef JAGUAR /* xxx configure test? */
f13900
-static int
f13900
-_set_command_name_jaguar(netsnmp_swrun_entry *entry)
f13900
-{
f13900
-    int	        mib[3] = {CTL_KERN, KERN_PROCARGS, 0};
f13900
-    size_t      procargssize, mib_size = sizeof(mib)/sizeof(mib[0]);
f13900
-    char       *arg_end, *exec_path;
f13900
-    int        *ip;
f13900
-    int         len;
f13900
-    char       *command_beg, *command, *command_end;
f13900
-    char        arg_buf[MAX_KERN_ARGMAX]; /* max to avoid kernel bug */
f13900
-
f13900
-    DEBUGMSGTL(("swrun:load:arch:_cn"," pid %d\n", entry->hrSWRunIndex));
f13900
-
f13900
-    mib[2] = entry->hrSWRunIndex;
f13900
-
f13900
-    memset(arg_buf, 0x0, sizeof(arg_buf));
f13900
-    procargssize = _kern_argmax;
f13900
-    if (sysctl(mib, mib_size, arg_buf, &procargssize, NULL, 0) == -1) {
f13900
-        snmp_log(LOG_ERR, "Error in PROCARGS sysctl() for %s: %s\n",
f13900
-                 entry->hrSWRunName, strerror(errno));
f13900
-        entry->hrSWRunPath_len = 0;
f13900
-        return -1;
f13900
-    }
f13900
-
f13900
-    /* Set ip just above the end of arg_buf. */
f13900
-    arg_end = &arg_buf[procargssize];
f13900
-    ip = (int *)arg_end;
f13900
-    
f13900
-    /*
f13900
-     * Skip the last 2 words, since the last is a 0 word, and
f13900
-     * the second to last may be as well, if there are no
f13900
-     * arguments.
f13900
-     */
f13900
-    ip -= 3;
f13900
-    
f13900
-    /* Iterate down the arguments until a 0 word is found. */
f13900
-    for (; *ip != 0; ip--) {
f13900
-        if (ip == (int *)arg_buf) {
f13900
-            DEBUGMSGTL(("swrun:load:arch:_cn"," unexpected toparg\n"));
f13900
-            return -1;
f13900
-        }
f13900
-    }
f13900
-    
f13900
-    /* The saved exec_path is just above the 0 word. */
f13900
-    ip++;
f13900
-    exec_path = (char *)ip;
f13900
-    DEBUGMSGTL(("swrun:load:arch:_cn"," exec_path %s\n", exec_path));
f13900
-    len = strlen(exec_path);
f13900
-    strlcpy(entry->hrSWRunPath, exec_path, sizeof(entry->hrSWRunPath));
f13900
-    if (len > sizeof(entry->hrSWRunPath)-1) {
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn"," truncating long run path\n"));
f13900
-        entry->hrSWRunPath[sizeof(entry->hrSWRunPath)-2] = '$';
f13900
-        entry->hrSWRunPath_len = sizeof(entry->hrSWRunPath)-1;
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn"," exec_path %s\n",
f13900
-                    entry->hrSWRunPath));
f13900
-    }
f13900
-    else
f13900
-        entry->hrSWRunPath_len = len;
f13900
-    
f13900
-    /*
f13900
-     * Get the beginning of the first argument.  It is word-aligned,
f13900
-     * so skip padding '\0' bytes.
f13900
-     */
f13900
-    command_beg = exec_path + strlen(exec_path);
f13900
-    DEBUGMSGTL(("swrun:load:arch:_cn"," command_beg '%s'\n", command_beg));
f13900
-    for (; *command_beg == '\0'; command_beg++) {
f13900
-        if (command_beg >= arg_end)
f13900
-            return -1;
f13900
-    }
f13900
-    DEBUGMSGTL(("swrun:load:arch:_cn"," command_beg '%s'\n", command_beg));
f13900
-    
f13900
-    /* Get the basename of command. */
f13900
-    command = command_end = command_beg + strlen(command_beg) + 1;
f13900
-    for (command--; command >= command_beg; command--) {
f13900
-        if (*command == '/')
f13900
-            break;
f13900
-    }
f13900
-    command++;
f13900
-    DEBUGMSGTL(("swrun:load:arch:_cn"," command '%s'\n", command));
f13900
-    
f13900
-    /* Allocate space for the command and copy. */
f13900
-    DEBUGMSGTL(("swrun:load:arch:_cn",
f13900
-                SWRUNINDENT "kernel name %s\n", command));
f13900
-    if (strncmp(command, entry->hrSWRunName, sizeof(entry->hrSWRunName)-1)) {
f13900
-        strlcpy(entry->hrSWRunName, command, sizeof(entry->hrSWRunName));
f13900
-        entry->hrSWRunName_len = strlen(entry->hrSWRunName);
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn", "**"
f13900
-                    SWRUNINDENT "updated name to %s\n", entry->hrSWRunName));
f13900
-        return 0;
f13900
-    }
f13900
-
f13900
-    /** no error, no change */
f13900
-    return 1;
f13900
-}
f13900
-#else
f13900
-static int
f13900
-_set_command_name(netsnmp_swrun_entry *entry)
f13900
-{
f13900
-    int	        mib[3] = {CTL_KERN, 0, 0};
f13900
-    size_t      procargssize, mib_size = sizeof(mib)/sizeof(mib[0]);
f13900
-    char       *cp;
f13900
-    int         len, nargs;
f13900
-    char       *command_beg, *command, *command_end, *exec_path, *argN;
f13900
-    char        arg_buf[MAX_KERN_ARGMAX]; /* max to avoid kernel bug */
f13900
-
f13900
-    /*
f13900
-     * arguments
f13900
-     */
f13900
-    mib[1] = KERN_PROCARGS2;
f13900
-    mib[2] = entry->hrSWRunIndex;
f13900
-
f13900
-    memset(arg_buf, 0x0, sizeof(arg_buf));
f13900
-    procargssize = _kern_argmax;
f13900
-    if (sysctl(mib, mib_size, arg_buf, &procargssize, NULL, 0) == -1) {
f13900
-        snmp_log(LOG_ERR, "Error in PROCARGS2 sysctl() for %s: %s\n",
f13900
-                 entry->hrSWRunName, strerror(errno));
f13900
-        entry->hrSWRunPath_len = 0;
f13900
-        entry->hrSWRunParameters_len = 0;
f13900
-        return -1;
f13900
-    }
f13900
-    else {
f13900
-        memcpy(&nargs,arg_buf, sizeof(nargs));
f13900
-    }
f13900
-
f13900
-    exec_path = arg_buf + sizeof(nargs);
f13900
-    len = strlen(exec_path);
f13900
-    strlcpy(entry->hrSWRunPath, exec_path, sizeof(entry->hrSWRunPath));
f13900
-    if (len > sizeof(entry->hrSWRunPath)-1) {
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn"," truncating long run path\n"));
f13900
-        entry->hrSWRunPath[sizeof(entry->hrSWRunPath)-2] = '$';
f13900
-        entry->hrSWRunPath_len = sizeof(entry->hrSWRunPath)-1;
f13900
-    }
f13900
-    else
f13900
-        entry->hrSWRunPath_len = len;
f13900
-
f13900
-    /** Skip the saved exec_path. */
f13900
-#if 0
f13900
-    cp = exec_path + len;
f13900
-#else
f13900
-    for (cp = exec_path; cp < &arg_buf[procargssize]; cp++) {
f13900
-        if (*cp == '\0') 
f13900
-            break; /* End of exec_path reached. */
f13900
-    }
f13900
-    if (cp != exec_path + len) {
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn", " OFF BY %d\n",
f13900
-                    (int)((exec_path + len) - cp)));
f13900
-        netsnmp_assert( cp == exec_path + len );
f13900
-    }
f13900
-#endif
f13900
-    if (cp == &arg_buf[procargssize]) {
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn"," unexpected end of buffer\n"));
f13900
-        return -1;
f13900
-    }
f13900
-
f13900
-    /** Skip trailing '\0' characters. */
f13900
-    for (; cp < &arg_buf[procargssize]; cp++) {
f13900
-        if (*cp != '\0')
f13900
-            break; /* Beginning of first argument reached. */
f13900
-    }
f13900
-    if (cp == &arg_buf[procargssize]) {
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn"," unexpected end of buffer\n"));
f13900
-        return -1;
f13900
-    }
f13900
-    command_beg = cp;
f13900
-
f13900
-    /*
f13900
-     * Make sure that the command is '\0'-terminated.  This protects
f13900
-     * against malicious programs; under normal operation this never
f13900
-     * ends up being a problem..
f13900
-     */
f13900
-    for (; cp < &arg_buf[procargssize]; cp++) {
f13900
-        if (*cp == '\0')
f13900
-            break; /* End of first argument reached. */
f13900
-    }
f13900
-    if (cp == &arg_buf[procargssize]) {
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn"," unexpected end of buffer\n"));
f13900
-        return -1;
f13900
-    }
f13900
-    command_end = command = cp;
f13900
-    --nargs;
f13900
-
f13900
-    /*
f13900
-     * save arguments
f13900
-     */
f13900
-    while( nargs && cp < &arg_buf[procargssize] ) {
f13900
-        /** Skip trailing '\0' characters from prev arg. */
f13900
-        for (; (cp < &arg_buf[procargssize]) && (*cp == 0); cp++) 
f13900
-            ; /* noop */
f13900
-        if (cp == &arg_buf[procargssize])
f13900
-            continue; /* effectively a break */
f13900
-    
f13900
-        /** save argN start */
f13900
-        argN = cp;
f13900
-        --nargs;
f13900
-        if (0 == nargs)
f13900
-            continue; /* effectively a break */
f13900
-
f13900
-        /** Skip to end of arg */
f13900
-        for (; (cp < &arg_buf[procargssize]) && (*cp != 0); cp++) 
f13900
-            ;  /* noop */
f13900
-        if (cp == &arg_buf[procargssize])
f13900
-            continue; /* effectively a break */
f13900
-
f13900
-        /*
f13900
-         * check for overrun into env
f13900
-         */
f13900
-        if ((*argN != '-') && strchr(argN,'='))  {
f13900
-            DEBUGMSGTL(("swrun:load:arch:_cn", " *** OVERRUN INTO ENV %d\n",nargs));
f13900
-            continue;
f13900
-        }
f13900
-
f13900
-        /*
f13900
-         * save arg
f13900
-         */
f13900
-        if(entry->hrSWRunParameters_len < sizeof(entry->hrSWRunParameters)-1) {
f13900
-            strlcat(&entry->hrSWRunParameters[entry->hrSWRunParameters_len],
f13900
-                    argN, sizeof(entry->hrSWRunParameters)-entry->hrSWRunParameters_len-1);
f13900
-            entry->hrSWRunParameters_len = strlen(entry->hrSWRunParameters);
f13900
-            if ((entry->hrSWRunParameters_len+2 < sizeof(entry->hrSWRunParameters)-1) && (0 != nargs)) {
f13900
-                /* add space between params */
f13900
-                entry->hrSWRunParameters[entry->hrSWRunParameters_len++] = ' ';
f13900
-                entry->hrSWRunParameters[entry->hrSWRunParameters_len] = 0;
f13900
-            } else {
f13900
-                DEBUGMSGTL(("swrun:load:arch:_cn"," truncating long arg list\n"));
f13900
-                entry->hrSWRunParameters[entry->hrSWRunParameters_len++] = '$';
f13900
-                entry->hrSWRunParameters[entry->hrSWRunParameters_len] = '0';
f13900
-            }
f13900
-        }
f13900
-    }
f13900
-    if (' ' == entry->hrSWRunParameters[entry->hrSWRunParameters_len])
f13900
-        entry->hrSWRunParameters[entry->hrSWRunParameters_len--] = 0;
f13900
-
f13900
-    
f13900
-    /* Get the basename of command. */
f13900
-    for (command--; command >= command_beg; command--) {
f13900
-        if (*command == '/')
f13900
-            break;
f13900
-    }
f13900
-    command++;
f13900
-    
f13900
-    /* Allocate space for the command and copy. */
f13900
-    if (strncmp(command, entry->hrSWRunName, sizeof(entry->hrSWRunName)-1)) {
f13900
-        strlcpy(entry->hrSWRunName, command, sizeof(entry->hrSWRunName));
f13900
-        entry->hrSWRunName_len = strlen(entry->hrSWRunName);
f13900
-        DEBUGMSGTL(("swrun:load:arch:_cn",
f13900
-                    " **updated name to %s\n", entry->hrSWRunName));
f13900
-    }
f13900
-
f13900
-    return 0;
f13900
-}
f13900
-#endif