yyh84yangtao / memlink

Automatically exported from code.google.com/p/memlink
0 stars 0 forks source link

Compile Patch for freebsd #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Index: dumpfile.c
===================================================================
--- dumpfile.c  (版本 610)
+++ dumpfile.c  (工作副本)
@@ -45,7 +45,7 @@
     DINFO("dumpfile to tmp: %s\n", tmpfile);

    gettimeofday(&start, NULL);
-    FILE    *fp = fopen64(tmpfile, "wb");
+    FILE    *fp = fopen(tmpfile, "wb");

     unsigned short formatver = DUMP_FORMAT_VERSION;
     ffwrite(&formatver, sizeof(short), 1, fp);
@@ -140,7 +140,7 @@
    struct timeval start, end;

    gettimeofday(&start, NULL);
-    fp = fopen64(filename, "rb");
+    fp = fopen(filename, "rb");
     if (NULL == fp) {
         DERROR("open dumpfile %s error: %s\n", filename, strerror(errno));
         return -1;
@@ -291,7 +291,7 @@
     FILE    *dumpf;

     //dumpf = fopen(filename, "r");
-    dumpf = fopen64(filename, "r");
+    dumpf = fopen(filename, "r");
     if (dumpf == NULL) {
         DERROR("open file %s error! %s\n", filename, strerror(errno));
         return -1;
Index: SConstruct
===================================================================
--- SConstruct  (版本 610)
+++ SConstruct  (工作副本)
@@ -4,9 +4,9 @@
 #defs     = ['DEBUG', 'RANGE_MASK_STR']
 #defs     = ['DEBUG', "__USE_FILE_OFFSET64", "__USE_LARGEFILE64", "_LARGEFILE_SOURCE", "_LARGEFILE64_SOURCE", "_FILE_OFFSET_BITS=64", 'DEBUGMEM']
 defs     = ['DEBUG', "__USE_FILE_OFFSET64", "__USE_LARGEFILE64", "_LARGEFILE_SOURCE", "_LARGEFILE64_SOURCE", "_FILE_OFFSET_BITS=64"]
-includes = ['/Developer/usr/include', '.']
-libpath  = ['/Developer/usr/lib']
-libs     = ['event', 'm']
+includes = ['/Developer/usr/include', '.', '/usr/local/include']
+libpath  = ['/Developer/usr/lib', '/usr/local/lib', '/usr/lib']
+libs     = ['event', 'm', 'pthread']
 #libs     = ['event', 'm', 'tcmalloc_minimal']
 cflags   = "-ggdb -pthread -std=gnu99 -Wall -Werror -O2"

Index: network.c
===================================================================
--- network.c   (版本 610)
+++ network.c   (工作副本)
@@ -4,7 +4,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <netdb.h>
-#include <netinet/tcp.h>
+#include <netinet/in.h>
 #include<arpa/inet.h>
 #include <sys/types.h>
 #include <fcntl.h>
@@ -12,6 +12,7 @@
 #include "logfile.h"
 #include "myconfig.h"
 #include "network.h"
+#include <netinet/tcp.h>

 int 
Index: conn.c
===================================================================
--- conn.c  (版本 610)
+++ conn.c  (工作副本)
@@ -4,6 +4,7 @@
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
 #ifdef __linux
 #include <linux/if.h>
 #endif

Index: synclog.c
===================================================================
--- synclog.c   (版本 610)
+++ synclog.c   (工作副本)
@@ -325,7 +325,7 @@
        FILE *fp = NULL;
        unsigned int offset = 0;

-       fp = fopen64(dumpfile, "rb");
+       fp = fopen(dumpfile, "rb");
        offset = sizeof(short) + sizeof(int);
        fseek(fp, offset, SEEK_SET);
        ret = ffread(&dumplogver, sizeof(int), 1, fp);
Index: sslave.c
===================================================================
--- sslave.c    (版本 610)
+++ sslave.c    (工作副本)
@@ -2,12 +2,12 @@
 #include <sys/socket.h>
 #include <netdb.h>
 #include <arpa/inet.h> 
-#include <netinet/tcp.h> 
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <sys/types.h>
+#include <netinet/tcp.h> 
 #include <fcntl.h>

 #include "logfile.h"
@@ -101,7 +101,7 @@

    FILE    *dumpf; 
    //dumpf = fopen(dumpfile, "r");
-   dumpf = (FILE*)fopen64(dumpfile, "r");
+   dumpf = (FILE*)fopen(dumpfile, "r");
    if (dumpf == NULL) {
        DERROR("open file %s error! %s\n", dumpfile, strerror(errno));
        return -1;

Original issue reported on code.google.com by yaoweibin@gmail.com on 11 Jan 2011 at 8:25

GoogleCodeExporter commented 8 years ago
On freebsd and Darwin, all the file offset is 64bit. There is no fopen64. 

Original comment by yaoweibin@gmail.com on 11 Jan 2011 at 8:28

GoogleCodeExporter commented 8 years ago
thanks

Original comment by zhaowei...@gmail.com on 26 Jan 2011 at 3:25