summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/misc/util/utilBridge.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/misc/util/utilBridge.c b/src/misc/util/utilBridge.c
index 3ac7ba2c..cd00dec6 100644
--- a/src/misc/util/utilBridge.c
+++ b/src/misc/util/utilBridge.c
@@ -22,6 +22,9 @@
#include <string.h>
#include <stdlib.h>
#include <assert.h>
+#ifdef LIN
+#include <unistd.h>
+#endif
#include "aig/gia/gia.h"
@@ -124,9 +127,24 @@ void Gia_CreateHeader( FILE * pFile, int Type, int Size, unsigned char * pBuffer
fprintf( pFile, " " );
fprintf( pFile, "%.16d", Size );
fprintf( pFile, " " );
+ #ifndef LIN
RetValue = fwrite( pBuffer, Size, 1, pFile );
assert( RetValue == 1 || Size == 0);
fflush( pFile );
+ #else
+ fflush(pFile);
+ int fd = fileno(pFile);
+
+ ssize_t bytes_written = 0;
+ while (bytes_written < Size){
+ ssize_t n = write(fd, &pBuffer[bytes_written], Size - bytes_written);
+ if (n < 0){
+ fprintf(stderr, "BridgeMode: failed to send package; aborting\n"); fflush(stderr);
+ _exit(255);
+ }
+ bytes_written += n;
+ }
+ #endif
}
@@ -244,7 +262,7 @@ int Gia_ManToBridgeResult( FILE * pFile, int Result, Abc_Cex_t * pCex )
Synopsis []
Description []
-
+
SideEffects []
SeeAlso []
@@ -393,7 +411,7 @@ int Gia_ManFromBridgeReadPackage( FILE * pFile, int * pType, int * pSize, unsign
Synopsis []
Description []
-
+
SideEffects []
SeeAlso []
@@ -439,7 +457,7 @@ Gia_Man_t * Gia_ManFromBridge( FILE * pFile, Vec_Int_t ** pvInit )
Synopsis []
Description []
-
+
SideEffects []
SeeAlso []
@@ -462,7 +480,7 @@ void Gia_ManToBridgeAbsNetlistTest( char * pFileName, Gia_Man_t * p, int msg_typ
Synopsis []
Description []
-
+
SideEffects []
SeeAlso []