* man/ffi_prep_closure.3: Delete.
* man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3.
(man_MANS): Ditto.
* man/Makefile.in: Rebuilt.
* configure.ac: Bump version to 2.99.8.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2008-02-15 Anthony Green <green@redhat.com>
|
||||
|
||||
* man/ffi_prep_closure.3: Delete.
|
||||
* man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3.
|
||||
(man_MANS): Ditto.
|
||||
* man/Makefile.in: Rebuilt.
|
||||
* configure.ac: Bump version to 2.99.8.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 2.99.7.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Status
|
||||
======
|
||||
|
||||
libffi-2.99.6 was released on February 14, 2008. Check the libffi web
|
||||
libffi-2.99.7 was released on February 14, 2008. Check the libffi web
|
||||
page for updates: <URL:http://sourceware.org/libffi/>.
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ arguments' test).
|
||||
History
|
||||
=======
|
||||
|
||||
3.00 Feb-XX-08
|
||||
2.99.7 Feb-XX-08
|
||||
Many changes, mostly thanks to the GCC project.
|
||||
Cygnus Solutions is now Red Hat.
|
||||
|
||||
|
||||
20
libffi/configure
vendored
20
libffi/configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.61 for libffi 2.99.7.
|
||||
# Generated by GNU Autoconf 2.61 for libffi 2.99.8.
|
||||
#
|
||||
# Report bugs to <http://gcc.gnu.org/bugs.html>.
|
||||
#
|
||||
@@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='libffi'
|
||||
PACKAGE_TARNAME='libffi'
|
||||
PACKAGE_VERSION='2.99.7'
|
||||
PACKAGE_STRING='libffi 2.99.7'
|
||||
PACKAGE_VERSION='2.99.8'
|
||||
PACKAGE_STRING='libffi 2.99.8'
|
||||
PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html'
|
||||
|
||||
# Factoring default headers for most tests.
|
||||
@@ -1457,7 +1457,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures libffi 2.99.7 to adapt to many kinds of systems.
|
||||
\`configure' configures libffi 2.99.8 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1528,7 +1528,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of libffi 2.99.7:";;
|
||||
short | recursive ) echo "Configuration of libffi 2.99.8:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1638,7 +1638,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
libffi configure 2.99.7
|
||||
libffi configure 2.99.8
|
||||
generated by GNU Autoconf 2.61
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@@ -1652,7 +1652,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by libffi $as_me 2.99.7, which was
|
||||
It was created by libffi $as_me 2.99.8, which was
|
||||
generated by GNU Autoconf 2.61. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2475,7 +2475,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='libffi'
|
||||
VERSION='2.99.7'
|
||||
VERSION='2.99.8'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -23297,7 +23297,7 @@ exec 6>&1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by libffi $as_me 2.99.7, which was
|
||||
This file was extended by libffi $as_me 2.99.8, which was
|
||||
generated by GNU Autoconf 2.61. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -23354,7 +23354,7 @@ Report bugs to <bug-autoconf@gnu.org>."
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
libffi config.status 2.99.7
|
||||
libffi config.status 2.99.8
|
||||
configured by $0, generated by GNU Autoconf 2.61,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
AC_INIT([libffi], [2.99.7], [http://gcc.gnu.org/bugs.html])
|
||||
AC_INIT([libffi], [2.99.8], [http://gcc.gnu.org/bugs.html])
|
||||
AC_CONFIG_HEADERS([fficonfig.h])
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set UPDATED 14 February 2008
|
||||
@set UPDATED-MONTH February 2008
|
||||
@set EDITION 2.99.7
|
||||
@set VERSION 2.99.7
|
||||
@set EDITION 2.99.8
|
||||
@set VERSION 2.99.8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set UPDATED 14 February 2008
|
||||
@set UPDATED-MONTH February 2008
|
||||
@set EDITION 2.99.7
|
||||
@set VERSION 2.99.7
|
||||
@set EDITION 2.99.8
|
||||
@set VERSION 2.99.8
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
|
||||
EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_closure.3
|
||||
EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3
|
||||
|
||||
man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_closure.3
|
||||
man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3
|
||||
|
||||
|
||||
@@ -171,8 +171,8 @@ toolexeclibdir = @toolexeclibdir@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_closure.3
|
||||
man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_closure.3
|
||||
EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3
|
||||
man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
.Dd July 20, 2007
|
||||
.Dt ffi_prep_closure 3
|
||||
.Sh NAME
|
||||
.Nm ffi_prep_closure
|
||||
.Nd Prepare a
|
||||
.Nm ffi_closure
|
||||
for execution.
|
||||
.Sh SYNOPSIS
|
||||
.In ffi.h
|
||||
.Ft ffi_status
|
||||
.Fo ffi_prep_closure
|
||||
.Fa "ffi_closure *closure"
|
||||
.Fa "ffi_cif *cif"
|
||||
.Fa "void (*fun)(ffi_cif*,void*,void**,void*)"
|
||||
.Fa "void *user_data"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
.Fa closure
|
||||
is prepared to execute
|
||||
.Fa fun .
|
||||
.Fa cif
|
||||
contains information describing the data types, sizes and alignments of the
|
||||
arguments to and return value from the function that will be called from
|
||||
.Fa fun ,
|
||||
and must be initialized with
|
||||
.Nm ffi_prep_cif
|
||||
before it is used with
|
||||
.Nm ffi_prep_closure .
|
||||
.Fa user_data
|
||||
may point to additional data to be used in
|
||||
.Fa fun .
|
||||
If no additional data is needed,
|
||||
.Fa user_data
|
||||
may be
|
||||
.Nm NULL .
|
||||
When
|
||||
.Fa closure
|
||||
is invoked,
|
||||
.Fa fun
|
||||
is called with
|
||||
.Fa cif ,
|
||||
an array of pointers to arguments, a pointer to a return value, and
|
||||
.Fa user_data .
|
||||
.Pp
|
||||
Some architectures do not allow the execution of data by default. In such cases,
|
||||
it is necessary to manually alter the permissions of the page that contains
|
||||
.Fa closure
|
||||
prior to its execution.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion,
|
||||
.Nm ffi_prep_closure
|
||||
returns
|
||||
.Nm FFI_OK .
|
||||
If the ABI specified in
|
||||
.Fa cif
|
||||
does not refer to a valid ABI,
|
||||
.Nm FFI_BAD_ABI
|
||||
will be returned. Available ABIs are
|
||||
defined in
|
||||
.Nm <ffi/ppc-ffitarget.h>
|
||||
and
|
||||
.Nm <ffi/x86-ffitarget.h> .
|
||||
.Sh EXAMPLES
|
||||
.Bd -literal
|
||||
#include <ffi/ffi.h>
|
||||
#include <sys/mman.h> // for mmap()
|
||||
|
||||
unsigned char
|
||||
foo(unsigned int, float);
|
||||
|
||||
static void
|
||||
foo_closure(ffi_cif*, void*, void**, void*);
|
||||
|
||||
int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
ffi_cif cif;
|
||||
ffi_closure *closure;
|
||||
ffi_type *arg_types[2];
|
||||
ffi_arg result;
|
||||
ffi_status status;
|
||||
|
||||
// Specify the data type of each argument. Available types are defined
|
||||
// in <ffi/ffi.h>.
|
||||
arg_types[0] = &ffi_type_uint;
|
||||
arg_types[1] = &ffi_type_float;
|
||||
|
||||
// Allocate a page to hold the closure with read and write permissions.
|
||||
if ((closure = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_PRIVATE, -1, 0)) == (void*)-1)
|
||||
{
|
||||
// Check errno and handle the error.
|
||||
}
|
||||
|
||||
// Prepare the ffi_cif structure.
|
||||
if ((status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI,
|
||||
2, &ffi_type_uint8, arg_types)) != FFI_OK)
|
||||
{
|
||||
// Handle the ffi_status error.
|
||||
}
|
||||
|
||||
// Prepare the ffi_closure structure.
|
||||
if ((status = ffi_prep_closure(closure, &cif, foo_closure, NULL)) != FFI_OK)
|
||||
{
|
||||
// Handle the ffi_status error.
|
||||
}
|
||||
|
||||
// Ensure that the closure will execute on all architectures.
|
||||
if (mprotect(closure, sizeof(closure), PROT_READ | PROT_EXEC) == -1)
|
||||
{
|
||||
// Check errno and handle the error.
|
||||
}
|
||||
|
||||
// The closure is now ready to be executed, and can be saved for later
|
||||
// execution if desired.
|
||||
|
||||
// Invoke the closure.
|
||||
result = ((unsigned char(*)(float, unsigned int))closure)(42, 5.1);
|
||||
|
||||
// Free the memory associated with the closure.
|
||||
if (munmap(closure, sizeof(closure)) == -1)
|
||||
{
|
||||
// Check errno and handle the error.
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Invoking the closure transfers control to this function.
|
||||
static void
|
||||
foo_closure(ffi_cif* cif, void* result, void** args, void* userdata)
|
||||
{
|
||||
// Access the arguments to be sent to foo().
|
||||
float arg1 = *(float*)args[0];
|
||||
unsigned int arg2 = *(unsigned int*)args[1];
|
||||
|
||||
// Call foo() and save its return value.
|
||||
unsigned char ret_val = foo(arg1, arg2);
|
||||
|
||||
// Copy the returned value into result. Because the return value of foo()
|
||||
// is smaller than sizeof(long), typecast it to ffi_arg. Use ffi_sarg
|
||||
// instead for signed types.
|
||||
*(ffi_arg*)result = (ffi_arg)ret_val;
|
||||
}
|
||||
|
||||
// The closed-over function.
|
||||
unsigned char
|
||||
foo(unsigned int x, float y)
|
||||
{
|
||||
unsigned char result = x - y;
|
||||
return result;
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr ffi 3 ,
|
||||
.Xr ffi_prep_cif 3 ,
|
||||
.Xr mmap 2 ,
|
||||
.Xr munmap 2 ,
|
||||
.Xr mprotect 2
|
||||
Reference in New Issue
Block a user