updated os2 project files

This commit is contained in:
2012-01-11 14:28:59 +00:00
parent a3eed193d5
commit 60ad0283bc
8 changed files with 647 additions and 465 deletions

View File

@ -82,29 +82,29 @@
# define QSE_WRITE(handle,buf,size) write(handle,buf,size)
#endif
#if !defined(_LP64) && defined(SYS__llseek)
#if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(SYS__llseek)
# define QSE_LLSEEK(handle,hoffset,loffset,out,whence) syscall(SYS__llseek,handle,hoffset,loffset,out,whence)
#elif !defined(_LP64) && defined(HAVE__LLSEEK)
#elif !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE__LLSEEK)
# define QSE_LLSEEK(handle,hoffset,loffset,out,whence) _llseek(handle,hoffset,loffset,out,whence)
#endif
#if !defined(_LP64) && defined(SYS_lseek64)
#if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(SYS_lseek64)
# define QSE_LSEEK(handle,offset,whence) syscall(SYS_lseek64,handle,offset,whence)
#elif defined(SYS_lseek)
# define QSE_LSEEK(handle,offset,whence) syscall(SYS_lseek,handle,offset,whence)
#elif !defined(_LP64) && defined(HAVE_LSEEK64)
#elif !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE_LSEEK64)
# define QSE_LSEEK(handle,offset,whence) lseek64(handle,offset,whence)
#else
# define QSE_LSEEK(handle,offset,whence) lseek(handle,offset,whence)
#endif
#if !defined(_LP64) && defined(SYS_fstat64)
# define QSE_FSTAT(path,stbuf) syscall(SYS_fstat,path,stbuf)
#if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(SYS_fstat64)
# define QSE_FSTAT(path,stbuf) syscall(SYS_fstat64,path,stbuf)
typedef struct stat64 qse_fstat_t;
#elif defined(SYS_fstat)
# define QSE_FSTAT(path,stbuf) syscall(SYS_fstat,path,stbuf)
typedef struct stat qse_fstat_t;
#elif !defined(_LP64) && defined(HAVE_FSTAT64)
#elif !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE_FSTAT64)
# define QSE_FSTAT(path,stbuf) fstat64(path,stbuf)
typedef struct stat64 qse_fstat_t;
#else
@ -112,11 +112,11 @@
typedef struct stat qse_fstat_t;
#endif
#if !defined(_LP64) && defined(SYS_ftruncate64)
#if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(SYS_ftruncate64)
# define QSE_FTRUNCATE(handle,size) syscall(SYS_ftruncate64,handle,size)
#elif defined(SYS_ftruncate)
# define QSE_FTRUNCATE(handle,size) syscall(SYS_ftruncate,handle,size)
#elif !defined(_LP64) && defined(HAVE_FTRUNCATE64)
#elif !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE_FTRUNCATE64)
# define QSE_FTRUNCATE(handle,size) ftruncate64(handle,size)
#else
# define QSE_FTRUNCATE(handle,size) ftruncate(handle,size)
@ -275,13 +275,13 @@
# define QSE_LINK(oldpath,newpath) link(oldpath,newpath)
#endif
#if !defined(_LP64) && defined(SYS_lstat64)
#if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(SYS_lstat64)
# define QSE_LSTAT(path,stbuf) syscall(SYS_lstat,path,stbuf)
typedef struct stat64 qse_lstat_t;
#elif defined(SYS_lstat)
# define QSE_LSTAT(path,stbuf) syscall(SYS_lstat,path,stbuf)
typedef struct stat qse_lstat_t;
#elif !defined(_LP64) && defined(HAVE_LSTAT64)
#elif !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE_LSTAT64)
# define QSE_LSTAT(path,stbuf) lstat64(path,stbuf)
typedef struct stat64 qse_lstat_t;
#else
@ -302,13 +302,13 @@
# define QSE_RMDIR(path) rmdir(path)
#endif
#if !defined(_LP64) && defined(SYS_stat64)
#if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(SYS_stat64)
# define QSE_STAT(path,stbuf) syscall(SYS_stat64,path,stbuf)
typedef struct stat64 qse_stat_t;
#elif defined(SYS_stat)
# define QSE_STAT(path,stbuf) syscall(SYS_stat,path,stbuf)
typedef struct stat qse_stat_t;
#elif !defined(_LP64) && defined(HAVE_STAT64)
#elif !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE_STAT64)
# define QSE_STAT(path,stbuf) stat64(path,stbuf)
typedef struct stat64 qse_stat_t;
#else

View File

@ -36,10 +36,18 @@
#define MAX_SEND_SIZE 4096
#ifdef HAVE_SYS_SENDFILE_H
#if defined(HAVE_SYS_SENDFILE_H)
# include <sys/sendfile.h>
# if !defined(_LP64) && (QSE_SIZEOF_VOID_P<8) && defined(HAVE_SENDFILE64)
# define xsendfile sendfile64
# else
# define xsendfile sendfile
# endif
#else
static qse_ssize_t sendfile (
static qse_ssize_t xsendfile (
int out_fd, int in_fd, qse_foff_t* offset, qse_size_t count)
{
qse_mchar_t buf[MAX_SEND_SIZE];
@ -389,7 +397,7 @@ static int task_main_file (
if (count >= ctx->left) count = ctx->left;
/* TODO: more adjustment needed for OS with different sendfile semantics... */
n = sendfile (
n = xsendfile (
client->handle.i,
ctx->handle.i,
&ctx->offset,
@ -978,8 +986,10 @@ qse_printf (QSE_T("READING CHUNKED MODE...\n"));
}
/* set the chunk length */
snprintf (chunklen, QSE_COUNTOF(chunklen), QSE_MT("%-4lX\r\n"), n);
QSE_MEMCPY (&cgi->buf[cgi->buflen], chunklen, QSE_SIZEOF(chunklen) - 1);
snprintf (chunklen, QSE_COUNTOF(chunklen),
QSE_MT("%-4lX\r\n"), (unsigned long)n);
QSE_MEMCPY (&cgi->buf[cgi->buflen],
chunklen, QSE_SIZEOF(chunklen) - 1);
cgi->buflen += QSE_SIZEOF(chunklen) - 1 + n;
/* set the trailing CR & LF for a chunk */