[distcc] HP-UX (was New user / porting)

'Martin Pool' mbp at samba.org
Thu Feb 27 00:36:43 GMT 2003


On 26 Feb 2003, Tom Matelich <tmatelich at zetec.com> wrote:

> I am trying to use distcc 1.2.1 on HP-UX 11i with gcc 3.2.
> changes to source so far:
> added to sendfile.c:
> #elif defined(__hpux)
> static ssize_t sys_sendfile(int ofd, int ifd, off_t *offset, size_t size)
> {
> 	return sendfile(ofd, ifd, *offset, size, NULL, 0);
> }

That's close, but may cause data corruption if there is a partial
transmission.  I think you need something like this.  Could you test
it please?

To apply this patch, just chdir to the source directory and run the
source of this email through the "patch" command.


--- sendfile.c.~1.1.~	2003-01-27 22:33:51.000000000 +1100
+++ sendfile.c	2003-02-27 11:31:09.000000000 +1100
@@ -1,7 +1,6 @@
 /* -*- c-file-style: "java"; indent-tabs-mode: nil; fill-column: 78 -*-
  * 
  * distcc -- A simple distributed compiler system
- * $Header: /data/cvs/distcc/src/sendfile.c,v 1.1 2003/01/27 11:33:51 mbp Exp $ 
  *
  * Copyright (C) 2002, 2003 by Martin Pool <mbp at samba.org>
  *
@@ -108,6 +107,24 @@ static ssize_t sys_sendfile(int ofd, int
 {
     return sendfile(ofd, ifd, offset, size);
 }
+#elif defined(__hpux) || defined(__hpux__)
+/* HP cc in ANSI mode defines __hpux; gcc defines __hpux__ */
+static ssize_t sys_sendfile(int ofd, int ifd, off_t *offset, size_t size)
+{
+    ssize_t ret;
+    
+    ret = sendfile(ofd, ifd, *offset, size, NULL, 0);
+    if (ret == -1) {
+        return -1;
+    } else if (ret > 0) {
+        *offset += ret;
+        return ret;
+    } else {
+        rs_log_error("don't know how to handle return %d from HP-UX sendfile",
+                     ret);
+        return -1;
+    }
+}
 #else
 #warning "Please write a sendfile implementation for this system"
 static ssize_t sys_sendfile(int ofd, int ifd, off_t *offset, size_t size)


-- 
Martin 


More information about the distcc mailing list