2

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?

4

2 回答 2

1

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.

于 2009-04-16T04:54:23.120 回答
1

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

于 2009-04-16T05:12:45.743 回答