summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eio.c28
-rw-r--r--eio.h14
-rw-r--r--eio.pod2
-rw-r--r--xthread.h2
4 files changed, 28 insertions, 18 deletions
diff --git a/eio.c b/eio.c
index d67a2b3..b2267b3 100644
--- a/eio.c
+++ b/eio.c
@@ -880,10 +880,10 @@ int eio_poll (void)
# define pread eio__pread
# define pwrite eio__pwrite
-static ssize_t
+static eio_ssize_t
eio__pread (int fd, void *buf, size_t count, off_t offset)
{
- ssize_t res;
+ eio_ssize_t res;
off_t ooffset;
X_LOCK (preadwritelock);
@@ -896,10 +896,10 @@ eio__pread (int fd, void *buf, size_t count, off_t offset)
return res;
}
-static ssize_t
+static eio_ssize_t
eio__pwrite (int fd, void *buf, size_t count, off_t offset)
{
- ssize_t res;
+ eio_ssize_t res;
off_t ooffset;
X_LOCK (preadwritelock);
@@ -998,7 +998,7 @@ eio__fallocate (int fd, int mode, off_t offset, size_t len)
# undef readahead
# define readahead(fd,offset,count) eio__readahead (fd, offset, count, self)
-static ssize_t
+static eio_ssize_t
eio__readahead (int fd, off_t offset, size_t count, etp_worker *self)
{
size_t todo = count;
@@ -1020,11 +1020,11 @@ eio__readahead (int fd, off_t offset, size_t count, etp_worker *self)
#endif
/* sendfile always needs emulation */
-static ssize_t
+static eio_ssize_t
eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self)
{
- ssize_t written = 0;
- ssize_t res;
+ eio_ssize_t written = 0;
+ eio_ssize_t res;
if (!count)
return 0;
@@ -1143,7 +1143,7 @@ eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self)
while (count)
{
- ssize_t cnt;
+ eio_ssize_t cnt;
cnt = pread (ifd, eio_buf, count > EIO_BUFSIZE ? EIO_BUFSIZE : count, offset);
@@ -1361,7 +1361,7 @@ eio__realpath (eio_req *req, etp_worker *self)
while (*rel)
{
- ssize_t len, linklen;
+ eio_ssize_t len, linklen;
char *beg = rel;
while (*rel && *rel != '/')
@@ -2182,7 +2182,7 @@ eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data)
REQ (EIO_FCHMOD); req->int1 = fd; req->int2 = (long)mode; SEND;
}
-eio_req *eio_fchown (int fd, uid_t uid, gid_t gid, int pri, eio_cb cb, void *data)
+eio_req *eio_fchown (int fd, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data)
{
REQ (EIO_FCHOWN); req->int1 = fd; req->int2 = (long)uid; req->int3 = (long)gid; SEND;
}
@@ -2212,7 +2212,7 @@ eio_req *eio_truncate (const char *path, off_t offset, int pri, eio_cb cb, void
REQ (EIO_TRUNCATE); PATH; req->offs = offset; SEND;
}
-eio_req *eio_chown (const char *path, uid_t uid, gid_t gid, int pri, eio_cb cb, void *data)
+eio_req *eio_chown (const char *path, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data)
{
REQ (EIO_CHOWN); PATH; req->int2 = (long)uid; req->int3 = (long)gid; SEND;
}
@@ -2369,11 +2369,11 @@ eio_grp_add (eio_req *grp, eio_req *req)
/*****************************************************************************/
/* misc garbage */
-ssize_t
+eio_ssize_t
eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count)
{
etp_worker wrk;
- ssize_t ret;
+ eio_ssize_t ret;
wrk.dbuf = 0;
diff --git a/eio.h b/eio.h
index e99f0d6..585345b 100644
--- a/eio.h
+++ b/eio.h
@@ -66,6 +66,16 @@ typedef int (*eio_cb)(eio_req *req);
# endif
#endif
+#ifdef _WIN32
+typedef int eio_uid_t;
+typedef int eio_gid_t;
+typedef intptr_t eio_ssize_t; /* or SSIZE_T */
+#else
+typedef uid_t eio_uid_t;
+typedef gid_t eio_gid_t;
+typedef ssize_t eio_ssize_t;
+#endif
+
#ifndef EIO_STRUCT_STATVFS
# define EIO_STRUCT_STATVFS struct statvfs
#endif
@@ -191,7 +201,7 @@ struct eio_req
{
eio_req volatile *next; /* private ETP */
- ssize_t result; /* result of syscall, e.g. result = read (... */
+ eio_ssize_t result; /* result of syscall, e.g. result = read (... */
off_t offs; /* read, write, truncate, readahead, sync_file_range, fallocate: file offset, mknod: dev_t */
size_t size; /* read, write, readahead, sendfile, msync, mlock, sync_file_range, fallocate: length */
void *ptr1; /* all applicable requests: pathname, old name; readdir: optional eio_dirents */
@@ -341,7 +351,7 @@ void eio_cancel (eio_req *req);
/*****************************************************************************/
/* convenience functions */
-ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count);
+eio_ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count);
#ifdef __cplusplus
}
diff --git a/eio.pod b/eio.pod
index eaee6ba..a2ccf24 100644
--- a/eio.pod
+++ b/eio.pod
@@ -911,7 +911,7 @@ was written to use very little stackspace, but when using C<EIO_CUSTOM>
requests, you might want to increase this.
If this symbol is undefined (the default) then libeio will use its default
-stack size (C<sizeof (long) * 4096> currently). If it is defined, but
+stack size (C<sizeof (void *) * 4096> currently). If it is defined, but
C<0>, then the default operating system stack size will be used. In all
other cases, the value must be an expression that evaluates to the desired
stack size.
diff --git a/xthread.h b/xthread.h
index a8acafb..3b6b4e0 100644
--- a/xthread.h
+++ b/xthread.h
@@ -130,7 +130,7 @@ typedef pthread_t xthread_t;
#endif
#ifndef X_STACKSIZE
-# define X_STACKSIZE sizeof (long) * 4096
+# define X_STACKSIZE sizeof (void *) * 4096
#endif
static int