Ignore:
Timestamp:
23/08/06 15:20:05 (14 years ago)
Author:
spascoe
Message:

Implemented two hooks in the bbftpd source that allow
python code to be executed before and afer a fork(). This is needed
to reset python logging and will probably be usefull for other things
in the future.

Location:
TI05-delivery/trunk/src/bbftp-server-3.2.0
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_daemon.c

    r1358 r1448  
    4949#include <stdio.h> 
    5050#include <bbftpd_private_log.h> 
     51#include <bbftpd_private_fork.h> 
    5152#include <sys/socket.h> 
    5253#if TIME_WITH_SYS_TIME 
     
    132133    } 
    133134    /* Fork - so I'm not the owner of the process group any more */ 
    134     retcode = fork(); 
     135    retcode = bbftpd_fork(); 
    135136    if (retcode < 0) { 
    136137        bbftpd_log(BBFTPD_ERR, "Cannot fork %s",strerror(errno)); 
     
    208209        } 
    209210            /* Fork off a handler */ 
    210         pid = fork(); 
     211        pid = bbftpd_fork(); 
    211212        if (pid < 0) { 
    212213            bbftpd_log(BBFTPD_ERR, "failed to fork: %s",strerror(errno)); 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_retr.c

    r1392 r1448  
    4444#include <signal.h> 
    4545#include <bbftpd_private_log.h> 
     46#include <bbftpd_private_fork.h> 
    4647#include <sys/stat.h> 
    4748#include <sys/types.h> 
     
    659660        ** So we are going to fork 
    660661        */ 
    661         if ( (retcode = fork()) == 0 ) { 
     662        if ( (retcode = bbftpd_fork()) == 0 ) { 
    662663                    int     ns ; 
    663664            /* 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_retr_rfio.c

    r1358 r1448  
    4141#include <signal.h> 
    4242#include <bbftpd_private_log.h> 
     43#include <bbftpd_private_fork.h> 
    4344#include <sys/stat.h> 
    4445#if TIME_WITH_SYS_TIME 
     
    715716        ** So we are going to fork 
    716717        */ 
    717         if ( (retcode = fork()) == 0 ) { 
     718        if ( (retcode = bbftpd_fork()) == 0 ) { 
    718719                    int     ns ; 
    719720            /* 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_store.c

    r1392 r1448  
    4343#include <signal.h> 
    4444#include <bbftpd_private_log.h> 
     45#include <bbftpd_private_fork.h> 
    4546#include <sys/stat.h> 
    4647#if TIME_WITH_SYS_TIME 
     
    940941        */ 
    941942        flagsighup = 0 ; 
    942         if ( ( retcode = fork() ) == 0 ) { 
     943        if ( ( retcode = bbftpd_fork() ) == 0 ) { 
    943944            int     ns ; 
    944945            /* 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_store_rfio.c

    r1358 r1448  
    4343#include <signal.h> 
    4444#include <bbftpd_private_log.h> 
     45#include <bbftpd_private_fork.h> 
    4546#include <sys/stat.h> 
    4647#if TIME_WITH_SYS_TIME 
     
    13101311        */ 
    13111312        flagsighup = 0 ; 
    1312         if ( ( retcode = fork() ) == 0 ) { 
     1313        if ( ( retcode = bbftpd_fork() ) == 0 ) { 
    13131314            int     ns ; 
    13141315            /* 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/sendafile.c

    r1395 r1448  
    7373#include <signal.h> 
    7474#include <bbftpd_private_log.h> 
     75#include <bbftpd_private_fork.h> 
    7576#include <sys/stat.h> 
    7677#include <sys/time.h> 
     
    403404        ** So we are going to fork 
    404405        */ 
    405         if ( (retcode = fork()) == 0 ) { 
     406        if ( (retcode = bbftpd_fork()) == 0 ) { 
    406407            /* 
    407408            ** We are in child 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/sendafilerfio.c

    r1431 r1448  
    7070#include <signal.h> 
    7171#include <bbftpd_private_log.h> 
     72#include <bbftpd_private_fork.h> 
    7273#include <sys/stat.h> 
    7374#include <sys/time.h> 
     
    380381        ** So we are going to fork 
    381382        */ 
    382         if ( (retcode = fork()) == 0 ) { 
     383        if ( (retcode = bbftpd_fork()) == 0 ) { 
    383384            /* 
    384385            ** We are in child 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/storeafile.c

    r1395 r1448  
    7474#include <stdio.h> 
    7575#include <bbftpd_private_log.h> 
     76#include <bbftpd_private_fork.h> 
    7677#include <sys/stat.h> 
    7778#include <sys/time.h> 
     
    380381        ** So we are going to fork 
    381382        */ 
    382         if ( (retcode = fork()) == 0 ) { 
     383        if ( (retcode = bbftpd_fork()) == 0 ) { 
    383384            /* 
    384385            ** We are in child 
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/includes/ndg.h

    r1447 r1448  
    3838int ndg_authz_store(char *path, char *logmessage); 
    3939void ndg_log(int priority, const char *format, va_list vargs); 
    40  
     40int ndg_before_fork_hook(char *logmessage); 
     41int ndg_after_fork_hook(char *logmessage); 
    4142 
    4243#endif // NDG_PYTHON_EMBED 
Note: See TracChangeset for help on using the changeset viewer.