IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33238


Ignore:
Timestamp:
Feb 10, 2012, 1:53:50 PM (14 years ago)
Author:
eugene
Message:

moving rconnect and myAssert,myAbort into libohana

Location:
branches/eam_branches/ipp-20111122/Ohana/src
Files:
2 added
21 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/addstar/src/resort_catalog.c

    r31160 r33238  
    2828  return;
    2929}
    30 
    31 # define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); }
    32 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort(); } }
    3330
    3431// sort the measure Sequence based on the average Sequence entries
  • branches/eam_branches/ipp-20111122/Ohana/src/dvomerge/include/dvomerge.h

    r29938 r33238  
    1616# include <arpa/inet.h>
    1717# include <glob.h>
    18 
    19 # define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); }
    20 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort(); } }
    2118
    2219int    VERBOSE;
  • branches/eam_branches/ipp-20111122/Ohana/src/dvomerge/src/dvorepairCPT.c

    r29938 r33238  
    11# include "dvomerge.h"
    2 
    3 # define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); }
    4 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort(); } }
    52
    63// broken cpt file, valid cpm file: we can recover everything in the cpt file from the cpm file:
  • branches/eam_branches/ipp-20111122/Ohana/src/dvomerge/src/dvorepairImageVsMeasure.c

    r29938 r33238  
    11# include "dvomerge.h"
    2 
    3 # define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); }
    4 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort(); } }
    52
    63// find images which are missing detections:
  • branches/eam_branches/ipp-20111122/Ohana/src/elixir/include/elixir.h

    r21153 r33238  
    169169int       WaitMsg (char *fifo, char **message, double maxdelay);
    170170int       WriteMsg (char *fifo, char *message);
    171 int       memstr (char *m1, char *m2, int n);
    172 int       rconnect (char *hostname, char *command, int *rsock, int *wsock);
    173 void GetConfig (char *config, char *field, char *format, int N, void *ptr);
     171void      GetConfig (char *config, char *field, char *format, int N, void *ptr);
     172int       rconnect_elixir (char *hostname, char *command, int *rsock, int *wsock);
  • branches/eam_branches/ipp-20111122/Ohana/src/elixir/src/MachineOps.c

    r27588 r33238  
    202202  char line[256];
    203203
    204   pid = rconnect (machine[0].hostname, CONNECT, &rsock, &wsock);
     204  pid = rconnect_elixir (machine[0].hostname, CONNECT, &rsock, &wsock);
    205205  if (pid) {
    206206    machine[0].rsock = rsock;
  • branches/eam_branches/ipp-20111122/Ohana/src/elixir/src/RemoteOps.c

    r27611 r33238  
    1515
    1616  /* set signal to remote machine */
    17   if (!rconnect (machine, CONNECT, &rsock, &wsock)) {
     17  if (!rconnect_elixir (machine, CONNECT, &rsock, &wsock)) {
    1818    fprintf (stderr, "can't make connection to machine %s to kill process\n", machine);
    1919    exit (1);
     
    4747
    4848  /* send signal to remote machine */
    49   if (!rconnect (machine, CONNECT, &rsock, &wsock)) {
     49  if (!rconnect_elixir (machine, CONNECT, &rsock, &wsock)) {
    5050    fprintf (stderr, "can't make connection to machine %s to kill process\n", machine);
    5151    exit (1);
     
    9090
    9191  /* send signal to remote machine */
    92   if (!rconnect (machine, CONNECT, &rsock, &wsock)) {
     92  if (!rconnect_elixir (machine, CONNECT, &rsock, &wsock)) {
    9393    fprintf (stderr, "can't make connection to machine %s to signal process\n", machine);
    9494    exit (1);
     
    151151
    152152  /* make connection to remote machine */
    153   if (!rconnect (machine, CONNECT, &rsock, &wsock)) {
     153  if (!rconnect_elixir (machine, CONNECT, &rsock, &wsock)) {
    154154    fprintf (stderr, "can't make connection to machine %s to kill process\n", machine);
    155155    exit (1);
  • branches/eam_branches/ipp-20111122/Ohana/src/elixir/src/SockScan.c

    r10336 r33238  
    55int SockScan (char *string, Fifo *fifo, int sock) {
    66 
    7   int i, done, status;
     7  int i, status;
     8  char *done;
    89
    9   done = 0;
    10   for (i = 0; (i < MAXTIME) && !done; i++) {
     10  done = string;
     11  for (i = 0; (i < MAXTIME) && (done != NULL); i++) {
    1112    ShiftFifo (fifo);
    1213    status = ReadtoFifo (fifo, sock);
     
    2425  return (status);
    2526}
    26 
    27 /* returns (offset to m2) + 1, or 0 if failure */
    28 int memstr (char *m1, char *m2, int n) {
    29 
    30   int i, N;
    31 
    32   N = strlen (m2);
    33   for (i = 0; (i < n - N + 1) && memcmp (m1, m2, N); i++, m1++);
    34   if (memcmp (m1, m2, N)) {
    35     return (0);
    36   }
    37   else {
    38     return (i+1);
    39   }
    40 
    41 }
    4227 
    4328/* SockScan reads from the given socket looking for the given string
  • branches/eam_branches/ipp-20111122/Ohana/src/elixir/src/rconnect.c

    r27588 r33238  
    44   one for read, one for write */
    55
    6 int rconnect (char *hostname, char *command, int *rsock, int *wsock) {
     6// this is a slightly different version than the one in libohana -- use a local name
     7int rconnect_elixir (char *hostname, char *command, int *rsock, int *wsock) {
    78
    89  int i, rfd[2], wfd[2], status;
  • branches/eam_branches/ipp-20111122/Ohana/src/imregister/Makefile

    r31496 r33238  
    6565$(IMREG)/ConfigPID.$(ARCH).o   \
    6666$(IMREG)/SetSignals.$(ARCH).o   \
    67 $(IMREG)/rconnect.$(ARCH).o   \
    6867$(IMREG)/FifoOps.$(ARCH).o   \
    6968$(IMREG)/SockScan.$(ARCH).o   \
  • branches/eam_branches/ipp-20111122/Ohana/src/imregister/imreg/SetSignals.c

    r27611 r33238  
    9090  char username[256], machine[256];
    9191  char line[512];
    92   int i, wsock, rsock;
     92  int i, iosock[3];
    9393  struct stat filestat;
    9494
     
    9999
    100100  /* send signal to remote machine */
    101   if (!rconnect (machine, CONNECT, &rsock, &wsock)) {
    102     fprintf (stderr, "can't make connection to machine %s to kill process %d\n", machine, pid);
     101  int errorInfo;
     102  if (!rconnect (CONNECT, machine, "/bin/csh", iosock, &errorInfo, TRUE)) {
     103    fprintf (stderr, "can't make connection to machine %s to kill process %d (error %d)\n", machine, pid, errorInfo);
    103104    exit (1);
    104105  }
    105106  sprintf (line, "kill -TERM %d\n", pid);
    106   if (write (wsock, line, strlen (line)) != strlen(line)) {
     107  if (write (iosock[0], line, strlen (line)) != strlen(line)) {
    107108    fprintf (stderr, "error sending signal\n");
    108109    exit (1);
  • branches/eam_branches/ipp-20111122/Ohana/src/imregister/imreg/SockScan.c

    r76 r33238  
    66int SockScan (char *string, Fifo *fifo, int sock) {
    77 
    8   int i, done, status;
     8  int i, status;
     9  char *done;
    910
    10   done = 0;
    11   for (i = 0; (i < MAXTIME) && !done; i++) {
     11  done = string;
     12  for (i = 0; (i < MAXTIME) && (done != NULL); i++) {
    1213    ShiftFifo (fifo);
    1314    status = ReadtoFifo (fifo, sock);
     
    2526  return (status);
    2627}
    27 
    28 /* returns (offset to m2) + 1, or 0 if failure */
    29 int memstr (char *m1, char *m2, int n) {
    30 
    31   int i, N;
    32 
    33   N = strlen (m2);
    34   for (i = 0; (i < n - N + 1) && memcmp (m1, m2, N); i++, m1++);
    35   if (memcmp (m1, m2, N)) {
    36     return (0);
    37   }
    38   else {
    39     return (i+1);
    40   }
    41 
    42 }
    4328 
    4429/* SockScan reads from the given socket looking for the given string
  • branches/eam_branches/ipp-20111122/Ohana/src/imregister/include/imreg.h

    r27435 r33238  
    118118int Shutdown (int status);
    119119void RemovePID (void);
    120 int rconnect (char *hostname, char *command, int *rsock, int *wsock);
    121120
    122121int InitFifo (Fifo *fifo, int Nalloc, int Nextra);
     
    126125void FreeFifo (Fifo *fifo);
    127126int SockScan (char *string, Fifo *fifo, int sock);
    128 int memstr (char *m1, char *m2, int n);
    129127
    130128off_t *unique_entries (RegImage *image, off_t Nimage, off_t *subset, off_t *Nmatch);
  • branches/eam_branches/ipp-20111122/Ohana/src/libkapa/src/bDrawFuncs.c

    r31663 r33238  
    11# include <kapa_internal.h>
    2 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort (); } }
    32
    43// move these to the bDrawBuffer type
  • branches/eam_branches/ipp-20111122/Ohana/src/libohana/Makefile

    r31663 r33238  
    3838$(SRC)/Fread.$(ARCH).o           \
    3939$(SRC)/IOBufferOps.$(ARCH).o     \
     40$(SRC)/memstr.$(ARCH).o  \
     41$(SRC)/rconnect.$(ARCH).o        \
    4042$(SRC)/CommOps.$(ARCH).o         \
    4143$(SRC)/isolate_elements.$(ARCH).o        \
  • branches/eam_branches/ipp-20111122/Ohana/src/libohana/include/ohana.h

    r33217 r33238  
    215215*/
    216216# define OHANA_WHITESPACE(c)(((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0b) || ((c) == 0x0b) || ((c) == 0x0c) || ((c) == 0x0d) || ((c) == 0x20))
     217# define OHANA_ASSERT(LOGIC,...) { if (!(LOGIC)) { fprintf (stderr, __VA_ARGS__); abort(); } }
     218# define myAssert(LOGIC,...) { if (!(LOGIC)) { fprintf (stderr, __VA_ARGS__); abort(); } }
     219# define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); }
    217220
    218221// sorting is now defined as a macro call
     
    328331off_t   Fwrite                 PROTO((void *ptr, off_t size, off_t nitems, FILE *f, char *type));
    329332
     333char   *memstr                 PROTO((char *m1, char *m2, int n));
     334int     write_fmt              PROTO((int fd, char *format, ...));
     335
    330336char   **isolate_elements      PROTO((int argc, char **argv, int *nstack));
    331337
     
    337343// gprint gets a stub implementation in libohana. opihi implements the real one.
    338344int    gprint (gpDest dest, char *format, ...);
     345
     346// rconnect is used to run remote programs with a pipe for communication
     347typedef enum {
     348  RCONNECT_ERR_NONE    = 0,
     349  RCONNECT_ERR_EXEC    = 1,
     350  RCONNECT_ERR_PIPE    = 2,
     351  RCONNECT_ERR_CONNECT = 3,
     352} RconnectErrors;
     353
     354void rconnect_set_timeout (int timeout);
     355int rconnect (char *command, char *hostname, char *shell, int *stdio, int *errorInfo, int doHandshake);
    339356
    340357/*
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/include/pcontrol.h

    r32632 r33238  
    252252int CheckDoneJob (Job *job, Host *host);
    253253int GetJobOutput (char *command, Host *host, JobOutput *output);
    254 int rconnect (char *command, char *hostname, char *shell, int *stdio);
    255254
    256255int PclientCommand (Host *host, char *command, char *response, HostResp response_state);
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/pcontrol/Makefile

    r26411 r33238  
    2424$(SRC)/init.$(ARCH).o \
    2525$(SRC)/pcontrol.$(ARCH).o \
    26 $(SRC)/rconnect.$(ARCH).o \
    2726$(SRC)/CheckBusyJob.$(ARCH).o \
    2827$(SRC)/CheckDoneHost.$(ARCH).o \
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/pcontrol/StartHost.c

    r28241 r33238  
    1414  if (VarConfig ("SHELL", "%s", shell)     == NULL) strcpy (shell, "pclient");
    1515
    16   if (VerboseMode()) gprint (GP_ERR, "starting host within thread\n");
     16  if (VerboseMode()) gprint (GP_ERR, "starting remote connection to %s...", host[0].hostname);
    1717
    18   pid = rconnect (command, host[0].hostname, shell, stdio);
     18  int errorInfo;
     19  pid = rconnect (command, host[0].hostname, shell, stdio, &errorInfo, TRUE);
    1920  if (!pid) {     
    2021    /** failure to start: extend retry period **/
    21     if (VerboseMode()) gprint (GP_ERR, "failure to start %s\n", host[0].hostname);
     22    if (VerboseMode()) gprint (GP_ERR, "failure to start %s (error %d)\n", host[0].hostname, errorInfo);
    2223    gettimeofday (&now, (void *) NULL);
    2324    if (ZTIME(host[0].next_start_try) || ZTIME(host[0].last_start_try)) {
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/resort_catalog.c

    r32346 r33238  
    11# include "relastro.h"
    2 
    3 # define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); }
    4 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort(); } }
    52
    63// sort the measure Sequence based on the average Sequence entries
  • branches/eam_branches/ipp-20111122/Ohana/src/tools/src/roc.c

    r32052 r33238  
    33# include <sys/types.h>
    44# include <regex.h>
    5 
    6 # define myAssert(LOGIC,...) { if (!(LOGIC)) { fprintf (stderr, __VA_ARGS__); exit(4); } }
    75
    86# define ROC_HEADER_SIZE  0x1000
Note: See TracChangeset for help on using the changeset viewer.