Thanks! I like to use kqueue and it is to redis database update for
multiple processes, possibly among multiple machines. I can have a sentinel
programs spawn off secondary IP sockets to threads and through database
listings, it could notify the thread that a unified operation on sessions
from possibly multiple threads are complete and need to notify the client
and free data. That probably isn't clear enough either. I have a complex
project for allowing folks to notify others of their positive or negative
sexually transmitted disease status, in which I've garnered interest
especially from an epidemiologist from Maryland for a federal grant. I just
need the program to be scalable, and it won't be possible without
multithreading. The iris scanning takes a loooooooong time; on the order of
seconds!!! I came up with the idea, patented it, and programmed it all
myself.

On Sun, Jul 31, 2016, 05:58 Peter J. Philipp <p...@centroid.eu> wrote:

> On Sun, Jul 31, 2016 at 09:05:52AM +0000, Luke Small wrote:
> > I'm trying to do some operations in which I fork and the child closes and
> > simplifies socketpair listings and sends the simpler list of malloced
> file
> > descriptors to a function and sends ioctl data after it opens a socket.
> The
> > parent sends a short greeting to the child to show that it is ready. The
> > child is supposed to receive it and send back an ip4 address to the
> parent,
> > but it seems to be hung up and very busy. Any ideas?
>
> I couldn't make out what you meant by reading this a few times, however let
> me try.  fork() is a common operation to create a new process... you can
> for example use it to keep a root owned process around and the child does
> privilege seperation however does InterProcess Communication with the root
> owned parent.  The IPC can be shared memory, a socketpair, a pipe, a named
> pipe or socket.  I think you mean to set up a socketpair between the parent
> and the child.  Right here with this kind of model of IPC it is perhaps
> wise to use the imsg framework that is in OpenBSD.
>
> http://man.openbsd.org/OpenBSD-current/man3/imsg_init.3
>
> This is probably what you want to use.  The child sends an IP4 address to
> the parent via the socketpair?  OK, you don't even need a greeting just
> select or poll around the descriptors and test for received data.  And then
> process it to do your ioctl operations and possibly return data via the
> socketpair.
>
> BTW at work I wrote such a program, hence this looks fairly familiar what
> you
> described.  It takes an IP address on a listening socket and sends via a
> socketpair to a root owned process which then inserts the IP4 into a pf
> table
> via ioctl, and then does another ioctl to flush the states for that IP4.
> Unfortunately I can't share the code, it's not licensed for sharing.
>
> Cheers,
>
> -peter

Reply via email to