change Copyright headers, change line endings to Unix format
[platform/core/system/swap-probe.git] / include / binproto.h
index c49f680..f2852db 100644 (file)
@@ -1,3 +1,32 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ *
+ * Nikita Kalyazin <n.kalyazin@samsung.com>
+ * Anastasia Lyupa <a.lyupa@samsung.com>
+ * 
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * 
+ * This library 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - Samsung RnD Institute Russia
+ * 
+ */
+
 #ifndef __BIN_PROTO_H__
 #define __BIN_PROTO_H__
 
@@ -20,6 +49,9 @@
 
 #include <sys/time.h>
 
+#include <sys/socket.h>
+#include "dahelper.h"
+
 #define MSG_PROBE_MEMORY 0x3001
 #define MSG_PROBE_UICONTROL 0x3002
 #define MSG_PROBE_UIEVENT 0x3003
@@ -296,23 +328,6 @@ static inline char *pack_args(char *to, const char *fmt, ...)
                BUF_PTR = pack_int32(BUF_PTR, api_type);             \
        } while (0)
 
-#define LOG_PATH "/tmp/trace.bin"
-#define OPEN_LOG()                                     \
-               do {                                    \
-                       log_fd = creat(LOG_PATH, 0644); \
-                       if (log_fd == -1) {             \
-                               exit(1);                \
-                       }                               \
-               } while (0)
-#define CLOSE_LOG()                            \
-               do {                            \
-                       if (log_fd > 0) {       \
-                               close(log_fd);  \
-                       }                       \
-               } while (0)
-
-
-
 #define LOCAL_BUF_SIZE 1024
 #define PREPARE_LOCAL_BUF()                    \
                char buf[LOCAL_BUF_SIZE];       \
@@ -323,7 +338,7 @@ static inline char *pack_args(char *to, const char *fmt, ...)
 #define MSG_HDR_LEN 20
 #define FLUSH_LOCAL_BUF()                                              \
                *(uint32_t *)(buf + MSG_LEN_OFFSET) = (p - buf) - MSG_HDR_LEN; \
-               write(log_fd, buf, p - buf);
+               send(gTraceInfo.socket.daemonSock, buf, (p - buf), 0);
 
 // =========================== post block macro ===========================
 
@@ -336,9 +351,6 @@ static inline char *pack_args(char *to, const char *fmt, ...)
        }                                                               \
        errno = (newerrno != 0) ? newerrno : olderrno
 
-/* data */
-extern int log_fd;
-
 /* int main(int argc, char **argv) */
 /* { */
 /*     char buf[1024]; */