termux-packages/x11-packages/qemu-common/0006-telldir-seekdir.patch

75 lines
2.0 KiB
Diff
Raw Normal View History

diff -uNr qemu-3.1.0/hw/9pfs/9p-local.c qemu-3.1.0.mod/hw/9pfs/9p-local.c
--- qemu-3.1.0/hw/9pfs/9p-local.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/hw/9pfs/9p-local.c 2019-02-14 00:29:24.568616982 +0200
@@ -535,9 +535,23 @@
rewinddir(fs->dir.stream);
}
+struct DIR {
+ int fd_;
+};
+
+static long android_telldir(struct DIR *dirp)
+{
+ return (long) lseek(dirp->fd_, 0, SEEK_CUR);
+}
+
+static void android_seekdir(DIR *dirp, long loc)
+{
+ (void) lseek(dirp->fd_, loc, SEEK_SET);
+}
+
static off_t local_telldir(FsContext *ctx, V9fsFidOpenState *fs)
{
- return telldir(fs->dir.stream);
+ return android_telldir(fs->dir.stream);
}
static bool local_is_mapped_file_metadata(FsContext *fs_ctx, const char *name)
@@ -571,7 +585,7 @@
static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
{
- seekdir(fs->dir.stream, off);
+ android_seekdir(fs->dir.stream, off);
}
static ssize_t local_preadv(FsContext *ctx, V9fsFidOpenState *fs,
diff -uNr qemu-3.1.0/hw/9pfs/9p-proxy.c qemu-3.1.0.mod/hw/9pfs/9p-proxy.c
--- qemu-3.1.0/hw/9pfs/9p-proxy.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/hw/9pfs/9p-proxy.c 2019-02-14 00:29:30.425318357 +0200
@@ -674,9 +674,23 @@
rewinddir(fs->dir.stream);
}
+struct DIR {
+ int fd_;
+};
+
+static long android_telldir(struct DIR *dirp)
+{
+ return (long) lseek(dirp->fd_, 0, SEEK_CUR);
+}
+
+static void android_seekdir(DIR *dirp, long loc)
+{
+ (void) lseek(dirp->fd_, loc, SEEK_SET);
+}
+
static off_t proxy_telldir(FsContext *ctx, V9fsFidOpenState *fs)
{
- return telldir(fs->dir.stream);
+ return android_telldir(fs->dir.stream);
}
static struct dirent *proxy_readdir(FsContext *ctx, V9fsFidOpenState *fs)
@@ -686,7 +700,7 @@
static void proxy_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
{
- seekdir(fs->dir.stream, off);
+ android_seekdir(fs->dir.stream, off);
}
static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs,