1 /*******************************************************************************
2 * Copyright (C) 2004-2008 Intel Corp. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
10 * - Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
14 * - Neither the name of Intel Corp. nor the names of its
15 * contributors may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *******************************************************************************/
31 #ifndef _AT_VERSION_TOOL_H_
32 #define _AT_VERSION_TOOL_H_
41 function check if user requested version information to be displayed on std output
42 and show version number
43 @param argc Argument count
44 @param argv Argument array
45 @param versionStr Version string to be displayed
46 @return bool true if version user requested version to be displayed
47 false if version information was not displayed
49 static bool ShowVersionIfArg(int argc
, const char **argv
, const char *versionStr
);
52 function gets application version - if target application uses this class to show version
53 @param appName application name
54 @param version string returning version or empty string if version not determined
55 @return true - if application is running, false - if not.
57 static bool GetAppVersion(const char *appName
, std::string
&version
);
60 function gets process version - if target application uses this class to show version
61 @param cmd path to application
62 @return string version or empty string if version not determined
64 static std::string
GetProcessVersion(std::string cmd
);
67 Checks if an application is running in the system.
68 @param app_name Application binary name (not including path).
69 @param pids returned list of pids of searched application
70 @return true - if application is running, false - if not.
72 static bool IsAppRunning(const char *app_name
, std::list
<unsigned long> &pids
);
75 Returns path associated with application with given PID. Note that to access this information for all processes
76 the function must be called with elevated privileges.
77 @param pid PID of application of interest.
78 @return Application path if possible.
79 Empty string if access is not possbile.
80 NULL if the application isn't runnig.
82 static std::string
GetAppPathByPid(unsigned long pid
);
84 static const std::string appSearchPath
;
87 #endif /* _AT_VERSION_TOOL_H_ */