loader: Introduce FreeBSD loader.

This commit is contained in:
Tijl Coosemans 2007-08-24 15:46:36 +02:00 committed by Alexandre Julliard
parent 2c5767e2c6
commit 9f5c69c96d
5 changed files with 80 additions and 0 deletions

2
.gitignore vendored
View File

@ -764,6 +764,8 @@ libs/wpp/ppl.yy.c
libs/wpp/ppy.tab.c
libs/wpp/ppy.tab.h
loader/wine
loader/wine-freebsd
loader/wine-freebsd-installed
loader/wine-glibc
loader/wine-glibc-installed
loader/wine-kthread

5
configure vendored
View File

@ -15622,6 +15622,11 @@ MAIN_BINARY="wine-pthread"
MAIN_BINARY="wine-glibc"
EXTRA_BINARIES="wine-kthread wine-pthread wine-preloader"
;;
freebsd*)
MAIN_BINARY="wine-freebsd"
EXTRA_BINARIES="wine-pthread"
;;
esac
;;

View File

@ -1224,6 +1224,9 @@ case $host_cpu in
linux* | k*bsd*-gnu)
AC_SUBST(MAIN_BINARY,"wine-glibc")
AC_SUBST(EXTRA_BINARIES,"wine-kthread wine-pthread wine-preloader") ;;
freebsd*)
AC_SUBST(MAIN_BINARY,"wine-freebsd")
AC_SUBST(EXTRA_BINARIES,"wine-pthread") ;;
esac
;;
esac

View File

@ -5,6 +5,7 @@ VPATH = @srcdir@
MODULE = wine
C_SRCS = \
freebsd.c \
glibc.c \
kthread.c \
main.c \
@ -20,6 +21,8 @@ WINE_BINARIES = $(MAIN_BINARY) $(EXTRA_BINARIES)
PROGRAMS = \
wine \
wine-freebsd \
wine-freebsd-installed \
wine-glibc \
wine-glibc-installed \
wine-kthread \
@ -40,6 +43,12 @@ all: $(WINE_BINARIES) $(WINE_BINARIES:%=%-installed) $(MODULE) $(MANPAGES)
LIBPTHREAD = @LIBPTHREAD@
LDEXECFLAGS = @LDEXECFLAGS@
wine-freebsd: freebsd.o Makefile.in
$(CC) -o $@ freebsd.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)
wine-freebsd-installed: freebsd.o Makefile.in
$(CC) -o $@ freebsd.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_INSTALL)
wine-glibc: glibc.o Makefile.in
$(CC) -o $@ glibc.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)

61
loader/freebsd.c Normal file
View File

@ -0,0 +1,61 @@
/*
* FreeBSD loader
*
* Copyright 2007 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#include "wine/library.h"
/* build a new full path from the specified path and name */
static const char *build_new_path( const char *path, const char *name )
{
const char *p;
char *ret;
if (!(p = strrchr( path, '/' ))) return name;
p++;
ret = malloc( (p - path) + strlen(name) + 1 );
memcpy( ret, path, p - path );
strcpy( ret + (p - path), name );
return ret;
}
/**********************************************************************
* main
*/
int main( int argc, char *argv[] )
{
const char *new_argv0 = build_new_path( argv[0], "wine-pthread" );
struct rlimit rl;
rl.rlim_cur = 0x02000000;
rl.rlim_max = 0x02000000;
setrlimit( RLIMIT_DATA, &rl );
wine_init_argv0_path( new_argv0 );
wine_exec_wine_binary( NULL, argv, NULL );
fprintf( stderr, "wine: could not exec %s\n", new_argv0 );
exit(1);
}