Fix build on 4-x

PR:		ports/68349
Submitted by:	maintainer
This commit is contained in:
Kirill Ponomarev 2004-06-26 05:21:59 +00:00
parent 7f258b9907
commit 69d55f08c2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=112298
4 changed files with 12 additions and 4 deletions

View File

@ -27,6 +27,7 @@ WRKSRC= ${WRKDIR}/${DISTNAME}
PATCH_STRIP= -p1
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC}\ -I${PREFIX}/include
MAN1= qemu.1 qemu-mkcow.1
ONLY_FOR_ARCHS= i386 amd64 powerpc
post-install:
@${CAT} ${PKGMESSAGE}

View File

@ -8,27 +8,30 @@ Index: qemu/qemu-mkcow.c
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@@ -36,6 +38,12 @@
@@ -36,6 +38,13 @@
#include <sys/stat.h>
#include <netinet/in.h>
+#ifdef _BSD
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/disk.h>
+#endif
+
#include "cow.h"
#include "bswap.h"
@@ -56,6 +64,13 @@ int cow_create(int cow_fd, const char *i
@@ -56,6 +64,15 @@ int cow_create(int cow_fd, const char *i
perror(image_filename);
exit(1);
}
+#ifdef _BSD
+ struct stat sb;
+ if (!fstat(fd,&sb) && (S_IFCHR & sb.st_mode)) {
+#ifdef DIOCGMEDIASIZE
+ if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&image_sectors))
+#endif
+ image_sectors = lseek(fd, 0LL, SEEK_END);
+ } else
+#endif

View File

@ -27,6 +27,7 @@ WRKSRC= ${WRKDIR}/${DISTNAME}
PATCH_STRIP= -p1
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC}\ -I${PREFIX}/include
MAN1= qemu.1 qemu-mkcow.1
ONLY_FOR_ARCHS= i386 amd64 powerpc
post-install:
@${CAT} ${PKGMESSAGE}

View File

@ -8,27 +8,30 @@ Index: qemu/qemu-mkcow.c
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@@ -36,6 +38,12 @@
@@ -36,6 +38,13 @@
#include <sys/stat.h>
#include <netinet/in.h>
+#ifdef _BSD
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/disk.h>
+#endif
+
#include "cow.h"
#include "bswap.h"
@@ -56,6 +64,13 @@ int cow_create(int cow_fd, const char *i
@@ -56,6 +64,15 @@ int cow_create(int cow_fd, const char *i
perror(image_filename);
exit(1);
}
+#ifdef _BSD
+ struct stat sb;
+ if (!fstat(fd,&sb) && (S_IFCHR & sb.st_mode)) {
+#ifdef DIOCGMEDIASIZE
+ if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&image_sectors))
+#endif
+ image_sectors = lseek(fd, 0LL, SEEK_END);
+ } else
+#endif