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