1 /**************************************************************************
5 Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
7 Contact: Boram Park <boram1288.park@samsung.com>
8 Sangjin LEE <lsj119@samsung.com>
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 **************************************************************************/
39 #include <sys/types.h>
40 #include <sys/fcntl.h>
48 #include <sys/socket.h>
49 #include <linux/socket.h>
51 #ifdef HAS_GETPEERUCRED
57 #include <X11/Xatom.h>
58 #include <X11/extensions/XI2proto.h>
59 #include <X11/extensions/Xvproto.h>
60 #include <windowstr.h>
63 #include "xdbg_types.h"
64 #include "xdbg_module.h"
65 #include "xdbg_module_evlog.h"
66 #include "xdbg_evlog.h"
71 #define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
73 static Bool xev_trace_on = FALSE;
74 static int xev_trace_fd = -1;
75 static int xev_trace_record_fd = -1;
76 static Atom atom_rotate = None;
77 static Atom atom_client_pid = None;
80 static void evtRecord (int fd, EvlogInfo *evinfo)
82 extern ExtensionInfo Evlog_extensions[];
83 extern int Extensions_size;
87 XDBG_RETURN_IF_FAIL (fd >= 0)
88 XDBG_RETURN_IF_FAIL (evinfo != NULL);
90 write_len = sizeof (int) +
95 if (evinfo->mask & EVLOG_MASK_CLIENT)
96 write_len += sizeof (EvlogClient);
98 if (evinfo->mask & EVLOG_MASK_REQUEST)
99 write_len += (sizeof (EvlogRequest) + (evinfo->req.length * 4));
101 if (evinfo->mask & EVLOG_MASK_EVENT)
102 write_len += (sizeof (EvlogEvent) + evinfo->evt.size);
104 if (evinfo->mask & EVLOG_MASK_REPLY)
105 write_len += (sizeof (EvlogReply) + evinfo->rep.size);
107 if (evinfo->mask & EVLOG_MASK_ERROR)
108 write_len += (sizeof (EvlogError));
110 if (evinfo->mask & EVLOG_MASK_ATOM)
111 write_len += (sizeof (int) +
112 (sizeof (EvlogAtomTable) * evinfo->evatom.size));
114 if (evinfo->mask & EVLOG_MASK_REGION)
115 write_len += (sizeof (int) +
116 (sizeof (EvlogRegionTable) * evinfo->evregion.size));
119 write_len += (sizeof (int) +
120 ((sizeof (int) * 3) * Extensions_size));
122 if (write (fd, &write_len, sizeof(int)) == -1)
124 XDBG_ERROR (MXDBG, "failed: write write_len\n");
130 if (write (fd, &Extensions_size, sizeof(int)) == -1)
132 XDBG_ERROR (MXDBG, "failed: write Extensions_size\n");
136 for (i = 0 ; i < Extensions_size ; i++)
138 if (write (fd, &Evlog_extensions[i].opcode, sizeof(int)) == -1)
140 XDBG_ERROR (MXDBG, "failed: write Evlog_extensions[%d] opcode\n", i);
143 if (write (fd, &Evlog_extensions[i].evt_base, sizeof(int)) == -1)
145 XDBG_ERROR (MXDBG, "failed: write Evlog_extensions[%d] evt_base\n", i);
148 if (write (fd, &Evlog_extensions[i].err_base, sizeof(int)) == -1)
150 XDBG_ERROR (MXDBG, "failed: write Evlog_extensions[%d] err_base\n", i);
158 if (write (fd, &evinfo->time, sizeof(CARD32)) == -1)
160 XDBG_ERROR (MXDBG, "failed: write msec\n");
163 if (write (fd, &evinfo->type, sizeof(EvlogType)) == -1)
165 XDBG_ERROR (MXDBG, "failed: write type\n");
168 if (write (fd, &evinfo->mask, sizeof(int)) == -1)
170 XDBG_ERROR (MXDBG, "failed: write mask\n");
174 if (evinfo->mask & EVLOG_MASK_CLIENT)
175 if (write (fd, &evinfo->client, sizeof (EvlogClient)) == -1)
177 XDBG_ERROR (MXDBG, "failed: write client\n");
181 if (evinfo->mask & EVLOG_MASK_REQUEST)
183 if (write (fd, &evinfo->req, sizeof (EvlogRequest)) == -1)
185 XDBG_ERROR (MXDBG, "failed: write request\n");
188 if (write (fd, evinfo->req.ptr, (evinfo->req.length * 4)) == -1)
190 XDBG_ERROR (MXDBG, "failed: write request\n");
194 if (evinfo->mask & EVLOG_MASK_EVENT)
196 if (write (fd, &evinfo->evt, sizeof (EvlogEvent)) == -1)
198 XDBG_ERROR (MXDBG, "failed: write event\n");
202 XDBG_WARNING_IF_FAIL (evinfo->evt.size > 0);
203 if (write (fd, evinfo->evt.ptr, evinfo->evt.size) == -1)
205 XDBG_ERROR (MXDBG, "failed: write event\n");
209 if (evinfo->mask & EVLOG_MASK_REPLY)
211 if (write (fd, &evinfo->rep, sizeof (EvlogReply)) == -1)
213 XDBG_ERROR (MXDBG, "failed: write reply\n");
217 XDBG_WARNING_IF_FAIL (evinfo->rep.size > 0);
218 if (write (fd, evinfo->rep.ptr, evinfo->rep.size) == -1)
220 XDBG_ERROR (MXDBG, "failed: write reply\n");
224 if (evinfo->mask & EVLOG_MASK_ERROR)
226 if (write (fd, &evinfo->err, sizeof (EvlogError)) == -1)
228 XDBG_ERROR (MXDBG, "failed: write reply\n");
233 if (evinfo->mask & EVLOG_MASK_ATOM)
235 EvlogAtomTable *table;
237 if (write (fd, &evinfo->evatom.size, sizeof (int)) == -1)
239 XDBG_ERROR (MXDBG, "failed: write atom size\n");
242 xorg_list_for_each_entry(table, &evinfo->evatom.list, link)
243 if (write (fd, table, sizeof (EvlogAtomTable)) == -1)
245 XDBG_ERROR (MXDBG, "failed: write atom table\n");
250 if (evinfo->mask & EVLOG_MASK_REGION)
252 EvlogRegionTable *table;
254 if (write (fd, &evinfo->evregion.size, sizeof (int)) == -1)
256 XDBG_ERROR (MXDBG, "failed: write region size\n");
259 xorg_list_for_each_entry(table, &evinfo->evregion.list, link)
260 if (write (fd, table, sizeof (EvlogRegionTable)) == -1)
262 XDBG_ERROR (MXDBG, "failed: write region table\n");
268 static void evtPrintF (int fd, EvlogInfo *evinfo, char *log)
273 dprintf (fd, "%s", log);
276 static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev, ReplyInfoRec *rep)
278 EvlogInfo evinfo = {0,};
279 static int EntryInit = 0;
287 ModuleClientInfo *info = GetClientInfo (client);
288 XDBG_RETURN_IF_FAIL (info != NULL);
290 evinfo.mask |= EVLOG_MASK_CLIENT;
291 evinfo.client.index = info->index;
292 evinfo.client.pid = info->pid;
293 evinfo.client.gid = info->gid;
294 evinfo.client.uid = info->uid;
295 strncpy (evinfo.client.command, info->command, strlen (info->command));
296 evinfo.client.pClient = (void*)client;
305 evinfo.mask |= EVLOG_MASK_REQUEST;
306 evinfo.req.id = stuff->reqType;
307 evinfo.req.length = client->req_len;
308 evinfo.req.ptr = client->requestBuffer;
310 if (client->requestVector == InitialVector && stuff->reqType == 1)
311 snprintf (evinfo.req.name, sizeof (evinfo.req.name), "%s", conn[0]);
312 else if (client->requestVector == InitialVector && stuff->reqType == 2)
313 snprintf (evinfo.req.name, sizeof (evinfo.req.name), "%s", conn[1]);
316 if (stuff->reqType < EXTENSION_BASE)
317 snprintf (evinfo.req.name, sizeof (evinfo.req.name), "%s",
318 LookupRequestName (stuff->reqType, 0));
320 snprintf (evinfo.req.name, sizeof (evinfo.req.name), "%s",
321 LookupRequestName (stuff->reqType, stuff->data));
330 evinfo.mask |= EVLOG_MASK_REPLY;
331 evinfo.rep.reqType = stuff->reqType;
332 evinfo.rep.reqData = stuff->data;
333 evinfo.rep.ptr = (xGenericReply*)rep->replyData;
334 evinfo.rep.size = rep->dataLenBytes - rep->padBytes;
335 evinfo.rep.isStart = rep->startOfReply;
337 if (stuff->reqType < EXTENSION_BASE)
338 snprintf (evinfo.rep.name, sizeof (evinfo.rep.name), "%s",
339 LookupRequestName (stuff->reqType, 0));
341 snprintf (evinfo.rep.name, sizeof (evinfo.rep.name), "%s",
342 LookupRequestName (stuff->reqType, stuff->data));
352 err = (xError *) rep->replyData;
354 evinfo.mask |= EVLOG_MASK_ERROR;
355 evinfo.err.errorCode = err->errorCode;
356 evinfo.err.resourceID = err->resourceID;
357 evinfo.err.minorCode = err->minorCode;
358 evinfo.err.majorCode = err->majorCode;
367 evinfo.mask |= EVLOG_MASK_EVENT;
369 snprintf (evinfo.evt.name, sizeof (evinfo.evt.name), "%s",
370 LookupEventName ((int)(ev->u.u.type)));
375 evinfo.time = GetTimeInMillis ();
377 /* get extension entry */
378 if (!EntryInit && !xDbgEvlogGetExtensionEntry (NULL))
383 if (!xDbgEvlogRuleValidate (&evinfo))
386 if (xev_trace_record_fd >= 0)
388 xDbgEvlogFillLog (&evinfo, TRUE, NULL, NULL);
389 evtRecord (xev_trace_record_fd, &evinfo);
394 int size = sizeof (log);
396 xDbgEvlogFillLog (&evinfo, TRUE, log, &size);
397 evtPrintF (xev_trace_fd, &evinfo, log);
400 /* evatom initialize */
401 xDbgDistroyAtomList(&evinfo);
402 xDbgDistroyRegionList(&evinfo);
406 _traceGetWindowName (ClientPtr client, Window window)
410 Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess;
413 static char winname[128];
416 rc = dixLookupWindow (&pWin, window, client, win_mode);
420 property = MakeAtom ("WM_NAME", strlen ("WM_NAME"), TRUE);
423 rc = dixLookupProperty (&pProp, pWin, property, client, prop_mode);
424 if (rc == Success && pProp->data)
426 datalen = (pProp->size>127) ?127:pProp->size;
427 strncpy (winname, pProp->data, datalen);
428 winname[datalen] = 0;
440 _traceFlush (CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
442 if (xev_trace_on == FALSE)
445 evtPrint (FLUSH, NULL, NULL, NULL);
449 _traceAReply (CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
451 if (xev_trace_on == FALSE)
454 ReplyInfoRec *pri = (ReplyInfoRec*)calldata;
456 evtPrint (REPLY, pri->client, NULL, pri);
460 _traceEvent (CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
462 EventInfoRec *pei = (EventInfoRec*)calldata;
464 ModuleClientInfo *info;
465 int ev; /* event index */
466 static int xi2_opcode = -1;
468 static char* ename[]=
476 XDBG_RETURN_IF_FAIL (pei != NULL);
478 pClient = pei->client;
479 XDBG_RETURN_IF_FAIL (pClient != NULL);
482 XDBG_RETURN_IF_FAIL (pev != NULL);
484 info = GetClientInfo (pClient);
485 XDBG_RETURN_IF_FAIL (info != NULL);
487 for (ev=0; ev < pei->count; ev++, pev++)
489 int type = pev->u.u.type & 0177;
491 if (type < LASTEvent)
497 XDBG_INFO (MXDBG, "%s(%d)_%d(%s.%d : %s.0x%lx) root(%d,%d) win(%d,%d)\n"
498 , ename[type-KeyPress], pev->u.u.detail, pev->u.u.type
499 , info->command, info->pid
500 , _traceGetWindowName (pClient, pev->u.keyButtonPointer.event), pev->u.keyButtonPointer.event
501 , pev->u.keyButtonPointer.rootX, pev->u.keyButtonPointer.rootY
502 , pev->u.keyButtonPointer.eventX, pev->u.keyButtonPointer.eventY);
507 XDBG_INFO (MXDBG, "%s(%d)_%d(%s.%d : %s.0x%lx) root(%d,%d) win(%d,%d)\n"
508 , ename[type-KeyPress], pev->u.u.detail, pev->u.u.type
509 , info->command, info->pid
510 , _traceGetWindowName (pClient, pev->u.keyButtonPointer.event), pev->u.keyButtonPointer.event
511 , pev->u.keyButtonPointer.rootX, pev->u.keyButtonPointer.rootY
512 , pev->u.keyButtonPointer.eventX, pev->u.keyButtonPointer.eventY);
515 if(!xi2_opcode) break;
518 ExtensionEntry *pExt = CheckExtension("XInputExtension");
519 if(!pExt) xi2_opcode = 0;
520 else xi2_opcode = pExt->base;
523 if(((xGenericEvent*)pev)->extension != xi2_opcode) break;
525 xXIDeviceEvent *xidev = (xXIDeviceEvent *)pev;
526 if(xidev->deviceid==2) break;
527 if(xidev->evtype==XI_ButtonPress)
528 XDBG_TRACE (MXDBG, "XI_ButtonPress(%d) device(%d), event win(0x%x), child(0x%x), root(%.f,%.f), win(%.f, %.f)\n", XI_ButtonPress, xidev->deviceid, xidev->event, xidev->child, FP1616toDBL(xidev->root_x), FP1616toDBL(xidev->root_y), FP1616toDBL(xidev->event_x), FP1616toDBL(xidev->event_y));
529 else if(xidev->evtype==XI_ButtonRelease)
530 XDBG_TRACE (MXDBG, "XI_ButtonRelease(%d) device(%d), event win(0x%x), child(0x%x), root(%.f,%.f), win(%.f, %.f)\n", XI_ButtonRelease, xidev->deviceid, xidev->event, xidev->child, FP1616toDBL(xidev->root_x), FP1616toDBL(xidev->root_y), FP1616toDBL(xidev->event_x), FP1616toDBL(xidev->event_y));
531 else if(xidev->evtype==XI_Motion)
532 XDBG_TRACE (MXDBG, "XI_Motion(%d) device(%d), event win(0x%x), child(0x%x), root(%.f,%.f), win(%.f, %.f)\n", XI_Motion, xidev->deviceid, xidev->event, xidev->child, FP1616toDBL(xidev->root_x), FP1616toDBL(xidev->root_y), FP1616toDBL(xidev->event_x), FP1616toDBL(xidev->event_y));
539 if (type != X_Error && xev_trace_on)
540 evtPrint (EVENT, pClient, pev, NULL);
541 else if (type == X_Error && xev_trace_on)
542 evtPrint (ERROR, pClient, pev, NULL);
547 _traceACoreEvents (CallbackListPtr *pcbl, pointer unused, pointer calldata)
549 if (xev_trace_on == FALSE)
552 XaceCoreDispatchRec *rec = calldata;
554 XDBG_RETURN_IF_FAIL (rec != NULL);
556 evtPrint (REQUEST, rec->client, NULL, NULL);
560 _traceAExtEvents (CallbackListPtr *pcbl, pointer unused, pointer calldata)
562 XaceExtAccessRec *rec = calldata;
565 XDBG_RETURN_IF_FAIL (rec != NULL);
567 client = rec->client;
570 if (stuff && stuff->reqType >= EXTENSION_BASE)
572 ExtensionEntry *xext = CheckExtension (XvName);
573 if (xext && stuff->reqType == xext->base)
575 ModuleClientInfo *info = GetClientInfo (client);
576 XDBG_RETURN_IF_FAIL (info != NULL);
582 xvGrabPortReq *req = (xvGrabPortReq *)client->requestBuffer;
583 XDBG_INFO (MXDBG, "%s(port:%d), %s(%d)\n",
584 LookupRequestName (stuff->reqType, stuff->data), req->port,
585 info->command, info->pid);
590 xvUngrabPortReq *req = (xvUngrabPortReq *)client->requestBuffer;
591 XDBG_INFO (MXDBG, "%s(port:%d), %s(%d)\n",
592 LookupRequestName (stuff->reqType, stuff->data), req->port,
593 info->command, info->pid);
598 xvStopVideoReq *req = (xvStopVideoReq *)client->requestBuffer;
599 XDBG_INFO (MXDBG, "%s(port:%d,drawable:0x%lx), %s(%d)\n",
600 LookupRequestName (stuff->reqType, stuff->data),
601 req->port, req->drawable,
602 info->command, info->pid);
612 if (xev_trace_on == FALSE)
615 evtPrint (REQUEST, rec->client, NULL, NULL);
619 _traceAuditEndEvents (CallbackListPtr *pcbl, pointer unused, pointer calldata)
625 _traceProperty (CallbackListPtr *pcbl, pointer unused, pointer calldata)
627 XacePropertyAccessRec *rec = calldata;
628 ModuleClientInfo *info = GetClientInfo (rec->client);
629 PropertyPtr pProp = *rec->ppProp;
630 Atom name = pProp->propertyName;
632 /* Don't care about the new content check */
633 if (rec->client == serverClient || rec->access_mode & DixPostAccess)
636 if (name == atom_client_pid && (rec->access_mode & DixWriteAccess))
638 XDBG_WARNING (MXDBG, "Invalid access X_CLINET_PID pid:%d, uid:%d\n", info->pid, info->uid);
639 rec->status = BadAccess;
643 rec->status = Success;
648 _traceResource (CallbackListPtr *pcbl, pointer unused, pointer calldata)
650 XaceResourceAccessRec *rec = calldata;
651 Mask access_mode = rec->access_mode;
652 ModuleClientInfo *info = GetClientInfo (rec->client);
654 /* Perform the background none check on windows */
655 if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW)
657 WindowPtr pWin = (WindowPtr) rec->res;
661 rc = dixChangeWindowProperty (serverClient,
662 pWin, atom_client_pid, XA_CARDINAL, 32,
663 PropModeReplace, 1, &pid, FALSE);
665 XDBG_ERROR (MXDBG, "failed : set X_CLIENT_PID to %d.\n", pid);
670 _traceReceive (CallbackListPtr *pcbl, pointer unused, pointer calldata)
672 XaceReceiveAccessRec *rec = calldata;
674 if (rec->events->u.u.type != VisibilityNotify)
677 rec->status = BadAccess;
681 xDbgModuleEvlogInstallHooks (XDbgModule *pMod)
685 ret &= AddCallback (&EventCallback, _traceEvent, NULL);
686 ret &= XaceRegisterCallback (XACE_PROPERTY_ACCESS, _traceProperty, NULL);
687 ret &= XaceRegisterCallback (XACE_RESOURCE_ACCESS, _traceResource, NULL);
688 ret &= XaceRegisterCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
690 /*Disable Visibility Event*/
691 ret &= XaceRegisterCallback (XACE_RECEIVE_ACCESS, _traceReceive, NULL);
693 if (atom_client_pid == None)
694 atom_client_pid = MakeAtom ("X_CLIENT_PID", 12, TRUE);
695 if (atom_rotate == None)
696 atom_rotate = MakeAtom ("_E_ILLUME_ROTATE_ROOT_ANGLE", 12, TRUE);
700 XDBG_ERROR (MXDBG, "failed: register one or more callbacks\n");
704 if (pMod && pMod->evlog_path)
705 xDbgModuleEvlogSetEvlogPath (pMod, -1, pMod->evlog_path, NULL, NULL);
711 xDbgModuleEvlogUninstallHooks (XDbgModule *pMod)
713 DeleteCallback (&EventCallback, _traceEvent, NULL);
714 XaceDeleteCallback (XACE_PROPERTY_ACCESS, _traceProperty, NULL);
715 XaceDeleteCallback (XACE_RESOURCE_ACCESS, _traceResource, NULL);
716 XaceDeleteCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
720 xDbgModuleEvlogPrintEvents (XDbgModule *pMod, Bool on, const char * client_name, char *reply, int *len)
724 on = (on)?TRUE:FALSE;
725 if (xev_trace_on == on)
735 for (i=1 ; i< currentMaxClients ; i++)
738 ModuleClientInfo *info;
740 pClient = clients[i];
744 info = GetClientInfo (pClient);
748 if (strlen (info->command) > 0 && strstr (client_name, info->command))
752 if (xev_trace_fd >= 0)
753 close (xev_trace_fd);
755 snprintf (fd_name, 256, "/proc/%d/fd/1", info->pid);
756 xev_trace_fd = open (fd_name, O_RDWR);
757 if (xev_trace_fd < 0)
758 XDBG_REPLY ("failed: open consol '%s'. (%s)\n", fd_name, strerror(errno));
762 ret &= AddCallback (&FlushCallback, _traceFlush, NULL);
763 ret &= AddCallback (&ReplyCallback, _traceAReply, NULL);
764 ret &= XaceRegisterCallback (XACE_CORE_DISPATCH, _traceACoreEvents, NULL);
765 ret &= XaceRegisterCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
766 ret &= XaceRegisterCallback (XACE_AUDIT_END, _traceAuditEndEvents, NULL);
770 XDBG_REPLY ("failed: register one or more callbacks.\n");
776 DeleteCallback (&FlushCallback, _traceFlush, NULL);
777 DeleteCallback (&ReplyCallback, _traceAReply, NULL);
778 XaceDeleteCallback (XACE_CORE_DISPATCH, _traceACoreEvents, NULL);
779 XaceDeleteCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
780 XaceDeleteCallback (XACE_AUDIT_END, _traceAuditEndEvents, NULL);
787 xDbgModuleEvlogInfoSetRule (XDbgModule *pMod, const int argc, const char ** argv, char *reply, int *len)
789 return xDbgEvlogRuleSet (argc, argv, reply, len);
793 xDbgModuleEvlogSetEvlogPath (XDbgModule *pMod, int pid, char *path, char *reply, int *len)
795 char fd_name[XDBG_PATH_MAX];
798 if (!path || strlen (path) <= 0)
800 XDBG_REPLY ("failed: invalid path\n");
804 if (xev_trace_record_fd >= 0)
806 close (xev_trace_record_fd);
807 xev_trace_record_fd = -1;
810 if (!strcmp (path, "console"))
816 if (xev_trace_fd >= 0)
817 close (xev_trace_fd);
819 snprintf (fd_name, sizeof (fd_name), "/proc/%d/fd/1", pid);
821 xev_trace_fd = open (fd_name, O_RDWR);
822 if (xev_trace_fd < 0)
823 XDBG_REPLY ("failed: open consol '%s'. (%s)\n", fd_name, strerror(errno));
830 snprintf (fd_name, XDBG_PATH_MAX, "%s", path);
834 snprintf (fd_name, XDBG_PATH_MAX, "%s/%s", pMod->cwd, path);
836 snprintf (fd_name, XDBG_PATH_MAX, "%s", path);
839 fd_check = open (fd_name, O_RDONLY);
845 xev_trace_record_fd = open (fd_name, O_CREAT|O_RDWR|O_APPEND, 0755);
846 if (xev_trace_record_fd < 0)
848 XDBG_REPLY ("failed: open file '%s'. (%s)\n", fd_name, strerror(errno));