libkysdk-system/man/systeminfo/kdk_system_get_eUser.3

224 lines
6.4 KiB
Groff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.TH "KDK_SYSTEM_GET_EUSER" 3 "Tue Sep 19 2023" "Linux Programmer's Manual" \"
.SH NAME
kdk_system_get_eUser - 获取当前登录用户的用户名Effect User
.SH SYNOPSIS
.nf
.B #include <libkysysinfo.h>
.sp
.BI "extern char* kdk_system_get_eUser();"
.sp
Link with \fI\-lkysysinfo\fP.
.SH "Detailed Description"
The main function of the interface is to obtain username of the currently logged in user (Effect User).
.SH "RETURN VALUE"
On success, returns username of the currently logged in user of type char*; The returned string needs to be released by
.I free
.
.PP
On error, return
.BR NULL.
.SH EXAMPLES
.EX
#include <libkysysinfo.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *res = kdk_system_get_architecture();
printf("架构:%s\n", res);
free(res);
res = kdk_system_get_systemName();
printf("系统名称:%s\n", res);
free(res);
res = kdk_system_get_version(0);
printf("系统简略版本:%s\n", res);
free(res);
res = kdk_system_get_version(1);
printf("系统详细版本:%s\n", res);
free(res);
res = kdk_system_get_kernelVersion();
printf("内核版本:%s\n", res);
free(res);
res = kdk_system_get_serialNumber();
printf("序列号:%s\n", res);
free(res);
int p;
int d;
int act = kdk_system_get_activationStatus(&p,&d);
printf("--------------\n");
printf("激活状态码:%d\n",act);
printf("激活状态:%s\n", act == 1 ? "已激活" : act == 0 ? "未激活" : "已过期");
res = kdk_system_get_eUser();
printf("当前用户:%s\n", res);
// free(res);
res = kdk_system_get_eUser_login_time();
printf("登录时间:%s\n", res);
res = kdk_system_get_projectName();
printf("项目编号名:%s\n", res);
free(res);
int zyj = kdk_system_is_zyj();
printf("专用机:%s\n", zyj == 0 ? "非专用机":"专用机");
res = kdk_system_get_hostVirtType();
printf("虚拟机类型:%s\n", res);
free(res);
res = kdk_system_get_hostCloudPlatform();
printf("云平台类型:%s\n", res);
free(res);
version_t test = kdk_system_get_version_detaile( );
printf("test.os_version = %s\n",test.os_version);
printf("test.update_version = %s\n",test.update_version);
char** name = kdk_system_get_resolving_power();
// printf("name = %s\n", name);
size_t count = 0;
while (name[count])
{
printf("No. %d\t %s\n", count + 1, name[count]);
count ++;
}
kdk_resolving_freeall(name);
char *ver = kdk_system_get_systemCategory();
printf("系统硬件版本类别 = %s\n", ver);
free(ver);
// ver = kdk_system_get_cloudPlatformType();
// printf("云平台类型 = %s\n", ver);
// free(ver);
char **ud_time = kdk_system_get_startup_time();
count = 0;
while (ud_time[count])
{
printf("开机时间 = %s\n", ud_time[count]);
count++;
}
kdk_resolving_freeall(ud_time);
ud_time = kdk_system_get_shutdown_time();
count = 0;
while (ud_time[count])
{
printf("关机时间 = %s\n", ud_time[count]);
count++;
}
kdk_resolving_freeall(ud_time);
res = kdk_get_host_vendor();
printf("整机制造商 = %s\n", res);
free(res);
res = kdk_get_host_product();
printf("整机型号 = %s\n", res);
free(res);
res = kdk_get_host_serial();
printf("整机序列号 = %s\n", res);
free(res);
res = kdk_system_get_buildTime();
printf("构建时间:%s\n", res);
free(res);
res = kdk_system_get_hostName();
printf("主机名:%s\n", res);
free(res);
printf("系统位数:%d\n", kdk_system_get_word());
struct KPci *pci = kdk_hw_get_pci_info();
struct KPci *tmp = pci;
while (tmp)
{
printf("slot path : %s\n", tmp->slot_path);
printf("\tclass name :%s\n", tmp->class_name);
printf("\tproduct name :%s\n", tmp->product_name);
printf("\trev :%02x\n", tmp->rev);
printf("\tsubsystem name :%s\n", tmp->ss_name);
printf("\tdriver user :%s\n", tmp->driver_use);
printf("\tmodules :");
for(int i = 0; i < tmp->module_count; i++)
{
printf("\t%s", tmp->modules[i]);
}
printf("\n");
tmp = tmp->next;
}
kdk_hw_free_pci_info(pci);
res = kdk_system_get_appScene();
printf("应用场景:%s\n", res);
free(res);
return 0;
}
.SH "CONFORMING TO"
These functions are as per the withdrawn POSIX.1e draft specification.
The following functions are Linux extensions:
.BR kdk_system_get_systemName (),
.BR kdk_system_get_architecture (),
.BR kdk_system_get_activationStatus (),
.BR kdk_system_get_version (),
.BR kdk_system_get_serialNumber (),
.BR kdk_system_get_kernelVersion (),
.BR kdk_system_get_eUser_login_time (),
.BR kdk_system_get_projectName (),
.BR kdk_system_get_projectSubName (),
.BR kdk_system_get_productFeatures (),
.BR kdk_system_get_hostVirtType (),
.BR kdk_system_get_hostCloudPlatform (),
.BR kdk_system_is_zyj (),
.BR kdk_system_get_version_detaile (),
.BR kdk_system_get_resolving_power (),
.BR kdk_system_get_systemCategory (),
.BR kdk_system_get_startup_time (),
.BR kdk_system_get_shutdown_time (),
.BR kdk_get_host_vendor (),
.BR kdk_get_host_product (),
.BR kdk_get_host_serial (),
.BR kdk_system_get_hostName (),
.BR kdk_system_get_word (),
.BR kdk_system_get_buildTime (),
.BR kdk_resolving_freeall (),
.BR kdk_hw_get_pci_info (),
.BR kdk_hw_free_pci_info (),
and
.BR kdk_system_get_appScene ().
.SH "SEE ALSO"
.BR kdk_system_get_systemName (3),
.BR kdk_system_get_architecture (3),
.BR kdk_system_get_version (3),
.BR kdk_system_get_activationStatus (3),
.BR kdk_system_get_serialNumber (3),
.BR kdk_system_get_kernelVersion (3),
.BR kdk_system_get_eUser_login_time (3),
.BR kdk_system_get_projectName (3),
.BR kdk_system_get_projectSubName (3),
.BR kdk_system_get_productFeatures (3),
.BR kdk_system_get_hostVirtType (3),
.BR kdk_system_get_hostCloudPlatform (3),
.BR kdk_system_is_zyj (3),
.BR kdk_system_get_version_detaile (3),
.BR kdk_system_get_resolving_power (3),
.BR kdk_system_get_systemCategory (3),
.BR kdk_system_get_startup_time (3),
.BR kdk_system_get_shutdown_time (3),
.BR kdk_get_host_vendor (3),
.BR kdk_get_host_product (3),
.BR kdk_get_host_serial (3),
.BR kdk_system_get_hostName (3),
.BR kdk_system_get_word (3),
.BR kdk_system_get_buildTime (3),
.BR kdk_resolving_freeall (3),
.BR kdk_hw_get_pci_info (3),
.BR kdk_hw_free_pci_info (3),
and
.BR kdk_system_get_appScene (3).