tizen 2.3 release
[framework/system/swap-probe.git] / probe_graphics / da_egl_tizen.cpp
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  *
8  * Vitaliy Cherepanov <v.cherepanov@samsung.com>
9  *
10  * This library is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU Lesser General Public License as published by the
12  * Free Software Foundation; either version 2.1 of the License, or (at your option)
13  * any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
16  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this library; if not, write to the Free Software Foundation, Inc., 51
22  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  * Contributors:
25  * - S-Core Co., Ltd
26  * - Samsung RnD Institute Russia
27  *
28  */
29
30 #include <egl_macro.h>
31 #include <egl.h>
32 #include "da_gles20.h"
33 #include "daprobe.h"
34 #include "binproto.h"
35 #include "common_probe_init.h"
36
37 #ifndef BEFORE_EGL
38 #define BEFORE_EGL      BEFORE_EGL_TIZEN
39 #endif
40
41 static enum DaOptions _sopt = OPT_GLES;
42 static __thread EGLint egl_error_external = EGL_SUCCESS;
43
44 EGLint eglGetError(void)
45 {
46         typedef EGLint (*methodType)(void);
47         BEFORE_EGL(eglGetError);
48         EGLint ret = eglGetErrorp();
49
50         if (egl_error_external == EGL_SUCCESS)
51                 egl_error_external = ret;
52
53         if (blockresult) {
54                 //external call
55                 ret = egl_error_external;
56                 egl_error_external = EGL_SUCCESS;
57         }
58
59         AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
60
61         return ret;
62 }
63
64 EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
65 {
66         typedef EGLDisplay (*methodType)(EGLNativeDisplayType display_id);
67         /* probe prepare */
68         BEFORE_EGL(eglGetDisplay);
69         /* call original function */
70         EGLDisplay ret = eglGetDisplayp(display_id);
71         /* get error code */
72         EGL_GET_ERROR();
73         /* pack and send */
74         AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "", "p",
75               voidp_to_uint64(display_id));
76         return ret;
77 }
78
79 EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
80 {
81         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLint *major,
82                                          EGLint *minor);
83         /* probe prepare */
84         BEFORE_EGL(eglInitialize);
85         /* call original function */
86         EGLBoolean ret = eglInitializep(dpy, major, minor);
87         /* get error code */
88         EGL_GET_ERROR();
89         /* pack and send */
90         AFTER('d', ret, APITYPE_CONTEXT, "", "ppp", voidp_to_uint64(dpy),
91               voidp_to_uint64(major), voidp_to_uint64(minor));
92         return ret;
93 }
94
95 EGLBoolean eglTerminate(EGLDisplay dpy)
96 {
97         typedef EGLBoolean (*methodType)(EGLDisplay dpy);
98         /* probe prepare */
99         BEFORE_EGL(eglTerminate);
100         /* call original function */
101         EGLBoolean ret = eglTerminatep(dpy);
102         /* get error code */
103         EGL_GET_ERROR();
104         /* pack and send */
105         AFTER('d', ret, APITYPE_CONTEXT, "", "p", voidp_to_uint64(dpy));
106         return ret;
107 }
108
109 const char *eglQueryString(EGLDisplay dpy, EGLint name)
110 {
111         typedef const char *(*methodType)(EGLDisplay dpy, EGLint name);
112         /* probe prepare */
113         BEFORE_EGL(eglQueryString);
114         /* call original function */
115         const char *ret = eglQueryStringp(dpy, name);
116         /* get error code */
117         EGL_GET_ERROR();
118         /* pack and send */
119         AFTER('s', ret, APITYPE_CONTEXT, "", "pd", voidp_to_uint64(dpy), name);
120         return ret;
121 }
122
123 EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size,
124                          EGLint *num_config)
125 {
126         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLConfig *configs,
127                                          EGLint config_size,
128                                          EGLint *num_config);
129         /* probe prepare */
130         BEFORE_EGL(eglGetConfigs);
131         /* call original function */
132         EGLBoolean ret = eglGetConfigsp(dpy, configs, config_size, num_config);
133         /* get error code */
134         EGL_GET_ERROR();
135         /* pack and send */
136         AFTER('d', ret, APITYPE_CONTEXT, "", "ppdp",
137               voidp_to_uint64(dpy), voidp_to_uint64(configs), config_size,
138               voidp_to_uint64(num_config));
139         return ret;
140 }
141
142 EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
143                            EGLConfig *configs, EGLint config_size,
144                            EGLint *num_config)
145 {
146         typedef EGLBoolean (*methodType)(EGLDisplay dpy,
147                                          const EGLint *attrib_list,
148                                          EGLConfig *configs, EGLint config_size,
149                                          EGLint *num_config);
150         /* probe prepare */
151         BEFORE_EGL(eglChooseConfig);
152         /* call original function */
153         EGLBoolean ret = eglChooseConfigp(dpy, attrib_list, configs,
154                                           config_size, num_config);
155         /* get error code */
156         EGL_GET_ERROR();
157         /* pack and send */
158         AFTER('d', ret, APITYPE_CONTEXT, "",
159               "pppdp", voidp_to_uint64(dpy), voidp_to_uint64(attrib_list),
160               voidp_to_uint64(configs), config_size,
161               voidp_to_uint64(num_config));
162         return ret;
163 }
164
165 EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
166                               EGLint attribute, EGLint *value)
167 {
168         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLConfig config,
169                                          EGLint attribute, EGLint *value);
170         /* probe prepare */
171         BEFORE_EGL(eglGetConfigAttrib);
172         /* call original function */
173         EGLBoolean ret = eglGetConfigAttribp(dpy, config, attribute, value);
174         /* get error code */
175         EGL_GET_ERROR();
176         /* pack and send */
177         AFTER('d', ret, APITYPE_CONTEXT, "",
178               "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(config), attribute,
179               voidp_to_uint64(value));
180         return ret;
181 }
182
183 EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
184                                   EGLNativeWindowType win,
185                                   const EGLint *attrib_list)
186 {
187         typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
188                                          EGLNativeWindowType win,
189                                          const EGLint *attrib_list);
190         /* probe prepare */
191         BEFORE_EGL(eglCreateWindowSurface);
192         /* call original function */
193         EGLSurface ret = eglCreateWindowSurfacep(dpy, config, win, attrib_list);
194
195         /* get error code */
196         EGL_GET_ERROR();
197         /* pack and send */
198         AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
199               "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
200               voidp_to_uint64(win), voidp_to_uint64(attrib_list));
201         return ret;
202 }
203
204 EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
205                                    const EGLint *attrib_list)
206 {
207         typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
208                                          const EGLint *attrib_list);
209         /* probe prepare */
210         BEFORE_EGL(eglCreatePbufferSurface);
211         /* call original function */
212         EGLSurface ret = eglCreatePbufferSurfacep(dpy, config, attrib_list);
213         /* get error code */
214         EGL_GET_ERROR();
215         /* pack and send */
216         AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
217               "ppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
218               voidp_to_uint64(attrib_list));
219         return ret;
220 }
221
222 EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
223                                   EGLNativePixmapType pixmap,
224                                   const EGLint *attrib_list)
225 {
226         typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
227                                          EGLNativePixmapType pixmap,
228                                          const EGLint *attrib_list);
229         /* probe prepare */
230         BEFORE_EGL(eglCreatePixmapSurface);
231         /* call original function */
232         EGLSurface ret = eglCreatePixmapSurfacep(dpy, config, pixmap,
233                                                  attrib_list);
234         /* get error code */
235         EGL_GET_ERROR();
236         /* pack and send */
237         AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
238               "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
239               voidp_to_uint64(pixmap), voidp_to_uint64(attrib_list));
240         return ret;
241 }
242
243 EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
244 {
245         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface);
246         /* probe prepare */
247         BEFORE_EGL(eglDestroySurface);
248         /* call original function */
249         EGLBoolean ret = eglDestroySurfacep(dpy, surface);
250         /* get error code */
251         EGL_GET_ERROR();
252         /* pack and send */
253         AFTER('d', ret, APITYPE_CONTEXT, "",
254               "pp", voidp_to_uint64(dpy), voidp_to_uint64(surface));
255         return ret;
256 }
257
258 EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute,
259                            EGLint *value)
260 {
261         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
262                                          EGLint attribute, EGLint *value);
263         /* probe prepare */
264         BEFORE_EGL(eglQuerySurface);
265         /* call original function */
266         EGLBoolean ret = eglQuerySurfacep(dpy, surface, attribute, value);
267         /* get error code */
268         EGL_GET_ERROR();
269         /* pack and send */
270         AFTER('d', ret, APITYPE_CONTEXT, "",
271               "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(surface),
272               attribute, voidp_to_uint64(value));
273         return ret;
274 }
275
276 EGLBoolean eglBindAPI(EGLenum api)
277 {
278         typedef EGLBoolean (*methodType)(EGLenum api);
279         /* probe prepare */
280         BEFORE_EGL(eglBindAPI);
281         /* call original function */
282         EGLBoolean ret = eglBindAPIp(api);
283         /* get error code */
284         EGL_GET_ERROR();
285         /* pack and send */
286         AFTER('d', ret, APITYPE_CONTEXT, "",
287               "d", api);
288         return ret;
289 }
290
291 EGLenum eglQueryAPI(void)
292 {
293         typedef EGLenum (*methodType)(void);
294         /* probe prepare */
295         BEFORE_EGL(eglQueryAPI);
296         /* call original function */
297         EGLenum ret = eglQueryAPIp();
298         /* get error code */
299         EGL_GET_ERROR();
300         /* pack and send */
301         AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
302         return ret;
303 }
304
305 EGLBoolean eglWaitClient(void)
306 {
307         typedef EGLBoolean (*methodType)(void);
308         /* probe prepare */
309         BEFORE_EGL(eglWaitClient);
310         /* call original function */
311         EGLBoolean ret = eglWaitClientp();
312         /* get error code */
313         EGL_GET_ERROR();
314         /* pack and send */
315         AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
316         return ret;
317 }
318
319 EGLBoolean eglReleaseThread(void)
320 {
321         typedef EGLBoolean (*methodType)(void);
322         /* probe prepare */
323         BEFORE_EGL(eglReleaseThread);
324         /* call original function */
325         EGLBoolean ret = eglReleaseThreadp();
326         /* get error code */
327         EGL_GET_ERROR();
328         /* pack and send */
329         AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
330         return ret;
331 }
332
333 EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
334                                             EGLClientBuffer buffer,
335                                             EGLConfig config,
336                                             const EGLint *attrib_list)
337 {
338         typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLenum buftype,
339                                          EGLClientBuffer buffer,
340                                          EGLConfig config,
341                                          const EGLint *attrib_list);
342         /* probe prepare */
343         BEFORE_EGL(eglCreatePbufferFromClientBuffer);
344         /* call original function */
345         EGLSurface ret = eglCreatePbufferFromClientBufferp(dpy, buftype, buffer,
346                                                            config, attrib_list);
347         /* get error code */
348         EGL_GET_ERROR();
349         /* pack and send */
350         AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
351               "pdppp", voidp_to_uint64(dpy), buftype, voidp_to_uint64(buffer),
352               voidp_to_uint64(config), voidp_to_uint64(attrib_list));
353         return ret;
354 }
355
356 EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
357                             EGLint attribute, EGLint value)
358 {
359         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
360                                          EGLint attribute, EGLint value);
361         /* probe prepare */
362         BEFORE_EGL(eglSurfaceAttrib);
363         /* call original function */
364         EGLBoolean ret = eglSurfaceAttribp(dpy, surface, attribute, value);
365         /* get error code */
366         EGL_GET_ERROR();
367         /* pack and send */
368         AFTER('d', ret, APITYPE_CONTEXT, "",
369               "ppdd", voidp_to_uint64(dpy), voidp_to_uint64(surface), attribute,
370               value);
371         return ret;
372 }
373
374 EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
375 {
376         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
377                                          EGLint buffer);
378         /* probe prepare */
379         BEFORE_EGL(eglBindTexImage);
380         /* call original function */
381         EGLBoolean ret = eglBindTexImagep(dpy, surface, buffer);
382         /* get error code */
383         EGL_GET_ERROR();
384         /* pack and send */
385         AFTER('d', ret, APITYPE_CONTEXT, "",
386               "ppd", voidp_to_uint64(dpy), voidp_to_uint64(surface), buffer);
387         return ret;
388 }
389
390 EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
391 {
392         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
393                                          EGLint buffer);
394         /* probe prepare */
395         BEFORE_EGL(eglReleaseTexImage);
396         /* call original function */
397         EGLBoolean ret = eglReleaseTexImagep(dpy, surface, buffer);
398         /* get error code */
399         EGL_GET_ERROR();
400         /* pack and send */
401         AFTER('d', ret, APITYPE_CONTEXT, "",
402               "ppd", voidp_to_uint64(dpy), voidp_to_uint64(surface), buffer);
403         return ret;
404 }
405
406 EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
407 {
408         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLint interval);
409         /* probe prepare */
410         BEFORE_EGL(eglSwapInterval);
411         /* call original function */
412         EGLBoolean ret = eglSwapIntervalp(dpy, interval);
413         /* get error code */
414         EGL_GET_ERROR();
415         /* pack and send */
416         AFTER('d', ret, APITYPE_CONTEXT, "",
417               "pd", voidp_to_uint64(dpy), interval);
418         return ret;
419 }
420
421 EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
422                             EGLContext share_context, const EGLint *attrib_list)
423 {
424         typedef EGLContext (*methodType)(EGLDisplay dpy, EGLConfig config,
425                                          EGLContext share_context,
426                                          const EGLint *attrib_list);
427         /* probe prepare */
428         BEFORE_EGL(eglCreateContext);
429         /* call original function */
430         EGLContext ret = eglCreateContextp(dpy, config, share_context,
431                                            attrib_list);
432         /* get error code */
433         EGL_GET_ERROR();
434         /* pack and send */
435
436         AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
437               "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
438               voidp_to_uint64(share_context), voidp_to_uint64(attrib_list));
439         return ret;
440 }
441
442 EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
443 {
444         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLContext ctx);
445         /* probe prepare */
446         BEFORE_EGL(eglDestroyContext);
447         /* call original function */
448         EGLBoolean ret = eglDestroyContextp(dpy, ctx);
449         /* get error code */
450         EGL_GET_ERROR()
451
452         /* pack and send */
453         AFTER('d', ret, APITYPE_CONTEXT, "",
454               "pp", voidp_to_uint64(dpy), voidp_to_uint64(ctx));
455         return ret;
456 }
457
458 EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
459                           EGLContext ctx)
460 {
461         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface draw,
462                                          EGLSurface read, EGLContext ctx);
463         /* probe prepare */
464         BEFORE_EGL(eglMakeCurrent);
465         /* call original function */
466         EGLBoolean ret = eglMakeCurrentp(dpy, draw, read, ctx);
467         /* get error code */
468         EGL_GET_ERROR();
469         /* pack and send */
470         AFTER('d', ret, APITYPE_CONTEXT, "",
471               "pppp", voidp_to_uint64(dpy), voidp_to_uint64(draw),
472               voidp_to_uint64(read), voidp_to_uint64(ctx));
473         return ret;
474 }
475
476 EGLContext eglGetCurrentContext(void)
477 {
478         typedef EGLContext (*methodType)(void);
479         /* probe prepare */
480         BEFORE_EGL(eglGetCurrentContext);
481         /* call original function */
482         EGLContext ret = eglGetCurrentContextp();
483
484         /* get error code */
485         EGL_GET_ERROR();
486         /* pack and send */
487         AFTER_NO_PARAM('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "");
488         return ret;
489 }
490
491 EGLSurface eglGetCurrentSurface(EGLint readdraw)
492 {
493         typedef EGLSurface (*methodType)(EGLint readdraw);
494         /* probe prepare */
495         BEFORE_EGL(eglGetCurrentSurface);
496         /* call original function */
497         EGLSurface ret = eglGetCurrentSurfacep(readdraw);
498         /* get error code */
499         EGL_GET_ERROR();
500         /* pack and send */
501         AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
502               "d", readdraw);
503         return ret;
504 }
505
506 EGLDisplay eglGetCurrentDisplay(void)
507 {
508         typedef EGLDisplay (*methodType)(void);
509         /* probe prepare */
510         BEFORE_EGL(eglGetCurrentDisplay);
511         /* call original function */
512         EGLDisplay ret = eglGetCurrentDisplayp();
513         /* get error code */
514         EGL_GET_ERROR();
515         /* pack and send */
516         AFTER_NO_PARAM('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "");
517         return ret;
518 }
519
520 EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute,
521                            EGLint *value)
522 {
523         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLContext ctx,
524                                          EGLint attribute, EGLint *value);
525         /* probe prepare */
526         BEFORE_EGL(eglQueryContext);
527         /* call original function */
528         EGLBoolean ret = eglQueryContextp(dpy, ctx, attribute, value);
529         /* get error code */
530         EGL_GET_ERROR();
531         /* pack and send */
532         AFTER('d', ret, APITYPE_CONTEXT, "",
533               "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(ctx),
534               attribute, voidp_to_uint64(value));
535         return ret;
536 }
537
538 EGLBoolean eglWaitGL(void)
539 {
540         typedef EGLBoolean (*methodType)(void);
541         /* probe prepare */
542         BEFORE_EGL(eglWaitGL);
543         /* call original function */
544         EGLBoolean ret = eglWaitGLp();
545         /* get error code */
546         EGL_GET_ERROR();
547         /* pack and send */
548         AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
549         return ret;
550 }
551
552 EGLBoolean eglWaitNative(EGLint engine)
553 {
554         typedef EGLBoolean (*methodType)(EGLint engine);
555         /* probe prepare */
556         BEFORE_EGL(eglWaitNative);
557         /* call original function */
558         EGLBoolean ret = eglWaitNativep(engine);
559         /* get error code */
560         EGL_GET_ERROR();
561         /* pack and send */
562         AFTER('d', ret, APITYPE_CONTEXT, "",
563               "d", engine);
564         return ret;
565 }
566
567 EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
568 {
569         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface);
570         BEFORE_EGL(eglSwapBuffers);
571         EGLBoolean ret = eglSwapBuffersp(dpy, surface);
572         EGL_GET_ERROR();
573         AFTER('d', ret, APITYPE_CONTEXT, "",
574               "pp", voidp_to_uint64(dpy), voidp_to_uint64(surface));
575         return ret;
576 }
577
578 EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
579                           EGLNativePixmapType target)
580 {
581         typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
582                                          EGLNativePixmapType target);
583         /* probe prepare */
584         BEFORE_EGL(eglCopyBuffers);
585         /* call original function */
586         EGLBoolean ret = eglCopyBuffersp(dpy, surface, target);
587         /* get error code */
588         EGL_GET_ERROR();
589         /* pack and send */
590         AFTER('d', ret, APITYPE_CONTEXT, "",
591               "ppp", voidp_to_uint64(dpy), voidp_to_uint64(surface),
592               voidp_to_uint64(target));
593         return ret;
594 }
595
596 #define __eglGetProcAddress_t __eglMustCastToProperFunctionPointerType
597 EGLAPI __eglGetProcAddress_t eglGetProcAddress(const char *procname)
598 {
599         typedef EGLAPI __eglGetProcAddress_t(*methodType)(const char *procname);
600         /* probe prepare */
601         BEFORE_EGL(eglGetProcAddress);
602         /* call original function */
603         __eglGetProcAddress_t ret = eglGetProcAddressp(procname);
604         /* get error code */
605         EGL_GET_ERROR();
606         /* pack and send */
607         AFTER('p', voidp_to_uint64((void *)ret), APITYPE_CONTEXT, "",
608               "s", procname);
609         return ret;
610 }
611