made minor changes to syscall definitions

This commit is contained in:
hyung-hwan 2011-11-23 15:11:22 +00:00
parent 350c75434c
commit 936353f809
4 changed files with 79 additions and 34 deletions

View File

@ -609,9 +609,6 @@ qse_fio_off_t qse_fio_seek (
}
return (qse_fio_off_t)tmp;
#elif defined(QSE_LSEEK64)
return QSE_LSEEK64 (fio->handle, offset, seek_map[origin]);
#else
return QSE_LSEEK (fio->handle, offset, seek_map[origin]);
#endif

View File

@ -22,7 +22,16 @@
#include <qse/cmn/str.h>
#include "mem.h"
int qse_fs_move (qse_fs_t* fs, const qse_char_t* oldpath, const qse_char_t* newpath)
/*
OVERWRITE AND FORCE handled by callback???
QSE_FS_MOVE_UPDATE
QSE_FS_MOVE_BACKUP_SIMPLE
QSE_FS_MOVE_BACKUP_NUMBERED
*/
int qse_fs_move (
qse_fs_t* fs, const qse_char_t* oldpath, const qse_char_t* newpath)
{
#if defined(_WIN32)
/* TODO: improve it... */
@ -58,6 +67,16 @@ int qse_fs_move (qse_fs_t* fs, const qse_char_t* oldpath, const qse_char_t* newp
const qse_mchar_t* mbsoldpath;
const qse_mchar_t* mbsnewpath;
#if 0
struct file_stat_t
{
int oldst_ok;
int newst_ok;
qse_lstat_t oldst;
qse_lstat_t newst;
};
#endif
#if defined(QSE_CHAR_IS_MCHAR)
mbsoldpath = oldpath;
mbsnewpath = newpath;
@ -82,6 +101,27 @@ int qse_fs_move (qse_fs_t* fs, const qse_char_t* oldpath, const qse_char_t* newp
}
*/
#if 0
if (opt)
{
/* use lstat because we need to move the symbolic link
* itself if the file is a symbolic link */
if (QSE_LSTAT (mboldpath, &oldst) == -1)
{
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
goto oops;
}
}
if (QSE_LSTAT (mbnewpath, &newst) == -1)
{
if (errno == ENOENT)
{
/* entry doesn't exist */
}
}
#endif
/* TODO: make it better to be able to move non-empty diretories
improve it to be able to move by copy/delete across volume */
if (QSE_RENAME (mbsoldpath, mbsnewpath) == -1)

View File

@ -533,11 +533,7 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
int x;
int stat_needed;
#if defined(QSE_LSTAT64)
struct stat64 st;
#else
struct stat st;
#endif
qse_lstat_t st;
info = fs->info;
if (info == QSE_NULL)
@ -580,11 +576,7 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
return QSE_NULL;
}
#if defined(QSE_LSTAT64)
x = QSE_LSTAT64 (mfname, &st);
#else
x = QSE_LSTAT (mfname, &st);
#endif
QSE_MMGR_FREE (fs->mmgr, mfname);
if (x == -1)

View File

@ -88,18 +88,30 @@
# define QSE_LLSEEK(handle,hoffset,loffset,out,whence) _llseek(handle,hoffset,loffset,out,whence)
#endif
#if defined(SYS_lseek64)
# define QSE_LSEEK64(handle,offset,whence) syscall(SYS_lseek64,handle,offset,whence)
#elif defined(HAVE_lseek64)
# define QSE_LSEEK64(handle,offset,whence) lseek64(handle,offset,whence)
#endif
#if defined(SYS_lseek)
#if !defined(_LP64) && 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)
# 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)
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)
# define QSE_FSTAT(path,stbuf) fstat64(path,stbuf)
typedef struct stat64 qse_fstat_t;
#else
# define QSE_FSTAT(path,stbuf) fstat(path,stbuf)
typedef struct stat qse_fstat_t;
#endif
#if !defined(_LP64) && defined(SYS_ftruncate64)
# define QSE_FTRUNCATE(handle,size) syscall(SYS_ftruncate64,handle,size)
#elif defined(SYS_ftruncate)
@ -263,16 +275,18 @@
# define QSE_LINK(oldpath,newpath) link(oldpath,newpath)
#endif
#if defined(SYS_lstat64)
# define QSE_LSTAT64(path,stbuf) syscall(SYS_lstat64,path,stbuf)
#elif defined(HAVE_lstat64)
# define QSE_LSTAT64(path,stbuf) lstat64(path,stbuf)
#endif
#if defined(SYS_lstat)
#if !defined(_LP64) && 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)
# define QSE_LSTAT(path,stbuf) lstat64(path,stbuf)
typedef struct stat64 qse_lstat_t;
#else
# define QSE_LSTAT(path,stbuf) lstat(path,stbuf)
typedef struct stat qse_lstat_t;
#endif
#if defined(SYS_rename)
@ -287,16 +301,18 @@
# define QSE_RMDIR(path) rmdir(path)
#endif
#if defined(SYS_stat64)
# define QSE_STAT64(path,stbuf) syscall(SYS_stat64,path,stbuf)
#elif defined(HAVE_stat64)
# define QSE_STAT64(path,stbuf) stat64(path,stbuf)
#endif
#if defined(SYS_stat)
#if !defined(_LP64) && 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)
# define QSE_STAT(path,stbuf) stat64(path,stbuf)
typedef struct stat64 qse_stat_t;
#else
# define QSE_STAT(path,stbuf) stat(path,stbuf)
typedef struct stat qse_stat_t;
#endif
#if defined(SYS_symlink)