Overloading QNX system call

Hi,

I am trying to overload QNX system calls. It will be great if anybody can send me example for overloading QNX system call.

Thanks in advance

What call? Depending on the type of call, this can easy, difficult, impossible. Do you want to do this for a program you are compiling yourself or for every program.

Hi,

I am trying to overload printf system call or more lower level system call which printf intenerally uses.
I want to overload printf for the all programs executing on my target system.

Thanks…

Since printf is in libc, you would need to replace it or perhaps somehow patch it. I wouldn’t think this was a good idea (if possible). What are you trying to accomplish? Since printf simply writes output to stdout, you can redirect that anyway you want - which should be easier than patching libc.

Rick…

Rick,

I want to redirect output of printf to “slogger” utility of QNX instead of stdout. (very similar to “vslogf” system call) Do you know any other better option to achieve this?

Thanks

Worse case, if it has to be generic, create a resource manager with a name of /dev/printf (or whatever) and then do a reopen /dev/printf on boot. Now your resource manager will get all the output from any app using printf and you can then call vslogf from the io_read function.

Rick…

Or do “program | router”. Router being a simple program that takes data from stdin and send it to slogger.