On Wed, 9 Jun 2004, Shachar Shemesh wrote: > Hi all, > > I'm trying to provide a library call that will run a ping to a server. > The catch is that it needs to be done as a non-root user, and I would > like to avoid any solution that involves any SUID or root running > processes beyond what is already there. That leaves me, pretty much, "ping". > > The catch is that I get a timeout value, and I'm asked to abort if the > operation is not complete within that time (and report status). > The code I'm using is doing the following (pseudo code warning): > block sigchld > fork > (child - execve ping -c 1 -n -q hostname) > pselect for timeout or sigchld > kill INT the ping > waitpid to get status.
man pthread_create man pthread_mutex_init good luck. M. > > Now here's the thing. Sometimes, I can see that the ping returned fairly > immediately, but the full timeout was spent. I suspect that, due to the > fact pselect is not a system call in Linux, ping has indeed finished > before the pselect, and the signal got lost. Does anyone have any > alternative solutions to implement what I'm doing here? > > Shachar > > -- > Shachar Shemesh > Lingnu Open Source Consulting ltd. > http://www.lingnu.com/ > > > ================================================================= > To unsubscribe, send mail to [EMAIL PROTECTED] with > the word "unsubscribe" in the message body, e.g., run the command > echo unsubscribe | mail [EMAIL PROTECTED] > > ................................................ Max Kovgan. . email: maxk _at_ cs.technion.ac.il . phone: 972-4-8294528 . ................................................ ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]