summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangjoon Baek <joon.c.baek@samsung.com>2017-06-01 21:37:23 +0900
committerGihun Chang <gihun.chang@samsung.com>2017-06-02 07:01:15 +0000
commitfdd397e8d326f195fb780dca37d3965abac62efa (patch)
treeef3307255c87d1e3729f1d4a9de7ec23324d3bda
parentf63a34e62b61d1bee28d049873851897f86246f2 (diff)
downloadttrace-fdd397e8d326f195fb780dca37d3965abac62efa.tar.gz
ttrace-fdd397e8d326f195fb780dca37d3965abac62efa.tar.bz2
ttrace-fdd397e8d326f195fb780dca37d3965abac62efa.zip
Add traceFS mount service and adjust service ordersubmit/tizen/20170602.072408accepted/tizen/unified/20170602.155201
4.x kernel splited traceFS and debugFS. /sys/kernel/debug/tracing and /tmp should be mounted before ttrace-marker.service started. - Add sys-kernel-tracing.service to mount tracefs to /sys/kernel/debug/tracing - Adjust ttrace-marker.service order to be after the sys-kernel-tracing.service Change-Id: I48f08bb8d4a31fa24b8508307812241a6fcb73b6 Signed-off-by: Changjoon Baek <joon.c.baek@samsung.com>
-rw-r--r--packaging/sys-kernel-tracing.service15
-rw-r--r--packaging/ttrace-marker.service4
-rw-r--r--packaging/ttrace.spec12
-rwxr-xr-xsrc/atrace/atrace.cpp38
4 files changed, 25 insertions, 44 deletions
diff --git a/packaging/sys-kernel-tracing.service b/packaging/sys-kernel-tracing.service
new file mode 100644
index 0000000..08b4335
--- /dev/null
+++ b/packaging/sys-kernel-tracing.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=TraceFs mount
+DefaultDependencies=no
+After=sys-kernel-debug.mount
+Before=tmp.mount systemd-tmpfiles-setup.service
+
+[Service]
+SmackProcessLabel=System
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/touch -f /sys/kernel/debug/tracing
+
+[Install]
+WantedBy=sysinit.target
+
diff --git a/packaging/ttrace-marker.service b/packaging/ttrace-marker.service
index e3f2d47..d5eafad 100644
--- a/packaging/ttrace-marker.service
+++ b/packaging/ttrace-marker.service
@@ -1,11 +1,11 @@
[Unit]
Description=T-trace marker
DefaultDependencies=no
-After=sys-kernel-debug.mount
+After=tmp.mount sys-kernel-tracing.service
[Service]
Type=simple
ExecStart=/usr/bin/atrace --init_exec
[Install]
-WantedBy=sys-kernel-debug.mount
+WantedBy=sysinit.target
diff --git a/packaging/ttrace.spec b/packaging/ttrace.spec
index e3b4b8d..08f271d 100644
--- a/packaging/ttrace.spec
+++ b/packaging/ttrace.spec
@@ -6,6 +6,7 @@ Group: System/Libraries
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
SOURCE100: packaging/ttrace.conf
+SOURCE101: packaging/sys-kernel-tracing.service
SOURCE102: packaging/ttrace-marker.service
SOURCE103: packaging/atrace-bootup.sh
@@ -60,13 +61,15 @@ make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}/usr/lib/tmpfiles.d
-install -d %{buildroot}%{_unitdir}/ttrace-marker.service.wants
install -m 0644 %{SOURCE100} %{buildroot}/usr/lib/tmpfiles.d/ttrace.conf
+install -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE102} %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_bindir}
cp %{SOURCE103} %{buildroot}%{_bindir}
-%install_service sys-kernel-debug.mount.wants ttrace-marker.service
+%install_service sysinit.target.wants ttrace-marker.service
+%install_service sysinit.target.wants sys-kernel-tracing.service
%post -p /sbin/ldconfig
@@ -77,10 +80,11 @@ cp %{SOURCE103} %{buildroot}%{_bindir}
%defattr(-,root,root,-)
%{_libdir}/libttrace.so.*
%{_unitdir}/ttrace-marker.service
-%{_unitdir}/ttrace-marker.service.wants/
+%{_unitdir}/sys-kernel-tracing.service
%attr(755,root,users) %{_bindir}/atrace
%attr(755,root,users) %{_bindir}/atrace-1.1
-%{_unitdir}/sys-kernel-debug.mount.wants/ttrace-marker.service
+%{_unitdir}/sysinit.target.wants/ttrace-marker.service
+%{_unitdir}/sysinit.target.wants/sys-kernel-tracing.service
%attr(755,root,root) %{_bindir}/atrace-bootup.sh
/usr/lib/tmpfiles.d/ttrace.conf
%license LICENSE
diff --git a/src/atrace/atrace.cpp b/src/atrace/atrace.cpp
index 2639795..b372c60 100755
--- a/src/atrace/atrace.cpp
+++ b/src/atrace/atrace.cpp
@@ -150,13 +150,6 @@ static bool g_categoryEnables[NELEM(k_categories)] = {};
static bool g_init_exec = false;
static bool g_append_trace = false;
static bool g_backup_trace = false;
-static struct group group_dev;
-#if TTRACE_TIZEN_VERSION_MAJOR < 3
-#define TTRACE_GROUP_NAME "developer"
-#else
-#define TTRACE_GROUP_NAME "users"
-#endif
-static struct group* group_ptr;
/* Save excluded tags list */
uint64_t excludedTags;
@@ -382,38 +375,7 @@ static bool setTagsProperty(uint64_t tags)
fprintf(stderr, "[Info] T-trace has been already initailized\n");
return false; //atrace has been already initailized.
}
- ret = getgrnam_r(TTRACE_GROUP_NAME, &group_dev, buf, bufSize, &group_ptr);
-
- if (ret != 0 && ret != ERANGE)
- {
- fprintf(stderr, "Fail to group[%s] info: %s(%d)\n", TTRACE_GROUP_NAME, strerror_r(errno, str_error, sizeof(str_error)), errno);
- return false;
- }
-
- bool isInvalid = false;
- while(ret == ERANGE)
- {
- long int tmpSize = -1;
-
- if(!isInvalid)
- tmpSize = sysconf(_SC_GETGR_R_SIZE_MAX);
-
- if (tmpSize == -1)
- {
- bufSize *= 2;
- }
- else bufSize = (size_t) tmpSize;
- char *dynbuf = (char *) malloc(bufSize);
- if(dynbuf == NULL)
- {
- fprintf(stderr, "Fail to allocate buffer for group[%s]: %s(%d)\n", TTRACE_GROUP_NAME, strerror_r(errno, str_error, sizeof(str_error)), errno);
- return false;
- }
- ret = getgrnam_r(TTRACE_GROUP_NAME, &group_dev, dynbuf, bufSize, &group_ptr);
- if(ret == ERANGE) isInvalid = true;
- free(dynbuf);
- }
fd = open("/tmp/tmp_tag", O_CREAT | O_RDWR | O_CLOEXEC, 0666);
if(fd < 0){
fprintf(stderr, "Fail to open enabled_tag file: %s(%d)\n", strerror_r(errno, str_error, sizeof(str_error)), errno);