1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5 *****************************************************************************
6 * @file sal_user_process.c
7 *
8 * @ingroup SalUserProcess
9 *
10 * @description
11 * This file contains implementation of functions to set/get user process
12 * name
13 *
14 *****************************************************************************/
15
16 #include "qat_utils.h"
17 #include "lac_common.h"
18 static char lacProcessName[LAC_USER_PROCESS_NAME_MAX_LEN + 1] =
19 LAC_KERNEL_PROCESS_NAME;
20
21 /**< Process name used to obtain values from correct section of config file. */
22
23 /*
24 * @ingroup LacCommon
25 * @description
26 * This function sets the process name
27 *
28 * @context
29 * This functions is called from module_init or from user space process
30 * initialisation function
31 *
32 * @assumptions
33 * None
34 * @sideEffects
35 * None
36 * @reentrant
37 * No
38 * @threadSafe
39 * No
40 *
41 * param[in] processName Process name to be set
42 */
43 CpaStatus
44 icpSetProcessName(const char *processName)
45 {
46 LAC_CHECK_NULL_PARAM(processName);
47
48 if (strnlen(processName, LAC_USER_PROCESS_NAME_MAX_LEN) ==
49 LAC_USER_PROCESS_NAME_MAX_LEN) {
50 QAT_UTILS_LOG(
51 "Process name too long, maximum process name is %d>\n",
52 LAC_USER_PROCESS_NAME_MAX_LEN);
53 return CPA_STATUS_FAIL;
54 }
55
56 strncpy(lacProcessName, processName, LAC_USER_PROCESS_NAME_MAX_LEN);
57 lacProcessName[LAC_USER_PROCESS_NAME_MAX_LEN] = '\0';
58
59 return CPA_STATUS_SUCCESS;
60 }
61
62 /*
63 * @ingroup LacCommon
64 * @description
65 * This function gets the process name
66 *
67 * @context
68 * This functions is called from LAC context
69 *
70 * @assumptions
71 * None
72 * @sideEffects
73 * None
74 * @reentrant
75 * No
76 * @threadSafe
77 * Yes
78 *
79 */
80 char *
81 icpGetProcessName(void)
82 {
83 return lacProcessName;
84 }
Cache object: 3b5ee266458e43e72b3224f86072905f
|