Skip to content
Snippets Groups Projects
Select Git revision
  • 90b1c0ea6f0a0db0347ffc4fa888f91dd532bd2a
  • master default
  • dbck-q-n-d-link
  • foutput-text_stat-override
  • generations
  • text-stat-sha256
  • use-nettle
  • import-nettle
  • refactor-cached_get_text
  • refactor-cached_get_text-part-2
  • add-text_store
  • introduce-generation_position
  • remove-reclamation
  • dbfile-temp-filenames
  • sstrdup
  • dbfile_open_read-check-magic
  • adns_dist
  • liboop_dist
  • search
  • isc
  • dbdbckmultiplechoice
  • last.cvs.revision
  • 2.1.2
  • 2.1.1
  • 2.1.0
  • adns_1_0
  • liboop_0_9
  • 2.0.7
  • search_bp
  • 2.0.6
  • 2.0.5
  • isc_1_01
  • Protocol-A-10.4
  • 2.0.4
  • 2.0.3
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • isc_1_00
  • isc_merge_1999_05_01
  • isc_merge_1999_04_21
41 results

string-malloc.c

Blame
  • backend.c 5.52 KiB
    /*\
    ||| This file a part of Pike, and is copyright by Fredrik Hubinette
    ||| Pike is distributed as GPL (General Public License)
    ||| See the files COPYING and DISCLAIMER for more information.
    \*/
    #include "global.h"
    RCSID("$Id: backend.c,v 1.8 1997/01/26 22:47:03 per Exp $");
    #include "backend.h"
    #include <errno.h>
    #ifdef HAVE_SYS_TYPES_H
    #include <sys/types.h>
    #endif
    #include <sys/param.h>
    #include <string.h>
    #include "interpret.h"
    #include "object.h"
    #include "types.h"
    #include "error.h"
    #include "fd_control.h"
    #include "main.h"
    #include "callback.h"
    #include "threads.h"
    
    #ifdef HAVE_SYS_SELECT_H
    #include <sys/select.h>
    #endif
    
    #define SELECT_READ 1
    #define SELECT_WRITE 2
    
    struct selectors
    {
      fd_set read;
      fd_set write;
    };
    
    static struct selectors selectors;
    
    file_callback read_callback[MAX_OPEN_FILEDESCRIPTORS];
    void *read_callback_data[MAX_OPEN_FILEDESCRIPTORS];
    file_callback write_callback[MAX_OPEN_FILEDESCRIPTORS];
    void *write_callback_data[MAX_OPEN_FILEDESCRIPTORS];
    
    static int max_fd;
    struct timeval current_time;
    struct timeval next_timeout;
    
    static struct callback_list backend_callbacks;
    
    struct callback *add_backend_callback(callback_func call,
    				      void *arg,
    				      callback_func free_func)
    {
      return add_to_callback(&backend_callbacks, call, arg, free_func);
    }
    
    void init_backend()
    {
      FD_ZERO(&selectors.read);
      FD_ZERO(&selectors.write);
    }
    
    void set_read_callback(int fd,file_callback cb,void *data)
    {
    #ifdef DEBUG
      if(fd<0 || fd>=MAX_OPEN_FILEDESCRIPTORS)
        fatal("File descriptor out of range.\n %d",fd);
    #endif
    
      read_callback[fd]=cb;