views:

275

answers:

2

Hi there...

I'm working on a C daemon that monitors a configuration file (updated using a web interface) and then uses the Linux "tc" (traffic control) command to update the systems traffic shaping configuration.

What's a good way to actually invoke the tc program? Should I use the exec family? Is there a library I can use that would be a bit more elegant? Using exec or system just seems a bit hacky to me.

Any ideas?

+2  A: 

Why don't you look at the source code of the tc program and figure out how to modify the systems traffic shaping configuration directly from your deamon? That would save you calling tc and parsing it's output.

lothar
I have looked it over a bit...it uses netlink socket API which I dislike working with. I was hoping there would be a better/easier way. Maybe just a fantasy :)
ChrisDiRulli
+1  A: 

Look at popen http://linux.die.net/man/3/popen

hiena