forked from enlightenment/efl
esacpe: remove library from tree
This has not been used for a while and is not even buildable after our switch to meson. It was a niche to start with given that it needed the PS3 OS to run on. I asked for any remaining users at EDD and on the list but heard nothing. Time to remove. Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com> Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10778
This commit is contained in:
parent
003ce06e85
commit
f3d9b8ee70
|
@ -39,9 +39,7 @@ pieces of information you will need.
|
|||
|
||||
Q. Do I need to make the source public of libraries or applications that I
|
||||
build on top of EFL?
|
||||
A. No, UNLESS you use the escape library. Escape is GPL. This is ONLY
|
||||
needed for PS3 development, so unless you are doing this, it is not
|
||||
relevant.
|
||||
A. No
|
||||
|
||||
Q. Do I need to provide the source for EFL?
|
||||
A. Yes. In general you do. If you are shipping any of the binaries or
|
||||
|
|
10
README
10
README
|
@ -365,16 +365,6 @@ their behavior as if they were real physical objects.
|
|||
|
||||
|
||||
|
||||
**Escape:**
|
||||
|
||||
//GPL v2 license//
|
||||
|
||||
This library is used as a compatibility library to provide missing
|
||||
libc APIs for porting to the Playstation 3 (PS3) native runtime
|
||||
environment.
|
||||
|
||||
|
||||
|
||||
**Ethumb:**
|
||||
|
||||
//LGPL v2 license//
|
||||
|
|
|
@ -209,12 +209,6 @@
|
|||
* @brief Microsoft Windows portability layer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup Escape Escape
|
||||
*
|
||||
* @brief PlayStation3 portability layer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup Ecore Ecore
|
||||
*
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
The Escape library is a library that acts implements some of the missing
|
||||
function from the PS3 GameOS system that are needed for the proper
|
||||
functioning of the EFL.
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
void
|
||||
_ecore_exe_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_exe_shutdown(void)
|
||||
{
|
||||
}
|
|
@ -26,10 +26,6 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EXOTIC
|
||||
# include <Exotic.h>
|
||||
#endif
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore_Con.h"
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
# include <evil_private.h> /* dlsym */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EXOTIC
|
||||
# include <Exotic.h>
|
||||
#endif
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
# include <features.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include "eina_safety_checks.h"
|
||||
#include "eina_counter.h"
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#include "eina_private.h"
|
||||
|
||||
/*============================================================================*
|
||||
|
|
|
@ -59,10 +59,6 @@
|
|||
#include "eina_xattr.h"
|
||||
#include "eina_file_common.h"
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
/*============================================================================*
|
||||
* Local *
|
||||
*============================================================================*/
|
||||
|
|
|
@ -41,10 +41,6 @@
|
|||
#include "eina_file_common.h"
|
||||
#include "eina_xattr.h"
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
# include <evil_private.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EXOTIC
|
||||
# include <Exotic.h>
|
||||
#endif
|
||||
|
|
|
@ -46,10 +46,6 @@
|
|||
# include <evil_private.h> /* path_is_absolute realpath dladdr */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_private.h"
|
||||
#include "eina_alloca.h"
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
#ifndef __ESCAPE_H__
|
||||
#define __ESCAPE_H__
|
||||
|
||||
#ifndef EAPI
|
||||
#define EAPI
|
||||
#endif /* EAPI */
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef CLOCK_REALTIME
|
||||
#undef CLOCK_REALTIME
|
||||
#endif
|
||||
#ifdef CLOCK_PROF
|
||||
#undef CLOCK_PROF
|
||||
#endif
|
||||
#ifdef CLOCK_PROCESS_CPUTIME_ID
|
||||
#undef CLOCK_PROCESS_CPUTIME_ID
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page escape_main Escape
|
||||
* @date 2011 (created)
|
||||
*
|
||||
* @section toc Table of Contents
|
||||
*
|
||||
* @li @ref escape_main_intro
|
||||
* @li @ref escape_main_compiling
|
||||
* @li @ref escape_main_next_steps
|
||||
*
|
||||
* @section escape_main_intro Introduction
|
||||
*
|
||||
* The Escape library is a library that acts implements some of the missing
|
||||
* function from the PS3 GameOS system that are needed for the proper
|
||||
* functioning of the EFL.
|
||||
*
|
||||
* @section escape_main_compiling How to compile
|
||||
*
|
||||
* Escape is a library your application links to. The procedure for
|
||||
* this is very simple. You simply have to compile your application
|
||||
* with the appropriate compiler flags that the @p pkg-config script
|
||||
* outputs. For example:
|
||||
*
|
||||
* Compiling C or C++ files into object files:
|
||||
*
|
||||
* @verbatim
|
||||
gcc -c -o main.o main.c `pkg-config --cflags escape`
|
||||
@endverbatim
|
||||
*
|
||||
* Linking object files into a binary executable:
|
||||
*
|
||||
* @verbatim
|
||||
gcc -o my_application main.o `pkg-config --libs escape`
|
||||
@endverbatim
|
||||
*
|
||||
* See @ref pkgconfig
|
||||
*
|
||||
* @section escape_main_next_steps Next Steps
|
||||
*
|
||||
* After you understood what Escape is and installed it in your system
|
||||
* you should proceed understanding the programming interface.
|
||||
*
|
||||
* Recommended reading:
|
||||
*
|
||||
* @li @ref Escape_Libgen_Group
|
||||
* @li @ref Escape_Unistd_Group
|
||||
* @li @ref Escape_Mman
|
||||
*/
|
||||
|
||||
#include "escape_libgen.h"
|
||||
#include "escape_unistd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Nothing to see here */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ESCAPE_H__ */
|
|
@ -1,90 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "Escape.h"
|
||||
|
||||
static char _escape_basename_buf[PATH_MAX];
|
||||
static char _escape_dirname_buf[PATH_MAX];
|
||||
|
||||
char *
|
||||
escape_basename(char *path)
|
||||
{
|
||||
char *p1;
|
||||
char *p2;
|
||||
size_t length;
|
||||
|
||||
/* path must begin by "?:\" or "?:/" */
|
||||
if (!path || strlen(path) <= 1)
|
||||
{
|
||||
memcpy(_escape_basename_buf, path, PATH_MAX);
|
||||
return _escape_basename_buf;
|
||||
}
|
||||
|
||||
length = strlen(path);
|
||||
p1 = strdup(path);
|
||||
if (!p1)
|
||||
{
|
||||
memcpy(_escape_basename_buf, path, PATH_MAX);
|
||||
return _escape_basename_buf;
|
||||
}
|
||||
|
||||
/* remove trailing backslashes */
|
||||
p2 = p1 + (length - 1);
|
||||
if (*p2 == '/')
|
||||
{
|
||||
while (*p2 == '/')
|
||||
p2--;
|
||||
}
|
||||
*(p2 + 1) = '\0';
|
||||
|
||||
p2 = strrchr(p1, '/');
|
||||
memcpy(_escape_basename_buf, p2 + 1, (p1 + length + 1) - p2);
|
||||
|
||||
free(p1);
|
||||
|
||||
return _escape_basename_buf;
|
||||
}
|
||||
|
||||
char *
|
||||
escape_dirname(char *path)
|
||||
{
|
||||
char *p1;
|
||||
char *p2;
|
||||
size_t length;
|
||||
|
||||
/* path must begin by "?:\" or "?:/" */
|
||||
if (!path || strlen(path) <= 1)
|
||||
{
|
||||
memcpy(_escape_dirname_buf, path, PATH_MAX);
|
||||
return _escape_dirname_buf;
|
||||
}
|
||||
|
||||
length = strlen(path);
|
||||
p1 = strdup(path);
|
||||
if (!p1)
|
||||
{
|
||||
memcpy(_escape_dirname_buf, path, PATH_MAX);
|
||||
return _escape_dirname_buf;
|
||||
}
|
||||
/* remove trailing backslashes */
|
||||
p2 = p1 + (length - 1);
|
||||
if (*p2 == '/')
|
||||
{
|
||||
while (*p2 == '/')
|
||||
p2--;
|
||||
}
|
||||
*(p2 + 1) = '\0';
|
||||
|
||||
p2 = strrchr(p1, '/');
|
||||
*p2 = '\0';
|
||||
memcpy(_escape_dirname_buf, p1, strlen(p1) + 1);
|
||||
|
||||
free(p1);
|
||||
|
||||
return _escape_dirname_buf;
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#ifndef __ESCAPE_LIBGEN_H__
|
||||
#define __ESCAPE_LIBGEN_H__
|
||||
|
||||
/**
|
||||
* @file escape_libgen.h
|
||||
* @brief The file that provides functions ported from Unix in libgen.h.
|
||||
* @defgroup Escape_Libgen_Group Libgen.h functions.
|
||||
* @ingroup Escape
|
||||
*
|
||||
* This header provides functions ported from Unix in libgen.h.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
EAPI char *escape_basename(char *path);
|
||||
|
||||
#ifdef basename
|
||||
#undef basename
|
||||
#endif
|
||||
#define basename(p) escape_basename(p)
|
||||
|
||||
EAPI char *escape_dirname(char *path);
|
||||
|
||||
#ifdef dirname
|
||||
#undef dirname
|
||||
#endif
|
||||
#define dirname(p) escape_dirname(p)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __ESCAPE_LIBGEN_H__ */
|
|
@ -1,67 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sys/mman.h"
|
||||
|
||||
/***** API *****/
|
||||
|
||||
void *
|
||||
mmap(void *addr __UNUSED__,
|
||||
size_t len,
|
||||
int prot,
|
||||
int flags,
|
||||
int fd,
|
||||
off_t offset)
|
||||
{
|
||||
void *data;
|
||||
size_t size;
|
||||
|
||||
data = malloc(len);
|
||||
if (!data)
|
||||
{
|
||||
fprintf (stderr, "[Escape] [mmap] malloc failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
size = read(fd, data, len);
|
||||
if (size != len)
|
||||
{
|
||||
fprintf (stderr, "[Escape] [mmap] read failed\n");
|
||||
free(data);
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
if (lseek(fd, -len, SEEK_CUR) == -1)
|
||||
{
|
||||
fprintf (stderr, "[Escape] [mmap] lseek failed\n");
|
||||
free(data);
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int
|
||||
munmap(void *addr,
|
||||
size_t len __UNUSED__)
|
||||
{
|
||||
if (addr && (addr != MAP_FAILED))
|
||||
free(addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
madvise(void *addr __UNUSED__,
|
||||
size_t length __UNUSED__,
|
||||
int advice __UNUSED__)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/types.h> /* See NOTES */
|
||||
#include <sys/socket.h>
|
||||
#include <net/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/net.h>
|
||||
#include <string.h>
|
||||
#include <libiberty.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "Escape.h"
|
||||
|
||||
char *
|
||||
escape_realpath(const char *path, char *resolved_path)
|
||||
{
|
||||
char *real = lrealpath (path);
|
||||
|
||||
if (real)
|
||||
{
|
||||
if (resolved_path)
|
||||
{
|
||||
memcpy (resolved_path, real, PATH_MAX);
|
||||
free (real);
|
||||
return resolved_path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return real;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
escape_access(const char *pathname, int mode)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
|
||||
if (stat(pathname, &stat_buf) != 0)
|
||||
return -1;
|
||||
|
||||
if (mode == F_OK)
|
||||
return 0;
|
||||
if (mode == R_OK)
|
||||
{
|
||||
if (stat_buf.st_mode & S_IRUSR)
|
||||
return 0;
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
if (mode == W_OK)
|
||||
{
|
||||
if (stat_buf.st_mode & S_IWUSR)
|
||||
return 0;
|
||||
errno = EROFS;
|
||||
return -1;
|
||||
}
|
||||
if (mode == X_OK)
|
||||
{
|
||||
if (stat_buf.st_mode & S_IXUSR)
|
||||
return 0;
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI ssize_t
|
||||
escape_readlink(const char *path,
|
||||
char *buf,
|
||||
size_t bufsize)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
escape_symlink(const char *path1, const char *path2)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* The code of the following functions has been kindly offered
|
||||
* by Tor Lillqvist.
|
||||
*/
|
||||
int
|
||||
escape_pipe(int *fds)
|
||||
{
|
||||
struct sockaddr_in saddr;
|
||||
int temp;
|
||||
int socket1 = -1;
|
||||
int socket2 = -1;
|
||||
fd_set read_set;
|
||||
fd_set write_set;
|
||||
int len;
|
||||
|
||||
temp = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if (temp == -1)
|
||||
goto out0;
|
||||
|
||||
memset (&saddr, 0, sizeof (saddr));
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = 0;
|
||||
saddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
||||
|
||||
if (bind (temp, (struct sockaddr *)&saddr, sizeof (saddr)))
|
||||
goto out0;
|
||||
|
||||
if (listen (temp, 1) == -1)
|
||||
goto out0;
|
||||
|
||||
len = sizeof (saddr);
|
||||
if (getsockname (temp, (struct sockaddr *)&saddr, &len))
|
||||
goto out0;
|
||||
|
||||
socket1 = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if (socket1 == -1)
|
||||
goto out0;
|
||||
|
||||
if ((connect (socket1, (struct sockaddr *)&saddr, len) == -1) &&
|
||||
(errno != EAGAIN))
|
||||
goto out1;
|
||||
|
||||
FD_ZERO (&read_set);
|
||||
FD_SET (temp, &read_set);
|
||||
|
||||
if (select (0, &read_set, NULL, NULL, NULL) == -1)
|
||||
goto out1;
|
||||
|
||||
if (!FD_ISSET (temp, &read_set))
|
||||
goto out1;
|
||||
|
||||
socket2 = accept (temp, (struct sockaddr *)&saddr, &len);
|
||||
if (socket2 == -1)
|
||||
goto out1;
|
||||
|
||||
FD_ZERO (&write_set);
|
||||
FD_SET (socket1, &write_set);
|
||||
|
||||
if (select (0, NULL, &write_set, NULL, NULL) == -1)
|
||||
goto out2;
|
||||
|
||||
if (!FD_ISSET (socket1, &write_set))
|
||||
goto out2;
|
||||
|
||||
fds[0] = socket1;
|
||||
fds[1] = socket2;
|
||||
|
||||
closesocket (temp);
|
||||
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
closesocket (socket2);
|
||||
out1:
|
||||
closesocket (socket1);
|
||||
out0:
|
||||
closesocket (temp);
|
||||
|
||||
fds[0] = -1;
|
||||
fds[1] = -1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#undef access
|
||||
int
|
||||
access(const char *pathname, int mode)
|
||||
{
|
||||
return escape_access (pathname, mode);
|
||||
}
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
#ifndef __ESCAPE_UNISTD_H__
|
||||
#define __ESCAPE_UNISTD_H__
|
||||
|
||||
/**
|
||||
* @file escape_unistd.h
|
||||
* @brief The file that provides functions ported from Unix in unistd.h.
|
||||
* @defgroup Escape_Unistd_Group Unistd.h functions
|
||||
* @ingroup Escape
|
||||
*
|
||||
* This header provides functions ported from Unix in unistd.h.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <sys/syslimits.h>
|
||||
|
||||
/* Path function */
|
||||
/**
|
||||
* @brief return the canonicalized absolute pathname
|
||||
*
|
||||
* @param path A path to canonicalize
|
||||
* @param resolved_path A pointer of size PATH_MAX where to store the result
|
||||
*
|
||||
* realpath() expands all symbolic links and resolves references to /./, /../
|
||||
* and extra '/' characters in the null-terminated string named by path to
|
||||
* produce a canonicalized absolute pathname. The resulting pathname is
|
||||
* stored as a null-terminated string, up to a maximum of PATH_MAX bytes,
|
||||
* in the buffer pointed to by resolved_path. The resulting path will have
|
||||
* no symbolic link, /./ or /../ components.
|
||||
*
|
||||
* If resolved_path is specified as NULL, then realpath() uses malloc(3)
|
||||
* to allocate a buffer of up to PATH_MAX bytes to hold the resolved pathname,
|
||||
* and returns a pointer to this buffer.
|
||||
* The caller should deallocate this buffer using free(3).
|
||||
*
|
||||
*/
|
||||
EAPI char *escape_realpath(const char *path, char *resolved_path);
|
||||
#ifdef realpath
|
||||
#undef realpath
|
||||
#endif
|
||||
#define realpath escape_realpath
|
||||
|
||||
EAPI ssize_t
|
||||
escape_readlink(const char *path,
|
||||
char *buf,
|
||||
size_t bufsize);
|
||||
#ifdef readlink
|
||||
#undef readlink
|
||||
#endif
|
||||
#define readlink escape_readlink
|
||||
|
||||
EAPI int
|
||||
escape_symlink(const char *path1, const char *path2);
|
||||
#ifdef symlink
|
||||
#undef symlink
|
||||
#endif
|
||||
#define symlink escape_symlink
|
||||
|
||||
/**
|
||||
* @brief check real user's permissions for a file
|
||||
*
|
||||
* @param pathname The path to check
|
||||
* @param mode the permission to check
|
||||
*
|
||||
* access() checks whether the calling process can access the file pathname.
|
||||
* If pathname is a symbolic link, it is dereferenced.
|
||||
* The mode specifies the accessibility check(s) to be performed, and is either
|
||||
* the value F_OK, or a mask consisting of the bitwise OR of one or more
|
||||
* of R_OK, W_OK, and X_OK. F_OK tests for the existence of the file.
|
||||
* R_OK, W_OK, and X_OK test whether the file exists and grants read, write,
|
||||
* and execute permissions, respectively.
|
||||
*
|
||||
*/
|
||||
EAPI int
|
||||
escape_access(const char *pathname, int mode);
|
||||
#ifdef access
|
||||
#undef access
|
||||
#endif
|
||||
#define access escape_access
|
||||
|
||||
/**
|
||||
* @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().
|
||||
* Contrary to Unix, that functions does not
|
||||
* create a pair of file descriptors.
|
||||
*
|
||||
* Conformity: Not applicable.
|
||||
*/
|
||||
EAPI int
|
||||
escape_pipe(int *fds);
|
||||
|
||||
/**
|
||||
* @def pipe(fds)
|
||||
*
|
||||
* Wrapper around escape_pipe().
|
||||
*/
|
||||
#define pipe(fds) escape_pipe(fds)
|
||||
|
||||
//#define sync()
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __ESCAPE_UNISTD_H__ */
|
|
@ -1,180 +0,0 @@
|
|||
#ifndef __ESCAPE_SYS_MMAN_H__
|
||||
#define __ESCAPE_SYS_MMAN_H__
|
||||
|
||||
#include <Escape.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#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_READ 0x01
|
||||
#define PROT_WRITE 0x02
|
||||
#define PROT_EXEC 0x04
|
||||
|
||||
/**
|
||||
* @def MAP_SHARED
|
||||
* Changes are shared.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def MAP_PRIVATE
|
||||
* Changes are private.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def MAP_FIXED
|
||||
* Interpret the address (addr) exactly.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def MAP_FAILED
|
||||
* Error return from mmap().
|
||||
*/
|
||||
|
||||
#define MAP_SHARED 0x0001
|
||||
#define MAP_PRIVATE 0x0002
|
||||
#define MAP_FIXED 0x0010
|
||||
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
|
||||
/**
|
||||
* @file mman.h
|
||||
* @brief The file that provides the memory map functions
|
||||
* @defgroup Escape_Mman Functions that manage memory mappping.
|
||||
* @ingroup Escape
|
||||
*
|
||||
* This header provides the meomry map functions mmap and munmap.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates or opens a named or unnamed file mapping object for a
|
||||
* specified file and maps a view of a file mapping into the
|
||||
* address space of a calling process.
|
||||
*
|
||||
* @param addr Unused
|
||||
* @param len Number of bytes to be mapped.
|
||||
* @param prot Protections.
|
||||
* @param flags Type of the mapped object.
|
||||
* @param fd File descriptor that describes the object to map.
|
||||
* @param offset Number of bytes from which to start the mapping.
|
||||
* @return The starting address of the mapped view on success, -1 otherwise.
|
||||
*
|
||||
* Create or open an unnamed file mapping object for a specified
|
||||
* file described by the file descriptor @p fd. The number of
|
||||
* bytes that are mapped is given by @p len and start after
|
||||
* @p offset bytes. The parameter @p addr is unused.
|
||||
*
|
||||
* The only type of the mapped object that is supported is
|
||||
* @c MAP_SHARED. If another value if given, -1 is returned.
|
||||
*
|
||||
* @p prot specifies the protection of the mapped region. If
|
||||
* PROT_EXEC is used, it set the execute access. If PROT_READ
|
||||
* is used, it sets the read access. If PROT_WRITE is used, it
|
||||
* sets the write access.
|
||||
*
|
||||
* If the map view of file can not be created, -1 is returned.
|
||||
* If the mappping can not be done, -1 is returned.
|
||||
*
|
||||
* If no error occurred, the starting address of the mapped view
|
||||
* is returned.
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* @ingroup Escape_Mman
|
||||
*/
|
||||
EAPI void *mmap(void *addr,
|
||||
size_t len,
|
||||
int prot,
|
||||
int flags,
|
||||
int fd,
|
||||
off_t offset);
|
||||
|
||||
/**
|
||||
* Unmaps a mapped view of a file from the calling process's
|
||||
* address space.
|
||||
*
|
||||
* @param addr Pointer to the base address.
|
||||
* @param len Unused.
|
||||
* @return 0 on success, -1 otherwise.
|
||||
*
|
||||
* Unmaps a mapped view of a file from the calling process's
|
||||
* address space. @p addr is the pointer to the base address.
|
||||
* This value must be identical to the value returned by a
|
||||
* previous call to mmap(). The parameter @p len is unused.
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* @ingroup Escape_Mman
|
||||
*/
|
||||
EAPI int
|
||||
munmap(void *addr,
|
||||
size_t len);
|
||||
|
||||
# define MADV_NORMAL 0 /* No further special treatment. */
|
||||
# define MADV_RANDOM 1 /* Expect random page references. */
|
||||
# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define MADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define MADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define MADV_REMOVE 9 /* Remove these pages and resources. */
|
||||
# define MADV_DONTFORK 10 /* Do not inherit across fork. */
|
||||
# define MADV_DOFORK 11 /* Do inherit across fork. */
|
||||
# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
|
||||
# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
|
||||
# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
|
||||
# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
|
||||
# define MADV_HWPOISON 100 /* Poison a page for testing. */
|
||||
|
||||
/**
|
||||
* give advice about use of memory
|
||||
*
|
||||
* @param addr Unused.
|
||||
* @param length Unused.
|
||||
* @param advice Unused.
|
||||
* @return 0 on success, -1 otherwise.
|
||||
*
|
||||
* The madvise() system call advises the kernel about how to handle
|
||||
* paging input/output in the address range beginning at address addr and
|
||||
* with size length bytes. It allows an application to tell the kernel
|
||||
* how it expects to use some mapped or shared memory areas, so that
|
||||
* the kernel can choose appropriate read-ahead and caching techniques.
|
||||
* This call does not influence the semantics of the application (except
|
||||
* in the case of MADV_DONTNEED), but may influence its performance.
|
||||
* The kernel is free to ignore the advice.
|
||||
|
||||
* Conformity: None.
|
||||
*
|
||||
* @ingroup Escape_Mman
|
||||
*/
|
||||
EAPI int
|
||||
madvise(void *addr,
|
||||
size_t length,
|
||||
int advice);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ESCAPE_SYS_MMAN_H__ */
|
||||
|
|
@ -24,10 +24,6 @@
|
|||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_ESCAPE
|
||||
# include <Escape.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PIXMAN
|
||||
#include <pixman.h>
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue