4 * Copyright (File::*c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
11 * Anastasia Lyupa <a.lyupa@samsung.com>
13 * This library is free software; you can redistribute it and/or modify it under
14 * the terms of the GNU Lesser General Public License as published by the
15 * Free Software Foundation; either version 2.1 of the License, or (at your option)
18 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
19 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
21 * License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this library; if not, write to the Free Software Foundation, Inc., 51
25 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 * - Samsung RnD Institute Russia
36 #include "probeinfo.h"
41 using namespace Tizen::Base;
43 enum FileSeekPosition {
44 FILESEEKPOSITION_BEGIN, /**<The beginning of the file */
45 FILESEEKPOSITION_CURRENT, /**<The current position of the file */
47 /**<The end of the file */
50 static enum DaOptions _sopt = OPT_FILE;
55 class FileAttributes {
57 virtual bool Equals(const Object& object) const;
58 FileAttributes(const FileAttributes &fileAttributes);
60 DateTime GetDateTime(void) const;
61 long long GetFileSize(void) const;
62 virtual int GetHashCode(void) const;
63 DateTime GetLastModifiedTime(void) const;
64 bool IsDirectory(void) const;
65 bool IsHidden(void) const;
66 bool IsReadOnly(void) const;
67 FileAttributes & operator=(const FileAttributes &fileAttributes);
68 virtual ~FileAttributes(void);
76 result Construct(const Tizen::Base::String& filePath,
77 const Tizen::Base::String& openMode, bool secureMode,
78 bool createParentDirectories);
79 result Construct(const Tizen::Base::String& filePath,
80 const Tizen::Base::String& openMode, bool secureMode,
81 const Tizen::Base::ByteBuffer& key, bool createParentDirectories);
83 result Construct(const Tizen::Base::String& filePath,
84 const Tizen::Base::String& openMode,
85 const Tizen::Base::ByteBuffer& secretKey);
87 result Construct(const Tizen::Base::String& filePath,
88 const Tizen::Base::String& openMode, bool createParentDirectories);
89 result Construct(const Tizen::Base::String& filePath,
90 const Tizen::Base::String& openMode);
92 result Construct(const Tizen::Base::String& filePath,
93 const char *pOpenMode);
94 result Construct(const Tizen::Base::String& filePath,
95 const char *pOpenMode, const Tizen::Base::ByteBuffer &seretKey);
103 Tizen::Base::String GetName(void) const;
104 result Read(Tizen::Base::String& buffer);
105 result Read(Tizen::Base::ByteBuffer& buffer);
106 int Read(void *buffer, int length);
107 result Seek(FileSeekPosition position, long offset);
109 int Tell(void) const;
111 result Truncate(int length);
113 result Write(const void *buffer, int length);
115 result Write(const Tizen::Base::ByteBuffer& buffer);
116 result Write(const Tizen::Base::String& buffer);
120 static result ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
121 const Tizen::Base::String &secureFilePath);
122 static result ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
123 const Tizen::Base::String &secureFilePath,
124 const Tizen::Base::ByteBuffer& key);
125 static result Copy(const Tizen::Base::String& srcFilePath,
126 const Tizen::Base::String& destFilePath, bool failIfExist);
127 static result GetAttributes(const Tizen::Base::String& filePath,
128 FileAttributes& attribute);
129 static const Tizen::Base::String GetFileExtension(
130 const Tizen::Base::String& filePath);
132 static const Tizen::Base::String GetFileName(const Tizen::Base::String& filePath);
134 const Tizen::Base::String& filePath);
135 static bool IsEncrypted(const Tizen::Base::String &filePath);
136 static bool IsFileExist(const Tizen::Base::String& filePath);
137 static result Move(const Tizen::Base::String& oldFilePath,
138 const Tizen::Base::String& newFilePath);
139 static result Remove(const Tizen::Base::String& filePath);
140 // static Tizen::Base::Collection::IList *GetPathsToAppsN(void);
145 //static (File::*Filep)();
148 result File::Construct(const Tizen::Base::String& filePath,
149 const Tizen::Base::String& openMode, bool createParentDirectories) {
150 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
151 const Tizen::Base::String& openMode, bool createParentDirectories);
152 static methodType Constructp = 0;
154 probeInfo_t probeInfo;
156 bool bfiltering = true;
159 //FileAttributes attr;
163 void *tmpPtr = dlsym(RTLD_NEXT,
164 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_b");
166 if (tmpPtr == NULL || dlerror() != NULL) {
167 perror("dlsym failed : Tizen::Io::File::Construct");
171 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
175 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
176 setProbePoint(&probeInfo);
180 ret = (this->*Constructp)(filePath, openMode, createParentDirectories);
182 if(postBlockBegin(blockresult)) {
184 WcharToChar(temp_path,filePath.GetPointer());
185 WcharToChar(temp_mode,openMode.GetPointer());
188 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_Tizen__Base__String__openMode__bool_createParentDirectories_,
189 "ssd", temp_path, temp_mode, createParentDirectories);
190 PACK_COMMON_END(ret, ret, blockresult);
191 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OPEN, 0, temp_path);
201 result File::Construct(const Tizen::Base::String& filePath,
202 const Tizen::Base::String& openMode, bool secureMode,
203 bool createParentDirectories) {
204 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
205 const Tizen::Base::String& openMode, bool secureMode,
206 bool createParentDirectories);
207 static methodType Constructp = 0;
209 probeInfo_t probeInfo;
212 bool bfiltering = true;
214 //FileAttributes attr;
219 void *tmpPtr = dlsym(RTLD_NEXT,
220 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_bb");
222 if (tmpPtr == NULL || dlerror() != NULL) {
223 perror("dlsym failed : Tizen::Io::File::Construct");
227 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
231 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
232 setProbePoint(&probeInfo);
236 ret = (this->*Constructp)(filePath, openMode, secureMode,
237 createParentDirectories);
239 if(postBlockBegin(blockresult)) {
243 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
244 LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
245 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
247 WcharToChar(temp,filePath.GetPointer());
248 log.length += sprintf(log.data + log.length,"`,%s",temp);
249 WcharToChar(temp,openMode.GetPointer());
250 log.length += sprintf(log.data + log.length,", %s",temp);
251 log.length += sprintf(log.data + log.length,", %s,%s`,%ld",(secureMode == 0 ? "false" : "true"),(createParentDirectories == 0 ? "false" : "true"),ret);
252 //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
253 //File::GetAttributes(this->GetName(),attr);
254 WcharToChar(temp,filePath.GetPointer());
255 log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
258 // if(E_SUCCESS != ret || blockresult == 2) {
259 // log.length += sprintf(log.data + log.length,
260 // "`,\ncallstack_start`,`,callstack_end");
262 log.length += sprintf(log.data + log.length,
263 "`,\ncallstack_start`,");
264 getBacktraceString(&log, 4096 - log.length - 17);
265 log.length += sprintf(log.data + log.length, "`,callstack_end");
268 printLog(&log, MSG_LOG);
275 result File::Construct(const Tizen::Base::String& filePath,
276 const Tizen::Base::String& openMode, bool secureMode,
277 const Tizen::Base::ByteBuffer& key, bool createParentDirectories) {
278 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
279 const Tizen::Base::String& openMode, bool secureMode,
280 const Tizen::Base::ByteBuffer& key, bool createParentDirectories);
281 static methodType Constructp = 0;
283 probeInfo_t probeInfo;
286 bool bfiltering = true;
288 //FileAttributes attr;
293 void *tmpPtr = dlsym(RTLD_NEXT,
294 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_bRKNS2_10ByteBufferEb");
296 if (tmpPtr == NULL || dlerror() != NULL) {
297 perror("dlsym failed : Tizen::Io::File::Construct");
301 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
305 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
306 setProbePoint(&probeInfo);
310 ret = (this->*Constructp)(filePath, openMode, secureMode, key,
311 createParentDirectories);
313 if(postBlockBegin(blockresult)) {
317 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
318 LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
319 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
321 WcharToChar(temp,filePath.GetPointer());
322 log.length += sprintf(log.data + log.length,"`,%s",temp);
323 WcharToChar(temp,openMode.GetPointer());
324 log.length += sprintf(log.data + log.length,", %s",temp);
325 log.length += sprintf(log.data + log.length,", %s,0x%x,%s`,%ld",(secureMode == 0 ? "false" : "true"),(unsigned int)&key,(createParentDirectories == 0 ? "false" : "true"),ret);
326 //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
327 //File::GetAttributes(this->GetName(),attr);
328 WcharToChar(temp,filePath.GetPointer());
329 log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
332 // if(E_SUCCESS != ret || blockresult == 2) {
333 // log.length += sprintf(log.data + log.length,
334 // "`,\ncallstack_start`,`,callstack_end");
336 log.length += sprintf(log.data + log.length,
337 "`,\ncallstack_start`,");
338 getBacktraceString(&log, 4096 - log.length - 17);
339 log.length += sprintf(log.data + log.length, "`,callstack_end");
342 printLog(&log, MSG_LOG);
349 result File::Construct(const Tizen::Base::String& filePath,
350 const Tizen::Base::String& openMode) {
351 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
352 const Tizen::Base::String& openMode);
353 static methodType Constructp = 0;
355 probeInfo_t probeInfo;
357 bool bfiltering = true;
360 //FileAttributes attr;
364 void *tmpPtr = dlsym(RTLD_NEXT,
365 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_");
367 if(tmpPtr == NULL || dlerror() != NULL) {
368 perror("dlsym failed : Tizen::Io::File::Construct");
372 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
376 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
377 setProbePoint(&probeInfo);
381 ret = (this->*Constructp)(filePath, openMode);
383 if(postBlockBegin(blockresult)) {
384 WcharToChar(temp_path,filePath.GetPointer());
385 WcharToChar(temp_mode,openMode.GetPointer());
388 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
389 API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_Tizen__Base__String__openMode_,
390 "ss", temp_path, temp_mode);
391 PACK_COMMON_END(ret, ret, blockresult);
392 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OPEN, 0, temp_path);
402 result File::Construct(const Tizen::Base::String& filePath,
403 const Tizen::Base::String& openMode,
404 const Tizen::Base::ByteBuffer& secretKey) {
405 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
406 const Tizen::Base::String &openMode,
407 const Tizen::Base::ByteBuffer& secretKey);
408 static methodType Constructp = 0;
410 probeInfo_t probeInfo;
413 bool bfiltering = true;
415 //FileAttributes attr;
420 void *tmpPtr = dlsym(RTLD_NEXT,
421 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_RKNS2_10ByteBufferE");
423 if(tmpPtr == NULL || dlerror() != NULL) {
424 perror("dlsym failed : Tizen::Io::File::Construct");
428 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
432 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
433 setProbePoint(&probeInfo);
437 ret = (this->*Constructp)(filePath, openMode, secretKey);
439 if(postBlockBegin(blockresult)) {
443 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d",
444 LC_RESOURCE, probeInfo.eventIndex, "File::Construct",
445 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
447 WcharToChar(temp,filePath.GetPointer());
448 log.length += sprintf(log.data + log.length,"`,%s",temp);
449 WcharToChar(temp,openMode.GetPointer());
450 log.length += sprintf(log.data + log.length,", %s",temp);
451 log.length += sprintf(log.data + log.length,", 0x%x`,%ld",(unsigned int)&secretKey,ret);
452 //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath
453 //File::GetAttributes(this->GetName(),attr);
454 WcharToChar(temp,filePath.GetPointer());
455 log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp);
458 // if(E_SUCCESS != ret || blockresult == 2) {
459 // log.length += sprintf(log.data + log.length,
460 // "`,\ncallstack_start`,`,callstack_end");
462 log.length += sprintf(log.data + log.length,
463 "`,\ncallstack_start`,");
464 getBacktraceString(&log, 4096 - log.length - 17);
465 log.length += sprintf(log.data + log.length, "`,callstack_end");
468 printLog(&log, MSG_LOG);
475 result File::Construct(const Tizen::Base::String& filePath,
476 const char *pOpenMode) {
477 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
478 const char *pOpenMode);
479 static methodType Constructp = 0;
481 probeInfo_t probeInfo;
483 bool bfiltering = true;
485 //FileAttributes attr;
489 void *tmpPtr = dlsym(RTLD_NEXT,
490 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringEPKc");
492 if(tmpPtr == NULL || dlerror() != NULL) {
493 perror("dlsym failed : Tizen::Io::File::Construct");
497 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
501 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
502 setProbePoint(&probeInfo);
506 ret = (this->*Constructp)(filePath, pOpenMode);
508 if(postBlockBegin(blockresult)) {
510 WcharToChar(temp,filePath.GetPointer());
513 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
514 API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_char__pOpenMode_,
515 "sp", temp, pOpenMode);
516 PACK_COMMON_END(ret, ret, blockresult);
517 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OPEN, 0, temp);
526 result File::Construct(const Tizen::Base::String& filePath,
527 const char *pOpenMode,
528 const Tizen::Base::ByteBuffer& secretKey) {
529 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
530 const char *pOpenMode,
531 const Tizen::Base::ByteBuffer& secretKey);
532 static methodType Constructp = 0;
534 probeInfo_t probeInfo;
536 bool bfiltering = true;
538 //FileAttributes attr;
543 void *tmpPtr = dlsym(RTLD_NEXT,
544 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringEPKcRKNS2_10ByteBufferE");
546 if(tmpPtr == NULL || dlerror() != NULL) {
547 perror("dlsym failed : Tizen::Io::File::Construct");
551 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
555 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
556 setProbePoint(&probeInfo);
560 ret = (this->*Constructp)(filePath, pOpenMode, secretKey);
562 if(postBlockBegin(blockresult)) {
563 WcharToChar(temp,filePath.GetPointer());
566 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
567 API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_char__pOpenMode__const_Tizen__Base__ByteBuffer__secretKey_,
568 "sp", temp, pOpenMode);
569 PACK_COMMON_END(ret, ret, blockresult);
570 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OPEN, 0, temp);
579 result File::Flush(void) {
580 typedef result (File::*methodType)(void);
581 static methodType Flushp = 0;
583 probeInfo_t probeInfo;
585 bool bfiltering = true;
587 //FileAttributes attr;
592 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5FlushEv");
594 if (tmpPtr == NULL || dlerror() != NULL) {
595 perror("dlsym failed : Tizen::Io::File::Flush");
599 memcpy(&Flushp, &tmpPtr, sizeof(tmpPtr));
603 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
604 setProbePoint(&probeInfo);
608 ret = (this->*Flushp)();
610 if(postBlockBegin(blockresult)) {
611 WcharToChar(temp,this->GetName().GetPointer());
614 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
615 API_ID_result_File__Flush_void_,
617 PACK_COMMON_END(ret, ret, blockresult);
618 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OTHER, 0, temp);
627 Tizen::Base::String File::GetName(void) const{
628 typedef Tizen::Base::String (File::*methodType)(void) const;
629 static methodType GetNamep = 0;
630 Tizen::Base::String ret;
631 probeInfo_t probeInfo;
633 bool bfiltering = true;
635 //FileAttributes attr;
640 void *tmpPtr = dlsym(RTLD_NEXT, "_ZNK5Tizen2Io4File7GetNameEv");
642 if (tmpPtr == NULL || dlerror() != NULL) {
643 perror("dlsym failed : Tizen::Io::File::GetName");
647 memcpy(&GetNamep, &tmpPtr, sizeof(tmpPtr));
651 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
652 setProbePoint(&probeInfo);
656 ret = (this->*GetNamep)();
657 result res = GetLastResult();
659 if(postBlockBegin(blockresult)) {
660 WcharToChar(temp,ret.GetPointer());
663 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
664 API_ID_Tizen__Base__String_File__GetName_void__const,
666 PACK_COMMON_END(ret.GetPointer(), res, blockresult);
667 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OTHER, 0, temp);
676 result File::Read(Tizen::Base::String& buffer) {
677 typedef result (File::*methodType)(Tizen::Base::String & buffer);
678 static methodType Readp = 0;
680 probeInfo_t probeInfo;
682 bool bfiltering = true;
685 //FileAttributes attr;
690 void *tmpPtr = dlsym(RTLD_NEXT,
691 "_ZN5Tizen2Io4File4ReadERNS_4Base6StringE");
693 if (tmpPtr == NULL || dlerror() != NULL) {
694 perror("dlsym failed : Tizen::Io::File::Read");
698 memcpy(&Readp, &tmpPtr, sizeof(tmpPtr));
702 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
703 setProbePoint(&probeInfo);
707 ret = (this->*Readp)(buffer);
709 if(postBlockBegin(blockresult)) {
710 WcharToChar(temp,this->GetName().GetPointer());
711 nRead = buffer.GetLength();
714 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
715 API_ID_result_File__Read_Tizen__Base__String__buffer_,
716 "x", (unsigned long)&buffer);
717 PACK_COMMON_END(ret, ret, blockresult);
718 PACK_RESOURCE(nRead, (unsigned long)this, FD_FILE, FD_API_READ, 0, temp);
727 result File::Read(Tizen::Base::ByteBuffer& buffer) {
728 typedef result (File::*methodType)(Tizen::Base::ByteBuffer & buffer);
729 static methodType Readp = 0;
731 probeInfo_t probeInfo;
733 bool bfiltering = true;
736 //FileAttributes attr;
741 void *tmpPtr = dlsym(RTLD_NEXT,
742 "_ZN5Tizen2Io4File4ReadERNS_4Base10ByteBufferE");
744 if (tmpPtr == NULL || dlerror() != NULL) {
745 perror("dlsym failed : Tizen::Io::File::Read");
749 memcpy(&Readp, &tmpPtr, sizeof(tmpPtr));
753 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
754 setProbePoint(&probeInfo);
758 ret = (this->*Readp)(buffer);
760 if(postBlockBegin(blockresult)) {
761 WcharToChar(temp,this->GetName().GetPointer());
762 buffer.GetInt(nRead);
765 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
766 API_ID_result_File__Read_Tizen__Base__ByteBuffer__buffer_,
767 "x", (unsigned long)&buffer);
768 PACK_COMMON_END(ret, ret, blockresult);
769 PACK_RESOURCE(nRead, (unsigned long)this, FD_FILE, FD_API_READ, 0, temp);
778 int File::Read(void *buffer, int length) {
779 typedef int (File::*methodType)(void *buffer, int length);
780 static methodType Readp = 0;
782 probeInfo_t probeInfo;
784 bool bfiltering = true;
787 //FileAttributes attr;
792 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File4ReadEPvi");
794 if (tmpPtr == NULL || dlerror() != NULL) {
795 perror("dlsym failed : Tizen::Io::File::Read");
799 memcpy(&Readp, &tmpPtr, sizeof(tmpPtr));
803 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
804 setProbePoint(&probeInfo);
809 ret = (this->*Readp)(buffer, length);
810 result res = GetLastResult();
812 if(postBlockBegin(blockresult)) {
813 WcharToChar(temp,this->GetName().GetPointer());
814 nRead = Tell() - nRead;
817 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
818 API_ID_int_File__Read_void__buffer__int_length_,
819 "xd", (unsigned long)buffer, length);
820 PACK_COMMON_END(ret, res, blockresult);
821 PACK_RESOURCE(nRead, (unsigned long)this, FD_FILE, FD_API_READ, 0, temp);
830 result File::Seek(FileSeekPosition position, long offset) {
831 typedef result (File::*methodType)(FileSeekPosition position, long offset);
832 static methodType Seekp = 0;
834 probeInfo_t probeInfo;
836 bool bfiltering = true;
839 //FileAttributes attr;
844 void *tmpPtr = dlsym(RTLD_NEXT,
845 "_ZN5Tizen2Io4File4SeekE16FileSeekPositionl");
847 if (tmpPtr == NULL || dlerror() != NULL) {
848 perror("dlsym failed : Tizen::Io::File::Seek");
852 memcpy(&Seekp, &tmpPtr, sizeof(tmpPtr));
857 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
858 setProbePoint(&probeInfo);
862 ret = (this->*Seekp)(position, offset);
864 if(postBlockBegin(blockresult)) {
866 if(FILESEEKPOSITION_BEGIN == position)
867 strcpy(temp_pos, "FILESEEKPOSITION_BEGIN");
868 else if(FILESEEKPOSITION_CURRENT == position)
869 strcpy(temp_pos, "FILESEEKPOSITION_CURRENT");
870 else if(FILESEEKPOSITION_END == position)
871 strcpy(temp_pos, "FILESEEKPOSITION_END");
873 sprintf(temp_pos, "%d", position);
875 WcharToChar(temp,this->GetName().GetPointer());
878 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
879 API_ID_result_File__Seek_FileSeekPosition_position__long_offset_,
880 "sx", temp_pos, offset);
881 PACK_COMMON_END(ret, ret, blockresult);
882 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OTHER, 0, temp);
891 int File::Tell(void) const {
892 typedef int (File::*methodType)(void) const;
893 static methodType Tellp = 0;
895 probeInfo_t probeInfo;
897 bool bfiltering = true;
899 //FileAttributes attr;
904 void *tmpPtr = dlsym(RTLD_NEXT, "_ZNK5Tizen2Io4File4TellEv");
906 if (tmpPtr == NULL || dlerror() != NULL) {
907 perror("dlsym failed : Tizen::Io::File::Tell");
911 memcpy(&Tellp, &tmpPtr, sizeof(tmpPtr));
916 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
917 setProbePoint(&probeInfo);
921 ret = (this->*Tellp)();
922 result res = GetLastResult();
924 if(postBlockBegin(blockresult)) {
925 WcharToChar(temp,this->GetName().GetPointer());
928 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
929 API_ID_int_File__Tell_void__const,
931 PACK_COMMON_END(ret, res, blockresult);
932 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OTHER, 0, temp);
941 result File::Truncate(int length) {
942 typedef result (File::*methodType)(int length);
943 static methodType Truncatep = 0;
945 probeInfo_t probeInfo;
947 bool bfiltering = true;
949 //FileAttributes attr;
954 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File8TruncateEi");
956 if (tmpPtr == NULL || dlerror() != NULL) {
957 perror("dlsym failed : Tizen::Io::File::Truncate");
961 memcpy(&Truncatep, &tmpPtr, sizeof(tmpPtr));
965 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
966 setProbePoint(&probeInfo);
970 ret = (this->*Truncatep)(length);
972 if(postBlockBegin(blockresult)) {
973 WcharToChar(temp,this->GetName().GetPointer());
976 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
977 API_ID_result_File__Truncate_int_length_,
979 PACK_COMMON_END(ret, ret, blockresult);
980 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_OTHER, 0, temp);
989 result File::Write(const void *buffer, int length) {
990 typedef result (File::*methodType)(const void *buffer, int length);
991 static methodType Writep = 0;
993 probeInfo_t probeInfo;
995 bool bfiltering = true;
998 //FileAttributes attr;
1003 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteEPKvi");
1005 if (tmpPtr == NULL || dlerror() != NULL) {
1006 perror("dlsym failed : Tizen::Io::File::Write");
1010 memcpy(&Writep, &tmpPtr, sizeof(tmpPtr));
1014 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1015 setProbePoint(&probeInfo);
1020 ret = (this->*Writep)(buffer, length);
1022 if(postBlockBegin(blockresult)) {
1023 WcharToChar(temp,this->GetName().GetPointer());
1024 nWritten = Tell() - nWritten;
1026 PREPARE_LOCAL_BUF();
1027 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
1028 API_ID_result_File__Write_const_void__buffer__int_length_,
1029 "xd", (unsigned long)buffer, length);
1030 PACK_COMMON_END(ret, ret, blockresult);
1031 PACK_RESOURCE(nWritten, (unsigned long)this, FD_FILE, FD_API_WRITE, 0, temp);
1040 result File::Write(const Tizen::Base::ByteBuffer& buffer) {
1041 typedef result (File::*methodType)(const Tizen::Base::ByteBuffer& buffer);
1042 static methodType Writep = 0;
1044 probeInfo_t probeInfo;
1046 bool bfiltering = true;
1049 //FileAttributes attr;
1054 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteERKNS_4Base10ByteBufferE");
1056 if (tmpPtr == NULL || dlerror() != NULL) {
1057 perror("dlsym failed : Tizen::Io::File::Write");
1061 memcpy(&Writep, &tmpPtr, sizeof(tmpPtr));
1065 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1066 setProbePoint(&probeInfo);
1071 ret = (this->*Writep)(buffer);
1073 if(postBlockBegin(blockresult)) {
1074 WcharToChar(temp,this->GetName().GetPointer());
1075 nWritten = Tell() - nWritten;
1077 PREPARE_LOCAL_BUF();
1078 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
1079 API_ID_result_File__Write_const_Tizen__Base__ByteBuffer__buffer_,
1080 "x", (unsigned long)&buffer);
1081 PACK_COMMON_END(ret, ret, blockresult);
1082 PACK_RESOURCE(nWritten, (unsigned long)this, FD_FILE, FD_API_WRITE, 0, temp);
1091 result File::Write(const Tizen::Base::String& buffer) {
1092 typedef result (File::*methodType)(const Tizen::Base::String& buffer);
1093 static methodType Writep = 0;
1095 probeInfo_t probeInfo;
1097 bool bfiltering = true;
1101 //FileAttributes attr;
1106 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteERKNS_4Base6StringE");
1108 if (tmpPtr == NULL || dlerror() != NULL) {
1109 perror("dlsym failed : Tizen::Io::File::Write");
1113 memcpy(&Writep, &tmpPtr, sizeof(tmpPtr));
1117 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1118 setProbePoint(&probeInfo);
1123 ret = (this->*Writep)(buffer);
1125 if(postBlockBegin(blockresult)) {
1126 WcharToChar(temp_buf,buffer.GetPointer());
1127 WcharToChar(temp_path,this->GetName().GetPointer());
1128 nWritten = Tell() - nWritten;
1130 PREPARE_LOCAL_BUF();
1131 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
1132 API_ID_result_File__Write_const_Tizen__Base__String__buffer_,
1134 PACK_COMMON_END(ret, ret, blockresult);
1135 PACK_RESOURCE(nWritten, (unsigned long)this, FD_FILE, FD_API_WRITE, 0, temp_path);
1144 typedef void (File::*methodType)();
1145 static methodType FileDp = 0;
1146 probeInfo_t probeInfo;
1148 bool bfiltering = true;
1154 tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4FileD1Ev");
1156 if (tmpPtr == NULL || dlerror() != NULL) {
1157 perror("dlsym failed : Tizen::Io::File::~File");
1161 memcpy(&FileDp, &tmpPtr, sizeof(tmpPtr));
1165 if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1166 setProbePoint(&probeInfo);
1172 if(postBlockBegin(blockresult)) {
1174 PREPARE_LOCAL_BUF();
1175 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
1176 API_ID_File___File_void_,
1178 PACK_COMMON_END(0, 0, blockresult);
1179 PACK_RESOURCE(0, (unsigned long)this, FD_FILE, FD_API_CLOSE, 0, "");
1188 //static result File::ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
1189 // const Tizen::Base::String &secureFilePath) {
1190 // typedef result (File::*methodType)(
1191 // const Tizen::Base::String &plainFilePath,
1192 // const Tizen::Base::String &secureFilePath);
1193 // static methodType ConvertToSecureFilep = 0;
1196 //static result File::ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
1197 // const Tizen::Base::String &secureFilePath,
1198 // const Tizen::Base::ByteBuffer& key) {
1199 // typedef result (File::*methodType)(
1200 // const Tizen::Base::String &plainFilePath,
1201 // const Tizen::Base::String &secureFilePath,
1202 // const Tizen::Base::ByteBuffer& key);
1203 // static methodType ConvertToSecureFilep = 0;
1206 //static result File::Copy(const Tizen::Base::String& srcFilePath,
1207 // const Tizen::Base::String& destFilePath, bool failIfExist) {
1208 // typedef result (File::*methodType)(const Tizen::Base::String& srcFilePath,
1209 // const Tizen::Base::String& destFilePath, bool failIfExist);
1210 // static methodType Copyp = 0;
1213 //static result File::GetAttributes(const Tizen::Base::String& filePath,
1214 // FileAttributes& attribute) {
1215 // typedef result (File::*methodType)(const Tizen::Base::String& filePath,
1216 // FileAttributes& attribute);
1217 // static methodType GetAttributesp = 0;
1220 //static const Tizen::Base::String File::GetFileExtension(
1221 // const Tizen::Base::String& filePath) {
1222 // typedef const Tizen::Base::String (File::*methodType)(
1223 // const Tizen::Base::String& filePath);
1224 // static methodType GetFileExtensionp = 0;
1227 //const Tizen::Base::String File::GetFileName(
1228 // const Tizen::Base::String& filePath) {
1229 // typedef const Tizen::Base::String (File::*methodType)(
1230 // const Tizen::Base::String& filePath);
1231 // static methodType GetFileNamep = 0;
1232 // Tizen::Base::String ret;
1234 // if (!GetFileNamep) {
1235 // probeBlockStart();
1236 // void *tmpPtr = dlsym(RTLD_NEXT,
1237 // "_ZN5Tizen2Io4File11GetFileNameERKNS_4Base6StringE");
1239 // if (tmpPtr == NULL || dlerror() != NULL) {
1240 // perror("dlsym failed : Tizen::Io::File::GetFileName");
1244 // memcpy(&GetFileNamep, &tmpPtr, sizeof(tmpPtr));
1247 // ret = (File::(*GetFileNamep))(filePath);
1251 //static bool File::IsEncrypted(const Tizen::Base::String &filePath) {
1252 // typedef bool (File::*methodType)(const Tizen::Base::String &filePath);
1253 // static methodType IsEncryptedp = 0;
1256 //static bool File::IsFileExist(const Tizen::Base::String& filePath) {
1257 // typedef bool (File::*methodType)(const Tizen::Base::String& filePath);
1258 // static methodType IsFileExistp = 0;
1261 //static result File::Move(const Tizen::Base::String& oldFilePath,
1262 // const Tizen::Base::String& newFilePath) {
1263 // typedef result (File::*methodType)(const Tizen::Base::String& oldFilePath,
1264 // const Tizen::Base::String& newFilePath);
1265 // static methodType Movep = 0;
1268 //static result File::Remove(const Tizen::Base::String& filePath) {
1269 // typedef result (File::*methodType)(const Tizen::Base::String& filePath);
1270 // static methodType Removep = 0;