forked from enlightenment/efl
update doc, add init/shutdown functions for the socket system, add Tor Lillqvist as author and other miscellaneous fixes
SVN revision: 33870
This commit is contained in:
parent
08bfdacdee
commit
73cf6fe558
|
@ -1,3 +1,4 @@
|
||||||
Main Authors:
|
Main Authors:
|
||||||
Vincent Torri <vtorri at univ-evry dot fr>
|
Vincent Torri <vtorri at univ-evry dot fr>
|
||||||
|
Tor Lillqvist <tml at iki dot fi>
|
||||||
ashikase
|
ashikase
|
||||||
|
|
|
@ -1,3 +1,25 @@
|
||||||
|
2008-02-29 Vincent Torri <doursse at users dot sf dot net>
|
||||||
|
|
||||||
|
* AUTHORS:
|
||||||
|
Add Tor Lillqvist as author as he kindly gave me
|
||||||
|
the right to use his code for pipe(). Thanks a lot !
|
||||||
|
|
||||||
|
* src/bin/test_dlfcn.c (main):
|
||||||
|
read module and symbol from command line
|
||||||
|
|
||||||
|
* src/bin/test_pipe.c (thread), (main):
|
||||||
|
change output
|
||||||
|
|
||||||
|
* src/lib/Evil.h:
|
||||||
|
* src/lib/dlfcn/dlfcn.h:
|
||||||
|
* src/lib/evil.c (mkstemp), (realpath), (evil_sockets_init),
|
||||||
|
(evil_sockets_shutdown):
|
||||||
|
* src/lib/mman/sys/mman.h:
|
||||||
|
update documentation, add unlink() function, realpath()
|
||||||
|
becomes a function instead of a macro, add functions to
|
||||||
|
init / shutdown the socket system of Windows, undef EAPI
|
||||||
|
at the end of each header files.
|
||||||
|
|
||||||
2008-02-27 Vincent Torri <doursse at users dot sf dot net>
|
2008-02-27 Vincent Torri <doursse at users dot sf dot net>
|
||||||
|
|
||||||
* initial release
|
* initial release
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
Installation Instructions
|
||||||
Foundation, Inc.
|
*************************
|
||||||
|
|
||||||
|
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||||
|
2006, 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is free documentation; the Free Software Foundation gives
|
This file is free documentation; the Free Software Foundation gives
|
||||||
unlimited permission to copy, distribute and modify it.
|
unlimited permission to copy, distribute and modify it.
|
||||||
|
@ -7,7 +10,10 @@ unlimited permission to copy, distribute and modify it.
|
||||||
Basic Installation
|
Basic Installation
|
||||||
==================
|
==================
|
||||||
|
|
||||||
These are generic installation instructions.
|
Briefly, the shell commands `./configure; make; make install' should
|
||||||
|
configure, build, and install this package. The following
|
||||||
|
more-detailed instructions are generic; see the `README' file for
|
||||||
|
instructions specific to this package.
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
The `configure' shell script attempts to guess correct values for
|
||||||
various system-dependent variables used during compilation. It uses
|
various system-dependent variables used during compilation. It uses
|
||||||
|
@ -20,9 +26,9 @@ debugging `configure').
|
||||||
|
|
||||||
It can also use an optional file (typically called `config.cache'
|
It can also use an optional file (typically called `config.cache'
|
||||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||||
the results of its tests to speed up reconfiguring. (Caching is
|
the results of its tests to speed up reconfiguring. Caching is
|
||||||
disabled by default to prevent problems with accidental use of stale
|
disabled by default to prevent problems with accidental use of stale
|
||||||
cache files.)
|
cache files.
|
||||||
|
|
||||||
If you need to do unusual things to compile the package, please try
|
If you need to do unusual things to compile the package, please try
|
||||||
to figure out how `configure' could check whether to do them, and mail
|
to figure out how `configure' could check whether to do them, and mail
|
||||||
|
@ -32,20 +38,17 @@ some point `config.cache' contains results you don't want to keep, you
|
||||||
may remove or edit it.
|
may remove or edit it.
|
||||||
|
|
||||||
The file `configure.ac' (or `configure.in') is used to create
|
The file `configure.ac' (or `configure.in') is used to create
|
||||||
`configure' by a program called `autoconf'. You only need
|
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||||
`configure.ac' if you want to change it or regenerate `configure' using
|
you want to change it or regenerate `configure' using a newer version
|
||||||
a newer version of `autoconf'.
|
of `autoconf'.
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
The simplest way to compile this package is:
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code and type
|
1. `cd' to the directory containing the package's source code and type
|
||||||
`./configure' to configure the package for your system. If you're
|
`./configure' to configure the package for your system.
|
||||||
using `csh' on an old version of System V, you might need to type
|
|
||||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
|
||||||
`configure' itself.
|
|
||||||
|
|
||||||
Running `configure' takes awhile. While running, it prints some
|
Running `configure' might take a while. While running, it prints
|
||||||
messages telling which features it is checking for.
|
some messages telling which features it is checking for.
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
2. Type `make' to compile the package.
|
||||||
|
|
||||||
|
@ -64,18 +67,21 @@ The simplest way to compile this package is:
|
||||||
all sorts of other programs in order to regenerate files that came
|
all sorts of other programs in order to regenerate files that came
|
||||||
with the distribution.
|
with the distribution.
|
||||||
|
|
||||||
|
6. Often, you can also type `make uninstall' to remove the installed
|
||||||
|
files again.
|
||||||
|
|
||||||
Compilers and Options
|
Compilers and Options
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
Some systems require unusual options for compilation or linking that
|
Some systems require unusual options for compilation or linking that the
|
||||||
the `configure' script does not know about. Run `./configure --help'
|
`configure' script does not know about. Run `./configure --help' for
|
||||||
for details on some of the pertinent environment variables.
|
details on some of the pertinent environment variables.
|
||||||
|
|
||||||
You can give `configure' initial values for configuration parameters
|
You can give `configure' initial values for configuration parameters
|
||||||
by setting variables in the command line or in the environment. Here
|
by setting variables in the command line or in the environment. Here
|
||||||
is an example:
|
is an example:
|
||||||
|
|
||||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||||
|
|
||||||
*Note Defining Variables::, for more details.
|
*Note Defining Variables::, for more details.
|
||||||
|
|
||||||
|
@ -84,34 +90,32 @@ Compiling For Multiple Architectures
|
||||||
|
|
||||||
You can compile the package for more than one kind of computer at the
|
You can compile the package for more than one kind of computer at the
|
||||||
same time, by placing the object files for each architecture in their
|
same time, by placing the object files for each architecture in their
|
||||||
own directory. To do this, you must use a version of `make' that
|
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
|
||||||
directory where you want the object files and executables to go and run
|
directory where you want the object files and executables to go and run
|
||||||
the `configure' script. `configure' automatically checks for the
|
the `configure' script. `configure' automatically checks for the
|
||||||
source code in the directory that `configure' is in and in `..'.
|
source code in the directory that `configure' is in and in `..'.
|
||||||
|
|
||||||
If you have to use a `make' that does not support the `VPATH'
|
With a non-GNU `make', it is safer to compile the package for one
|
||||||
variable, you have to compile the package for one architecture at a
|
architecture at a time in the source code directory. After you have
|
||||||
time in the source code directory. After you have installed the
|
installed the package for one architecture, use `make distclean' before
|
||||||
package for one architecture, use `make distclean' before reconfiguring
|
reconfiguring for another architecture.
|
||||||
for another architecture.
|
|
||||||
|
|
||||||
Installation Names
|
Installation Names
|
||||||
==================
|
==================
|
||||||
|
|
||||||
By default, `make install' will install the package's files in
|
By default, `make install' installs the package's commands under
|
||||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||||
installation prefix other than `/usr/local' by giving `configure' the
|
can specify an installation prefix other than `/usr/local' by giving
|
||||||
option `--prefix=PATH'.
|
`configure' the option `--prefix=PREFIX'.
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
You can specify separate installation prefixes for
|
||||||
architecture-specific files and architecture-independent files. If you
|
architecture-specific files and architecture-independent files. If you
|
||||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||||
PATH as the prefix for installing programs and libraries.
|
PREFIX as the prefix for installing programs and libraries.
|
||||||
Documentation and other data files will still use the regular prefix.
|
Documentation and other data files still use the regular prefix.
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
In addition, if you use an unusual directory layout you can give
|
||||||
options like `--bindir=PATH' to specify different values for particular
|
options like `--bindir=DIR' to specify different values for particular
|
||||||
kinds of files. Run `configure --help' for a list of the directories
|
kinds of files. Run `configure --help' for a list of the directories
|
||||||
you can set and what kinds of files go in them.
|
you can set and what kinds of files go in them.
|
||||||
|
|
||||||
|
@ -137,11 +141,11 @@ you can use the `configure' options `--x-includes=DIR' and
|
||||||
Specifying the System Type
|
Specifying the System Type
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
There may be some features `configure' cannot figure out
|
There may be some features `configure' cannot figure out automatically,
|
||||||
automatically, but needs to determine by the type of machine the package
|
but needs to determine by the type of machine the package will run on.
|
||||||
will run on. Usually, assuming the package is built to be run on the
|
Usually, assuming the package is built to be run on the _same_
|
||||||
_same_ architectures, `configure' can figure that out, but if it prints
|
architectures, `configure' can figure that out, but if it prints a
|
||||||
a message saying it cannot guess the machine type, give it the
|
message saying it cannot guess the machine type, give it the
|
||||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||||
type, such as `sun4', or a canonical name which has the form:
|
type, such as `sun4', or a canonical name which has the form:
|
||||||
|
|
||||||
|
@ -156,7 +160,7 @@ where SYSTEM can have one of these forms:
|
||||||
need to know the machine type.
|
need to know the machine type.
|
||||||
|
|
||||||
If you are _building_ compiler tools for cross-compiling, you should
|
If you are _building_ compiler tools for cross-compiling, you should
|
||||||
use the `--target=TYPE' option to select the type of system they will
|
use the option `--target=TYPE' to select the type of system they will
|
||||||
produce code for.
|
produce code for.
|
||||||
|
|
||||||
If you want to _use_ a cross compiler, that generates code for a
|
If you want to _use_ a cross compiler, that generates code for a
|
||||||
|
@ -167,9 +171,9 @@ eventually be run) with `--host=TYPE'.
|
||||||
Sharing Defaults
|
Sharing Defaults
|
||||||
================
|
================
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share,
|
If you want to set default values for `configure' scripts to share, you
|
||||||
you can create a site shell script called `config.site' that gives
|
can create a site shell script called `config.site' that gives default
|
||||||
default values for variables like `CC', `cache_file', and `prefix'.
|
values for variables like `CC', `cache_file', and `prefix'.
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
`CONFIG_SITE' environment variable to the location of the site script.
|
||||||
|
@ -186,14 +190,18 @@ them in the `configure' command line, using `VAR=value'. For example:
|
||||||
|
|
||||||
./configure CC=/usr/local2/bin/gcc
|
./configure CC=/usr/local2/bin/gcc
|
||||||
|
|
||||||
will cause the specified gcc to be used as the C compiler (unless it is
|
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||||
overridden in the site shell script).
|
overridden in the site shell script).
|
||||||
|
|
||||||
|
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||||
|
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||||
|
|
||||||
|
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||||
|
|
||||||
`configure' Invocation
|
`configure' Invocation
|
||||||
======================
|
======================
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it
|
`configure' recognizes the following options to control how it operates.
|
||||||
operates.
|
|
||||||
|
|
||||||
`--help'
|
`--help'
|
||||||
`-h'
|
`-h'
|
||||||
|
|
|
@ -9,46 +9,44 @@
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
|
||||||
void *module;
|
void *module;
|
||||||
double t1 = 0.0;
|
void *symbol;
|
||||||
double t2 = 0.0;
|
|
||||||
|
|
||||||
int (*time)(struct timeval *tv, void *tz);
|
if (argc < 3)
|
||||||
|
{
|
||||||
|
printf ("Usage: %s file.dll symbol\n\n", argv[0]);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
module = dlopen("d:\\msys\\1.0\\local\\bin\\libevil-0.dll", 0);
|
printf ("opening module %s\n", argv[1]);
|
||||||
|
module = dlopen(argv[1], 0);
|
||||||
if (!module)
|
if (!module)
|
||||||
{
|
{
|
||||||
printf ("%s\n", dlerror());
|
printf ("%s\n", dlerror());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
printf ("opening module %s successful\n", argv[1]);
|
||||||
|
|
||||||
time = dlsym(module, "gettimeofday");
|
printf ("getting symbol %s\n", argv[2]);
|
||||||
if (!time)
|
symbol = dlsym(module, argv[2]);
|
||||||
|
if (!symbol)
|
||||||
{
|
{
|
||||||
printf ("%s\n", dlerror());
|
printf ("%s\n", dlerror());
|
||||||
if (dlclose(module))
|
if (dlclose(module))
|
||||||
printf ("%s\n", dlerror());
|
printf ("%s\n", dlerror());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
printf ("getting symbol %s successful\n", argv[2]);
|
||||||
|
|
||||||
if (time(&tv, NULL) == 0)
|
printf ("closing module %s\n", argv[1]);
|
||||||
t1 = tv.tv_sec + tv.tv_usec / 1000000.0;
|
|
||||||
|
|
||||||
Sleep(3000);
|
|
||||||
|
|
||||||
if (time(&tv, NULL) == 0)
|
|
||||||
t2 = tv.tv_sec + tv.tv_usec / 1000000.0;
|
|
||||||
|
|
||||||
printf ("3 seconds ? %f\n", t2 - t1);
|
|
||||||
|
|
||||||
if (dlclose(module))
|
if (dlclose(module))
|
||||||
{
|
{
|
||||||
printf ("%s\n", dlerror());
|
printf ("%s\n", dlerror());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
printf ("closing module %s successful\n", argv[1]);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,7 @@ thread (void *param)
|
||||||
Sleep (2 * 1000);
|
Sleep (2 * 1000);
|
||||||
d = (data *)param;
|
d = (data *)param;
|
||||||
buf[0] = d;
|
buf[0] = d;
|
||||||
printf ("writing...\n");
|
|
||||||
send(d->fd_write, (char *)buf, sizeof(buf), 0);
|
send(d->fd_write, (char *)buf, sizeof(buf), 0);
|
||||||
printf ("end of writing...\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -60,13 +58,11 @@ main (int argc, char *argv[])
|
||||||
d = (data *)malloc(sizeof (data));
|
d = (data *)malloc(sizeof (data));
|
||||||
d->val = 14;
|
d->val = 14;
|
||||||
d->fd_write = sockets[FDWRITE];
|
d->fd_write = sockets[FDWRITE];
|
||||||
printf (" pointeur 0 : %p\n", d);
|
printf (" pointeur sent........: %p\n", d);
|
||||||
|
|
||||||
h = CreateThread (NULL, 0, thread, d, 0, &thread_id);
|
h = CreateThread (NULL, 0, thread, d, 0, &thread_id);
|
||||||
|
|
||||||
printf (" * select : %d %d\n", sockets[0], sockets[1]);
|
|
||||||
ret = select(sockets[FDREAD] + 1, &rfds, NULL, NULL, &t);
|
ret = select(sockets[FDREAD] + 1, &rfds, NULL, NULL, &t);
|
||||||
printf (" * select : ret %d\n", ret);
|
|
||||||
|
|
||||||
if (ret < 0) return -1;
|
if (ret < 0) return -1;
|
||||||
|
|
||||||
|
@ -81,16 +77,14 @@ main (int argc, char *argv[])
|
||||||
int j = 0;
|
int j = 0;
|
||||||
void *buf[1];
|
void *buf[1];
|
||||||
|
|
||||||
printf ("bon \n");
|
|
||||||
while ((len = recv(sockets[FDREAD], (char *)buf, sizeof(buf), 0)) > 0)
|
while ((len = recv(sockets[FDREAD], (char *)buf, sizeof(buf), 0)) > 0)
|
||||||
{
|
{
|
||||||
printf ("len : %d\n", len);
|
|
||||||
if (len == sizeof(buf))
|
if (len == sizeof(buf))
|
||||||
{
|
{
|
||||||
d = buf[0];
|
d = buf[0];
|
||||||
printf (" pointeur 1 : %p\n", d);
|
printf (" pointeur received....: %p\n", d);
|
||||||
j = d->val;
|
j = d->val;
|
||||||
printf ("reussite : %d\n", j);
|
printf (" value (should be 14) : %d\n", j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ extern "C" {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mainpage Evil
|
* @mainpage Evil
|
||||||
|
* @author Vincent Torri
|
||||||
|
* @date 2008
|
||||||
*
|
*
|
||||||
* @section intro_sec Introduction
|
* @section intro_sec Introduction
|
||||||
*
|
*
|
||||||
|
@ -52,6 +54,7 @@ extern "C" {
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#ifndef __CEGCC__
|
#ifndef __CEGCC__
|
||||||
|
|
||||||
|
@ -87,6 +90,21 @@ extern "C" {
|
||||||
# define F_SETLK 6
|
# define F_SETLK 6
|
||||||
# define F_SETLKW 7
|
# define F_SETLKW 7
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def F_RDLCK
|
||||||
|
* Read (or shared) lock
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def F_WRLCK
|
||||||
|
* Write (or exclusive) lock
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def F_UNLCK
|
||||||
|
* Remove lock
|
||||||
|
*/
|
||||||
|
|
||||||
# ifndef F_RDLCK
|
# ifndef F_RDLCK
|
||||||
# define F_RDLCK 0
|
# define F_RDLCK 0
|
||||||
# define F_WRLCK 1
|
# define F_WRLCK 1
|
||||||
|
@ -157,6 +175,7 @@ EAPI int fcntl(int fd, int cmd, ...);
|
||||||
* On success, the function returns the file descriptor of the
|
* On success, the function returns the file descriptor of the
|
||||||
* temporary file. Otherwise, it returns -1 and errno is set to the
|
* temporary file. Otherwise, it returns -1 and errno is set to the
|
||||||
* following values:
|
* following values:
|
||||||
|
* - EINVAL: @p template has an invalid format.
|
||||||
* - EACCESS: Given path is a directory, or file is read-only, but an
|
* - EACCESS: Given path is a directory, or file is read-only, but an
|
||||||
* open-for-writing operation was attempted.
|
* open-for-writing operation was attempted.
|
||||||
* - EEXISTS: File name already exists.
|
* - EEXISTS: File name already exists.
|
||||||
|
@ -229,6 +248,23 @@ EAPI int symlink(const char *oldpath, const char *newpath);
|
||||||
*/
|
*/
|
||||||
EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz);
|
EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create a pair of sockets.
|
||||||
|
*
|
||||||
|
* @param fds A pointer that contains two sockets.
|
||||||
|
*
|
||||||
|
* Create a pair of sockets that can be use with select().
|
||||||
|
* Hence, evil_sockets_init() must have been caled at least
|
||||||
|
* once before. Contrary to Unix, that functions does not
|
||||||
|
* create a pair of file descriptors.
|
||||||
|
*
|
||||||
|
* Conformity: Not applicable.
|
||||||
|
*
|
||||||
|
* Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
|
||||||
|
* Windows XP.
|
||||||
|
*
|
||||||
|
* @ingroup Evil
|
||||||
|
*/
|
||||||
EAPI int pipe(int *fds);
|
EAPI int pipe(int *fds);
|
||||||
|
|
||||||
#endif /* ! __CEGCC__ */
|
#endif /* ! __CEGCC__ */
|
||||||
|
@ -236,21 +272,109 @@ EAPI int pipe(int *fds);
|
||||||
#if defined(__MSDOS__) || defined(__EMX__) || \
|
#if defined(__MSDOS__) || defined(__EMX__) || \
|
||||||
(defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__))
|
(defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__))
|
||||||
# if defined(_MSC_VER) || defined(__MINGW32__)
|
# if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
# define open(path,flag,mode) EAPI _open((path),(flag),(mode))
|
# define S_IRGRP S_IRUSR
|
||||||
# define close(fd) EAPI _close(fd)
|
# define S_IROTH S_IRUSR
|
||||||
# define read(fd,buffer,count) EAPI _read((fd),(buffer),(count))
|
# define S_IWGRP S_IWUSR
|
||||||
# define write(fd,buffer,count) EAPI _write((fd),(buffer),(count))
|
# define S_IWOTH S_IWUSR
|
||||||
# define mkdir(p,m) EAPI _mkdir(p)
|
# define S_IXGRP S_IXUSR
|
||||||
|
# define S_IXOTH S_IXUSR
|
||||||
|
# define open(path,flag,mode) _open((path),(flag),(mode))
|
||||||
|
# define close(fd) _close(fd)
|
||||||
|
# define read(fd,buffer,count) _read((fd),(buffer),(count))
|
||||||
|
# define write(fd,buffer,count) _write((fd),(buffer),(count))
|
||||||
|
# define unlink(filename) _unlink((filename))
|
||||||
|
# define mkdir(p,m) _mkdir(p)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define realpath(file_name, resolved_name) EAPI _fullpath((resolved_name), (file_name), PATH_MAX)
|
/**
|
||||||
|
* @brief Return aan absolute or full path name for a specified relative path name.
|
||||||
|
*
|
||||||
|
* @param file_name The absolute path name.
|
||||||
|
* @param resolved_name The relative path name.
|
||||||
|
* @return @c NULL on failure, a pointer to the absolute path name otherwise.
|
||||||
|
*
|
||||||
|
* The function expands the relative path name @p file_name to its
|
||||||
|
* fully qualified or absolute path and store it in the buffer pointed
|
||||||
|
* by @p resolved_name. The buffer is at most @c PATH_MAX bytes long.
|
||||||
|
* If @p resolved_name is @c NULL, malloc() is used to allocate a
|
||||||
|
* buffer of sufficient length to hold the path name. In that case, it
|
||||||
|
* is the responsability of the caller to free this buffer with free().
|
||||||
|
*
|
||||||
|
* That function can be used to obtain the absolute path name for
|
||||||
|
* relative paths (relPath) that include "./" or "../" in their names.
|
||||||
|
*
|
||||||
|
* Conformity: None.
|
||||||
|
*
|
||||||
|
* Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
|
||||||
|
* Windows XP.
|
||||||
|
*
|
||||||
|
* @ingroup Evil
|
||||||
|
*/
|
||||||
|
EAPI char *realpath(const char *file_name, char *resolved_name);
|
||||||
|
|
||||||
EAPI char *evil_tmpdir_get(void);
|
/**
|
||||||
|
* @brief Initiates the use of Windows sockets.
|
||||||
|
*
|
||||||
|
* @return 1 on success, 0 otherwise.
|
||||||
|
*
|
||||||
|
* Initiates the use of Windows sockets. If the function succeeds,
|
||||||
|
* it returns 1, otherwise it return 0.
|
||||||
|
*
|
||||||
|
* Conformity: Non applicable.
|
||||||
|
*
|
||||||
|
* Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
|
||||||
|
* Windows XP.
|
||||||
|
*
|
||||||
|
* @ingroup Evil
|
||||||
|
*/
|
||||||
|
EAPI int evil_sockets_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shutdown the Windows socket system.
|
||||||
|
*
|
||||||
|
* Shutdown the Windows socket system.
|
||||||
|
*
|
||||||
|
* Conformity: Non applicable.
|
||||||
|
*
|
||||||
|
* Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
|
||||||
|
* Windows XP.
|
||||||
|
*
|
||||||
|
* @ingroup Evil
|
||||||
|
*/
|
||||||
|
EAPI void evil_sockets_shutdown(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return a dir to store temporary files.
|
||||||
|
*
|
||||||
|
* @return The directory to store temporary files.
|
||||||
|
*
|
||||||
|
* Return a directory to store temporary files. The function gets
|
||||||
|
* the value of the followig environment variables, and in that order:
|
||||||
|
* - TMP
|
||||||
|
* - TEMP
|
||||||
|
* - USERPROFILE
|
||||||
|
* - WINDIR
|
||||||
|
* and returns its value if it exists. If none exists, the function
|
||||||
|
* returns "C:\".
|
||||||
|
*
|
||||||
|
* Conformity: Non applicable.
|
||||||
|
*
|
||||||
|
* Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
|
||||||
|
* Windows XP.
|
||||||
|
*
|
||||||
|
* @ingroup Evil
|
||||||
|
*/
|
||||||
|
EAPI const char *evil_tmpdir_get(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# undef EAPI
|
||||||
|
# define EAPI
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#endif /* __E_WIN32_H__ */
|
#endif /* __E_WIN32_H__ */
|
||||||
|
|
|
@ -17,6 +17,20 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def RTLD_LAZY
|
||||||
|
* Lazy function call binding
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def RTLD_NOW
|
||||||
|
* Immediate function call binding
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def RTLD_GLOBAL
|
||||||
|
* Symbols in this dlopen'ed obj are visible to other dlopen'ed objs
|
||||||
|
*/
|
||||||
|
|
||||||
# define RTLD_LAZY 1 /* lazy function call binding */
|
# define RTLD_LAZY 1 /* lazy function call binding */
|
||||||
# define RTLD_NOW 2 /* immediate function call binding */
|
# define RTLD_NOW 2 /* immediate function call binding */
|
||||||
|
@ -171,4 +185,9 @@ EAPI char *dlerror (void);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# undef EAPI
|
||||||
|
# define EAPI
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#endif /* __E_WIN32_DLFCN_H__ */
|
#endif /* __E_WIN32_DLFCN_H__ */
|
||||||
|
|
|
@ -93,14 +93,19 @@ int fcntl(int fd, int cmd, ...)
|
||||||
int
|
int
|
||||||
mkstemp(char *template)
|
mkstemp(char *template)
|
||||||
{
|
{
|
||||||
char *filename;
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
filename = _mktemp(template);
|
#ifdef __MINGW32__
|
||||||
if (!filename)
|
if (!_mktemp(template))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fd = _sopen(filename, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
fd = _sopen(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||||
|
#else
|
||||||
|
if (_mktemp_s(template, _MAX_PATH) != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
_sopen_s(&fd, template, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||||
|
#endif /* ! __MINGW32__ */
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
@ -224,6 +229,10 @@ readlink(const char *path, char *buf, size_t bufsiz)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The code of the following functions has been kindly offered
|
||||||
|
* by Tor Lillqvist.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
pipe(int *fds)
|
pipe(int *fds)
|
||||||
{
|
{
|
||||||
|
@ -333,6 +342,26 @@ pipe(int *fds)
|
||||||
#endif /* ! __CEGCC__ */
|
#endif /* ! __CEGCC__ */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
realpath(const char *file_name, char *resolved_name)
|
||||||
|
{
|
||||||
|
return _fullpath(resolved_name, file_name, PATH_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
evil_sockets_init(void)
|
||||||
|
{
|
||||||
|
WSADATA wsa_data;
|
||||||
|
|
||||||
|
return (WSAStartup(MAKEWORD( 2, 2 ), &wsa_data) == 0) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evil_sockets_shutdown(void)
|
||||||
|
{
|
||||||
|
WSACleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
evil_tmpdir_get(void)
|
evil_tmpdir_get(void)
|
||||||
{
|
{
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
|
|
|
@ -18,11 +18,46 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def PROT_NONE
|
||||||
|
* Data can not be accessed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def PROT_READ
|
||||||
|
* Data can be read.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def PROT_WRITE
|
||||||
|
* Data can be written.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def PROT_EXEC
|
||||||
|
* Data can be executed.
|
||||||
|
*/
|
||||||
|
|
||||||
#define PROT_NONE 0x00
|
#define PROT_NONE 0x00
|
||||||
#define PROT_READ 0x01
|
#define PROT_READ 0x01
|
||||||
#define PROT_WRITE 0x02
|
#define PROT_WRITE 0x02
|
||||||
#define PROT_EXEC 0x04
|
#define PROT_EXEC 0x04
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def MAP_SHARED
|
||||||
|
* Changes are shared.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def MAP_PRIVATE
|
||||||
|
* Changes are private.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def MAP_FIXED
|
||||||
|
* Interpret the address (addr) exactly.
|
||||||
|
*/
|
||||||
|
|
||||||
#define MAP_SHARED 0x0001
|
#define MAP_SHARED 0x0001
|
||||||
#define MAP_PRIVATE 0x0002
|
#define MAP_PRIVATE 0x0002
|
||||||
#define MAP_FIXED 0x0010
|
#define MAP_FIXED 0x0010
|
||||||
|
@ -111,5 +146,10 @@ EAPI int munmap(void *addr,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# undef EAPI
|
||||||
|
# define EAPI
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#endif /* __E_WIN32_SYS_MMAN_H__ */
|
#endif /* __E_WIN32_SYS_MMAN_H__ */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue