New upstream version 2.0.0.0
This commit is contained in:
parent
d310e7c576
commit
9fddb42939
|
@ -0,0 +1,174 @@
|
|||
libkysdk-base (2.0.0.0-0k0.5) v101; urgency=medium
|
||||
|
||||
* BUG号 : 171517 【安全日志】终端打开传书等应用,报错“Create log Rotate Config Failed”
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 无
|
||||
|
||||
-- tianshaoshuai <tianshaoshuai@kylinos.cn> Tue, 06 Jun 2023 15:30:08 +0800
|
||||
|
||||
libkysdk-base (2.0.0.0-0k0.4) v101; urgency=medium
|
||||
|
||||
* BUG号 : 160465【安全日志】终端打开传书等应用,报错“Argument is not boolean”解决
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 无
|
||||
|
||||
-- shaozhimin <shaozhimin@kylinos.cn> Fri, 10 Mar 2023 17:47:52 +0800
|
||||
|
||||
libkysdk-base (2.0.0.0-0k0.3) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 修改control文件
|
||||
|
||||
-- shaozhimin <shaozhimin@kylinos.cn> Thu, 09 Feb 2023 11:33:23 +0800
|
||||
|
||||
libkysdk-base (2.0.0.0-0k0.2) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 增加日志转储功能
|
||||
|
||||
-- shaozhimin <shaozhimin@kylinos.cn> Mon, 09 Jan 2023 14:58:20 +0800
|
||||
|
||||
libkysdk-base (2.0.0.0-0k0.1) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : gsettings配置
|
||||
|
||||
-- shaozhimin <shaozhimin@kylinos.cn> Fri, 23 Dec 2022 15:30:25 +0800
|
||||
|
||||
libkysdk-base (1.2.0.7-0k0.1) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 修改control文件中dev包的架构为all
|
||||
|
||||
-- shaozhimin <shaozhimin@kylinos.cn> Thu, 24 Nov 2022 16:34:04 +0800
|
||||
|
||||
libkysdk-base (1.2.0.8) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 修改control文件中dev包的架构为all
|
||||
|
||||
-- shaozhimin <shaozhimin@kylinos.cn> Thu, 03 Nov 2022 15:07:03 +0800
|
||||
|
||||
libkysdk-base (1.2.0.7) v101; urgency=medium
|
||||
|
||||
* BUG号 : 144824 【看图】图片详情页大小单位显示为M,应统一为10^3进制的MB
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 无
|
||||
|
||||
-- shaozhimin <shaozhimin@kylinos.cn> Tue, 25 Oct 2022 16:15:46 +0800
|
||||
|
||||
libkysdk-base (1.2.0.6) v101; urgency=medium
|
||||
|
||||
* BUG号 : 138078 【HWE-Base1】【控制面板】卸载音乐和影音软件重新下载,点击控制面板-默认应用页面的恢复默认按钮后控制面板偶现闪退
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 无
|
||||
|
||||
-- jishengjie <jishengjie@kylinos.cn> Fri, 02 Sep 2022 16:59:43 +0800
|
||||
|
||||
libkysdk-base (1.2.0.5) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : control添加kylog、kyconfig版本号
|
||||
|
||||
-- liuyapeng <liuyapeng@kylinos.cn> Tue, 26 Jul 2022 09:48:22 +0800
|
||||
|
||||
libkysdk-base (1.2.0.4) v101; urgency=medium
|
||||
|
||||
* BUG号 : 124357
|
||||
* 需求号 : 无
|
||||
* 其他修改 :
|
||||
修改自测问题 libkysdk-basecommon公用数据包用于指定运行链接库
|
||||
修改自测问题 shlibs文件问题
|
||||
修改自测问题 添加libkysdk-utils安装依赖
|
||||
|
||||
-- liuyapeng <liuyapeng@kylinos.cn> Tue, 28 Jun 2022 15:21:36 +0800
|
||||
|
||||
libkysdk-base (1.2.0.3) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 修改其他包引用kylog,编译报错的问题
|
||||
|
||||
-- liuyapeng <liuyapeng@kylinos.cn> Fri, 17 Jun 2022 11:46:07 +0800
|
||||
|
||||
libkysdk-base (1.2.0.2) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 解决自测bug 其他包引用kylog编译报错的问题
|
||||
|
||||
-- wangweiran <wangweiran@kylinos.cn> Fri, 17 Jun 2022 09:35:33 +0800
|
||||
|
||||
libkysdk-base (1.2.0.1) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : 修改utils下的cmake文件
|
||||
|
||||
-- wangweiran <wangweiran@kylinos.cn> Tue, 07 Jun 2022 17:09:54 +0800
|
||||
|
||||
libkysdk-base (1.2.0kylin1) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他修改 : kysdk v1.2版本发布
|
||||
|
||||
-- wangweiran <wangweiran@kylinos.cn> Wed, 18 May 2022 11:09:10 +0800
|
||||
|
||||
libkysdk-base (1.1.1kylin1) ultron; urgency=medium
|
||||
|
||||
* BUG号 : 119832
|
||||
* 需求号 : 无
|
||||
* 其他修改 :
|
||||
* publish for v1.1 update
|
||||
|
||||
-- liuyunhe <liuyunhe@kylinos.cn> Tue, 17 May 2022 16:17:53 +0800
|
||||
|
||||
libkysdk-base (1.1.0kylin1) v101; urgency=medium
|
||||
|
||||
* BUG号 : 无
|
||||
* 需求号 : 无
|
||||
* 其他改动 : kysdk v1.1版本发布
|
||||
|
||||
-- liuyang <liuyang@kylinos.cn> Thu, 05 May 2022 10:27:53 +0800
|
||||
|
||||
libkysdk-base (1.0.0kylin6-0k0) v101; urgency=medium
|
||||
|
||||
* 修改为quilt格式
|
||||
|
||||
-- Xie Wei <xiewei@kylinos.cn> Mon, 06 Jun 2022 14:17:54 +0800
|
||||
|
||||
libkysdk-base (1.0.0kylin6) v101; urgency=medium
|
||||
|
||||
*Bug号:103155
|
||||
*需求号:无
|
||||
*其他修改:
|
||||
1、解决停止定时器时文件描述符关闭异常的问题
|
||||
|
||||
-- chenzhikai <chenzhikai@kylinos.cn> Fri, 14 Jan 2022 09:37:11 +0800
|
||||
|
||||
libkysdk-base (1.0.0kylin5) v101; urgency=medium
|
||||
|
||||
*Bug号:90497
|
||||
*需求号:无
|
||||
*其他修改:
|
||||
1、修改了调用strlastof函数进入死循环的问题
|
||||
2、支持C++调用函数接口
|
||||
3、解决安装脚本换行问题
|
||||
4、处理kysdk-timer依赖关系
|
||||
|
||||
-- chenzhikai <chenzhikai@kylinos.cn> Thu, 02 Dec 2021 16:35:50 +0800
|
||||
|
||||
libkysdk-base (1.0.0kylin3) v101; urgency=medium
|
||||
|
||||
*Bug号:无
|
||||
*需求号:8996
|
||||
*其他修改:KYSDK 1.0.0 release
|
||||
|
||||
-- liuyunhe <liuyunhe@kylinos.cn> Fri, 05 Nov 2021 15:40:55 +0800
|
|
@ -0,0 +1,154 @@
|
|||
Source: libkysdk-base
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: kylin <chenzhikai@kylinos.cn>
|
||||
Build-Depends: debhelper-compat (= 12),
|
||||
libc6-dev,
|
||||
cmake,
|
||||
libsystemd-dev,
|
||||
libdbus-1-dev,
|
||||
libssl-dev,
|
||||
libgtk-3-dev,
|
||||
libglib2.0-dev
|
||||
Standards-Version: 4.4.1
|
||||
Homepage: http://gitlab2.kylin.com/kysdk/kysdk-base
|
||||
|
||||
Package: libkysdk-base
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-timer (= ${binary:Version}),
|
||||
libkysdk-log (= ${binary:Version}),
|
||||
libkysdk-config (= ${binary:Version}),
|
||||
libkysdk-utils (= ${binary:Version}),
|
||||
libkysdk-basecommon(= ${binary:Version}),
|
||||
libkysdk-gsetting(= ${binary:Version})
|
||||
Multi-Arch: same
|
||||
Description: 麒麟开发者套件 - 基础层套件,提供日志管理、消息通信、进程守护、线程管理、定时器、调试与埋点、配置文件、utils
|
||||
|
||||
Package: libkysdk-base-dev
|
||||
Architecture: all
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-base(= ${binary:Version}),
|
||||
libkysdk-timer-dev(= ${binary:Version}),
|
||||
libkysdk-log-dev(= ${binary:Version}),
|
||||
libkysdk-config-dev(= ${binary:Version}),
|
||||
libkysdk-utils-dev(= ${binary:Version}),
|
||||
libkysdk-gsetting-dev(= ${binary:Version})
|
||||
Multi-Arch: foreign
|
||||
Description: 麒麟开发者套件 - 基础层套件 - 开发库,提供日志管理、消息通信、进程守护、线程管理、定时器、调试与埋点、配置文件、utils
|
||||
|
||||
Package: libkysdk-timer
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends} ,
|
||||
libkysdk-basecommon,
|
||||
libkysdk-utils
|
||||
Multi-Arch: same
|
||||
Description: 定制器模块库
|
||||
|
||||
Package: libkysdk-timer-dev
|
||||
Architecture: all
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-utils-dev,
|
||||
libkysdk-timer,
|
||||
libkysdk-basecommon
|
||||
Multi-Arch: foreign
|
||||
Description: 定时器模块 - 开发库
|
||||
|
||||
Package: libkysdk-log
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-config,
|
||||
logrotate,
|
||||
libkysdk-basecommon,
|
||||
libkysdk-utils,
|
||||
dbus
|
||||
Multi-Arch: same
|
||||
Description: 日志库
|
||||
|
||||
Package: libkysdk-basecommon
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Multi-Arch: same
|
||||
Description: kysdk-base层公用数据包
|
||||
|
||||
Package: libkysdk-log-dev
|
||||
Architecture: all
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-log,
|
||||
libkysdk-config-dev,
|
||||
libkysdk-utils-dev,
|
||||
libsystemd-dev
|
||||
Multi-Arch: foreign
|
||||
Description: 日志库 - 开发库
|
||||
|
||||
Package: libkysdk-config
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-basecommon,
|
||||
libkysdk-utils
|
||||
Multi-Arch: same
|
||||
Description: 配置文件库
|
||||
|
||||
Package: libkysdk-config-dev
|
||||
Architecture: all
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-utils-dev,
|
||||
libkysdk-config
|
||||
Multi-Arch: foreign
|
||||
Description: 配置文件库 - 开发库
|
||||
|
||||
Package: libkysdk-utils
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-basecommon
|
||||
Multi-Arch: same
|
||||
Description: 开发者utils
|
||||
|
||||
Package: libkysdk-utils-dev
|
||||
Architecture: all
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-utils
|
||||
Multi-Arch: foreign
|
||||
Description: 开发者utils - 开发库
|
||||
|
||||
Package: libkysdk-gsetting
|
||||
Architecture: any
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libgtk-3-0,
|
||||
libglib2.0-0,
|
||||
libkysdk-basecommon
|
||||
Multi-Arch: same
|
||||
Description: 开发者gsetting
|
||||
|
||||
Package: libkysdk-gsetting-dev
|
||||
Architecture: all
|
||||
Section: utils
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libkysdk-gsetting
|
||||
Multi-Arch: foreign
|
||||
Description: 开发者gsetting - 开发库
|
|
@ -0,0 +1,43 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: kysdk-base
|
||||
Upstream-Contact: <preferred name and address to reach the upstream project>
|
||||
Source: <url://example.com>
|
||||
|
||||
Files: *
|
||||
Copyright: <years> <put author's name and email here>
|
||||
<years> <likewise for another author>
|
||||
License: <special license>
|
||||
<Put the license of the package here indented by 1 space>
|
||||
<This follows the format of Description: lines in control file>
|
||||
.
|
||||
<Including paragraphs>
|
||||
|
||||
# If you want to use GPL v2 or later for the /debian/* files use
|
||||
# the following clauses, or change it to suit. Delete these two lines
|
||||
Files: debian/*
|
||||
Copyright: 2021 kylin <chenzhikai@kylinos.cn>
|
||||
License: GPL-2+
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
||||
|
||||
# Please also look if there are files or directories which have a
|
||||
# different copyright/license attached and list them here.
|
||||
# Please avoid picking licenses with terms that are more restrictive than the
|
||||
# packaged work, as it may make Debian's contributions unacceptable upstream.
|
||||
#
|
||||
# If you need, there are some extra license texts available in two places:
|
||||
# /usr/share/debhelper/dh_make/licenses/
|
||||
# /usr/share/common-licenses/
|
|
@ -0,0 +1 @@
|
|||
development-files/kysdk-base.pc usr/share/pkgconfig/
|
|
@ -0,0 +1 @@
|
|||
development-files/kysdk-base.conf etc/ld.so.conf.d
|
|
@ -0,0 +1,2 @@
|
|||
src/config/libkyconf.h usr/include/kysdk/kysdk-base
|
||||
development-files/kysdk-config.pc usr/share/pkgconfig/
|
|
@ -0,0 +1 @@
|
|||
usr/lib/kysdk/kysdk-base/libkyconf.so*
|
|
@ -0,0 +1,2 @@
|
|||
src/gsettings/libkygsetting.h usr/include/kysdk/kysdk-base
|
||||
development-files/kysdk-gsetting.pc usr/share/pkgconfig/
|
|
@ -0,0 +1 @@
|
|||
usr/lib/kysdk/kysdk-base/libkygsetting.so*
|
|
@ -0,0 +1,2 @@
|
|||
src/log/libkylog.h usr/include/kysdk/kysdk-base
|
||||
development-files/kysdk-log.pc usr/share/pkgconfig/
|
|
@ -0,0 +1,4 @@
|
|||
usr/lib/kysdk/kysdk-base/libkylog.so*
|
||||
src/log/kylog-default.conf etc/kysdk/kysdk-base
|
||||
src/log/kylog-rotate-default etc/kysdk/kysdk-base
|
||||
src/log/logrotate.cron etc/kysdk/kysdk-base
|
|
@ -0,0 +1,2 @@
|
|||
src/timer/libkytimer.h usr/include/kysdk/kysdk-base
|
||||
development-files/kysdk-timer.pc usr/share/pkgconfig/
|
|
@ -0,0 +1 @@
|
|||
usr/lib/kysdk/kysdk-base/libkytimer.so*
|
|
@ -0,0 +1,7 @@
|
|||
src/utils/sdkmarcos.h usr/include/kysdk/kysdk-base
|
||||
src/utils/kerr.h usr/include/kysdk/kysdk-base
|
||||
src/utils/cstring-extension.h usr/include/kysdk/kysdk-base
|
||||
src/utils/kyutils.h usr/include/kysdk/kysdk-base
|
||||
src/utils/data-structure/linklist/skip_linklist/skip_linklist.h usr/include/kysdk/kysdk-base
|
||||
src/utils/data-structure/linklist/listdata.h usr/include/kysdk/kysdk-base
|
||||
development-files/kysdk-utils.pc usr/share/pkgconfig/
|
|
@ -0,0 +1,2 @@
|
|||
usr/lib/kysdk/kysdk-base/libkydatastruct.so*
|
||||
usr/lib/kysdk/kysdk-base/libkyutils.so*
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/make -f
|
||||
# See debhelper(7) (uncomment to enable)
|
||||
# output every command that modifies files on the build system.
|
||||
#export DH_VERBOSE = 1
|
||||
|
||||
|
||||
# see FEATURE AREAS in dpkg-buildflags(1)
|
||||
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
# see ENVIRONMENT in dpkg-buildflags(1)
|
||||
# package maintainers to append CFLAGS
|
||||
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
|
||||
# package maintainers to append LDFLAGS
|
||||
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
|
||||
# dh_make generated override targets
|
||||
# This is example for Cmake (See https://bugs.debian.org/641051 )
|
||||
#override_dh_auto_configure:
|
||||
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
|
||||
|
|
@ -0,0 +1 @@
|
|||
3.0 (native)
|
|
@ -1,6 +1,6 @@
|
|||
base_version=1.2.0
|
||||
base_version=2.0.0
|
||||
|
||||
Name: libkysdk-base
|
||||
Description: kysdk base layer
|
||||
Requires: kysdk-log >= ${base_version} kysdk-config >= ${base_version} kysdk-timer >= ${base_version} kysdk-utils >= ${base_version}
|
||||
Version: 1.2.0
|
||||
Version: 2.0.0
|
|
@ -1,8 +1,8 @@
|
|||
base_version=1.2.0
|
||||
base_version=2.0.0
|
||||
|
||||
Name: libkysdk-config
|
||||
Description: kysdk base layer config component
|
||||
Requires: kysdk-utils
|
||||
Version: 1.2.0
|
||||
Version: 2.0.0
|
||||
Cflags: -I/usr/include/kysdk/kysdk-base/
|
||||
Libs: -L/usr/lib/kysdk/kysdk-base/ -lkyconf -Wl,-rpath=/usr/lib/kysdk/kysdk-base/
|
|
@ -0,0 +1,6 @@
|
|||
Name: libkysdk-gsetting
|
||||
Description: kysdk base layer gsettings component
|
||||
Requires: gtk+-3.0 glib-2.0
|
||||
Version: 2.0.0
|
||||
Libs: -L/usr/lib/kysdk/kysdk-base/ -lkygsetting -Wl,-rpath=/usr/lib/kysdk/kysdk-base/
|
||||
Cflags: -I/usr/include/kysdk/kysdk-base/
|
|
@ -1,8 +1,8 @@
|
|||
base_version=1.2.0
|
||||
base_version=2.0.0
|
||||
|
||||
Name: libkysdk-log
|
||||
Description: kysdk base layer log component
|
||||
Requires: kysdk-config kysdk-utils libsystemd
|
||||
Version: 1.2.0
|
||||
Version: 2.0.0
|
||||
Cflags: -I/usr/include/kysdk/kysdk-base/
|
||||
Libs: -L/usr/lib/kysdk/kysdk-base/ -lkylog -Wl,-rpath=/usr/lib/kysdk/kysdk-base/
|
|
@ -1,6 +1,6 @@
|
|||
Name: libkysdk-timer
|
||||
Description: kysdk base layer time component
|
||||
Requires: kysdk-utils
|
||||
Version: 1.2.0
|
||||
Version: 2.0.0
|
||||
Cflags: -I/usr/include/kysdk/kysdk-base/
|
||||
Libs: -L/usr/lib/kysdk/kysdk-base/ -lkytimer -Wl,-rpath=/usr/lib/kysdk/kysdk-base/
|
|
@ -1,5 +1,5 @@
|
|||
Name: libkysdk-utils
|
||||
Description: kysdk base layer utils component
|
||||
Version: 1.2.0
|
||||
Version: 2.0.0
|
||||
Cflags:-I/usr/include/kysdk/kysdk-base/
|
||||
Libs: -L/usr/lib/kysdk/kysdk-base/ -lkydatastruct -lkyutils -Wl,-rpath=/usr/lib/kysdk/kysdk-base/
|
|
@ -2,6 +2,7 @@ include_directories(config)
|
|||
include_directories(utils)
|
||||
include_directories(log)
|
||||
include_directories(timer)
|
||||
include_directories(gsettings)
|
||||
|
||||
# add_subdirectory(communication)
|
||||
add_subdirectory(config)
|
||||
|
@ -11,4 +12,5 @@ add_subdirectory(log)
|
|||
# add_subdirectory(thread)
|
||||
add_subdirectory(timer)
|
||||
add_subdirectory(utils)
|
||||
#add_subdirectory(diagnostics)
|
||||
# add_subdirectory(diagnostics)
|
||||
add_subdirectory(gsettings)
|
|
@ -1,6 +1,6 @@
|
|||
aux_source_directory(. SOURCESCODE)
|
||||
add_library(kyconf SHARED ${SOURCESCODE})
|
||||
set_target_properties(kyconf PROPERTIES VERSION 1.2.0 SOVERSION 1)
|
||||
set_target_properties(kyconf PROPERTIES VERSION 2.0.0 SOVERSION 1)
|
||||
add_executable(kyconf-test-struct test/test_structlist.c)
|
||||
target_link_libraries(kyconf-test-struct kyconf kylog pthread)
|
||||
|
||||
|
|
|
@ -210,6 +210,7 @@ int kdk_conf_reload(int id)
|
|||
|
||||
if (S_parseFile(data, conf->confpath))
|
||||
{
|
||||
free(data);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -329,4 +330,17 @@ char** const kdk_conf_list_group(int id)
|
|||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
inline void kdk_config_freeall(char **list)
|
||||
{
|
||||
if (! list)
|
||||
return;
|
||||
size_t index = 0;
|
||||
while (list[index])
|
||||
{
|
||||
free(list[index]);
|
||||
index ++;
|
||||
}
|
||||
free(list);
|
||||
}
|
|
@ -103,6 +103,13 @@ extern char** const kdk_conf_list_key(int id, const char* group);
|
|||
*/
|
||||
extern char** const kdk_conf_list_group(int id);
|
||||
|
||||
/**
|
||||
* @brief 用于回收字符串列表
|
||||
*
|
||||
* @param ptr 字符串列表
|
||||
*/
|
||||
extern inline void kdk_config_freeall(char **ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,7 @@ static KconfigureDataNode* append_group(structParse *parse, const char *group)
|
|||
parse->content.groupList = newGroupList;
|
||||
}
|
||||
KconfigureDataNode *groupnode = (KconfigureDataNode *)calloc(1, sizeof(KconfigureDataNode));
|
||||
if (!group)
|
||||
if (!groupnode)
|
||||
return NULL;
|
||||
|
||||
groupnode->nodeType = KconfigureNodeGroup;
|
||||
|
@ -101,7 +101,7 @@ static int parseFile(structParse *parse, const char *filepath)
|
|||
ASSERT_NOT_NULL(cfp, -1);
|
||||
|
||||
KconfigureDataNode *cur_group_node = NULL;
|
||||
|
||||
char *tmp_buf = NULL;
|
||||
char buf[LINEMAX];
|
||||
while (feof(cfp) == 0)
|
||||
{
|
||||
|
@ -124,12 +124,13 @@ static int parseFile(structParse *parse, const char *filepath)
|
|||
// Group
|
||||
if (strstartswith(buf, "[") == 0 && strendwith(buf, "]") == 0)
|
||||
{
|
||||
|
||||
cur_group_node = append_group(parse, strndup(&buf[1], strlen(buf) - 2));
|
||||
tmp_buf = strndup(&buf[1], strlen(buf) - 2);
|
||||
cur_group_node = append_group(parse, tmp_buf);
|
||||
if (!cur_group_node)
|
||||
{
|
||||
// err output
|
||||
fclose(cfp);
|
||||
free(tmp_buf);
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
|
@ -163,12 +164,23 @@ static int parseFile(structParse *parse, const char *filepath)
|
|||
{
|
||||
// OOM
|
||||
fclose(cfp);
|
||||
free(cur_group_node);
|
||||
free(tmp_buf);
|
||||
return -1;
|
||||
}
|
||||
strcpy(defaultnode, "KDK_DefaultGroup");
|
||||
|
||||
cur_group_node = append_group(parse, defaultnode);
|
||||
groupnode = cur_group_node;
|
||||
if(!cur_group_node)
|
||||
{
|
||||
fclose(cfp);
|
||||
free(tmp_buf);
|
||||
free(defaultnode);
|
||||
return -1;
|
||||
}
|
||||
else{
|
||||
groupnode = cur_group_node;
|
||||
}
|
||||
}
|
||||
|
||||
// 多重赋值的情况
|
||||
|
@ -181,6 +193,8 @@ static int parseFile(structParse *parse, const char *filepath)
|
|||
{
|
||||
// OOM
|
||||
fclose(cfp);
|
||||
free(cur_group_node);
|
||||
free(tmp_buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -191,12 +205,23 @@ static int parseFile(structParse *parse, const char *filepath)
|
|||
// OOM
|
||||
free(keylist);
|
||||
fclose(cfp);
|
||||
free(cur_group_node);
|
||||
free(tmp_buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < multikeys; i ++)
|
||||
{
|
||||
append_key(groupnode, strdup(strskipspace(keylist[i])), strdup(i >= multivals ? "" : strskipspace(vallist[i])));
|
||||
char *strkey = strdup(strskipspace(keylist[i]));
|
||||
char *val = i >= multivals ? "" : strdup(strskipspace(vallist[i]));
|
||||
|
||||
if (strkey != NULL && val != NULL) {
|
||||
append_key(groupnode, strkey, val);
|
||||
} else {
|
||||
if (strkey != NULL) free(strkey);
|
||||
if (val != NULL) free(val);
|
||||
}
|
||||
// append_key(groupnode, strdup(strskipspace(keylist[i])), strdup(i >= multivals ? "" : strskipspace(vallist[i])));
|
||||
}
|
||||
|
||||
free(keylist);
|
||||
|
@ -204,7 +229,16 @@ static int parseFile(structParse *parse, const char *filepath)
|
|||
}
|
||||
else
|
||||
{
|
||||
append_key(groupnode, strdup(keyStr), strdup(valStr));
|
||||
char *strkey = strdup(keyStr);
|
||||
char *val = strdup(valStr);
|
||||
|
||||
if (strkey != NULL && val != NULL) {
|
||||
append_key(groupnode, strkey, val);
|
||||
} else {
|
||||
if (strkey != NULL) free(strkey);
|
||||
if (val != NULL) free(val);
|
||||
}
|
||||
// append_key(groupnode, strdup(keyStr), strdup(valStr));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
char **keylist = NULL;
|
||||
int id = kdk_conf_init("struct.conf");
|
||||
ASSERT_NOT_NULL(id, -1);
|
||||
|
||||
|
@ -15,7 +16,7 @@ int main()
|
|||
while ((tmpgroup = grouplist[index]))
|
||||
{
|
||||
printf("Group: %s\n", tmpgroup);
|
||||
char **keylist = kdk_conf_list_key(id, tmpgroup);
|
||||
keylist = kdk_conf_list_key(id, tmpgroup);
|
||||
ASSERT_NOT_NULL(keylist, -1);
|
||||
char *tmpkey;
|
||||
int k_index = 0;
|
||||
|
@ -25,11 +26,13 @@ int main()
|
|||
printf("%s = %s\n", tmpkey , tmpval);
|
||||
k_index ++;
|
||||
}
|
||||
kdk_config_freeall(keylist);
|
||||
|
||||
index ++;
|
||||
}
|
||||
|
||||
kdk_conf_destroy(id);
|
||||
kdk_config_freeall(grouplist);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
aux_source_directory(. SOURCESCODE)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0 glib-2.0)
|
||||
include_directories(${GTK3_INCLUDE_DIRS})
|
||||
|
||||
link_directories(${GTK3_LIBRARY_DIRS})
|
||||
add_definitions(${GTK3_CFLAGS_OTHER})
|
||||
|
||||
add_library(kygsetting SHARED ${SOURCESCODE})
|
||||
set_target_properties(kygsetting PROPERTIES VERSION 2.0.0 SOVERSION 1)
|
||||
|
||||
add_executable(test-kygsetting test/test-gsetting.c)
|
||||
target_link_libraries(kygsetting ${GTK3_LIBRARIES})
|
||||
target_link_libraries(test-kygsetting kygsetting)
|
||||
|
||||
install(TARGETS kygsetting
|
||||
DESTINATION lib/kysdk/kysdk-base)
|
||||
|
||||
install(FILES libkygsetting.h
|
||||
DESTINATION include/kysdk/kysdk-base)
|
|
@ -0,0 +1,249 @@
|
|||
#include "libkygsetting.h"
|
||||
#include <stdio.h>
|
||||
#include <gio/gio.h>
|
||||
#include <gio/gsettings.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib-object.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
gboolean schema_key_is_exist(char *schema_id, char *name)
|
||||
{
|
||||
gboolean ret;
|
||||
GSettingsSchema *schema;
|
||||
|
||||
if(schema_id == NULL || name == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
schema = g_settings_schema_source_lookup(g_settings_schema_source_get_default(),schema_id, FALSE);
|
||||
if (schema == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = g_settings_schema_has_key (schema, name);
|
||||
if(!ret) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
int kdk_gsettings_set(const char *schema_id, const char *key, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
GSettings *settings;
|
||||
GVariant *value;
|
||||
va_list ap;
|
||||
if(schema_id == NULL || key == NULL || format == NULL) {
|
||||
printf("incorrect input");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return 0;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
va_start(ap, format);
|
||||
|
||||
if (strstr(format, "as"))
|
||||
{
|
||||
char **variant;
|
||||
GArray *as;
|
||||
|
||||
variant = va_arg(ap, char **);
|
||||
va_end(ap);
|
||||
|
||||
as = g_array_new(TRUE, TRUE, sizeof(char **));
|
||||
int i = 0;
|
||||
for (i; variant[i]; i++)
|
||||
{
|
||||
}
|
||||
variant[i - 1] = NULL;
|
||||
for (int j = 0; variant[j]; j++)
|
||||
{
|
||||
g_array_append_val(as, variant[j]);
|
||||
}
|
||||
|
||||
ret = g_settings_set_strv(settings, key, (const char **)as->data);
|
||||
g_array_free(as, TRUE);
|
||||
}
|
||||
else if (strstr(format, "ai"))
|
||||
{
|
||||
GVariantBuilder *builder = NULL;
|
||||
GVariant *variant;
|
||||
|
||||
int *res;
|
||||
res = va_arg(ap, int *);
|
||||
size_t size = va_arg(ap, size_t);
|
||||
|
||||
variant = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, res, size, sizeof(res[0]));
|
||||
va_end(ap);
|
||||
|
||||
ret = g_settings_set_value(settings, key, variant);
|
||||
}
|
||||
else if (strstr(format, "ad"))
|
||||
{
|
||||
GVariant *variant;
|
||||
|
||||
double *res;
|
||||
res = va_arg(ap, double*);
|
||||
|
||||
int size = va_arg(ap, int);
|
||||
variant = g_variant_new_fixed_array(G_VARIANT_TYPE_DOUBLE, res, size, sizeof(res[0]));
|
||||
va_end(ap);
|
||||
|
||||
ret = g_settings_set_value(settings, key, variant);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = g_variant_new_va(format, NULL, &ap);
|
||||
va_end(ap);
|
||||
|
||||
ret = g_settings_set_value(settings, key, g_steal_pointer(&value));
|
||||
}
|
||||
|
||||
g_settings_sync();
|
||||
g_object_unref(settings);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int kdk_settings_reset(const char *schema_id, const char *key)
|
||||
{
|
||||
GSettings *settings;
|
||||
if(schema_id == NULL || key == NULL) {
|
||||
printf("incorrect input");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return 0;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
g_settings_reset(settings, key);
|
||||
g_settings_sync();
|
||||
g_object_unref(settings);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int kdk_settings_set_string(const char *schema_id, const char *key, const char *value)
|
||||
{
|
||||
GSettings *settings;
|
||||
if(schema_id == NULL || key == NULL || value == NULL) {
|
||||
printf("incorrect input");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return 0;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
g_settings_set_string(settings, key, value);
|
||||
g_settings_sync();
|
||||
g_object_unref(settings);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kdk_settings_set_int(const char *schema_id, const char *key, int value)
|
||||
{
|
||||
GSettings *settings;
|
||||
if(schema_id == NULL || key == NULL || value == NULL) {
|
||||
printf("incorrect input");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return 0;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
g_settings_set_int(settings, key, value);
|
||||
g_settings_sync();
|
||||
g_object_unref(settings);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *kdk_gsettings_get(const char *schema_id, const char *key, const char *format, ...)
|
||||
{
|
||||
GSettings *settings;
|
||||
GVariant *value;
|
||||
va_list ap;
|
||||
|
||||
if(schema_id == NULL || key == NULL || format == NULL) {
|
||||
printf("incorrect input");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
|
||||
value = g_settings_get_value(settings, key);
|
||||
|
||||
va_start(ap, format);
|
||||
g_variant_get_va(value, format, NULL, &ap);
|
||||
va_end(ap);
|
||||
|
||||
g_variant_unref(value);
|
||||
}
|
||||
|
||||
char *kdk_settings_get_string(const char *schema_id, const char *key)
|
||||
{
|
||||
GSettings *settings;
|
||||
char *current_setting;
|
||||
if(schema_id == NULL || key == NULL) {
|
||||
printf("incorrect input");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return NULL;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
current_setting = g_settings_get_string(settings, key);
|
||||
return current_setting;
|
||||
}
|
||||
|
||||
int kdk_settings_get_int(const char *schema_id, const char *key)
|
||||
{
|
||||
GSettings *settings;
|
||||
int current_setting;
|
||||
if(schema_id == NULL || key == NULL) {
|
||||
printf("incorrect input");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return 0;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
current_setting = g_settings_get_int(settings, key);
|
||||
return current_setting;
|
||||
}
|
||||
|
||||
double kdk_settings_get_double(const char *schema_id, const char *key)
|
||||
{
|
||||
GSettings *settings;
|
||||
double current_setting;
|
||||
if(schema_id == NULL || key == NULL) {
|
||||
printf("incorrect input");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!schema_key_is_exist(schema_id,key)) {
|
||||
printf("%s does not have a key named %s exist", schema_id, key);
|
||||
return 0;
|
||||
}
|
||||
settings = g_settings_new(schema_id);
|
||||
current_setting = g_settings_get_double(settings, key);
|
||||
return current_setting;
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
#ifndef KYSDK_BASE_GSETTINGS_H__
|
||||
#define KYSDK_BASE_GSETTINGS_H__
|
||||
|
||||
|
||||
/** @defgroup Gsettings
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file libkygseetings.h
|
||||
* @author zhouhuazhi (zhouhuazhi@kylinos.cn)
|
||||
* @brief KYSDK C语言Gsettings模块
|
||||
* @version 0.1
|
||||
* @date 2022-10-18
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @brief 设置gesettings指定key值
|
||||
*
|
||||
* @return int 成功返回1
|
||||
*/
|
||||
extern int kdk_gsettings_set(const char *schema_id, const char *key, const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief 重置gesettings指定key值
|
||||
*
|
||||
* @return int 成功返回0
|
||||
*/
|
||||
extern int kdk_settings_reset(const char *schema_id, const char *key);
|
||||
|
||||
/**
|
||||
* @brief 设置gesettings指定string类型key值
|
||||
*
|
||||
* @return int 成功返回0
|
||||
*/
|
||||
extern int kdk_settings_set_string(const char *schema_id, const char *key, const char *value);
|
||||
|
||||
/**
|
||||
* @brief 设置gesettings指定int类型key值
|
||||
*
|
||||
* @return int 成功返回0
|
||||
*/
|
||||
extern int kdk_settings_set_int(const char *schema_id, const char *key, int value);
|
||||
|
||||
/**
|
||||
* @brief 获取gesettings指定key值
|
||||
*
|
||||
* @return GVariant key的值
|
||||
*/
|
||||
void* kdk_gsettings_get(const char *schema_id, const char *key, const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief 获取gesettings指定string类型key值
|
||||
*
|
||||
* @return char* key的值
|
||||
*/
|
||||
extern char* kdk_settings_get_string(const char *schema_id, const char *key);
|
||||
|
||||
/**
|
||||
* @brief 获取gesettings指定int类型key值
|
||||
*
|
||||
* @return int key的值
|
||||
*/
|
||||
extern int kdk_settings_get_int(const char *schema_id, const char *key);
|
||||
|
||||
/**
|
||||
* @brief 获取gesettings指定double类型key值
|
||||
*
|
||||
* @return int key的值
|
||||
*/
|
||||
extern double kdk_settings_get_double(const char *schema_id, const char *key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //KYSDK_BASE_GSETTINGS_H__
|
|
@ -0,0 +1,5 @@
|
|||
all:
|
||||
gcc -g -O0 -o test-gsetting test-gsetting.c
|
||||
|
||||
clean:
|
||||
rm demo
|
|
@ -0,0 +1,39 @@
|
|||
#include "../libkygsetting.h"
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int ret = kdk_settings_reset("org.gnome.evolution-data-server.calendar", "notify-custom-snooze-minutes");
|
||||
|
||||
double a[] = {0.0,2.0};
|
||||
size_t s = 2;
|
||||
// double **s = a;
|
||||
|
||||
ret = kdk_gsettings_set("org.onboard.window", "docking-aspect-change-range", "ad", a, s); //当类型为数组时,请输入数组大小,size_t
|
||||
printf("%d\n", ret);
|
||||
ret = kdk_settings_set_string("org.gnome.evolution", "version", "3.36.1");
|
||||
ret = kdk_settings_set_int("org.ukui.audio", "output-volume", 67);
|
||||
char* res = kdk_settings_get_string("org.gnome.evolution", "version");
|
||||
printf("res = %s\n", res);
|
||||
|
||||
int key = kdk_settings_get_int("org.ukui.audio", "output-volume");
|
||||
printf("key = %d\n", key);
|
||||
bool enabled;
|
||||
GVariantIter iter;
|
||||
kdk_gsettings_get("org.ukui.control-center.notice", "blacklist", "as", &iter);
|
||||
printf("enable = %d\n", enabled);
|
||||
// printf("value = %d\n", value);
|
||||
// for (int i = 0; value[i]; i++)
|
||||
// {
|
||||
// printf("[%d]Get disk info error.\n", value[i]);
|
||||
// }
|
||||
|
||||
double dde = kdk_settings_get_double("org.ukui.SettingsDaemon.plugins.xsettings", "scaling-factor");
|
||||
printf("dde = %0.1f\n", dde);
|
||||
return 0;
|
||||
}
|
|
@ -1,12 +1,18 @@
|
|||
aux_source_directory(. SOURCESCODE)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(DBus REQUIRED
|
||||
dbus-1)
|
||||
include_directories(${DBus_INCLUDE_DIRS})
|
||||
add_library(kylog SHARED ${SOURCESCODE})
|
||||
set_target_properties(kylog PROPERTIES VERSION 1.2.0 SOVERSION 1)
|
||||
set_target_properties(kylog PROPERTIES VERSION 2.0.0 SOVERSION 1)
|
||||
add_executable(kylog-testlog test/test-log.c)
|
||||
add_executable(kylog-testsetdir test/test-setdir.c)
|
||||
add_executable(kylog-testpressure test/test-pressure.c)
|
||||
add_executable(kylog-testautowrap test/test-autowrap.c)
|
||||
find_library(SYSTEMD_LIB systemd)
|
||||
target_link_libraries(kylog kyconf pthread ${SYSTEMD_LIB})
|
||||
find_library(DBUS_LIB dbus-1)
|
||||
target_link_libraries(kylog kyconf pthread ${SYSTEMD_LIB} ${DBUS_LIB})
|
||||
target_link_libraries(kylog-testlog kylog)
|
||||
target_link_libraries(kylog-testsetdir kylog)
|
||||
target_link_libraries(kylog-testautowrap kylog)
|
||||
|
|
|
@ -7,11 +7,98 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "dbus/dbus.h"
|
||||
|
||||
KLogger* logger;
|
||||
const char* stringLevel[8] = {"EMERG", "ALERT", "CRIT", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
|
||||
const char* stringLType[LTENUMMAX] = {"user." , "local3." , "syslog."};
|
||||
|
||||
static int _call_method(const char *path)
|
||||
{
|
||||
DBusError err;
|
||||
DBusConnection *conn;
|
||||
int ret;
|
||||
// initialise the errors
|
||||
dbus_error_init(&err);
|
||||
|
||||
// connect to the bus
|
||||
conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
|
||||
if (dbus_error_is_set(&err))
|
||||
{
|
||||
// fprintf(stderr, "Connection Error (%s)\n", err.message);
|
||||
dbus_error_free(&err);
|
||||
return -1;
|
||||
}
|
||||
if (NULL == conn)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
DBusMessage *msg;
|
||||
DBusMessageIter args;
|
||||
DBusPendingCall *pending;
|
||||
int result = 0;
|
||||
|
||||
msg = dbus_message_new_method_call("com.kysdk.base", // target for the method call
|
||||
"/com/kysdk/base/logrotate", // object to call on
|
||||
"com.kysdk.base.logrotate", // interface to call on
|
||||
"setConfig"); // method name
|
||||
if (NULL == msg)
|
||||
{
|
||||
// fprintf(stderr, "Message Null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// append arguments
|
||||
dbus_message_iter_init_append(msg, &args);
|
||||
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &path))
|
||||
{
|
||||
// fprintf(stderr, "Out Of Memory!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// send message and get a handle for a reply
|
||||
if (!dbus_connection_send_with_reply(conn, msg, &pending, -1))
|
||||
{ // -1 is default timeout
|
||||
// fprintf(stderr, "Out Of Memory!\n");
|
||||
return -1;
|
||||
}
|
||||
if (NULL == pending)
|
||||
{
|
||||
// fprintf(stderr, "Pending Call Null\n");
|
||||
return -1;
|
||||
}
|
||||
dbus_connection_flush(conn);
|
||||
|
||||
// free message
|
||||
dbus_message_unref(msg);
|
||||
|
||||
// block until we recieve a reply
|
||||
dbus_pending_call_block(pending);
|
||||
// get the reply message
|
||||
msg = dbus_pending_call_steal_reply(pending);
|
||||
if (NULL == msg)
|
||||
{
|
||||
// fprintf(stderr, "Reply Null\n");
|
||||
return -1;
|
||||
}
|
||||
// free the pending message handle
|
||||
dbus_pending_call_unref(pending);
|
||||
// read the parameters
|
||||
if (!dbus_message_iter_init(msg, &args))
|
||||
{
|
||||
// fprintf(stderr, "Message has no arguments!\n");
|
||||
return -1;
|
||||
}
|
||||
else if (DBUS_TYPE_INT32 != dbus_message_iter_get_arg_type(&args))
|
||||
{
|
||||
// fprintf(stderr, "Argument is not boolean!\n");
|
||||
return -1;
|
||||
}
|
||||
dbus_message_iter_get_basic(&args, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int _dir_exist(const char *dpath)
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -29,7 +116,9 @@ static int _create_dir(const char *dpath)
|
|||
if (!command)
|
||||
return -1;
|
||||
sprintf(command, "mkdir -p %s", dpath);
|
||||
return system(command);
|
||||
int ret = system(command);
|
||||
free(command);
|
||||
return ret;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
|
@ -224,6 +313,9 @@ int initKLogger(int cid)
|
|||
printf("无法打开日志文件%s:%s\n" , logPath, strerror(errno));
|
||||
return errno;
|
||||
}
|
||||
if (-1 == _call_method(logPath))
|
||||
;
|
||||
// printf("Create %s Rotate Config Failed", logPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -237,6 +329,9 @@ int initKLogger(int cid)
|
|||
return errno;
|
||||
}
|
||||
printf("日志记录文件:%s\n" , logPath);
|
||||
if (-1 == _call_method(logPath))
|
||||
;
|
||||
// printf("Create %s Rotate Config Failed", logPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
aux_source_directory(. SOURCESCODE)
|
||||
add_library(kytimer SHARED ${SOURCESCODE})
|
||||
set_target_properties(kytimer PROPERTIES VERSION 1.2.0 SOVERSION 1)
|
||||
set_target_properties(kytimer PROPERTIES VERSION 2.0.0 SOVERSION 1)
|
||||
add_executable(test-kytimer test/test-kytimer.c)
|
||||
target_link_libraries(kytimer pthread)
|
||||
target_link_libraries(test-kytimer kytimer)
|
||||
|
|
|
@ -164,7 +164,7 @@ static void* timerCoreThread(void* data)
|
|||
read_fds = epoll_wait(epollfd , activeEvs , KTIMER_MAXTIMERFD , -1);
|
||||
if (read_fds < 0)
|
||||
{
|
||||
printf("epoll wait error , %s\n" , strerror(errno));
|
||||
//printf("epoll wait error , %s\n" , strerror(errno));
|
||||
continue;
|
||||
}
|
||||
for (int i = 0 ; i < read_fds ; i ++)
|
||||
|
|
|
@ -31,14 +31,14 @@ int main()
|
|||
|
||||
//测试1 -- 基本功能
|
||||
size_t fdpoll[10] = {0};
|
||||
for (int i = 1 ; i <= 10 ; i ++)
|
||||
{
|
||||
char* data = (char*)malloc(10);
|
||||
assert(data);
|
||||
sprintf(data , "%d号" , i);
|
||||
fdpoll[i - 1] = kdk_timer_start(i * 1000 , (time_handler)func , KTIMER_PERIODIC , KTIMER_ABSOLUTE, (void*)data , 1);
|
||||
assert(fdpoll[i - 1]);
|
||||
}
|
||||
// for (int i = 1 ; i <= 10 ; i ++)
|
||||
// {
|
||||
// char* data = (char*)malloc(10);
|
||||
// assert(data);
|
||||
// sprintf(data , "%d号" , i);
|
||||
// fdpoll[i - 1] = kdk_timer_start(i * 1000 , (time_handler)func , KTIMER_PERIODIC , KTIMER_ABSOLUTE, (void*)data , 1);
|
||||
// assert(fdpoll[i - 1]);
|
||||
// }
|
||||
kdk_timer_start(10000 , (time_handler)stop , KTIMER_SINGLESHOT , KTIMER_ABSOLUTE, (void*)fdpoll , 0);
|
||||
sleep(11);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
aux_source_directory(. SOURCESCODE)
|
||||
add_library(kyutils SHARED ${SOURCESCODE})
|
||||
set_target_properties(kyutils PROPERTIES VERSION 1.2.0 SOVERSION 1)
|
||||
set_target_properties(kyutils PROPERTIES VERSION 2.0.0 SOVERSION 1)
|
||||
include_directories(.)
|
||||
install(TARGETS kyutils
|
||||
DESTINATION lib/kysdk/kysdk-base)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
aux_source_directory(linklist/skip_linklist SOURCESCODESTRUCT)
|
||||
add_library(kydatastruct SHARED ${SOURCESCODESTRUCT})
|
||||
set_target_properties(kydatastruct PROPERTIES VERSION 1.2.0 SOVERSION 1)
|
||||
set_target_properties(kydatastruct PROPERTIES VERSION 2.0.0 SOVERSION 1)
|
||||
add_subdirectory(linklist)
|
||||
|
||||
include_directories(linklist)
|
||||
|
|
|
@ -59,11 +59,19 @@ static int do_scale_by_power (uintmax_t *x, int base, int power)
|
|||
static int get_exp2(uint64_t n, KDKVolumeBaseType base)
|
||||
{
|
||||
int shft;
|
||||
int num;
|
||||
|
||||
if((base == KDK_KILO) || (base == KDK_MEGA) ||
|
||||
(base == KDK_GIGA) || (base == KDK_TERA)||
|
||||
(base == KDK_PETA) || (base == KDK_EXA)){
|
||||
base -= 6;
|
||||
}
|
||||
|
||||
for (shft = 10; shft <= base * 10; shft += 10) {
|
||||
if (n < (1ULL << shft))
|
||||
break;
|
||||
}
|
||||
|
||||
return shft - 10;
|
||||
}
|
||||
|
||||
|
@ -226,13 +234,18 @@ char *size_to_human_string(int options, uint64_t bytes, int base)
|
|||
c = *(letters + (exp ? exp / 10 : 0));
|
||||
dec = exp ? bytes / (1ULL << exp) : bytes;
|
||||
frac = exp ? bytes % (1ULL << exp) : 0;
|
||||
|
||||
*psuf++ = c;
|
||||
|
||||
if ((options & SIZE_SUFFIX_3LETTER) && (c != 'B')) {
|
||||
*psuf++ = 'i';
|
||||
*psuf++ = 'B';
|
||||
}
|
||||
else if (((base == KDK_KILOBYTE) || (base == KDK_MEGABYTE) ||
|
||||
(base == KDK_MEGABYTE) || (base == KDK_GIGABYTE)||
|
||||
(base == KDK_TERABYTE) || (base == KDK_PETABYTE) ||
|
||||
(base == KDK_EXABYTE)) && (c != 'B')) {
|
||||
*psuf++ = 'B';
|
||||
}
|
||||
|
||||
*psuf = '\0';
|
||||
|
||||
|
@ -287,7 +300,7 @@ int kdkVolumeBaseCharacterConvert(const char* origin_data, KDKVolumeBaseType res
|
|||
syslog(LOG_ERR, "[KYSDK:utils:%s] parse origin data failed, please contact developer, origin data = %s, errcode = %d\n", __FUNCTION__, origin_data ,ret);
|
||||
return KDK_INVAILD_DATA_FORMAT;
|
||||
}
|
||||
printf("%lu\n", basic_data);
|
||||
// printf("%lu\n", basic_data);
|
||||
char *temp;
|
||||
temp = size_to_human_string(SIZE_SUFFIX_1LETTER | SIZE_DECIMAL_2DIGITS, basic_data, result_base);
|
||||
strcpy(result_data, temp);
|
||||
|
|
|
@ -49,6 +49,12 @@ typedef enum{
|
|||
KDK_TERABYTE, /**< TB */
|
||||
KDK_PETABYTE, /**< PB */
|
||||
KDK_EXABYTE, /**< EB */
|
||||
KDK_KILO, /**< K */
|
||||
KDK_MEGA, /**< M */
|
||||
KDK_GIGA, /**< G */
|
||||
KDK_TERA, /**< T */
|
||||
KDK_PETA, /**< P */
|
||||
KDK_EXA, /**< E */
|
||||
}KDKVolumeBaseType;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue