implemented qse_fio_chmod() for win32 and unix

- on win32, it is a best effort implemention.
- it gets the volume name from a handle and use SetFileAttributes().
fixed the problem of wrongly detecting objdump.
- place AC_PROG_LIBTOOL after any AC_CHECK_TOOL.
- otherwise, AC_PROG_LIBTOOL overrides the value of tools checked.
This commit is contained in:
hyung-hwan 2008-12-27 02:52:47 +00:00
parent 359beea51e
commit 39c4afe129
24 changed files with 1322 additions and 675 deletions

View File

@ -121,6 +121,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -131,7 +132,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -99,6 +99,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -109,7 +110,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -132,6 +132,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -142,7 +143,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -114,6 +114,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -124,7 +125,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -113,6 +113,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -123,7 +124,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

1654
qse/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -18,17 +18,21 @@ AC_PROG_CXX
dnl checks if the C++ compiler exists in PATH. dnl checks if the C++ compiler exists in PATH.
AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no) AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_CHECK_TOOL(RANLIB, ranlib)
AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib)
AC_CHECK_TOOL(STRIP, strip)
AC_CHECK_TOOL(OBJDUMP, objdump)
AC_CHECK_TOOL(NM, nm)
AC_CHECK_TOOL(LD, ld)
AC_CHECK_TOOL(GREP, grep) AC_CHECK_TOOL(GREP, grep)
AC_CHECK_TOOL(RM, rm) AC_CHECK_TOOL(RM, rm)
AC_CHECK_TOOL(SED, sed) AC_CHECK_TOOL(SED, sed)
AC_CHECK_TOOL(CJ, gcj) AC_CHECK_TOOL(CJ, gcj)
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
dnl overrides the default CFLAGS setting dnl overrides the default CFLAGS setting
#if test "$ac_test_CFLAGS" = "set" #if test "$ac_test_CFLAGS" = "set"
#then #then
@ -70,6 +74,13 @@ dnl make visible the 64bit interface to the file system
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H" CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H" CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
case "$host" in
*-*-mingw*|*-*-cygwin*)
#CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0400"
platform_win32=yes
esac
AM_CONDITIONAL(WIN32, test "${platform_win32}" = "yes" )
dnl Checks for the math library (is -lm needed?) dnl Checks for the math library (is -lm needed?)
AC_CHECK_LIBM AC_CHECK_LIBM
AC_SUBST(LIBM, $LIBM) AC_SUBST(LIBM, $LIBM)
@ -327,6 +338,7 @@ echo
echo "-[SUMMARY]---------------------------------------------------------------" echo "-[SUMMARY]---------------------------------------------------------------"
echo "Configured for ${host}" echo "Configured for ${host}"
echo " Build mode : ${BUILD_MODE}" echo " Build mode : ${BUILD_MODE}"
echo " Source directory: ${srcdir}"
echo " Installation directory: ${prefix}" echo " Installation directory: ${prefix}"
echo " C compiler: ${CC} ${CFLAGS}" echo " C compiler: ${CC} ${CFLAGS}"
echo " C++ compiler: ${CXX} ${CXXFLAGS}" echo " C++ compiler: ${CXX} ${CXXFLAGS}"

View File

@ -102,6 +102,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -112,7 +113,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -111,6 +111,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -121,7 +122,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -103,6 +103,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -113,7 +114,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -101,6 +101,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -111,7 +112,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -22,9 +22,11 @@ enum qse_fio_open_flag_t
QSE_FIO_EXCLUSIVE = (1 << 6), QSE_FIO_EXCLUSIVE = (1 << 6),
QSE_FIO_SYNC = (1 << 7), QSE_FIO_SYNC = (1 << 7),
/* for ms windows only */ /* for WIN32 only. harmless(no effect) when used on other platforms */
QSE_FIO_NOSHRD = (1 << 16), QSE_FIO_NOSHRD = (1 << 16),
QSE_FIO_NOSHWR = (1 << 17) QSE_FIO_NOSHWR = (1 << 17),
QSE_FIO_RANDOM = (1 << 18), /* hint that access be random */
QSE_FIO_SEQUENTIAL = (1 << 19) /* hint that access is sequential */
}; };
/* seek origin */ /* seek origin */
@ -35,8 +37,24 @@ enum qse_fio_seek_origin_t
QSE_FIO_END = 2 QSE_FIO_END = 2
}; };
enum qse_fio_mode_t
{
QSE_FIO_SUID = 04000, /* set UID */
QSE_FIO_SGID = 02000, /* set GID */
QSE_FIO_SVTX = 01000, /* sticky bit */
QSE_FIO_RUSR = 00400, /* can be read by owner */
QSE_FIO_WUSR = 00200, /* can be written by owner */
QSE_FIO_XUSR = 00100, /* can be executed by owner */
QSE_FIO_RGRP = 00040, /* can be read by group */
QSE_FIO_WGRP = 00020, /* can be written by group */
QSE_FIO_XGRP = 00010, /* can be executed by group */
QSE_FIO_ROTH = 00004, /* can be read by others */
QSE_FIO_WOTH = 00002, /* can be written by others */
QSE_FIO_XOTH = 00001 /* can be executed by others */
};
#ifdef _WIN32 #ifdef _WIN32
/* <winnt.h> typedef PVOID HANDLE; */ /* <winnt.h> => typedef PVOID HANDLE; */
typedef void* qse_fio_hnd_t; typedef void* qse_fio_hnd_t;
#else #else
typedef int qse_fio_hnd_t; typedef int qse_fio_hnd_t;
@ -108,7 +126,7 @@ qse_fio_hnd_t qse_fio_gethandle (
); );
/****f* qse.cmn.fio/qse_fio_sethandle /****f* qse.cmn.fio/qse_fio_sethandle
* SYNOPSIS * NAME
* qse_fio_sethandle - set the file handle * qse_fio_sethandle - set the file handle
* WARNING * WARNING
* Avoid using this function if you don't know what you are doing. * Avoid using this function if you don't know what you are doing.
@ -145,6 +163,16 @@ qse_ssize_t qse_fio_write (
qse_size_t size qse_size_t size
); );
/****f* qse.cmn.fio/qse_fio_chmod
* NAME
* ase_fio_chmod - change the file mode
* SYNOPSIS
*/
int qse_fio_chmod (
qse_fio_t* fio,
int mode
);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -101,6 +101,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -111,7 +112,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -101,6 +101,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -111,7 +112,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -101,6 +101,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -111,7 +112,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -28,7 +28,7 @@ extern "C" {
#endif #endif
int qse_runmain (int argc, qse_achar_t* argv[], int(*mf) (int,qse_char_t*[])); int qse_runmain (int argc, qse_achar_t* argv[], int(*mf) (int,qse_char_t*[]));
/* TODO - qse_runmain with env */ /* TODO - qse_runmain with env, namely, qse_runmaine */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -99,6 +99,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -109,7 +110,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -138,6 +138,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -148,7 +149,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -11,3 +11,7 @@ libqsecmn_la_SOURCES = mem.h chr.h \
misc.c misc.c
libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined
if WIN32
libqsecmn_la_LIBADD = -lpsapi
endif

View File

@ -50,7 +50,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES)
libqsecmn_la_LIBADD = libqsecmn_la_DEPENDENCIES =
am_libqsecmn_la_OBJECTS = mem.lo chr.lo chr_cnv.lo rex.lo str_bas.lo \ am_libqsecmn_la_OBJECTS = mem.lo chr.lo chr_cnv.lo rex.lo str_bas.lo \
str_cnv.lo str_dyn.lo lda.lo map.lo sll.lo dll.lo opt.lo \ str_cnv.lo str_dyn.lo lda.lo map.lo sll.lo dll.lo opt.lo \
fio.lo sio.lo tio.lo tio_get.lo tio_put.lo time.lo misc.lo fio.lo sio.lo tio.lo tio_get.lo tio_put.lo time.lo misc.lo
@ -120,6 +120,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -130,7 +131,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -208,6 +211,7 @@ libqsecmn_la_SOURCES = mem.h chr.h \
misc.c misc.c
libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined
@WIN32_TRUE@libqsecmn_la_LIBADD = -lpsapi
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View File

@ -7,6 +7,8 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <psapi.h>
#include <tchar.h>
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
@ -71,11 +73,11 @@ qse_fio_t* qse_fio_init (
DWORD desired_access = 0; DWORD desired_access = 0;
DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
DWORD creation_disposition = 0; DWORD creation_disposition = 0;
DWORD attributes = FILE_ATTRIBUTE_NORMAL; DWORD flag_and_attr = FILE_ATTRIBUTE_NORMAL;
if (flags & QSE_FIO_APPEND) if (flags & QSE_FIO_APPEND)
{ {
/* this is not officialy documented for CreateFile. /* this is not officially documented for CreateFile.
* ZwCreateFile (kernel) seems to document it */ * ZwCreateFile (kernel) seems to document it */
desired_access |= FILE_APPEND_DATA; desired_access |= FILE_APPEND_DATA;
} }
@ -99,14 +101,25 @@ qse_fio_t* qse_fio_init (
} }
else creation_disposition = OPEN_EXISTING; else creation_disposition = OPEN_EXISTING;
if (flags & QSE_FIO_NOSHRD) share_mode &= ~FILE_SHARE_READ; if (flags & QSE_FIO_NOSHRD)
if (flags & QSE_FIO_NOSHWR) share_mode &= ~FILE_SHARE_WRITE; share_mode &= ~FILE_SHARE_READ;
if (flags & QSE_FIO_NOSHWR)
share_mode &= ~FILE_SHARE_WRITE;
if (!(mode & QSE_FIO_WUSR))
flag_and_attr = FILE_ATTRIBUTE_READONLY;
if (flags & QSE_FIO_SYNC)
flag_and_attr |= FILE_FLAG_WRITE_THROUGH;
/* these two are just hints to OS */
if (flags & QSE_FIO_RANDOM)
flag_and_attr |= FILE_FLAG_RANDOM_ACCESS;
if (flags & QSE_FIO_SEQUENTIAL)
flag_and_attr |= FILE_FLAG_SEQUENTIAL_SCAN;
if (flags & QSE_FIO_SYNC) attributes |= FILE_FLAG_WRITE_THROUGH;
/* TODO: handle mode... set attribuets */
handle = CreateFile (path, handle = CreateFile (path,
desired_access, share_mode, QSE_NULL, desired_access, share_mode, QSE_NULL,
creation_disposition, attributes, 0); creation_disposition, flag_and_attr, 0);
} }
if (handle == INVALID_HANDLE_VALUE) return QSE_NULL; if (handle == INVALID_HANDLE_VALUE) return QSE_NULL;
@ -120,7 +133,7 @@ qse_fio_t* qse_fio_init (
} }
} }
/* TODO: a lot more */ /* TODO: support more features on WIN32 - TEMPORARY, DELETE_ON_CLOSE */
#else #else
if (flags & QSE_FIO_HANDLE) if (flags & QSE_FIO_HANDLE)
@ -228,7 +241,8 @@ qse_fio_off_t qse_fio_seek (
/* /*
x.QuadPart = offset; x.QuadPart = offset;
x.LowPart = SetFilePointer (fio->handle, x.LowPart, &x.HighPart, seek_map[origin]); x.LowPart = SetFilePointer (
fio->handle, x.LowPart, &x.HighPart, seek_map[origin]);
if (x.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) if (x.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
{ {
return (qse_fio_off_t)-1; return (qse_fio_off_t)-1;
@ -281,7 +295,6 @@ int qse_fio_truncate (qse_fio_t* fio, qse_fio_off_t size)
return 0; return 0;
#else #else
#if !defined(_LP64) && defined(SYS_ftruncate64) #if !defined(_LP64) && defined(SYS_ftruncate64)
return syscall (SYS_ftruncate64, fio->handle, size); return syscall (SYS_ftruncate64, fio->handle, size);
#elif defined(SYS_ftruncate) #elif defined(SYS_ftruncate)
@ -327,3 +340,122 @@ qse_ssize_t qse_fio_write (qse_fio_t* fio, const void* data, qse_size_t size)
#endif #endif
#endif #endif
} }
#ifdef _WIN32
static int get_devname_from_handle (
HANDLE handle, qse_char_t* buf, qse_size_t len)
{
BOOL bSuccess = FALSE;
HANDLE map = NULL;
void* mem = NULL;
DWORD olen;
/* create a file mapping object */
map = CreateFileMapping (
handle,
NULL,
PAGE_READONLY,
0,
1,
NULL
);
if (map == NULL) return -1;
/* create a file mapping to get the file name. */
mem = MapViewOfFile (map, FILE_MAP_READ, 0, 0, 1);
if (mem == NULL)
{
CloseHandle (map);
return -1;
}
olen = GetMappedFileName (GetCurrentProcess(), mem, buf, len);
if (olen == 0)
{
UnmapViewOfFile (mem);
CloseHandle (map);
return -1;
}
UnmapViewOfFile (mem);
CloseHandle (map);
return 0;
}
static int get_volname_from_handle (
HANDLE handle, qse_char_t* buf, qse_size_t len)
{
if (get_devname_from_handle (handle, buf, len) == -1) return -1;
if (_tcsnicmp(QSE_T("\\Device\\LanmanRedirector\\"), buf, 25) == 0)
{
buf[0] = QSE_T('\\');
_tcscpy (&buf[1], &buf[24]);
}
else
{
DWORD n;
qse_char_t drives[128];
n = GetLogicalDriveStrings (QSE_COUNTOF(drives), drives);
if (n == 0 /* error */ ||
n > QSE_COUNTOF(drives) /* buffer small */)
{
return -1;
}
while (n > 0)
{
qse_char_t drv[3];
qse_char_t path[MAX_PATH];
drv[0] = drives[--n];
drv[1] = QSE_T(':');
drv[2] = QSE_T('\0');
if (QueryDosDevice (drv, path, QSE_COUNTOF(path)))
{
qse_size_t pl = _tcslen(path);
qse_size_t bl = _tcslen(buf);
if (bl > pl && buf[pl] == QSE_T('\\') &&
_tcsnicmp(path, buf, pl) == 0)
{
buf[0] = drv[0];
buf[1] = QSE_T(':');
_tcscpy (&buf[2], &buf[pl]);
break;
}
}
}
}
/* if the match is not found, the device name is returned
* without translation */
return 0;
}
#endif
int qse_fio_chmod (qse_fio_t* fio, int mode)
{
#ifdef _WIN32
int flags = FILE_ATTRIBUTE_NORMAL;
qse_char_t name[MAX_PATH];
/* it is a best effort implementation. if the file size is 0,
* it can't even get the file name from the handle and thus fails. */
if (get_volname_from_handle (
fio->handle, name, QSE_COUNTOF(name)) == -1) return -1;
if (!(mode & QSE_FIO_WUSR)) flags = FILE_ATTRIBUTE_READONLY;
return (SetFileAttributes (name, flags) == FALSE)? -1: 0;
#else
#if defined(SYS_fchmod)
return syscall (SYS_fchmod, fio->handle, mode);
#else
return fchmod (fio->handle, mode);
#endif
#endif
}

View File

@ -120,6 +120,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -130,7 +131,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -118,6 +118,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -128,7 +129,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -118,6 +118,7 @@ JAR = @JAR@
JAR_PATH = @JAR_PATH@ JAR_PATH = @JAR_PATH@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
JAVAC_PATH = @JAVAC_PATH@ JAVAC_PATH = @JAVAC_PATH@
LD = @LD@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBM = @LIBM@ LIBM = @LIBM@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
@ -128,7 +129,9 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@