Changeset 315


Ignore:
Timestamp:
Mar 11, 2011, 8:30:55 PM (14 years ago)
Author:
katerina
Message:

Fix for ticket #236 (blocking on NFS mounts).

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r310 r315  
    126126        sh_log_check.h sh_log_evalrule.h sh_log_correlate.h \
    127127        sh_log_mark.h sh_log_repeat.h sh_inotify.h sh_registry.h sh_ipvx.h \
    128         sh_restrict.h
     128        sh_restrict.h sh_sub.h
    129129
    130130
     
    168168        $(srcsrc)/sh_inotify.c $(srcsrc)/sh_log_repeat.c \
    169169        $(srcsrc)/sh_audit.c $(srcsrc)/sh_registry.c \
    170         $(srcsrc)/sh_ipvx.c $(srcsrc)/sh_restrict.c $(srcsrc)/sh_filetype.c \
     170        $(srcsrc)/sh_ipvx.c $(srcsrc)/sh_restrict.c \
     171        $(srcsrc)/sh_filetype.c $(srcsrc)/sh_sub.c \
    171172        $(srcsrc)/t-test1.c
    172173
     
    188189        sh_log_correlate.o sh_log_mark.o sh_log_repeat.o \
    189190        sh_pthread.o sh_string.o sh_inotify.o dnmalloc.o \
    190         sh_audit.o sh_registry.o sh_ipvx.o sh_restrict.o sh_filetype.o
     191        sh_audit.o sh_registry.o sh_ipvx.o sh_restrict.o \
     192        sh_filetype.o sh_sub.o
    191193
    192194KERN = kern_head.h kern_head.c
     
    17301732sh_gpg.o: $(srcsrc)/sh_gpg.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h
    17311733sh_cat.o: $(srcsrc)/sh_cat.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_cat.h
    1732 sh_calls.o: $(srcsrc)/sh_calls.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_calls.h $(srcinc)/sh_ipvx.h
     1734sh_calls.o: $(srcsrc)/sh_calls.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_calls.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_sub.h $(srcinc)/sh_utils.h
    17331735sh_extern.o: $(srcsrc)/sh_extern.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_extern.h $(srcinc)/sh_calls.h $(srcinc)/sh_filter.h $(srcinc)/sh_static.h
    17341736sh_database.o: $(srcsrc)/sh_database.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h
     
    17881790sh_restrict.o: $(srcsrc)/sh_restrict.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h $(srcinc)/CuTest.h
    17891791sh_filetype.o: $(srcsrc)/sh_filetype.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_utils.h
     1792sh_sub.o: $(srcsrc)/sh_sub.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h
  • trunk/depend.dep

    r310 r315  
    2828sh_gpg.o: $(srcsrc)/sh_gpg.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h
    2929sh_cat.o: $(srcsrc)/sh_cat.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_cat.h
    30 sh_calls.o: $(srcsrc)/sh_calls.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_calls.h $(srcinc)/sh_ipvx.h
     30sh_calls.o: $(srcsrc)/sh_calls.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_calls.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_sub.h $(srcinc)/sh_utils.h
    3131sh_extern.o: $(srcsrc)/sh_extern.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_extern.h $(srcinc)/sh_calls.h $(srcinc)/sh_filter.h $(srcinc)/sh_static.h
    3232sh_database.o: $(srcsrc)/sh_database.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h
     
    8888sh_restrict.o: $(srcsrc)/sh_restrict.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h $(srcinc)/CuTest.h
    8989sh_filetype.o: $(srcsrc)/sh_filetype.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_utils.h
     90sh_sub.o: $(srcsrc)/sh_sub.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h
  • trunk/depend.sum

    r310 r315  
    1 2589357922
     12743510484
  • trunk/docs/Changelog

    r312 r315  
    112.8.3:
     2        * fix zeroing of result from getnameinfo() (problem reported by Richard)
     3        * fix spurious warnings about unsupported address family (reported
     4          by N Silverman)
     5        * option to run lstat/stat in subprocess to avoid hanging on NFS mounts
     6          (off by default)
    27        * fix Windows/Cygwin compile error (reported by A. Schmidt)
    38
  • trunk/include/sh_calls.h

    r295 r315  
    3939                      int fd, struct sh_sockaddr *serv_addr, int * addrlen);
    4040#endif
     41
     42int sh_calls_set_sub (const char * str);
    4143
    4244long int retry_stat (const char * file, int line,
  • trunk/include/sh_ipvx.h

    r295 r315  
    4646int sh_ipvx_set_port(struct sh_sockaddr * ss, int port);
    4747
     48/* Get the port
     49 */
     50int sh_ipvx_get_port(struct sockaddr * ss, int sa_family);
     51
    4852/* Save a sockaddress
    4953 */
    5054void sh_ipvx_save(struct sh_sockaddr * ss, int sa_family, struct sockaddr * sa);
     55
     56/* Ascii numerical sockaddress
     57 */
     58char * sh_ipvx_print_sockaddr (struct sockaddr * sa, int sa_family);
    5159
    5260/* Determine whether the given address is numeric
  • trunk/include/sh_pthread.h

    r214 r315  
    1010#define SH_MUTEX_STATIC(M,I)                    static pthread_mutex_t M = I
    1111#define SH_MUTEX_EXTERN(M)                      extern pthread_mutex_t M
     12
     13#define SH_SETSIGMASK(A, B, C)                  sh_pthread_setsigmask(A,B,C)
     14
     15int sh_pthread_setsigmask(int how, const void *set, void *oldset);
    1216
    1317/* pthread_mutex_unlock() has the wrong type (returns int), so
     
    133137#else
    134138
     139#define SH_SETSIGMASK(A, B, C)                  sh_pthread_setsigmask(A,B,C)
     140
     141int sh_pthread_setsigmask(int how, const void *set, void *oldset);
     142
    135143#define PTHREAD_MUTEX_INITIALIZER               NULL
    136144#define SH_MUTEX(M)                             void *SH_MUTEX_DUMMY_ ## M
  • trunk/src/sh_calls.c

    r307 r315  
    5252#include "sh_calls.h"
    5353#include "sh_ipvx.h"
     54#include "sh_sub.h"
     55#include "sh_utils.h"
    5456
    5557#undef  FIL__
     
    240242}
    241243
     244static int sh_use_sub = 0;
     245
     246int sh_calls_set_sub (const char * str)
     247{
     248  return sh_util_flagval(str, &sh_use_sub);
     249}
     250
    242251long int retry_lstat(const char * file, int line,
    243252                     const char *file_name, struct stat *buf)
     
    249258  SL_ENTER(_("retry_lstat"));
    250259
    251   do {
    252     val_retry = /*@-unrecog@*/lstat (file_name, buf)/*@+unrecog@*/;
    253   } while (val_retry < 0 && errno == EINTR);
     260  if (sh_use_sub)
     261    {
     262      val_retry = sh_sub_lstat (file_name, buf);
     263    }
     264  else
     265    {
     266      do {
     267        val_retry = /*@-unrecog@*/lstat (file_name, buf)/*@+unrecog@*/;
     268      } while (val_retry < 0 && errno == EINTR);
     269    }
     270
    254271  error = errno;
    255272  if (val_retry < 0) {
     
    260277  }
    261278  errno = error;   
     279
    262280  SL_RETURN(val_retry, _("retry_lstat"));
    263281}
     
    272290  SL_ENTER(_("retry_stat"));
    273291
    274   do {
    275     val_retry = stat (file_name, buf);
    276   } while (val_retry < 0 && errno == EINTR);
     292  if (sh_use_sub)
     293    {
     294      val_retry = sh_sub_stat (file_name, buf);
     295    }
     296  else
     297    {
     298      do {
     299        val_retry = stat (file_name, buf);
     300      } while (val_retry < 0 && errno == EINTR);
     301    }
     302
    277303  error = errno;
    278304  if (val_retry < 0) {
     
    283309  }
    284310  errno = error;   
     311
    285312  SL_RETURN(val_retry, _("retry_stat"));
    286313}
  • trunk/src/sh_forward.c

    r307 r315  
    48624862  int flag   = 1; /* non-zero to enable an option */
    48634863
     4864  /* fprintf(stderr, "FIXME IPVX: bind addr %s (%d) :%d\n",
     4865          sh_ipvx_print_sockaddr (sa, domain), salen,
     4866          sh_ipvx_get_port(sa, domain)); */
     4867
    48644868  /* create the socket, bind() it and listen()
    48654869   */
     
    49404944      hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
    49414945      hints.ai_socktype = SOCK_STREAM;
     4946      hints.ai_family   = AF_UNSPEC;
    49424947      sl_snprintf(port, sizeof(port), "%d", server_port);
    49434948
  • trunk/src/sh_port2proc.c

    r298 r315  
    422422
    423423                sh_ipvx_ntoa(a, sizeof(a), &ss);
    424                 sh_ipvx_ntoa(b, sizeof(b), &ss);
     424                sh_ipvx_ntoa(b, sizeof(b), saddr);
    425425
    426426                fprintf(stderr, " -> inode %u, iface/port %s,%u, status %u, searching %s,%u, %u\n",
  • trunk/src/sh_pthread.c

    r259 r315  
    1515SH_MUTEX_INIT(mutex_readdir,      PTHREAD_MUTEX_INITIALIZER);
    1616SH_MUTEX_INIT(mutex_thread_nolog, PTHREAD_MUTEX_INITIALIZER);
     17
     18int sh_pthread_setsigmask(int how, const void *set, void *oldset)
     19{
     20  return pthread_sigmask(how, (const sigset_t *)set, (sigset_t *)oldset);
     21}
    1722
    1823void sh_pthread_mutex_unlock (void *arg)
     
    288293#endif
    289294
     295#else
     296
     297#include <signal.h>
     298
     299int sh_pthread_setsigmask(int how, const void *set, void *oldset)
     300{
     301  return sigprocmask(how, (const sigset_t *)set, (sigset_t *)oldset);
     302}
     303
    290304
    291305#endif
  • trunk/src/sh_readconf.c

    r310 r315  
    12271227    sh_util_sigtype },
    12281228
     1229  { N_("avoidblock"),     SH_SECTION_MISC,  SH_SECTION_NONE,
     1230    sh_calls_set_sub },
     1231
    12291232  { NULL,    0,   0,  NULL}
    12301233};
  • trunk/src/sh_socket.c

    r295 r315  
    683683      {
    684684        ++retry;
    685         retry_msleep(0, 1);
     685        retry_msleep(0, 10);
    686686      }
    687687  } while ((nbytes < 0) && (retry < 3));
  • trunk/src/sh_unix.c

    r310 r315  
    15291529  do {
    15301530    errno = 0;
    1531     test  = sigprocmask(SIG_UNBLOCK, &set_proc, NULL);
     1531    test  = SH_SETSIGMASK(SIG_UNBLOCK, &set_proc, NULL);
    15321532  } while (test < 0 && errno == EINTR);
    15331533
Note: See TracChangeset for help on using the changeset viewer.