Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
- Reput hook for raw sockets, needed for BW experiments
[simgrid.git] / src / amok / base.c
1 /* $Id$ */
2
3 /* gras_addons - several addons to do specific stuff not in GRAS itself     */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2003 the OURAGAN project.                                  */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #include <stdlib.h>
12 #include <stdio.h>
13
14 #include <gras.h>
15
16 void
17 grasRepportError (gras_sock_t *sock, gras_msgid_t id, int SeqCount,
18                   const char *severeError,
19                   gras_error_t errcode, const char* format,...) {
20   msgError_t *error;
21   va_list ap;
22
23   if (!(error=(msgError_t*)malloc(sizeof(msgError_t)))) {
24     fprintf(stderr,severeError);
25     return;
26   }
27
28   error->errcode=errcode;
29   va_start(ap,format);
30   vsprintf(error->errmsg,format,ap);
31   va_end(ap);
32
33   /* FIXME: If message id have more than 17 sequences, the following won't work */
34   if (gras_msg_new_and_send(sock,id,SeqCount,   error,1,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,
35                      NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0)) {
36     fprintf(stderr,severeError);
37   }
38 }