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