01d00244 add $0xc,%esp 01d00247 push $0x0 01d00249 push $0x2 01d0024b push $0x2 01d0024d call 0x1d01300 <socket> 01d00252 add $0x10,%esp 01d00255 test %eax,%eax 01d00257 mov %eax,(%ebx) <--- ERROR HERE!!!!!! 01d00259 js 0x1d00344 /home/tiago/l4/pkg/failuredetector/server/src/FailureDetector.cc:38
That means that the return value of the socket() call is stored somewhere (in sock_fd). What ist sock_fd -- an object variable, a local variable or a global variable?
thats true. sock_fd is an object variable. the definition of the class is the following:
#ifndef FAILUREDETECTOR_H #define FAILUREDETECTOR_H
#include "WOO_vector.h" #include "WOO_map.h" #include <string> #include <stdlib.h> #include <string.h>
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <fcntl.h> #include <netdb.h> #include <stdio.h>
//TODO: deixar de usar pthread e passar a usar l4thread #include <l4/thread/thread.h> #include <l4/lock/lock.h>
#define PORTNUMBER 45555
#define NULL 0
using namespace std;
struct heartbeat{ int eid; };
class FailureDetector{
private: int sock_fd; <<---- HERE IS SOCK_FD socklen_t addrLength_fd; struct sockaddr_in destinationAddr_fd; struct sockaddr_in myAddr_fd; struct sockaddr_in responseAddr_fd; int trueFlag_fd; map<int,heartbeat> suspected;
l4lock_t lock_suspected; l4lock_t lock_stop;
bool stop_flag;
l4thread_t fdect;
//params int eid; long sleep_time; vector<int> *group;
l4lock_t *group_lock;
public:
private: void initialize_comm_fd(); public: //Constructor //TODO: l4 lock FailureDetector(int new_eid, int new_sleep_time, vector<int> *new_group, l4lock_t *new_group_lock);
void dump_suspicious(); map<int, heartbeat> get_Suspected(); bool is_Suspected(int eid); bool to_stop(); void stop(); void failureDetector(); };
void helper_failure_detector(void *args);
#endif // FAILUREDETECTOR_H
If it is an global variable, I assume the the object was not constructed. Perhaps, sock_fd is part of a static object?
the code is this one (i'll show the sequence of execution):
the program starts and invokes a function that starts an l4 thread using the short version. the error lines are in the first function called by the thread (lines 30 to 38):
int flags=0;
printf("TOU ANTES DO SOCKET!!!!!!!\n"); /* Create socket from which to send */ if ((sock_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { perror("open error on socket"); exit(1); printf("ERRROOOOOOOOO!!!!!!!\n"); }
i've thought it was from perror and i've comment this block, but it gave the same error in the next lines.
must i reallocate the internal program thread? if so, how can i do it?
Please post a little bit more, at least the definition of sock_fd or even the whole file.
Frank
thanks for the patience
Tiago
l4-hackers mailing list l4-hackers@os.inf.tu-dresden.de http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers