summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/isc/unix
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2020-01-22 08:17:01 +0000
committertedu <tedu@openbsd.org>2020-01-22 08:17:01 +0000
commit11ade654bad3030fdabca0dad443d1adc2222a94 (patch)
treeed55acab30485c6b0d532f8142b5f5ea79010b47 /usr.sbin/bind/lib/isc/unix
parentremove defines from config.h.in that are no longer checked in the code (diff)
downloadwireguard-openbsd-11ade654bad3030fdabca0dad443d1adc2222a94.tar.xz
wireguard-openbsd-11ade654bad3030fdabca0dad443d1adc2222a94.zip
unifdef a few features we have. ok florian
Diffstat (limited to 'usr.sbin/bind/lib/isc/unix')
-rw-r--r--usr.sbin/bind/lib/isc/unix/file.c38
-rw-r--r--usr.sbin/bind/lib/isc/unix/stdio.c10
2 files changed, 2 insertions, 46 deletions
diff --git a/usr.sbin/bind/lib/isc/unix/file.c b/usr.sbin/bind/lib/isc/unix/file.c
index 0521c54b68d..e9eeb9a9077 100644
--- a/usr.sbin/bind/lib/isc/unix/file.c
+++ b/usr.sbin/bind/lib/isc/unix/file.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*/
-/* $Id: file.c,v 1.12 2020/01/20 18:51:53 florian Exp $ */
+/* $Id: file.c,v 1.13 2020/01/22 08:17:01 tedu Exp $ */
/*! \file */
@@ -60,9 +60,7 @@
#include <sys/stat.h>
#include <sys/time.h>
-#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
-#endif
#include <isc/dir.h>
#include <isc/file.h>
@@ -654,46 +652,12 @@ void *
isc_file_mmap(void *addr, size_t len, int prot,
int flags, int fd, off_t offset)
{
-#ifdef HAVE_MMAP
return (mmap(addr, len, prot, flags, fd, offset));
-#else
- void *buf;
- ssize_t ret;
- off_t end;
-
- UNUSED(addr);
- UNUSED(prot);
- UNUSED(flags);
-
- end = lseek(fd, 0, SEEK_END);
- lseek(fd, offset, SEEK_SET);
- if (end - offset < (off_t) len)
- len = end - offset;
-
- buf = malloc(len);
- if (buf == NULL)
- return (NULL);
-
- ret = read(fd, buf, len);
- if (ret != (ssize_t) len) {
- free(buf);
- buf = NULL;
- }
-
- return (buf);
-#endif
}
int
isc_file_munmap(void *addr, size_t len) {
-#ifdef HAVE_MMAP
return (munmap(addr, len));
-#else
- UNUSED(len);
-
- free(addr);
- return (0);
-#endif
}
isc_boolean_t
diff --git a/usr.sbin/bind/lib/isc/unix/stdio.c b/usr.sbin/bind/lib/isc/unix/stdio.c
index 3cd4f5e1fdb..09b203b8025 100644
--- a/usr.sbin/bind/lib/isc/unix/stdio.c
+++ b/usr.sbin/bind/lib/isc/unix/stdio.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdio.c,v 1.3 2019/12/17 01:46:37 sthen Exp $ */
+/* $Id: stdio.c,v 1.4 2020/01/22 08:17:01 tedu Exp $ */
#include <config.h>
@@ -53,11 +53,7 @@ isc_result_t
isc_stdio_seek(FILE *f, off_t offset, int whence) {
int r;
-#ifdef HAVE_FSEEKO
r = fseeko(f, offset, whence);
-#else
- r = fseek(f, offset, whence);
-#endif
if (r == 0)
return (ISC_R_SUCCESS);
else
@@ -70,11 +66,7 @@ isc_stdio_tell(FILE *f, off_t *offsetp) {
REQUIRE(offsetp != NULL);
-#ifdef HAVE_FTELLO
r = ftello(f);
-#else
- r = ftell(f);
-#endif
if (r >= 0) {
*offsetp = r;
return (ISC_R_SUCCESS);