--- /dev/null
+build_log
+*.log
+*.pyc
+usr
+opt
+*.o
+*.os
+*.exe
+packages
+binaries
+*.ipk
+*~
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
ADD_EXECUTABLE(heynotitool heynotitool.c)
-TARGET_LINK_LIBRARIES(heynotitool ${pkgs_LDFLAGS} ${glib_pkg_LDFLAGS} ${PROJECT_NAME})
+SET_TARGET_PROPERTIES(heynotitool PROPERTIES COMPILE_FLAGS "-fPIE")
+TARGET_LINK_LIBRARIES(heynotitool ${pkgs_LDFLAGS} ${glib_pkg_LDFLAGS} ${PROJECT_NAME} "-pie")
INSTALL(TARGETS heynotitool DESTINATION bin)
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
ENDFOREACH(hfile)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/SLP_Heynoti_PG.h DESTINATION include/${PROJECT_NAME})
-ADD_SUBDIRECTORY(test)
+#ADD_SUBDIRECTORY(test)
/**
*
- * @ingroup SLP_PG
+ * @ingroup SLP_PG
* @defgroup HEYNOTI_PG HEY(ligHt Easy speedY) Notification
@{
<h1 class="pg">Introduction</h1>
-Heynoti is notification system which uses the Linux kernel inotify subsystem. <br>
-It is ligHt, Easy, speedY, so that is named 'Heynoti'. <br>
-But it doesn't support data delivery, is just sent event notification. <br>
-If developers want to send event with data like integer, string, they have to use DBus for IPC. <br>
-Heynoti is based on inotify in Linux Sytem. So for more information about inotify, refer to manpage(inotify(7)).
+<p>Heynoti is notification system which uses the Linux kernel inotify subsystem. </p>
+<p> It is ligHt, Easy, speedY, so that is named 'Heynoti'. </p>
+<p> But it doesn't support data delivery, is just sent event notification. </p>
+<p> If developers want to send event with data like integer, string, they have to use DBus for IPC. </p>>
+<p> Heynoti is based on inotify in Linux Sytem. So for more information about inotify, refer to manpage(inotify(7)).</p>
-@image html SLP_Heynoti_PG_image01.png
+<h1 class="pg">Features</h1>
+<ul>
+ <li>HEYNOTI provides a mechanism to define/undefine a notification </li>
+ <li>It provides a mechanism to subscribe for a notification </li>
+ <li>It supports unsubscription from subscription</li>
+ <li>It provides a mechanism to publish a notification</li>
+</ul>
<h2 class="pg">Properties</h2>
-- HEY(ligHt Easy speedY) Notification
-- Convenient API
-- Header File : heynoti.h
+ <ul>
+ <li> light weight Notification system. </li>
+ <li> Very fast Notifcation delivery </li>
+ <li> Convenient API's to use </li>
+ <li> It does not send event data </li>
+ </ul>
+
+<h1 class="pg"> Heynoti Logical view diagram </h1>
+\image html SLP_heynoti_PG_images_logical_view.png "Picture 1. Logical view"
+
+
+<h1 class="pg"> Heynoti Functional diagram </h1>
+\image html SLP_Heynoti_PG_image01.png "Picture 2. Functional view"
+
<h1 class="pg">Programming Guide</h1>
-For receiving notification, we can use heynoti_attach_handler() or heynoti_poll_event().
+<h2 class="pg"> Header file </h2>
+<p> header file name :<strong> heynoti.h </strong> </p>
+
+<p>For receiving notification, we can use heynoti_attach_handler() or heynoti_poll_event().
heynoti_attach_handler() use g_main_loop of default context.
-For g_main_loop, refer to glib manual.
+For g_main_loop, refer to glib manual.</p>
@code
#include <stdio.h>
}
@endcode
-And heynoti_poll_event() use polling mechanism. Therefore the process block until notification is received.
+<p> And heynoti_poll_event() use polling mechanism. Therefore the process block until notification is received.</p>
@code
#include <stdio.h>
if(!heynoti_poll_event(fd))
fprintf(stderr, "heynoti_poll_event FAIL\n");
-
+
heynoti_unsubscribe(fd, "test_testnoti", callback);
return 0;
}
@endcode
-If developer want to send notification message to the other process that watch the event, call heynoti_publish() API.
+<p> If developer want to send notification message to the other process that watch the event, call heynoti_publish() API. </p>
@code
#include <stdio.h>
fprintf(stderr, "heynoti_publish() FAIL\n");
return -1;
}
-
+
return 0;
}
@endcode
-Also, heynoti can do the monitoring of file. This is a basic faculty of inotify.
+<p> Also, heynoti can do the monitoring of file. This is a basic faculty of inotify. </p>
@code
#include <stdio.h>
static int __make_noti_file(const char *p);
static inline int __make_noti_path(char *path, int size, const char *name);
static int __read_proc(const char *path, char *buf, int size);
-static int __get_kern_ver();
static void __clear_nslot_list(GList *g_ns);
static struct noti_cont *__get_noti_cont(int fd);
static int __handle_callback(struct noti_cont *nc, int wd, uint32_t mask);
if ((fd = open(p, O_RDONLY)) == -1)
return -1;
-
+
close(fd);
return 0;
return ret;
}
-static int kern_ver; /* Kernel version */
#define PROC_VERSION "/proc/version"
-static int __get_kern_ver()
+static int __check_kern_ver()
{
struct utsname nm;
int ret;
int v2;
int v3;
- util_retv_if(kern_ver != 0, kern_ver);
-
ret = uname(&nm);
if (ret == 0) {
strncpy(buf, nm.release, sizeof(buf));
}
if (ret == 3) {
- kern_ver = KERNEL_VERSION(v1, v2, v3);
- return kern_ver;
+ if(KERNEL_VERSION(v1, v2, v3) < KERNEL_VERSION(2, 6, 13)) {
+ return -1;
+ } else {
+ return 0;
+ }
}
return -1;
{
int r;
struct inotify_event ie;
- char name[FILENAME_MAX];
+ char name[FILENAME_MAX] = {0, };
struct noti_cont *nc;
if (nc)
__handle_callback(nc, ie.wd, ie.mask);
- if (ie.len > 0)
- read(fd, name, ie.len);
+ if(ie.len > SSIZE_MAX)
+ return -1;
- r = read(fd, &ie, sizeof(ie));
+ if (ie.len > 0u) {
+ r = read(fd, name, (ie.len > FILENAME_MAX) ? (size_t)FILENAME_MAX : (size_t) ie.len);
+ }
+
+ if(r > 0) {
+ r = read(fd, &ie, sizeof(ie));
+ }
}
return 0;
struct noti_cont *nc;
- if (__get_kern_ver() < KERNEL_VERSION(2, 6, 13)) {
+ if(__check_kern_ver() < 0) {
UTIL_ERR("inotify requires kernel version >= 2.6.13 ");
errno = EPERM;
return -1;
fd = inotify_init();
util_retvm_if(fd == -1, -1, "inotify init: %s", strerror(errno));
- fcntl(fd, F_SETFD, FD_CLOEXEC);
- fcntl(fd, F_SETFL, O_NONBLOCK);
+ r = fcntl(fd, F_SETFD, FD_CLOEXEC);
+ util_retvm_if(r < 0, -1, "fcntl error : %s", strerror(errno));
+ r = fcntl(fd, F_SETFL, O_NONBLOCK);
+ util_retvm_if(r < 0, -1, "fcntl error : %s", strerror(errno));
r = __make_noti_root(noti_root);
if (r == -1) {
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/bin/heynotitool" exec_label="none" />
+ </assign>
+</manifest>
#include <dlog.h>
#define UTIL_DLOG(prio, fmt, arg...) \
do { } while (0)
-#define UTIL_INFO(fmt, arg...) LOGD("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
-#define UTIL_ERR(fmt, arg...) LOGE("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
-#define _UTIL_DBG(fmt, arg...) LOGD("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
+#define UTIL_INFO(fmt, arg...) LOGD(fmt,##arg)
+#define UTIL_ERR(fmt, arg...) LOGE(fmt,##arg)
+#define _UTIL_DBG(fmt, arg...) LOGD(fmt,##arg)
#else
#include <syslog.h>
Name: heynoti
Summary: HEY (ligHt Easy speedy) notification library
Version: 0.0.2
-Release: 35
+Release: 45
Group: System/Libraries
-License: Apache License, Version 2.0
+License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
-
BuildRequires: cmake
-
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(ecore)
-
+#BuildRequires: pkgconfig(ecore)
%description
lightweight notification library, service APIs
-
%package devel
Summary: Notification library
Group: Development/Libraries
%description devel
heynoti API (devel)
-
%prep
%setup -q
-
%build
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_BUILD_TYPE="Debug"
-
make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/usr/share/license
+install LICENSE %{buildroot}/usr/share/license/%{name}
%post
/sbin/ldconfig
%postun -p /sbin/ldconfig
-
%files
+%manifest heynoti.manifest
%defattr(-,root,root,-)
%{_libdir}/libheynoti.so.0
%{_libdir}/libheynoti.so.0.0.2
%{_bindir}/heynotitool
-
+/usr/share/license/%{name}
%files devel
%defattr(-,root,root,-)
if (argc > 1) {
char p[FILENAME_MAX];
- if (!heynoti_get_snoti_name(argv[1], p, sizeof(p))) ;
- heynoti_publish(p);
+ if (!heynoti_get_snoti_name(argv[1], p, sizeof(p)))
+ heynoti_publish(p);
+ else
+ printf("noti name error\n");
} else {
printf("usage) %s NOTI_NAME\n", argv[0]);
}