SPDX: Mass-update to GPL-2.0-or-later
[exim.git] / src / OS / os.c-Linux
index 5589a015bc1177cd450c286b8bff9c90aeb64712..34dd7c1905d3319510c8ac17bc81c8478c2afac1 100644 (file)
@@ -1,10 +1,9 @@
-/* $Cambridge: exim/src/OS/os.c-Linux,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
-
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1997 - 2001 */
+/* Copyright (c) University of Cambridge 1997 - 2018 */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Linux-specific code. This is concatenated onto the generic
@@ -20,7 +19,7 @@ a unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to
 provide the function. However, when compiling os.c for utilities, we may not
 want this at all, so check that it isn't set first. */
 
-#ifndef OS_LOAD_AVERAGE
+#if !defined(OS_LOAD_AVERAGE) && defined(__linux__)
 #define OS_LOAD_AVERAGE
 
 /* Linux has 2 ways of returning load average:
@@ -96,7 +95,7 @@ ip_address_item *last = NULL;
 ip_address_item  *next;
 char addr6p[8][5];
 unsigned int plen, scope, dad_status, if_idx;
-char devname[20];
+char devname[20+1];
 FILE *f;
 #endif
 
@@ -114,9 +113,9 @@ last = yield;
 if (last != NULL) while (last->next != NULL) last = last->next;
 
 while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
-            addr6p[0], addr6p[1], addr6p[2], addr6p[3],
-            addr6p[4], addr6p[5], addr6p[6], addr6p[7],
-            &if_idx, &plen, &scope, &dad_status, devname) != EOF)
+             addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+             addr6p[4], addr6p[5], addr6p[6], addr6p[7],
+             &if_idx, &plen, &scope, &dad_status, devname) != EOF)
   {
   struct sockaddr_in6 addr;
 
@@ -126,8 +125,8 @@ while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
   next->next = NULL;
   next->port = 0;
   sprintf(CS next->address, "%s:%s:%s:%s:%s:%s:%s:%s",
-        addr6p[0], addr6p[1], addr6p[2], addr6p[3],
-        addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
+         addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+         addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
 
   /* Normalize the representation */
 
@@ -152,4 +151,16 @@ return yield;
 
 #endif  /* FIND_RUNNING_INTERFACES */
 
+
+/*************
+* Sendfile   *
+*************/
+#include <sys/sendfile.h>
+
+ssize_t
+os_sendfile(int out, int in, off_t * off, size_t cnt)
+{
+return sendfile(out, in, off, cnt);
+}
+
 /* End of os.c-Linux */