Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ aclocal.*
*.a
config.mak
preload/exported.h
preload/ldexportlist
preload/export.map
preload/wrappers.c
obj-32
obj-64
Expand All @@ -29,5 +29,4 @@ utils/sb2-interp-wrapper
.version
preload/privatewrappers.c
preload/privatewrappers.h
preload/export.map
include/scratchbox2_version.h
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
TOPDIR = $(CURDIR)
OBJDIR = $(TOPDIR)
SRCDIR = $(TOPDIR)
VPATH = $(SRCDIR)
VPATH = $(SRCDIR):$(OBJDIR)

MACH := $(shell uname -m)
OS := $(shell uname -s)

ifeq ($(OS),Linux)
LIBSB2_LDFLAGS = -Wl,-soname=$(LIBSB2_SONAME) \
-Wl,--version-script=preload/export.map
-Wl,--version-script=$(OBJDIR)/preload/export.map

SHLIBEXT = so
else
Expand Down Expand Up @@ -107,10 +107,11 @@ do-all: $(targets)
echo $(PACKAGE_VERSION) > .version; \
fi)

include/scratchbox2_version.h: .version Makefile
echo "/* Automatically generated file. Do not edit. */" >include/scratchbox2_version.h
echo '#define SCRATCHBOX2_VERSION "'`cat .version`'"' >>include/scratchbox2_version.h
echo '#define LIBSB2_SONAME "'$(LIBSB2_SONAME)'"' >>include/scratchbox2_version.h
$(OBJDIR)/include/scratchbox2_version.h: .version Makefile
mkdir -p $(OBJDIR)/include
echo "/* Automatically generated file. Do not edit. */" >$(OBJDIR)/include/scratchbox2_version.h
echo '#define SCRATCHBOX2_VERSION "'`cat .version`'"' >>$(OBJDIR)/include/scratchbox2_version.h
echo '#define LIBSB2_SONAME "'$(LIBSB2_SONAME)'"' >>$(OBJDIR)/include/scratchbox2_version.h

regular: .configure .version
@$(MAKE) -f $(SRCDIR)/Makefile --include-dir=$(SRCDIR) SRCDIR=$(SRCDIR) do-all
Expand Down
3 changes: 1 addition & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
#automake_version=1.9

rm -rf configure autom4te.cache
autoreconf --verbose --force --install --make

autoreconf --verbose --force --install
21 changes: 12 additions & 9 deletions llbuild/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ll build system
# ll build system -*- makefile -*-
#
# Copyright (C) 2006-2007 Lauri Leukkunen <lle@rahina.org>
#
Expand Down Expand Up @@ -41,15 +41,17 @@ endef
define import_dir
subdirs :=
subdirs-y :=
objects :=
objects-y :=
objs :=
objs-y :=
D := $(1)
$(shell mkdir -p $(1))
include $(1)/Makefile
dep_files := $$(wildcard $(1)/.*.d)
include $(dep_files)
all_objects := $$(all_objects) $$(patsubst %,$(1)/%,$$(objects))
all_objects := $$(all_objects) $$(patsubst %,$(1)/%,$$(objects-y))
include $(SRCDIR)/$(1)/Makefile
deps := $(join $(subst ./, $(D)/, $(dir $(objs))), $(patsubst %,.%.d,$(notdir $(objs))))
objs-y := $(join $(subst ./, $(D)/, $(dir $(objs))), $(notdir $(objs)))
objs-all := $(objs-all) \
$(patsubst %,$(OBJDIR)/%,$(objs-y))
deps-all := $(deps-all) $(patsubst %,$(OBJDIR)/%,$(deps))
include $(wildcard $(deps))
subdirs := $$(subdirs) $$(subdirs-y)
tmp := $$(patsubst %,$(1)/%,$$(subdirs))
perkele := $$(foreach dir,$$(tmp),$$(eval $$(call import_dir,$$(dir))))
Expand All @@ -58,8 +60,9 @@ endef
$(foreach dir,$(subdirs),$(eval $(call import_dir,$(dir))))


all_objects += $(foreach t,$(extra_targets),$($(t)))
objs-all += $(foreach t,$(extra_targets),$($(t)))

CLEAN_FILES += $(deps-all)

ifdef V
Q =
Expand Down
2 changes: 1 addition & 1 deletion luaif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ luaif/libluaif.a: override LDFLAGS := $(LDFLAGS)
luaif/libluaif.a: override LIBS := $(LUA_LIBS)


luaif/sb_log.o: include/scratchbox2_version.h
luaif/sb_log.o: $(OBJDIR)/include/scratchbox2_version.h


targets := $(targets) $(D)/libluaif.a
Expand Down
39 changes: 24 additions & 15 deletions preload/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ objs := wrappers.o privatewrappers.o \

ifeq ($(shell uname -s),Linux)
LIBSB2_LDFLAGS = -Wl,-soname=$(LIBSB2_SONAME) \
-Wl,--version-script=preload/export.map
-Wl,--version-script=$(OBJDIR)/preload/export.map

# DO NOT add any libraries that depend on libpthread to
# LIBSB2_LIBS or LIBS!! see the comments in luaif.c.
Expand All @@ -42,31 +42,40 @@ $(D)/libsb2.$(SHLIBEXT): LIBS := -ldl $(LIBSB2_LIBS)

targets := $(targets) $(D)/libsb2.$(SHLIBEXT)

$(D)/libsb2.o $(D)/sb_l10n.o: preload/exported.h
$(D)/exported.h $(D)/ldexportlist: preload/wrappers.c
$(D)/wrappers.c: preload/interface.master preload/gen-interface.pl
$(D)/libsb2.o $(D)/sb_l10n.o: $(OBJDIR)/preload/exported.h
preloader_generated_public := \
$(OBJDIR)/$(D)/wrappers.c \
$(OBJDIR)/$(D)/exported.h \
$(OBJDIR)/$(D)/export.map \
$(OBJDIR)/$(D)/libsb2_interface.7

$(preloader_generated_public): preload/interface.master \
preload/gen-interface.pl
$(MKOUTPUTDIR)
$(P)PERL
$(Q)$(SRCDIR)/preload/gen-interface.pl \
-n public \
-W preload/wrappers.c \
-E preload/exported.h \
-M preload/export.map \
-W $(OBJDIR)/preload/wrappers.c \
-E $(OBJDIR)/preload/exported.h \
-M $(OBJDIR)/preload/export.map \
-V $(PACKAGE_VERSION) \
-m preload/libsb2_interface.7 \
-m $(OBJDIR)/preload/libsb2_interface.7 \
<$(SRCDIR)/preload/interface.master

$(D)/privatewrappers.h: preload/privatewrappers.c
$(D)/privatewrappers.c: preload/interface.private preload/gen-interface.pl
preloader_generated_private := \
$(OBJDIR)/$(D)/privatewrappers.h \
$(OBJDIR)/$(D)/privatewrappers.c

$(preloader_generated_private): preload/interface.private \
preload/gen-interface.pl
$(MKOUTPUTDIR)
$(P)PERL
$(Q)$(SRCDIR)/preload/gen-interface.pl \
-n private \
-W preload/privatewrappers.c \
-E preload/privatewrappers.h \
-W $(OBJDIR)/preload/privatewrappers.c \
-E $(OBJDIR)/preload/privatewrappers.h \
<$(SRCDIR)/preload/interface.private

generated := preload/wrappers.c preload/exported.h preload/ldexportlist
.PRECIOUS: $(generated)
.PRECIOUS: $(preloader_generated_public) $(preloader_generated_private)

CLEAN_FILES += $(generated)
CLEAN_FILES += $(preloader_generated_public) $(preloader_generated_private)
32 changes: 16 additions & 16 deletions preload/interface.master
Original file line number Diff line number Diff line change
Expand Up @@ -185,74 +185,74 @@ GATE: pid_t waitpid(pid_t pid, int *status, int options)

GATE: int __open(const char *pathname, int flags, ...) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map(pathname) optional_arg_is_create_mode(flags&O_CREAT) \
map(pathname) optional_arg_is_create_mode(__OPEN_NEEDS_MODE(flags)) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)
GATE: int __open64(const char *pathname, int flags, ...) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map(pathname) optional_arg_is_create_mode(flags&O_CREAT) \
map(pathname) optional_arg_is_create_mode(__OPEN_NEEDS_MODE(flags)) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)

GATE: int open(const char *pathname, int flags, ...) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map(pathname) optional_arg_is_create_mode(flags&O_CREAT) \
map(pathname) optional_arg_is_create_mode(__OPEN_NEEDS_MODE(flags)) \
postprocess(pathname) \
create_nomap_nolog_version \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)
GATE: int open64(const char *pathname, int flags, ...) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map(pathname) optional_arg_is_create_mode(flags&O_CREAT) \
map(pathname) optional_arg_is_create_mode(__OPEN_NEEDS_MODE(flags)) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)

-- open; variants witout varargs
GATE: int __open_2(const char *pathname, int flags) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map(pathname) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)
GATE: int __open64_2(const char *pathname, int flags) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map(pathname) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)

-- openat:
GATE: int openat(int dirfd, const char *pathname, int flags, ...) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map_at(dirfd,pathname) optional_arg_is_create_mode(flags&O_CREAT) \
map_at(dirfd,pathname) optional_arg_is_create_mode(__OPEN_NEEDS_MODE(flags)) \
create_nomap_nolog_version \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)

GATE: int openat64(int dirfd, const char *pathname, int flags, ...) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map_at(dirfd,pathname) optional_arg_is_create_mode(flags&O_CREAT) \
map_at(dirfd,pathname) optional_arg_is_create_mode(__OPEN_NEEDS_MODE(flags)) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)

-- openat; variants witout varargs
GATE: int __openat_2(int dirfd, const char *pathname, int flags) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map_at(dirfd,pathname) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)
GATE: int __openat64_2(int dirfd, const char *pathname, int flags) : \
dont_resolve_final_symlink_if(flags&O_NOFOLLOW) \
map_at(dirfd,pathname) \
postprocess(pathname) \
check_and_fail_if_readonly(flags&OPEN_FLAGS_RW_MODE,pathname,-1,EROFS) \
class(OPEN) conditionally_class(flags&O_CREAT,CREAT)
class(OPEN) conditionally_class(__OPEN_NEEDS_MODE(flags),CREAT)

-- close:
WRAP: int close(int fd) : \
Expand Down
3 changes: 1 addition & 2 deletions rpm/scratchbox2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ Scratchbox2 man pages.
./autogen.sh
%configure
touch .configure
# Can't use %{?_smp_mflags} here: race condition in build system
%{__make} %{_make_output_sync} %{_make_verbose}
%make_build

%install
%__make install prefix=%{buildroot}/usr
Expand Down
2 changes: 1 addition & 1 deletion sblib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sblib/libsblib.a: override CFLAGS := $(CFLAGS) $(LUA_CFLAGS) -O2 -g -fPIC -Wall
sblib/libsblib.a: override LDFLAGS := $(LDFLAGS)
sblib/libsblib.a: override LIBS :=

sblib/sb_log.o: include/scratchbox2_version.h
sblib/sb_log.o: $(OBJDIR)/include/scratchbox2_version.h

targets := $(targets) $(D)/libsblib.a

12 changes: 10 additions & 2 deletions utils/sb2-ruletree.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@ void sblog_printf_line_to_logfile(const char *file, int line,
va_end(ap);
}

extern int open_nomap_nolog(const char *pathname, int flags, mode_t mode);
extern int open_nomap_nolog(const char *pathname, int flags, ...);

int open_nomap_nolog(const char *pathname, int flags, mode_t mode)
int open_nomap_nolog(const char *pathname, int flags, ...)
{
mode_t mode = 0;
if(__OPEN_NEEDS_MODE(flags)) {
va_list arg;
va_start (arg, flags);
mode = va_arg (arg, int);
va_end (arg);
}

return open(pathname, flags, mode);
}

Expand Down