[新增] 增加kdk_system_get_eUser:获取当前Effect UserName
[修改] 修改所有CMakeList规则文件,将各动态库所需的link so直接链接到对应的动态库上
This commit is contained in:
parent
83d3ba2c68
commit
b341bbb80a
|
@ -8,6 +8,7 @@ pkg_check_modules(PKGS REQUIRED
|
|||
dbus-1
|
||||
glib-2.0
|
||||
dbus-glib-1
|
||||
udev
|
||||
)
|
||||
include_directories(${PKGS_INCLUDE_DIRS})
|
||||
include_directories("${PROJECT_BINARY_DIR}")
|
||||
|
|
|
@ -3,9 +3,11 @@ add_library(kydiskinfo SHARED ${SOURCESCODE})
|
|||
add_executable(test-getdiskinfo test/getdiskinfo.c)
|
||||
add_executable(test-getdisklist test/getdisklist.c)
|
||||
find_library(UDEV_LIB udev)
|
||||
message(${UDEV_LIB})
|
||||
target_link_libraries(test-getdiskinfo kydiskinfo blkid kylog pthread systemd kyconf ${UDEV_LIB})
|
||||
target_link_libraries(test-getdisklist kydiskinfo blkid kylog pthread systemd kyconf ${UDEV_LIB})
|
||||
target_link_libraries(kydiskinfo blkid kylog pthread systemd kyconf ${UDEV_LIB})
|
||||
target_link_libraries(test-getdiskinfo kydiskinfo)
|
||||
target_link_libraries(test-getdisklist kydiskinfo)
|
||||
# target_link_libraries(test-getdiskinfo kydiskinfo blkid kylog pthread systemd kyconf ${UDEV_LIB})
|
||||
# target_link_libraries(test-getdisklist kydiskinfo blkid kylog pthread systemd kyconf ${UDEV_LIB})
|
||||
|
||||
install(TARGETS kydiskinfo
|
||||
DESTINATION lib/kysdk/kysdk-system)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <libkylog.h>
|
||||
#include <kerr.h>
|
||||
#include <sdkmarcos.h>
|
||||
#include <cstring-extension.h>
|
||||
#include <blkid/blkid.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -6,8 +6,8 @@ find_package(Qt5Core)
|
|||
include_directories(${Qt5Core_INCLUDE_DIRS})
|
||||
add_library(kyfilewatcher SHARED ${SOURCECODE})
|
||||
add_executable(kyfilewatcher-test test/kyfilewatcher-test.cpp)
|
||||
target_link_libraries(kyfilewatcher kylog kyconf systemd pthread)
|
||||
target_link_libraries(kyfilewatcher-test kyfilewatcher kylog kyconf systemd pthread ${Qt5Core_LIBRARIES})
|
||||
target_link_libraries(kyfilewatcher kylog kyconf systemd pthread ${Qt5Core_LIBRARIES})
|
||||
target_link_libraries(kyfilewatcher-test kyfilewatcher)
|
||||
|
||||
install(TARGETS kyfilewatcher
|
||||
DESTINATION lib/kysdk/kysdk-system)
|
||||
|
|
|
@ -3,8 +3,9 @@ include_directories(.)
|
|||
add_library(kyhw SHARED ${SOURCESCODE})
|
||||
add_executable(kync-test test/kync-test.c)
|
||||
add_executable(kycpu-test test/kycpu-test.c)
|
||||
target_link_libraries(kync-test kyhw kylog kyconf pthread systemd)
|
||||
target_link_libraries(kycpu-test kyhw kylog kyconf pthread systemd)
|
||||
target_link_libraries(kyhw kylog kyconf pthread systemd)
|
||||
target_link_libraries(kync-test kyhw)
|
||||
target_link_libraries(kycpu-test kyhw)
|
||||
|
||||
install(TARGETS kyhw
|
||||
DESTINATION lib/kysdk/kysdk-system)
|
||||
|
|
|
@ -5,7 +5,9 @@ find_library(DBUS_LIB dbus-1)
|
|||
find_library(DBUS_GLIB_LIB dbus-glib-1)
|
||||
add_library(kysysinfo SHARED ${SOURCESCODE})
|
||||
add_executable(kysysinfo-test test/kysysinfo_test.c)
|
||||
target_link_libraries(kysysinfo-test kysysinfo kylin-activation kylog systemd kyconf ${GLIBC_LIB} ${DBUS_LIB} ${DBUS_GLIB_LIB})
|
||||
target_link_libraries(kysysinfo kylin-activation kylog systemd kyconf ${GLIBC_LIB} ${DBUS_LIB} ${DBUS_GLIB_LIB})
|
||||
target_link_libraries(kysysinfo-test kysysinfo)
|
||||
# target_link_libraries(kysysinfo-test kysysinfo kylin-activation kylog systemd kyconf ${GLIBC_LIB} ${DBUS_LIB} ${DBUS_GLIB_LIB})
|
||||
|
||||
install(TARGETS kysysinfo
|
||||
DESTINATION lib/kysdk/kysdk-system)
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "libkysysinfo.h"
|
||||
#include <cstring-extension.h>
|
||||
#include <libkylog.h>
|
||||
#include <dbus-1.0/dbus/dbus.h>
|
||||
#include <kysdk/kysdk-base/cstring-extension.h>
|
||||
#include <kysdk/kysdk-base/libkylog.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define KYLIN_ACTIVATION_DBUS_ADDRESS "org.freedesktop.activation"
|
||||
|
||||
|
@ -360,9 +362,13 @@ char* kdk_system_get_kernelVersion()
|
|||
return kernver;
|
||||
}
|
||||
|
||||
char* kdk_system_get_currentUser()
|
||||
char* kdk_system_get_eUser()
|
||||
{
|
||||
|
||||
char *loginName = NULL;
|
||||
#ifdef __linux__
|
||||
loginName = strdup(getpwuid(getuid())->pw_name);
|
||||
#endif
|
||||
return loginName;
|
||||
}
|
||||
|
||||
char* kdk_system_get_projectName()
|
||||
|
|
|
@ -69,11 +69,11 @@ extern char* kdk_system_get_serialNumber();
|
|||
extern char* kdk_system_get_kernelVersion();
|
||||
|
||||
/**
|
||||
* @brief 获取当前登录用户的用户名
|
||||
* @brief 获取当前登录用户的用户名(Effect User)
|
||||
*
|
||||
* @return char*
|
||||
*/
|
||||
extern char* kdk_system_get_currentUser();
|
||||
extern char* kdk_system_get_eUser();
|
||||
|
||||
/**
|
||||
* @brief 获取操作系统项目编号名
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
CFLAGS += -g -O0 --std=c11 -I../
|
||||
VPATH=../:./
|
||||
|
||||
all:systeminfo.o
|
||||
gcc -o systeminfo $(CFLAGS) kysysinfo_test.c ../systeminfo.c
|
||||
all:
|
||||
gcc -o kysysinfo_test $(CFLAGS) kysysinfo_test.c ../libkysysinfo.c
|
||||
|
||||
.PHONY:systeminfo.o
|
||||
systeminfo.o:systeminfo.c
|
||||
gcc -c -o systeminfo.o $(CFLAGS) ../systeminfo.c
|
||||
clean:
|
||||
-rm kysysinfo_test
|
|
@ -29,6 +29,13 @@ int main()
|
|||
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_projectName();
|
||||
printf("项目编号名:%s\n", res);
|
||||
free(res);
|
||||
int zyj = kdk_system_is_zyj();
|
||||
printf("专用机:%s\n", zyj == 0 ? "非专用机":"专用机");
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue