Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
- Reduce the number of system headers loaded, overload some more system
[simgrid.git] / src / gras / Transport / transport_plugin_file.c
index fd17106..825d2bc 100644 (file)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include "gras_private.h"
 #include "transport_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport);
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport,
+       "Pseudo-transport to write to/read from a file");
 
 /***
  *** Prototypes 
@@ -24,7 +26,7 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport);
 void         gras_trp_file_close(gras_socket_t *sd);
   
 gras_error_t gras_trp_file_chunk_send(gras_socket_t *sd,
-                                     char *data,
+                                     const char *data,
                                      long int size);
 
 gras_error_t gras_trp_file_chunk_recv(gras_socket_t *sd,
@@ -52,7 +54,7 @@ typedef struct {
 gras_error_t
 gras_trp_file_setup(gras_trp_plugin_t *plug) {
 
-  gras_trp_file_plug_data_t *file = malloc(sizeof(gras_trp_file_plug_data_t));
+  gras_trp_file_plug_data_t *file = gras_new(gras_trp_file_plug_data_t,1);
   if (!file)
     RAISE_MALLOC;
 
@@ -185,7 +187,7 @@ void gras_trp_file_close(gras_socket_t *sock){
  */
 gras_error_t 
 gras_trp_file_chunk_send(gras_socket_t *sock,
-                        char *data,
+                        const char *data,
                         long int size) {
   
   gras_assert0(sock->outgoing, "Cannot write on client file socket");