Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Wrapping the select() library function
Ref. No. QNX.000001751
Category(ies) Development
Issue We need to "wrap" the select() system call.
i.e. we want to override select() with our own version:

x09x09int select(.....)
x09x09{
x09x09x09/* do stuff */
x09x09x09invoke the system select()
x09x09x09/* do other stuff */
x09x09}

Therefore, we need a way to get at the original, system select().  On most Unix systems, two symbols are provided for the select() system call: select and _select, so we can use the _select symbol to get at the system select().  On other Unix systems you can use the syscall() function to invoke the select() system call.

QNX does not have the _select symbol or the syscall() function.  So, is it possible to wrap the select() system call?

Solution The easiest way to do the selects is by making a myselect function.

<t.c >

myselect(){
x09.
x09.
x09select()
x09.
x09.
}

<i.h >

#define select myselect

and do not include the i.h in the t.c and it will be two different selects.