mux/src/sqlslave.cpp File Reference

#include "autoconf.h"
#include "config.h"
#include <dbi/dbi.h>

Include dependency graph for sqlslave.cpp:

Go to the source code of this file.

Defines

#define MAX_STRING   1000

Functions

int main (int argc, char *argv[])


Define Documentation

#define MAX_STRING   1000

Definition at line 9 of file sqlslave.cpp.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 11 of file sqlslave.cpp.

References MAX_STRING, and parent_pid.

00012 {
00013     pid_t parent_pid = getppid();
00014     if (parent_pid == 1)
00015     {
00016         // Our real parent process is gone, and we have been inherited by the
00017         // init process.
00018         //
00019         return 1;
00020     }
00021 
00022     dbi_conn conn;
00023     dbi_initialize(NULL);
00024 
00025     for (;;)
00026     {
00027         char arg[MAX_STRING];
00028         int len = read(0, arg, sizeof(arg)-1);
00029         if (len == 0)
00030         {
00031             break;
00032         }
00033 
00034         if (len < 0)
00035         {
00036             if (EINTR == errno)
00037             {
00038                 errno = 0;
00039                 continue;
00040             }
00041             break;
00042         }
00043 
00044         arg[len] = '\0';
00045 
00046         write(1, "OK", 2);
00047     }
00048 
00049     dbi_shutdown();
00050     return 0;
00051 }


Generated on Mon May 28 04:40:22 2007 for MUX by  doxygen 1.4.7